@carbon/ai-chat-components 0.5.0 → 0.6.0-rc.1

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 (483) hide show
  1. package/custom-elements.json +9201 -295
  2. package/dist/16-B6dpbhwk.js +91 -0
  3. package/dist/apl-Bkd9Mf6P.js +91 -0
  4. package/dist/asciiarmor-DL4R2aFc.js +91 -0
  5. package/dist/asn1-BNuq0wMN.js +91 -0
  6. package/dist/asterisk-CKsJI4Xo.js +91 -0
  7. package/dist/button-Cl3aa-QH.js +157 -0
  8. package/dist/button-skeleton-DpmYT5sr.js +116 -0
  9. package/dist/carbon-element-DtQeYrv7.js +91 -0
  10. package/dist/carbon-element-wyoWZuGw.js +91 -0
  11. package/dist/chain-of-thought.min.js +276 -0
  12. package/dist/chat-button.min.js +71 -81
  13. package/dist/checkbox-skeleton-77m2gyNb.js +166 -0
  14. package/dist/class-map-BgQK6m9u.js +106 -0
  15. package/dist/clike-7TJ9zfKW.js +91 -0
  16. package/dist/clojure-9jpZ60Lu.js +91 -0
  17. package/dist/cmake-UY0DwvRL.js +91 -0
  18. package/dist/cobol-DhfZi79a.js +91 -0
  19. package/dist/code-snippet.min.js +91 -0
  20. package/dist/codemirror-runtime-ClX6d06H.js +173 -0
  21. package/dist/coffeescript-mDf6LSpC.js +91 -0
  22. package/dist/collection-helpers-DTO_rBxT.js +91 -0
  23. package/dist/commonlisp-Qa7gZPAc.js +91 -0
  24. package/dist/crystal-C1gbEnje.js +91 -0
  25. package/dist/css-BLorXS28.js +91 -0
  26. package/dist/custom-element-C-oe1CPQ.js +96 -0
  27. package/dist/cypher-BY0J-JQD.js +91 -0
  28. package/dist/d-zkooxxUz.js +91 -0
  29. package/dist/diff-CrCOHpAq.js +91 -0
  30. package/dist/dockerfile-D7x4UVxN.js +91 -0
  31. package/dist/dtd-Cp_rfrvO.js +91 -0
  32. package/dist/dylan-BWjG5gpG.js +91 -0
  33. package/dist/ebnf-JN5Vq0lF.js +91 -0
  34. package/dist/ecl-De3xBvSp.js +91 -0
  35. package/dist/eiffel-BUg3McKi.js +91 -0
  36. package/dist/elm-BzEpaycL.js +91 -0
  37. package/dist/erlang-CRda3Szm.js +91 -0
  38. package/dist/factor-HH6tZH2o.js +91 -0
  39. package/dist/fcl-DethtZZ9.js +91 -0
  40. package/dist/feedback.min.js +300 -0
  41. package/dist/forth-CvRI4Fp8.js +91 -0
  42. package/dist/fortran-BlOOIWks.js +91 -0
  43. package/dist/gas-D13dt2I8.js +91 -0
  44. package/dist/gherkin-DeOVdg90.js +91 -0
  45. package/dist/groovy-HwkbYX11.js +91 -0
  46. package/dist/haskell-BrtcJMpO.js +91 -0
  47. package/dist/haxe-DLraHdYm.js +91 -0
  48. package/dist/http-DZFwp0rs.js +91 -0
  49. package/dist/icon-button-DLTQYCDh.js +143 -0
  50. package/dist/icon-loader-DNSGSUXr.js +101 -0
  51. package/dist/idl-9eLgsa_L.js +91 -0
  52. package/dist/if-defined-D_Efffcr.js +96 -0
  53. package/dist/index-07U-x-DZ.js +91 -0
  54. package/dist/index-B-leT4Qo.js +91 -0
  55. package/dist/index-BCIOZ3Iv.js +91 -0
  56. package/dist/index-BJcdJS87.js +91 -0
  57. package/dist/index-BlpbVMq_.js +91 -0
  58. package/dist/index-CB8fQWmx.js +91 -0
  59. package/dist/index-CDmjsjkj.js +91 -0
  60. package/dist/index-CHI0qSLN.js +91 -0
  61. package/dist/index-CHor-HRv.js +91 -0
  62. package/dist/index-C_x1WGc6.js +91 -0
  63. package/dist/index-Cg3MLvVN.js +91 -0
  64. package/dist/index-Cp5sEHjB.js +367 -0
  65. package/dist/index-CtUoNlIM.js +91 -0
  66. package/dist/index-CusUYvgE.js +91 -0
  67. package/dist/index-CvvPafwM.js +168 -0
  68. package/dist/index-DDjGfF24.js +91 -0
  69. package/dist/index-DxS06aLY.js +91 -0
  70. package/dist/index-FwP_JV-c.js +91 -0
  71. package/dist/index-Hcd_VCMd.js +91 -0
  72. package/dist/index-LlI0lXKE.js +91 -0
  73. package/dist/index-Q34JRmNZ.js +91 -0
  74. package/dist/index-f7UAoB15.js +91 -0
  75. package/dist/index-mQZVoo3c.js +91 -0
  76. package/dist/index-yd1vgygF.js +91 -0
  77. package/dist/javascript-hgM39w7C.js +91 -0
  78. package/dist/julia-DtM_gc7j.js +91 -0
  79. package/dist/{settings-XW6XylsZ.js → lit-element-BnGYooZk.js} +70 -12
  80. package/dist/livescript-BySrhTUe.js +91 -0
  81. package/dist/lua-ChD7R8km.js +91 -0
  82. package/dist/markdown.min.js +296 -0
  83. package/dist/mathematica-kcP6Cajy.js +91 -0
  84. package/dist/mbox-Bw_KHaUe.js +91 -0
  85. package/dist/mirc-jvko25mJ.js +91 -0
  86. package/dist/mllike-CNKOuVeX.js +91 -0
  87. package/dist/modelica-YfrFDmxR.js +91 -0
  88. package/dist/mscgen-Bok75bzR.js +91 -0
  89. package/dist/mumps-BTuSBaU1.js +91 -0
  90. package/dist/nginx-DwZuHJnC.js +91 -0
  91. package/dist/nsis-CIx93lk7.js +91 -0
  92. package/dist/ntriples-Djj269Be.js +91 -0
  93. package/dist/octave-CrdvfVOv.js +91 -0
  94. package/dist/oz-C4bYf6je.js +91 -0
  95. package/dist/pascal-D2KPt6vl.js +91 -0
  96. package/dist/perl-5YDHx0ay.js +91 -0
  97. package/dist/pig-DzmRINVg.js +91 -0
  98. package/dist/powershell-BT_ybnoW.js +91 -0
  99. package/dist/processing.min.js +71 -4
  100. package/dist/properties-4YytEGly.js +91 -0
  101. package/dist/protobuf-CI-p1B8j.js +91 -0
  102. package/dist/pug-DLHGbkXU.js +91 -0
  103. package/dist/puppet-BbNNtXxr.js +91 -0
  104. package/dist/python-D3PSFk0-.js +91 -0
  105. package/dist/q-ObXF982D.js +91 -0
  106. package/dist/query-DLqIY4Wn.js +101 -0
  107. package/dist/r-DiZLK5qY.js +91 -0
  108. package/dist/radio-group-manager-GuAarpdg.js +91 -0
  109. package/dist/reasoning-steps.min.js +171 -0
  110. package/dist/repeat-DQkjGru3.js +96 -0
  111. package/dist/rpm-BA1XlISV.js +91 -0
  112. package/dist/ruby-o3bYJp8s.js +91 -0
  113. package/dist/sas-YW-OKZPX.js +91 -0
  114. package/dist/scheme-D5iPrCDC.js +91 -0
  115. package/dist/settings-BfbbHBjJ.js +99 -0
  116. package/dist/shell-BMwJ8_g7.js +91 -0
  117. package/dist/sieve-BE4sKTG2.js +91 -0
  118. package/dist/simple-mode-2GmZ0AR1.js +91 -0
  119. package/dist/smalltalk-CI3t8V3g.js +91 -0
  120. package/dist/solr-xhjjvvCE.js +91 -0
  121. package/dist/sparql-D64FGxiD.js +91 -0
  122. package/dist/spreadsheet-CnwQq-zp.js +91 -0
  123. package/dist/sql-CWCB15es.js +91 -0
  124. package/dist/state-BF51fRID.js +96 -0
  125. package/dist/stex-DqIfOYF1.js +91 -0
  126. package/dist/stylus-xz-vruRQ.js +91 -0
  127. package/dist/swift-BPHP66va.js +91 -0
  128. package/dist/sync-HIZypRbs.js +91 -0
  129. package/dist/table-runtime-C7apcdgu.js +510 -0
  130. package/dist/table.min.js +91 -0
  131. package/dist/tcl-BSDESp20.js +91 -0
  132. package/dist/text-input-Ca8K1Ydg.js +158 -0
  133. package/dist/textile-COeIYMRW.js +91 -0
  134. package/dist/throttle-CN5lMS8t.js +91 -0
  135. package/dist/tiddlywiki-Bs5PoKQf.js +91 -0
  136. package/dist/tiki-DqKGtwP5.js +91 -0
  137. package/dist/tile-container.min.js +70 -14
  138. package/dist/toml-DA5Yl8WK.js +91 -0
  139. package/dist/toolbar.min.js +180 -0
  140. package/dist/troff-BRNQrjuW.js +91 -0
  141. package/dist/ttcn-Bn8eKWOh.js +91 -0
  142. package/dist/ttcn-cfg-BO-9W9JU.js +91 -0
  143. package/dist/turtle-CxuhUAyA.js +91 -0
  144. package/dist/vb-C40-VEDj.js +91 -0
  145. package/dist/vbscript-BogOMGMf.js +91 -0
  146. package/dist/velocity-CQs7G9b4.js +91 -0
  147. package/dist/verilog-CelFoyTQ.js +91 -0
  148. package/dist/vhdl-BlCs0iAG.js +91 -0
  149. package/dist/webidl-VWB4mjSa.js +91 -0
  150. package/dist/workspace-shell.min.js +162 -0
  151. package/dist/xquery-B8qd1YwF.js +91 -0
  152. package/dist/yacas-OhfCFLfI.js +91 -0
  153. package/dist/z80-oZfTgdDp.js +91 -0
  154. package/es/components/chain-of-thought/index.d.ts +4 -0
  155. package/es/components/chain-of-thought/index.js +11 -0
  156. package/es/components/chain-of-thought/index.js.map +1 -0
  157. package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.d.ts +15 -0
  158. package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js +36 -0
  159. package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js.map +1 -0
  160. package/es/components/chain-of-thought/src/chain-of-thought.d.ts +87 -0
  161. package/es/components/chain-of-thought/src/chain-of-thought.js +189 -0
  162. package/es/components/chain-of-thought/src/chain-of-thought.js.map +1 -0
  163. package/es/components/chain-of-thought/src/chain-of-thought.scss.js +13 -0
  164. package/es/components/chain-of-thought/src/chain-of-thought.scss.js.map +1 -0
  165. package/es/components/chain-of-thought/src/chain-of-thought.template.d.ts +5 -0
  166. package/es/components/chain-of-thought/src/chain-of-thought.template.js +206 -0
  167. package/es/components/chain-of-thought/src/chain-of-thought.template.js.map +1 -0
  168. package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.d.ts +10 -0
  169. package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js +50 -0
  170. package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js.map +1 -0
  171. package/es/components/chain-of-thought/src/types.d.ts +73 -0
  172. package/es/components/chain-of-thought/src/types.js +29 -0
  173. package/es/components/chain-of-thought/src/types.js.map +1 -0
  174. package/es/components/chat-button/defs.d.ts +25 -0
  175. package/es/components/chat-button/defs.js +36 -0
  176. package/es/components/chat-button/defs.js.map +1 -0
  177. package/es/components/chat-button/index.d.ts +1 -1
  178. package/es/components/chat-button/index.js +1 -1
  179. package/es/components/chat-button/src/chat-button.d.ts +32 -0
  180. package/es/components/chat-button/{chat-button.js → src/chat-button.js} +16 -10
  181. package/es/components/chat-button/src/chat-button.js.map +1 -0
  182. package/es/components/chat-button/src/chat-button.scss.js +1 -1
  183. package/es/components/code-snippet/index.d.ts +3 -0
  184. package/es/components/code-snippet/index.js +10 -0
  185. package/es/components/code-snippet/index.js.map +1 -0
  186. package/es/components/code-snippet/src/code-snippet-tile-container.d.ts +32 -0
  187. package/es/components/code-snippet/src/code-snippet-tile-container.js +143 -0
  188. package/es/components/code-snippet/src/code-snippet-tile-container.js.map +1 -0
  189. package/es/components/code-snippet/src/code-snippet.d.ts +482 -0
  190. package/es/components/code-snippet/src/code-snippet.js +592 -0
  191. package/es/components/code-snippet/src/code-snippet.js.map +1 -0
  192. package/es/components/code-snippet/src/code-snippet.scss.js +13 -0
  193. package/es/components/code-snippet/src/code-snippet.scss.js.map +1 -0
  194. package/es/components/code-snippet/src/codemirror/base-setup.d.ts +12 -0
  195. package/es/components/code-snippet/src/codemirror/base-setup.js +65 -0
  196. package/es/components/code-snippet/src/codemirror/base-setup.js.map +1 -0
  197. package/es/components/code-snippet/src/codemirror/codemirror-loader.d.ts +12 -0
  198. package/es/components/code-snippet/src/codemirror/codemirror-loader.js +36 -0
  199. package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -0
  200. package/es/components/code-snippet/src/codemirror/codemirror-runtime.d.ts +7 -0
  201. package/es/components/code-snippet/src/codemirror/codemirror-runtime.js +13 -0
  202. package/es/components/code-snippet/src/codemirror/codemirror-runtime.js.map +1 -0
  203. package/es/components/code-snippet/src/codemirror/content-sync.d.ts +12 -0
  204. package/es/components/code-snippet/src/codemirror/content-sync.js +72 -0
  205. package/es/components/code-snippet/src/codemirror/content-sync.js.map +1 -0
  206. package/es/components/code-snippet/src/codemirror/editor-manager.d.ts +28 -0
  207. package/es/components/code-snippet/src/codemirror/editor-manager.js +75 -0
  208. package/es/components/code-snippet/src/codemirror/editor-manager.js.map +1 -0
  209. package/es/components/code-snippet/src/codemirror/language-controller.d.ts +38 -0
  210. package/es/components/code-snippet/src/codemirror/language-controller.js +220 -0
  211. package/es/components/code-snippet/src/codemirror/language-controller.js.map +1 -0
  212. package/es/components/code-snippet/src/codemirror/language-data.d.ts +6 -0
  213. package/es/components/code-snippet/src/codemirror/language-data.js +1043 -0
  214. package/es/components/code-snippet/src/codemirror/language-data.js.map +1 -0
  215. package/es/components/code-snippet/src/codemirror/language-utils.d.ts +79 -0
  216. package/es/components/code-snippet/src/codemirror/language-utils.js +219 -0
  217. package/es/components/code-snippet/src/codemirror/language-utils.js.map +1 -0
  218. package/es/components/code-snippet/src/codemirror/marker-utils.d.ts +123 -0
  219. package/es/components/code-snippet/src/codemirror/marker-utils.js +183 -0
  220. package/es/components/code-snippet/src/codemirror/marker-utils.js.map +1 -0
  221. package/es/components/code-snippet/src/codemirror/theme.d.ts +54 -0
  222. package/es/components/code-snippet/src/codemirror/theme.js +320 -0
  223. package/es/components/code-snippet/src/codemirror/theme.js.map +1 -0
  224. package/es/components/code-snippet/src/dom-utils.d.ts +24 -0
  225. package/es/components/code-snippet/src/dom-utils.js +63 -0
  226. package/es/components/code-snippet/src/dom-utils.js.map +1 -0
  227. package/es/components/code-snippet/src/formatters.d.ts +4 -0
  228. package/es/components/code-snippet/src/formatters.js +19 -0
  229. package/es/components/code-snippet/src/formatters.js.map +1 -0
  230. package/es/components/code-snippet/src/layout-utils.d.ts +22 -0
  231. package/es/components/code-snippet/src/layout-utils.js +63 -0
  232. package/es/components/code-snippet/src/layout-utils.js.map +1 -0
  233. package/es/components/code-snippet/src/streaming-manager.d.ts +24 -0
  234. package/es/components/code-snippet/src/streaming-manager.js +120 -0
  235. package/es/components/code-snippet/src/streaming-manager.js.map +1 -0
  236. package/es/components/feedback/index.d.ts +7 -0
  237. package/es/components/feedback/index.js +12 -0
  238. package/es/components/feedback/index.js.map +1 -0
  239. package/es/components/feedback/src/cds-aichat-feedback-buttons.d.ts +15 -0
  240. package/es/components/feedback/src/cds-aichat-feedback-buttons.js +36 -0
  241. package/es/components/feedback/src/cds-aichat-feedback-buttons.js.map +1 -0
  242. package/es/components/feedback/src/cds-aichat-feedback.d.ts +15 -0
  243. package/es/components/feedback/src/cds-aichat-feedback.js +36 -0
  244. package/es/components/feedback/src/cds-aichat-feedback.js.map +1 -0
  245. package/es/components/feedback/src/feedback-buttons.d.ts +56 -0
  246. package/es/components/feedback/src/feedback-buttons.js +104 -0
  247. package/es/components/feedback/src/feedback-buttons.js.map +1 -0
  248. package/es/components/feedback/src/feedback-buttons.scss.js +13 -0
  249. package/es/components/feedback/src/feedback-buttons.scss.js.map +1 -0
  250. package/es/components/feedback/src/feedback-buttons.template.d.ts +4 -0
  251. package/es/components/feedback/src/feedback-buttons.template.js +79 -0
  252. package/es/components/feedback/src/feedback-buttons.template.js.map +1 -0
  253. package/es/components/feedback/src/feedback.d.ts +114 -0
  254. package/es/components/feedback/src/feedback.js +182 -0
  255. package/es/components/feedback/src/feedback.js.map +1 -0
  256. package/es/components/feedback/src/feedback.scss.js +13 -0
  257. package/es/components/feedback/src/feedback.scss.js.map +1 -0
  258. package/es/components/feedback/src/feedback.template.d.ts +12 -0
  259. package/es/components/feedback/src/feedback.template.js +115 -0
  260. package/es/components/feedback/src/feedback.template.js.map +1 -0
  261. package/es/components/markdown/index.d.ts +2 -0
  262. package/es/components/markdown/index.js +9 -0
  263. package/es/components/markdown/index.js.map +1 -0
  264. package/es/components/markdown/src/cds-aichat-markdown.d.ts +13 -0
  265. package/es/components/markdown/src/cds-aichat-markdown.js +35 -0
  266. package/es/components/markdown/src/cds-aichat-markdown.js.map +1 -0
  267. package/es/components/markdown/src/markdown-renderer.d.ts +62 -0
  268. package/es/components/markdown/src/markdown-renderer.js +354 -0
  269. package/es/components/markdown/src/markdown-renderer.js.map +1 -0
  270. package/es/components/markdown/src/markdown-token-tree.d.ts +32 -0
  271. package/es/components/markdown/src/markdown-token-tree.js +178 -0
  272. package/es/components/markdown/src/markdown-token-tree.js.map +1 -0
  273. package/es/components/markdown/src/markdown.d.ts +44 -0
  274. package/es/components/markdown/src/markdown.js +238 -0
  275. package/es/components/markdown/src/markdown.js.map +1 -0
  276. package/es/components/markdown/src/markdown.scss.js +13 -0
  277. package/es/components/markdown/src/markdown.scss.js.map +1 -0
  278. package/es/components/markdown/src/markdown.template.d.ts +3 -0
  279. package/es/components/markdown/src/markdown.template.js +24 -0
  280. package/es/components/markdown/src/markdown.template.js.map +1 -0
  281. package/es/components/markdown/src/plugins/markdown-it-attrs.d.ts +7 -0
  282. package/es/components/markdown/src/plugins/markdown-it-attrs.js +84 -0
  283. package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -0
  284. package/es/components/markdown/src/plugins/markdown-it-highlight.d.ts +7 -0
  285. package/es/components/markdown/src/plugins/markdown-it-highlight.js +59 -0
  286. package/es/components/markdown/src/plugins/markdown-it-highlight.js.map +1 -0
  287. package/es/components/markdown/src/plugins/markdown-it-task-lists.d.ts +12 -0
  288. package/es/components/markdown/src/plugins/markdown-it-task-lists.js +73 -0
  289. package/es/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -0
  290. package/es/components/markdown/src/plugins/markdownItAttrs/core.d.ts +26 -0
  291. package/es/components/markdown/src/plugins/markdownItAttrs/core.js +330 -0
  292. package/es/components/markdown/src/plugins/markdownItAttrs/core.js.map +1 -0
  293. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.d.ts +6 -0
  294. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js +63 -0
  295. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js.map +1 -0
  296. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.d.ts +6 -0
  297. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js +43 -0
  298. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js.map +1 -0
  299. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.d.ts +5 -0
  300. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js +55 -0
  301. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js.map +1 -0
  302. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.d.ts +19 -0
  303. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js +210 -0
  304. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js.map +1 -0
  305. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.d.ts +13 -0
  306. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js +156 -0
  307. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js.map +1 -0
  308. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.d.ts +13 -0
  309. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js +216 -0
  310. package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js.map +1 -0
  311. package/es/components/markdown/src/plugins/markdownItAttrs/types.d.ts +34 -0
  312. package/es/components/markdown/src/plugins/markdownItAttrs/types.js +8 -0
  313. package/es/components/markdown/src/plugins/markdownItAttrs/types.js.map +1 -0
  314. package/es/components/markdown/src/plugins/markdownItAttrs/utils.d.ts +25 -0
  315. package/es/components/markdown/src/plugins/markdownItAttrs/utils.js +62 -0
  316. package/es/components/markdown/src/plugins/markdownItAttrs/utils.js.map +1 -0
  317. package/es/components/markdown/src/utils/html-helpers.d.ts +2 -0
  318. package/es/components/markdown/src/utils/html-helpers.js +204 -0
  319. package/es/components/markdown/src/utils/html-helpers.js.map +1 -0
  320. package/es/components/markdown/src/utils/table-helpers.d.ts +31 -0
  321. package/es/components/markdown/src/utils/table-helpers.js +106 -0
  322. package/es/components/markdown/src/utils/table-helpers.js.map +1 -0
  323. package/es/components/markdown/src/utils.d.ts +8 -0
  324. package/es/components/markdown/src/utils.js +31 -0
  325. package/es/components/markdown/src/utils.js.map +1 -0
  326. package/es/components/reasoning-steps/index.d.ts +2 -0
  327. package/es/components/reasoning-steps/index.js +10 -0
  328. package/es/components/reasoning-steps/index.js.map +1 -0
  329. package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.d.ts +29 -0
  330. package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js +231 -0
  331. package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js.map +1 -0
  332. package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js +13 -0
  333. package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js.map +1 -0
  334. package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.d.ts +13 -0
  335. package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js +96 -0
  336. package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js.map +1 -0
  337. package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js +13 -0
  338. package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js.map +1 -0
  339. package/es/components/table/index.d.ts +3 -0
  340. package/es/components/table/index.js +9 -0
  341. package/es/components/table/index.js.map +1 -0
  342. package/es/components/table/src/cds-aichat-table.d.ts +262 -0
  343. package/es/components/table/src/cds-aichat-table.js +511 -0
  344. package/es/components/table/src/cds-aichat-table.js.map +1 -0
  345. package/es/components/table/src/table-loader.d.ts +4 -0
  346. package/es/components/table/src/table-loader.js +28 -0
  347. package/es/components/table/src/table-loader.js.map +1 -0
  348. package/es/components/table/src/table-pagination.template.d.ts +27 -0
  349. package/es/components/table/src/table-pagination.template.js +55 -0
  350. package/es/components/table/src/table-pagination.template.js.map +1 -0
  351. package/es/components/table/src/table-runtime.d.ts +2 -0
  352. package/es/components/table/src/table-runtime.js +10 -0
  353. package/es/components/table/src/table-runtime.js.map +1 -0
  354. package/es/components/table/src/table-skeleton.template.d.ts +6 -0
  355. package/es/components/table/src/table-skeleton.template.js +34 -0
  356. package/es/components/table/src/table-skeleton.template.js.map +1 -0
  357. package/es/components/table/src/table.scss.js +13 -0
  358. package/es/components/table/src/table.scss.js.map +1 -0
  359. package/es/components/table/src/table.template.d.ts +10 -0
  360. package/es/components/table/src/table.template.js +89 -0
  361. package/es/components/table/src/table.template.js.map +1 -0
  362. package/es/components/table/src/types.d.ts +13 -0
  363. package/es/components/table/src/types.js +8 -0
  364. package/es/components/table/src/types.js.map +1 -0
  365. package/es/components/tile-container/src/styles.scss.js +1 -1
  366. package/es/components/toolbar/index.d.ts +1 -0
  367. package/es/components/toolbar/index.js +9 -0
  368. package/es/components/toolbar/index.js.map +1 -0
  369. package/es/components/toolbar/src/toolbar.d.ts +39 -0
  370. package/es/components/toolbar/src/toolbar.js +179 -0
  371. package/es/components/toolbar/src/toolbar.js.map +1 -0
  372. package/es/components/toolbar/src/toolbar.scss.js +13 -0
  373. package/es/components/toolbar/src/toolbar.scss.js.map +1 -0
  374. package/es/components/workspace-shell/index.d.ts +5 -0
  375. package/es/components/workspace-shell/index.js +13 -0
  376. package/es/components/workspace-shell/index.js.map +1 -0
  377. package/es/components/workspace-shell/src/styles.scss.js +13 -0
  378. package/es/components/workspace-shell/src/styles.scss.js.map +1 -0
  379. package/es/components/workspace-shell/src/workspace-shell-body.d.ts +16 -0
  380. package/es/components/workspace-shell/src/workspace-shell-body.js +50 -0
  381. package/es/components/workspace-shell/src/workspace-shell-body.js.map +1 -0
  382. package/es/components/workspace-shell/src/workspace-shell-footer.d.ts +19 -0
  383. package/es/components/workspace-shell/src/workspace-shell-footer.js +53 -0
  384. package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -0
  385. package/es/components/workspace-shell/src/workspace-shell-header.d.ts +27 -0
  386. package/es/components/workspace-shell/src/workspace-shell-header.js +77 -0
  387. package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -0
  388. package/es/components/workspace-shell/src/workspace-shell-toolbar.d.ts +22 -0
  389. package/es/components/workspace-shell/src/workspace-shell-toolbar.js +61 -0
  390. package/es/components/workspace-shell/src/workspace-shell-toolbar.js.map +1 -0
  391. package/es/components/workspace-shell/src/workspace-shell.d.ts +20 -0
  392. package/es/components/workspace-shell/src/workspace-shell.js +83 -0
  393. package/es/components/workspace-shell/src/workspace-shell.js.map +1 -0
  394. package/es/components/workspace-shell/src/workspace-shell.scss.js +13 -0
  395. package/es/components/workspace-shell/src/workspace-shell.scss.js.map +1 -0
  396. package/es/globals/utils/uuid.d.ts +5 -0
  397. package/es/globals/utils/uuid.js +32 -0
  398. package/es/globals/utils/uuid.js.map +1 -0
  399. package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js +9 -0
  400. package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js.map +1 -0
  401. package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js +11 -0
  402. package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js.map +1 -0
  403. package/es/node_modules/@codemirror/autocomplete/dist/index.js +258 -0
  404. package/es/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
  405. package/es/node_modules/@codemirror/commands/dist/index.js +1140 -0
  406. package/es/node_modules/@codemirror/commands/dist/index.js.map +1 -0
  407. package/es/node_modules/@codemirror/lint/dist/index.js +636 -0
  408. package/es/node_modules/@codemirror/lint/dist/index.js.map +1 -0
  409. package/es/node_modules/@lezer/common/dist/index.js +253 -0
  410. package/es/node_modules/@lezer/common/dist/index.js.map +1 -0
  411. package/es/node_modules/crelt/index.js +37 -0
  412. package/es/node_modules/crelt/index.js.map +1 -0
  413. package/es/react/ai-label.d.ts +2 -1
  414. package/es/react/ai-label.js +3 -2
  415. package/es/react/ai-label.js.map +1 -1
  416. package/es/react/button.d.ts +2 -1
  417. package/es/react/button.js +3 -2
  418. package/es/react/button.js.map +1 -1
  419. package/es/react/chain-of-thought.d.ts +7 -0
  420. package/es/react/chain-of-thought.js +29 -0
  421. package/es/react/chain-of-thought.js.map +1 -0
  422. package/es/react/chat-button.d.ts +4 -4
  423. package/es/react/chat-button.js +6 -4
  424. package/es/react/chat-button.js.map +1 -1
  425. package/es/react/code-snippet-tile-container.d.ts +5 -0
  426. package/es/react/code-snippet-tile-container.js +30 -0
  427. package/es/react/code-snippet-tile-container.js.map +1 -0
  428. package/es/react/code-snippet.d.ts +4 -0
  429. package/es/react/code-snippet.js +31 -0
  430. package/es/react/code-snippet.js.map +1 -0
  431. package/es/react/content-switcher.d.ts +7 -0
  432. package/es/react/content-switcher.js +37 -0
  433. package/es/react/content-switcher.js.map +1 -0
  434. package/es/react/feedback-buttons.d.ts +4 -0
  435. package/es/react/feedback-buttons.js +28 -0
  436. package/es/react/feedback-buttons.js.map +1 -0
  437. package/es/react/feedback.d.ts +6 -0
  438. package/es/react/feedback.js +32 -0
  439. package/es/react/feedback.js.map +1 -0
  440. package/es/react/icon-button.d.ts +2 -1
  441. package/es/react/icon-button.js +3 -2
  442. package/es/react/icon-button.js.map +1 -1
  443. package/es/react/icon.d.ts +4 -0
  444. package/es/react/icon.js +28 -0
  445. package/es/react/icon.js.map +1 -0
  446. package/es/react/markdown.d.ts +4 -0
  447. package/es/react/markdown.js +28 -0
  448. package/es/react/markdown.js.map +1 -0
  449. package/es/react/overflow-menu.d.ts +9 -0
  450. package/es/react/overflow-menu.js +40 -0
  451. package/es/react/overflow-menu.js.map +1 -0
  452. package/es/react/processing.d.ts +2 -1
  453. package/es/react/processing.js +3 -2
  454. package/es/react/processing.js.map +1 -1
  455. package/es/react/reasoning-step.d.ts +6 -0
  456. package/es/react/reasoning-step.js +31 -0
  457. package/es/react/reasoning-step.js.map +1 -0
  458. package/es/react/reasoning-steps.d.ts +3 -0
  459. package/es/react/reasoning-steps.js +27 -0
  460. package/es/react/reasoning-steps.js.map +1 -0
  461. package/es/react/tile-container.d.ts +2 -1
  462. package/es/react/tile-container.js +3 -2
  463. package/es/react/tile-container.js.map +1 -1
  464. package/es/react/tile.d.ts +3 -2
  465. package/es/react/tile.js +5 -4
  466. package/es/react/tile.js.map +1 -1
  467. package/es/react/toolbar.d.ts +4 -0
  468. package/es/react/toolbar.js +28 -0
  469. package/es/react/toolbar.js.map +1 -0
  470. package/es/react/utils/withWebComponentBridge.d.ts +15 -0
  471. package/es/react/utils/withWebComponentBridge.js +95 -0
  472. package/es/react/utils/withWebComponentBridge.js.map +1 -0
  473. package/es/testing/load-all-lazy-deps.d.ts +10 -0
  474. package/es/testing/load-all-lazy-deps.js +30 -0
  475. package/es/testing/load-all-lazy-deps.js.map +1 -0
  476. package/package.json +39 -5
  477. package/dist/carbon-element-CMR7BOhG.js +0 -24
  478. package/dist/class-map-h7IEvsL_.js +0 -39
  479. package/es/components/chat-button/chat-button.d.ts +0 -23
  480. package/es/components/chat-button/chat-button.js.map +0 -1
  481. package/es/components/chat-button/src/chat-button.template.d.ts +0 -16
  482. package/es/components/chat-button/src/chat-button.template.js +0 -27
  483. package/es/components/chat-button/src/chat-button.template.js.map +0 -1
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { EditorView } from '@codemirror/view';
9
+ import ChevronDown16 from '@carbon/icons/es/chevron--down/16.js';
10
+ import { getAttributes } from '@carbon/icon-helpers';
11
+
12
+ /*
13
+ * Copyright IBM Corp. 2025
14
+ *
15
+ * This source code is licensed under the Apache-2.0 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ * @license
19
+ */
20
+ /**
21
+ * Creates a Carbon Design System styled fold marker for CodeMirror's foldGutter.
22
+ *
23
+ * This function returns a `markerDOM` function that can be used with CodeMirror's
24
+ * `foldGutter()` extension to display Carbon's chevron icon as fold indicators.
25
+ * The markers include proper accessibility attributes and keyboard support.
26
+ *
27
+ * **Note:** This function only provides the fold marker DOM. You must also include
28
+ * `createCarbonTheme()` to get the proper styling (icon size, rotation, focus states).
29
+ *
30
+ * @example Basic usage
31
+ * ```typescript
32
+ * import { EditorView } from 'codemirror';
33
+ * import { foldGutter } from '@codemirror/view';
34
+ * import { createCarbonTheme } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
35
+ * import { createCarbonFoldMarker } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
36
+ * import { javascript } from '@codemirror/lang-javascript';
37
+ *
38
+ * const editor = new EditorView({
39
+ * parent: document.body,
40
+ * extensions: [
41
+ * createCarbonTheme(), // Required for styling the fold markers
42
+ * foldGutter({
43
+ * markerDOM: createCarbonFoldMarker()
44
+ * }),
45
+ * javascript(),
46
+ * ],
47
+ * });
48
+ * ```
49
+ *
50
+ * @example Custom accessibility labels
51
+ * ```typescript
52
+ * import { foldGutter } from '@codemirror/view';
53
+ * import { createCarbonFoldMarker } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
54
+ *
55
+ * foldGutter({
56
+ * markerDOM: createCarbonFoldMarker({
57
+ * collapseLabel: 'Collapse this section',
58
+ * expandLabel: 'Expand this section',
59
+ * })
60
+ * })
61
+ * ```
62
+ *
63
+ * @example Keyboard accessibility
64
+ * The fold markers are keyboard accessible by default:
65
+ * - Tab to focus the marker
66
+ * - Enter or Space to toggle fold/unfold
67
+ * - Visual focus indicator matches Carbon Design System
68
+ *
69
+ * To enable keyboard support, you also need to add the keyboard event handler
70
+ * using the `carbonFoldMarkerKeyHandler()` utility:
71
+ * ```typescript
72
+ * import { EditorView } from 'codemirror';
73
+ * import { carbonFoldMarkerKeyHandler } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
74
+ *
75
+ * const editor = new EditorView({
76
+ * parent: document.body,
77
+ * extensions: [
78
+ * // ... other extensions
79
+ * carbonFoldMarkerKeyHandler(),
80
+ * ],
81
+ * });
82
+ * ```
83
+ *
84
+ * @param options - Configuration options for labels
85
+ * @returns A markerDOM function for use with foldGutter()
86
+ */
87
+ function createCarbonFoldMarker(options = {}) {
88
+ const { collapseLabel = "Collapse code block", expandLabel = "Expand code block", } = options;
89
+ return (open) => {
90
+ // Manually create SVG to avoid toSVG's attribute issues
91
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
92
+ const attrs = getAttributes(ChevronDown16.attrs);
93
+ // Only set attributes that have valid values
94
+ Object.entries(attrs).forEach(([key, value]) => {
95
+ if (value !== undefined &&
96
+ value !== "undefined" &&
97
+ value !== null &&
98
+ String(value) !== "undefined") {
99
+ svg.setAttribute(key, String(value));
100
+ }
101
+ });
102
+ // Add the path element
103
+ ChevronDown16.content.forEach((item) => {
104
+ if (item.elem === "path") {
105
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
106
+ Object.entries(item.attrs).forEach(([key, value]) => {
107
+ path.setAttribute(key, String(value));
108
+ });
109
+ svg.appendChild(path);
110
+ }
111
+ });
112
+ // Accessibility attributes - all styling is in theme.ts for CSP compliance
113
+ svg.setAttribute("role", "button");
114
+ svg.setAttribute("aria-label", open ? collapseLabel : expandLabel);
115
+ svg.setAttribute("aria-expanded", String(open));
116
+ svg.setAttribute("tabindex", "0");
117
+ return svg;
118
+ };
119
+ }
120
+ /**
121
+ * Creates a keyboard event handler for Carbon fold markers.
122
+ *
123
+ * This extension enables keyboard accessibility for fold markers created with
124
+ * `createCarbonFoldMarker()`. It allows users to toggle code folding by pressing
125
+ * Enter or Space when a fold marker is focused.
126
+ *
127
+ * @example Complete setup with keyboard support
128
+ * ```typescript
129
+ * import { EditorView } from 'codemirror';
130
+ * import { foldGutter, lineNumbers } from '@codemirror/view';
131
+ * import { createCarbonTheme } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
132
+ * import {
133
+ * createCarbonFoldMarker,
134
+ * carbonFoldMarkerKeyHandler
135
+ * } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
136
+ * import { javascript } from '@codemirror/lang-javascript';
137
+ *
138
+ * const editor = new EditorView({
139
+ * parent: document.body,
140
+ * extensions: [
141
+ * createCarbonTheme(),
142
+ * lineNumbers(),
143
+ * foldGutter({
144
+ * markerDOM: createCarbonFoldMarker()
145
+ * }),
146
+ * carbonFoldMarkerKeyHandler(), // Enable keyboard support
147
+ * javascript(),
148
+ * ],
149
+ * });
150
+ * ```
151
+ *
152
+ * @example Keyboard interaction
153
+ * - **Tab**: Focus the fold marker
154
+ * - **Enter** or **Space**: Toggle fold/unfold
155
+ * - **Tab** again: Move to next focusable element
156
+ *
157
+ * @returns CodeMirror extension for keyboard event handling
158
+ */
159
+ function carbonFoldMarkerKeyHandler() {
160
+ return EditorView.domEventHandlers({
161
+ keydown(event, _view) {
162
+ const target = event.target;
163
+ // Check if the target is a fold gutter marker
164
+ if (target.tagName === "svg" &&
165
+ target.getAttribute("role") === "button" &&
166
+ target.hasAttribute("aria-expanded") &&
167
+ (event.key === "Enter" || event.key === " ")) {
168
+ event.preventDefault();
169
+ // Trigger a mouse event to activate CodeMirror's fold handler
170
+ const mouseEvent = new MouseEvent("mousedown", {
171
+ bubbles: true,
172
+ cancelable: true,
173
+ });
174
+ target.dispatchEvent(mouseEvent);
175
+ return true;
176
+ }
177
+ return false;
178
+ },
179
+ });
180
+ }
181
+
182
+ export { carbonFoldMarkerKeyHandler, createCarbonFoldMarker };
183
+ //# sourceMappingURL=marker-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker-utils.js","sources":["../../../../../src/components/code-snippet/src/codemirror/marker-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAOG;AAuBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEG;AACG,SAAU,sBAAsB,CACpC,OAAA,GAAmC,EAAE,EAAA;IAErC,MAAM,EACJ,aAAa,GAAG,qBAAqB,EACrC,WAAW,GAAG,mBAAmB,GAClC,GAAG,OAAO;IAEX,OAAO,CAAC,IAAa,KAAI;;QAEvB,MAAM,GAAG,GAAG,QAAQ,CAAC,eAAe,CAAC,4BAA4B,EAAE,KAAK,CAAC;QACzE,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC;;AAGhD,QAAA,MAAM,CAAC,OAAO,CAA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UAAU,CAAC,gBAAgB,CAAC;QACjC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAA;AAClB,YAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB;;AAE1C,YAAA,IACE,MAAM,CAAC,OAAO,KAAK,KAAK;AACxB,gBAAA,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,QAAQ;AACxC,gBAAA,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC;AACpC,iBAAC,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,EAC5C;gBACA,KAAK,CAAC,cAAc,EAAE;;AAEtB,gBAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE;AAC7C,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAC;AACF,gBAAA,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC;AAChC,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,OAAO,KAAK;QACd,CAAC;AACF,KAAA,CAAC;AACJ;;;;"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Creates a CodeMirror theme that uses Carbon Design System CSS custom properties.
3
+ * This allows the editor to automatically adapt to Carbon's light/dark themes.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { EditorView } from 'codemirror';
8
+ * import { createCarbonTheme, createCarbonHighlightStyle } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
9
+ * import { createCarbonFoldMarker, carbonFoldMarkerKeyHandler } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
10
+ * import { lineNumbers, foldGutter } from '@codemirror/view';
11
+ * import { javascript } from '@codemirror/lang-javascript';
12
+ *
13
+ * const editor = new EditorView({
14
+ * parent: document.body,
15
+ * extensions: [
16
+ * createCarbonTheme(),
17
+ * createCarbonHighlightStyle(),
18
+ * lineNumbers(),
19
+ * foldGutter({ markerDOM: createCarbonFoldMarker() }),
20
+ * carbonFoldMarkerKeyHandler(), // Enable keyboard support for fold markers
21
+ * javascript(),
22
+ * ],
23
+ * });
24
+ * ```
25
+ *
26
+ * @returns CodeMirror theme extension
27
+ */
28
+ export declare function createCarbonTheme(): import("@codemirror/state").Extension;
29
+ /**
30
+ * Creates syntax highlighting styles using Carbon Design System CSS custom properties.
31
+ * This provides color theming for code syntax that adapts to Carbon's light/dark themes.
32
+ *
33
+ * All syntax colors are defined using CSS custom properties (--cds-syntax-*) that can be
34
+ * customized via your Carbon theme. Fallback values mirror VSCode Light defaults.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { EditorView } from 'codemirror';
39
+ * import { createCarbonTheme, createCarbonHighlightStyle } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
40
+ * import { python } from '@codemirror/lang-python';
41
+ *
42
+ * const editor = new EditorView({
43
+ * parent: document.body,
44
+ * extensions: [
45
+ * createCarbonTheme(),
46
+ * createCarbonHighlightStyle(),
47
+ * python(),
48
+ * ],
49
+ * });
50
+ * ```
51
+ *
52
+ * @returns CodeMirror syntax highlighting extension
53
+ */
54
+ export declare function createCarbonHighlightStyle(): import("@codemirror/state").Extension;
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { EditorView } from 'codemirror';
9
+ import { syntaxHighlighting, HighlightStyle } from '@codemirror/language';
10
+ import { tags } from '@lezer/highlight';
11
+
12
+ /*
13
+ * Copyright IBM Corp. 2025
14
+ *
15
+ * This source code is licensed under the Apache-2.0 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ * @license
19
+ */
20
+ /**
21
+ * Creates a CodeMirror theme that uses Carbon Design System CSS custom properties.
22
+ * This allows the editor to automatically adapt to Carbon's light/dark themes.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { EditorView } from 'codemirror';
27
+ * import { createCarbonTheme, createCarbonHighlightStyle } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
28
+ * import { createCarbonFoldMarker, carbonFoldMarkerKeyHandler } from '@carbon/ai-chat-components/es/globals/codemirror/marker-utils';
29
+ * import { lineNumbers, foldGutter } from '@codemirror/view';
30
+ * import { javascript } from '@codemirror/lang-javascript';
31
+ *
32
+ * const editor = new EditorView({
33
+ * parent: document.body,
34
+ * extensions: [
35
+ * createCarbonTheme(),
36
+ * createCarbonHighlightStyle(),
37
+ * lineNumbers(),
38
+ * foldGutter({ markerDOM: createCarbonFoldMarker() }),
39
+ * carbonFoldMarkerKeyHandler(), // Enable keyboard support for fold markers
40
+ * javascript(),
41
+ * ],
42
+ * });
43
+ * ```
44
+ *
45
+ * @returns CodeMirror theme extension
46
+ */
47
+ function createCarbonTheme() {
48
+ return EditorView.theme({
49
+ ".cm-editor": {
50
+ fontFamily: "var(--cds-code-01-font-family, 'IBM Plex Mono', monospace)",
51
+ fontSize: "var(--cds-code-01-font-size, 0.875rem)",
52
+ fontWeight: "var(--cds-code-01-font-weight, 400)",
53
+ letterSpacing: "var(--cds-code-01-letter-spacing, 0.16px)",
54
+ lineHeight: "var(--cds-code-01-line-height, 1.5)",
55
+ background: "var(--cds-layer, #ffffff)",
56
+ color: "var(--cds-text-primary, #161616)",
57
+ },
58
+ // Cursor / caret
59
+ ".cm-cursor, .cm-dropCursor": {
60
+ borderLeftColor: "var(--cds-text-primary, #161616)",
61
+ },
62
+ // Gutters
63
+ ".cm-gutters": {
64
+ backgroundColor: "var(--cds-background, #ffffff)",
65
+ color: "var(--cds-text-helper, #6f6f6f)",
66
+ border: "none",
67
+ },
68
+ ".cm-gutterElement .cm-lineNumbers": {
69
+ textAlign: "end",
70
+ },
71
+ ".cm-foldGutter": {
72
+ paddingInlineEnd: "0.25rem",
73
+ },
74
+ // Editor content
75
+ ".cm-content": {
76
+ flexBasis: "0 !important",
77
+ caretColor: "var(--cds-text-primary, #161616)",
78
+ },
79
+ ".cm-scroller": {
80
+ maxBlockSize: "var(--cds-snippet-max-height, 16rem)",
81
+ minBlockSize: "var(--cds-snippet-min-height, 3rem)",
82
+ },
83
+ // Fold gutter / caret icons
84
+ ".cm-foldGutter .cm-gutterElement": {
85
+ display: "flex",
86
+ justifyContent: "center",
87
+ alignItems: "center",
88
+ width: "16px",
89
+ },
90
+ ".cm-foldGutter svg": {
91
+ width: "12px",
92
+ height: "12px",
93
+ cursor: "pointer",
94
+ transition: "transform 0.11s cubic-bezier(0.2, 0, 0.38, 0.9)",
95
+ fill: "var(--cds-icon-primary, #161616)",
96
+ },
97
+ ".cm-foldGutter svg[aria-expanded='true']": {
98
+ transform: "rotate(0deg)",
99
+ },
100
+ ".cm-foldGutter svg[aria-expanded='false']": {
101
+ transform: "rotate(-90deg)",
102
+ },
103
+ ".cm-foldGutter svg:focus": {
104
+ outline: "2px solid var(--cds-focus, #0f62fe)",
105
+ },
106
+ // Search / selection highlights
107
+ ".cm-searchMatch": {
108
+ backgroundColor: "var(--cds-highlight, #d0e2ff)",
109
+ },
110
+ ".cm-searchMatch-selected": {
111
+ backgroundColor: "var(--cds-highlight, #d0e2ff)",
112
+ },
113
+ ".cm-selectionBackground": {
114
+ backgroundColor: "var(--cds-highlight, #d0e2ff)",
115
+ },
116
+ ".cm-selectionMatch": {
117
+ backgroundColor: "var(--cds-highlight, #d0e2ff)",
118
+ },
119
+ "&.cm-focused .cm-selectionBackground": {
120
+ backgroundColor: "var(--cds-highlight, #d0e2ff) !important",
121
+ },
122
+ "&.cm-focused .cm-selectionMatch": {
123
+ backgroundColor: "var(--cds-highlight, #d0e2ff) !important",
124
+ },
125
+ // Native selection fallback
126
+ ".cm-content ::selection": {
127
+ backgroundColor: "var(--cds-highlight, #d0e2ff) !important",
128
+ },
129
+ "&.cm-focused .cm-content ::selection": {
130
+ backgroundColor: "var(--cds-highlight, #d0e2ff) !important",
131
+ },
132
+ });
133
+ }
134
+ /**
135
+ * Creates syntax highlighting styles using Carbon Design System CSS custom properties.
136
+ * This provides color theming for code syntax that adapts to Carbon's light/dark themes.
137
+ *
138
+ * All syntax colors are defined using CSS custom properties (--cds-syntax-*) that can be
139
+ * customized via your Carbon theme. Fallback values mirror VSCode Light defaults.
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * import { EditorView } from 'codemirror';
144
+ * import { createCarbonTheme, createCarbonHighlightStyle } from '@carbon/ai-chat-components/es/globals/codemirror/theme';
145
+ * import { python } from '@codemirror/lang-python';
146
+ *
147
+ * const editor = new EditorView({
148
+ * parent: document.body,
149
+ * extensions: [
150
+ * createCarbonTheme(),
151
+ * createCarbonHighlightStyle(),
152
+ * python(),
153
+ * ],
154
+ * });
155
+ * ```
156
+ *
157
+ * @returns CodeMirror syntax highlighting extension
158
+ */
159
+ function createCarbonHighlightStyle() {
160
+ return syntaxHighlighting(carbonHighlightStyle);
161
+ }
162
+ const TAG_REGISTRY = tags;
163
+ const toVarName = (name) => name
164
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
165
+ .replace(/([A-Za-z])([0-9])/g, "$1-$2")
166
+ .toLowerCase();
167
+ const colorVar = (token) => `var(--cds-syntax-${token}, var(--cds-text-primary, #161616))`;
168
+ const resolveTag = (tagName) => TAG_REGISTRY[tagName];
169
+ const BASE_TAG_NAMES = [
170
+ "comment",
171
+ "lineComment",
172
+ "blockComment",
173
+ "docComment",
174
+ "name",
175
+ "variableName",
176
+ "typeName",
177
+ "tagName",
178
+ "propertyName",
179
+ "attributeName",
180
+ "className",
181
+ "labelName",
182
+ "namespace",
183
+ "macroName",
184
+ "literal",
185
+ "string",
186
+ "docString",
187
+ "character",
188
+ "attributeValue",
189
+ "number",
190
+ "integer",
191
+ "float",
192
+ "bool",
193
+ "regexp",
194
+ "escape",
195
+ "color",
196
+ "url",
197
+ "keyword",
198
+ "self",
199
+ "null",
200
+ "atom",
201
+ "unit",
202
+ "modifier",
203
+ "operatorKeyword",
204
+ "controlKeyword",
205
+ "definitionKeyword",
206
+ "moduleKeyword",
207
+ "operator",
208
+ "derefOperator",
209
+ "arithmeticOperator",
210
+ "logicOperator",
211
+ "bitwiseOperator",
212
+ "compareOperator",
213
+ "updateOperator",
214
+ "definitionOperator",
215
+ "typeOperator",
216
+ "controlOperator",
217
+ "punctuation",
218
+ "separator",
219
+ "bracket",
220
+ "angleBracket",
221
+ "squareBracket",
222
+ "paren",
223
+ "brace",
224
+ "content",
225
+ "heading",
226
+ "heading1",
227
+ "heading2",
228
+ "heading3",
229
+ "heading4",
230
+ "heading5",
231
+ "heading6",
232
+ "contentSeparator",
233
+ "list",
234
+ "quote",
235
+ "emphasis",
236
+ "strong",
237
+ "link",
238
+ "monospace",
239
+ "strikethrough",
240
+ "invalid",
241
+ "meta",
242
+ "documentMeta",
243
+ "annotation",
244
+ "processingInstruction",
245
+ ];
246
+ const HEADING_TAG_NAMES = [
247
+ "heading",
248
+ "heading1",
249
+ "heading2",
250
+ "heading3",
251
+ "heading4",
252
+ "heading5",
253
+ "heading6",
254
+ ];
255
+ const manualConfigs = [
256
+ ...HEADING_TAG_NAMES.map((tagName) => ({
257
+ tagName,
258
+ style: {
259
+ fontWeight: "bold",
260
+ textDecoration: "underline",
261
+ },
262
+ })),
263
+ { tagName: "link", style: { textDecoration: "underline" } },
264
+ { tagName: "emphasis", style: { fontStyle: "italic" } },
265
+ { tagName: "strong", style: { fontWeight: "bold" } },
266
+ { tagName: "strikethrough", style: { textDecoration: "line-through" } },
267
+ ];
268
+ const MANUAL_TAG_NAMES = new Set(manualConfigs.map(({ tagName }) => tagName));
269
+ const manualTokenStyles = manualConfigs
270
+ .map(({ tagName, style }) => {
271
+ const tag = resolveTag(tagName);
272
+ if (!tag) {
273
+ return null;
274
+ }
275
+ return {
276
+ tag,
277
+ color: colorVar(toVarName(tagName)),
278
+ ...style,
279
+ };
280
+ })
281
+ .filter(Boolean);
282
+ const autoTagStyles = BASE_TAG_NAMES.filter((tagName) => !MANUAL_TAG_NAMES.has(tagName))
283
+ .map((tagName) => {
284
+ const tag = resolveTag(tagName);
285
+ if (!tag) {
286
+ return null;
287
+ }
288
+ return {
289
+ tag,
290
+ color: colorVar(toVarName(tagName)),
291
+ };
292
+ })
293
+ .filter(Boolean);
294
+ const modifierTokenStyles = [
295
+ { tag: tags.definition(tags.variableName), color: colorVar("definition") },
296
+ { tag: tags.definition(tags.propertyName), color: colorVar("definition") },
297
+ { tag: tags.definition(tags.typeName), color: colorVar("definition") },
298
+ { tag: tags.definition(tags.className), color: colorVar("definition") },
299
+ { tag: tags.constant(tags.variableName), color: colorVar("constant") },
300
+ { tag: tags.constant(tags.propertyName), color: colorVar("constant") },
301
+ { tag: tags.constant(tags.typeName), color: colorVar("constant") },
302
+ { tag: tags.function(tags.variableName), color: colorVar("function") },
303
+ { tag: tags.function(tags.propertyName), color: colorVar("function") },
304
+ { tag: tags.function(tags.typeName), color: colorVar("function") },
305
+ { tag: tags.standard(tags.variableName), color: colorVar("standard") },
306
+ { tag: tags.standard(tags.propertyName), color: colorVar("standard") },
307
+ { tag: tags.local(tags.variableName), color: colorVar("local") },
308
+ { tag: tags.local(tags.propertyName), color: colorVar("local") },
309
+ { tag: tags.special(tags.variableName), color: colorVar("special") },
310
+ { tag: tags.special(tags.propertyName), color: colorVar("special") },
311
+ { tag: tags.special(tags.string), color: colorVar("special-string") },
312
+ ];
313
+ const carbonHighlightStyle = HighlightStyle.define([
314
+ ...modifierTokenStyles,
315
+ ...manualTokenStyles,
316
+ ...autoTagStyles,
317
+ ]);
318
+
319
+ export { createCarbonHighlightStyle, createCarbonTheme };
320
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sources":["../../../../../src/components/code-snippet/src/codemirror/theme.ts"],"sourcesContent":[null],"names":["t"],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAOG;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;SACa,iBAAiB,GAAA;IAC/B,OAAO,UAAU,CAAC,KAAK,CAAC;AACtB,QAAA,YA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AAU,CAAC,EAAE;AAC5D,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,QAAQ,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;AAChE,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,QAAQ,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;AAChE,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,KAAK,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;AAC1D,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,KAAK,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;AAC1D,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,OAAO,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE;AAC9D,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,OAAO,CAACA,IAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE;AAC9D,IAAA,EAAE,GAAG,EAAEA,IAAC,CAAC,OAAO,CAACA,IAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;CAChE;AAED,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAC;AACjD,IAAA,GAAG,mBAAmB;AACtB,IAAA,GAAG,iBAAiB;AACpB,IAAA,GAAG,aAAa;AACjB,CAAA,CAAC;;;;"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Observes resize of the given element with the provided resize observer.
3
+ * Returns an object with a release() method to clean up the observer.
4
+ */
5
+ export declare const observeResize: (observer: ResizeObserver, elem: Element) => {
6
+ release(): null;
7
+ } | null;
8
+ /**
9
+ * Gets scroll and dimension information from a code reference element.
10
+ */
11
+ export declare function getCodeRefDimensions(ref: Element): {
12
+ horizontalOverflow: boolean;
13
+ codeClientWidth: number;
14
+ codeScrollWidth: number;
15
+ codeScrollLeft: number;
16
+ };
17
+ /**
18
+ * Extracts text content from child nodes of an element without trimming so callers can decide how to normalize whitespace.
19
+ */
20
+ export declare function extractTextContent(element: Element): string;
21
+ /**
22
+ * Extracts text content from a slot's assigned nodes without trimming so streaming whitespace is preserved.
23
+ */
24
+ export declare function extractSlotContent(slot: HTMLSlotElement): string;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /*
9
+ * Copyright IBM Corp. 2025
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ * @license
15
+ */
16
+ /**
17
+ * Observes resize of the given element with the provided resize observer.
18
+ * Returns an object with a release() method to clean up the observer.
19
+ */
20
+ const observeResize = (observer, elem) => {
21
+ if (!elem) {
22
+ return null;
23
+ }
24
+ observer.observe(elem);
25
+ return {
26
+ release() {
27
+ observer.unobserve(elem);
28
+ return null;
29
+ },
30
+ };
31
+ };
32
+ /**
33
+ * Gets scroll and dimension information from a code reference element.
34
+ */
35
+ function getCodeRefDimensions(ref) {
36
+ const { clientWidth: codeClientWidth, scrollLeft: codeScrollLeft, scrollWidth: codeScrollWidth, } = ref;
37
+ return {
38
+ horizontalOverflow: codeScrollWidth > codeClientWidth,
39
+ codeClientWidth,
40
+ codeScrollWidth,
41
+ codeScrollLeft,
42
+ };
43
+ }
44
+ /**
45
+ * Extracts text content from child nodes of an element without trimming so callers can decide how to normalize whitespace.
46
+ */
47
+ function extractTextContent(element) {
48
+ const textContent = Array.from(element.childNodes)
49
+ .filter((node) => node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE)
50
+ .map((node) => node.textContent || "")
51
+ .join("");
52
+ return textContent;
53
+ }
54
+ /**
55
+ * Extracts text content from a slot's assigned nodes without trimming so streaming whitespace is preserved.
56
+ */
57
+ function extractSlotContent(slot) {
58
+ const nodes = slot.assignedNodes({ flatten: true });
59
+ return nodes.map((node) => node.textContent || "").join("");
60
+ }
61
+
62
+ export { extractSlotContent, extractTextContent, getCodeRefDimensions, observeResize };
63
+ //# sourceMappingURL=dom-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.js","sources":["../../../../src/components/code-snippet/src/dom-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;AAGG;MACU,aAAa,GAAG,CAC3B,QAAwB,EACxB,IAAa,KACiB;IAC9B,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,OAAO,IAAI;IACb;AACA,IAAA,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;IACtB,OAAO;QACL,OAAO,GAAA;AACL,YAAA,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;AACxB,YAAA,OAAO,IAAI;QACb,CAAC;KACF;AACH;AAEA;;AAEG;AACG,SAAU,oBAAoB,CAAC,GAAY,EAAA;AAC/C,IAAA,MAAM,EACJ,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,eAAe,GAC7B,GAAG,GAAkB;IAEtB,OAAO;QACL,kBAAkB,EAAE,eAAe,GAAG,eAAe;QACrD,eAAe;QACf,eAAe;QACf,cAAc;KACf;AACH;AAEA;;AAEG;AACG,SAAU,kBAAkB,CAAC,OAAgB,EAAA;IACjD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU;SAC9C,MAAM,CACL,CAAC,IAAI,KACH,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;SAE1E,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW,IAAI,EAAE;SACpC,IAAI,CAAC,EAAE,CAAC;AAEX,IAAA,OAAO,WAAW;AACpB;AAEA;;AAEG;AACG,SAAU,kBAAkB,CAAC,IAAqB,EAAA;AACtD,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7D;;;;"}
@@ -0,0 +1,4 @@
1
+ export type LineCountFormatter = ({ count }: {
2
+ count: number;
3
+ }) => string;
4
+ export declare const defaultLineCountText: LineCountFormatter;