@carbon/ai-chat-components 0.5.0 → 0.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9201 -295
- package/dist/16-dhcD1XnN.js +91 -0
- package/dist/apl-DqFn9Cbk.js +91 -0
- package/dist/asciiarmor-CQVR_D9L.js +91 -0
- package/dist/asn1-Bdl290ll.js +91 -0
- package/dist/asterisk-CHhwduFx.js +91 -0
- package/dist/button-C7jiyqgq.js +157 -0
- package/dist/button-skeleton-CmP7IJd9.js +116 -0
- package/dist/carbon-element-Bx5dT_rO.js +91 -0
- package/dist/carbon-element-GZbOyRvd.js +91 -0
- package/dist/chain-of-thought.min.js +276 -0
- package/dist/chat-button.min.js +71 -81
- package/dist/checkbox-skeleton-DwliWSxe.js +166 -0
- package/dist/class-map-C991A_SZ.js +106 -0
- package/dist/clike-D_BRCCKx.js +91 -0
- package/dist/clojure-DJgQfSNr.js +91 -0
- package/dist/cmake-B-ZvYGPj.js +91 -0
- package/dist/cobol-DQkSt8H4.js +91 -0
- package/dist/code-snippet.min.js +91 -0
- package/dist/codemirror-runtime-BNdgITbn.js +173 -0
- package/dist/coffeescript-BLbmGaLw.js +91 -0
- package/dist/collection-helpers-CFQuvZZA.js +91 -0
- package/dist/commonlisp-C9udfub_.js +91 -0
- package/dist/crystal-Cx264mZy.js +91 -0
- package/dist/css-C3wBe_UD.js +91 -0
- package/dist/custom-element-Cn0sJQhF.js +96 -0
- package/dist/cypher-B6v9gzB5.js +91 -0
- package/dist/d-TP3OUaM_.js +91 -0
- package/dist/diff-Y92SrBOy.js +91 -0
- package/dist/dockerfile-b9e_zbYe.js +91 -0
- package/dist/dtd-CyzcM_UR.js +91 -0
- package/dist/dylan-CLgWKLaP.js +91 -0
- package/dist/ebnf-Cj21Kqae.js +91 -0
- package/dist/ecl-BcwtDAaq.js +91 -0
- package/dist/eiffel-Dgs2eMt8.js +91 -0
- package/dist/elm-Lz8luKdH.js +91 -0
- package/dist/erlang-M1-xYwsL.js +91 -0
- package/dist/factor-DMuLpKP7.js +91 -0
- package/dist/fcl-6D51jO4g.js +91 -0
- package/dist/feedback.min.js +300 -0
- package/dist/forth-C50AZvgy.js +91 -0
- package/dist/fortran-Dpu0QrPi.js +91 -0
- package/dist/gas-B9QnMcpy.js +91 -0
- package/dist/gherkin-DTyHG7By.js +91 -0
- package/dist/groovy-C5hIRvZS.js +91 -0
- package/dist/haskell-riE-Rg6U.js +91 -0
- package/dist/haxe-BKi5Bt6T.js +91 -0
- package/dist/http-CCf5f1Lw.js +91 -0
- package/dist/icon-button-slcp5_YI.js +143 -0
- package/dist/icon-loader-B470ctm0.js +101 -0
- package/dist/idl-ChujC8hT.js +91 -0
- package/dist/if-defined-KYZWA80L.js +96 -0
- package/dist/index-BE2hQiYV.js +91 -0
- package/dist/index-BJSu7ZrY.js +91 -0
- package/dist/index-BNCWBho3.js +91 -0
- package/dist/index-Bo9Cedlp.js +91 -0
- package/dist/index-BtGjzzQh.js +91 -0
- package/dist/index-BvcTcg8N.js +91 -0
- package/dist/index-CL7jwlI7.js +91 -0
- package/dist/index-CPho0oBg.js +91 -0
- package/dist/index-CSzVoPB_.js +91 -0
- package/dist/index-CbsQNetX.js +91 -0
- package/dist/index-CdZ_a1WB.js +91 -0
- package/dist/index-Ce_RTZPK.js +91 -0
- package/dist/index-Cic4krlv.js +91 -0
- package/dist/index-CqP0C8Q_.js +91 -0
- package/dist/index-CsEIBvob.js +91 -0
- package/dist/index-D5o8uLCI.js +168 -0
- package/dist/index-D8SIiSq6.js +367 -0
- package/dist/index-DP_9bMys.js +91 -0
- package/dist/index-DofS9KDk.js +91 -0
- package/dist/index-Duo7vkZg.js +91 -0
- package/dist/index-DxcNpyu9.js +91 -0
- package/dist/index-ET89Rloy.js +91 -0
- package/dist/index-LQA85hjt.js +91 -0
- package/dist/index-T4fwu_xG.js +91 -0
- package/dist/javascript-BXzknqbJ.js +91 -0
- package/dist/julia-Ks6uUXS_.js +91 -0
- package/dist/{settings-XW6XylsZ.js → lit-element-Cj6JUqRW.js} +70 -12
- package/dist/livescript-C-N_oa0B.js +91 -0
- package/dist/lua-DyvKK1uJ.js +91 -0
- package/dist/markdown.min.js +296 -0
- package/dist/mathematica-DEg7Ra1Y.js +91 -0
- package/dist/mbox-DreqCmNH.js +91 -0
- package/dist/mirc-Cf2JTO1B.js +91 -0
- package/dist/mllike-BrIsM2v2.js +91 -0
- package/dist/modelica-B8SYrhCg.js +91 -0
- package/dist/mscgen-Ci9STQqX.js +91 -0
- package/dist/mumps-DdZIEnoV.js +91 -0
- package/dist/nginx-csHLvOI4.js +91 -0
- package/dist/nsis-BJ14NiV_.js +91 -0
- package/dist/ntriples-r4TsB1vg.js +91 -0
- package/dist/octave-DAywLo7W.js +91 -0
- package/dist/oz-DF39EOLJ.js +91 -0
- package/dist/pascal-Cdx2JBFI.js +91 -0
- package/dist/perl-CUDzEjb5.js +91 -0
- package/dist/pig-BgGDN3Fs.js +91 -0
- package/dist/powershell-yf7ZzrwA.js +91 -0
- package/dist/processing.min.js +71 -4
- package/dist/properties-Cna57Jh2.js +91 -0
- package/dist/protobuf-CWUMO8BP.js +91 -0
- package/dist/pug-D44aRpDl.js +91 -0
- package/dist/puppet-9oZPpLZK.js +91 -0
- package/dist/python-BzmgDs2d.js +91 -0
- package/dist/q-DDRrIilQ.js +91 -0
- package/dist/query-CIc5rDzI.js +101 -0
- package/dist/r-DT4JIpvb.js +91 -0
- package/dist/radio-group-manager-Dy7yXQky.js +91 -0
- package/dist/reasoning-steps.min.js +171 -0
- package/dist/repeat-DA7noZfi.js +96 -0
- package/dist/rpm-Q94njsnC.js +91 -0
- package/dist/ruby-p6VwoSsc.js +91 -0
- package/dist/sas-C8r72_Ai.js +91 -0
- package/dist/scheme-Bw1qfPdY.js +91 -0
- package/dist/settings-Bx1fCry0.js +99 -0
- package/dist/shell-B0162WXP.js +91 -0
- package/dist/sieve-DcAl9TNY.js +91 -0
- package/dist/simple-mode-dBIHJK_w.js +91 -0
- package/dist/smalltalk-BRpoyy0q.js +91 -0
- package/dist/solr-CntivwdY.js +91 -0
- package/dist/sparql-CPxRv-GB.js +91 -0
- package/dist/spreadsheet-DiWzltX0.js +91 -0
- package/dist/sql-BZFWK8-D.js +91 -0
- package/dist/state-ldHJ0lGt.js +96 -0
- package/dist/stex-DVnajZzj.js +91 -0
- package/dist/stylus-BCkTgCvi.js +91 -0
- package/dist/swift-DumH6rGA.js +91 -0
- package/dist/sync-BrWXU4C6.js +91 -0
- package/dist/table-runtime-C-85Ozvo.js +510 -0
- package/dist/table.min.js +91 -0
- package/dist/tcl-Ds60z3Ro.js +91 -0
- package/dist/text-input-BNmEJ8ys.js +158 -0
- package/dist/textile-CgTb_UUX.js +91 -0
- package/dist/throttle-CT5ZAUBU.js +91 -0
- package/dist/tiddlywiki-D0BukLzX.js +91 -0
- package/dist/tiki-DlrtqA5_.js +91 -0
- package/dist/tile-container.min.js +70 -14
- package/dist/toml-CG0tgYZ1.js +91 -0
- package/dist/toolbar.min.js +180 -0
- package/dist/troff-DZdS2uzR.js +91 -0
- package/dist/ttcn-D2NdeEoM.js +91 -0
- package/dist/ttcn-cfg-dCpHFW8J.js +91 -0
- package/dist/turtle-DBImhCBD.js +91 -0
- package/dist/vb-BdASAZha.js +91 -0
- package/dist/vbscript-DlJph2V7.js +91 -0
- package/dist/velocity-ds6Akj1B.js +91 -0
- package/dist/verilog-KFajwNWD.js +91 -0
- package/dist/vhdl-DWozufY6.js +91 -0
- package/dist/webidl-BSUbcB__.js +91 -0
- package/dist/workspace-shell.min.js +162 -0
- package/dist/xquery-CvISDSSw.js +91 -0
- package/dist/yacas-BNn6e9ff.js +91 -0
- package/dist/z80-BwinLJKG.js +91 -0
- package/es/components/chain-of-thought/index.d.ts +4 -0
- package/es/components/chain-of-thought/index.js +11 -0
- package/es/components/chain-of-thought/index.js.map +1 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.d.ts +15 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js +36 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.d.ts +87 -0
- package/es/components/chain-of-thought/src/chain-of-thought.js +189 -0
- package/es/components/chain-of-thought/src/chain-of-thought.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.scss.js +13 -0
- package/es/components/chain-of-thought/src/chain-of-thought.scss.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.d.ts +5 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.js +206 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.js.map +1 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.d.ts +10 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js +50 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js.map +1 -0
- package/es/components/chain-of-thought/src/types.d.ts +73 -0
- package/es/components/chain-of-thought/src/types.js +29 -0
- package/es/components/chain-of-thought/src/types.js.map +1 -0
- package/es/components/chat-button/defs.d.ts +25 -0
- package/es/components/chat-button/defs.js +36 -0
- package/es/components/chat-button/defs.js.map +1 -0
- package/es/components/chat-button/index.d.ts +1 -1
- package/es/components/chat-button/index.js +1 -1
- package/es/components/chat-button/src/chat-button.d.ts +32 -0
- package/es/components/chat-button/{chat-button.js → src/chat-button.js} +16 -10
- package/es/components/chat-button/src/chat-button.js.map +1 -0
- package/es/components/chat-button/src/chat-button.scss.js +1 -1
- package/es/components/code-snippet/index.d.ts +3 -0
- package/es/components/code-snippet/index.js +10 -0
- package/es/components/code-snippet/index.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.d.ts +32 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.js +143 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet.d.ts +482 -0
- package/es/components/code-snippet/src/code-snippet.js +592 -0
- package/es/components/code-snippet/src/code-snippet.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet.scss.js +13 -0
- package/es/components/code-snippet/src/code-snippet.scss.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/base-setup.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/base-setup.js +65 -0
- package/es/components/code-snippet/src/codemirror/base-setup.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js +36 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.d.ts +7 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.js +13 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/content-sync.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/content-sync.js +72 -0
- package/es/components/code-snippet/src/codemirror/content-sync.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.d.ts +28 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.js +75 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-controller.d.ts +38 -0
- package/es/components/code-snippet/src/codemirror/language-controller.js +220 -0
- package/es/components/code-snippet/src/codemirror/language-controller.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-data.d.ts +6 -0
- package/es/components/code-snippet/src/codemirror/language-data.js +1043 -0
- package/es/components/code-snippet/src/codemirror/language-data.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-utils.d.ts +79 -0
- package/es/components/code-snippet/src/codemirror/language-utils.js +219 -0
- package/es/components/code-snippet/src/codemirror/language-utils.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.d.ts +123 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.js +183 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/theme.d.ts +54 -0
- package/es/components/code-snippet/src/codemirror/theme.js +320 -0
- package/es/components/code-snippet/src/codemirror/theme.js.map +1 -0
- package/es/components/code-snippet/src/dom-utils.d.ts +24 -0
- package/es/components/code-snippet/src/dom-utils.js +63 -0
- package/es/components/code-snippet/src/dom-utils.js.map +1 -0
- package/es/components/code-snippet/src/formatters.d.ts +4 -0
- package/es/components/code-snippet/src/formatters.js +19 -0
- package/es/components/code-snippet/src/formatters.js.map +1 -0
- package/es/components/code-snippet/src/layout-utils.d.ts +22 -0
- package/es/components/code-snippet/src/layout-utils.js +63 -0
- package/es/components/code-snippet/src/layout-utils.js.map +1 -0
- package/es/components/code-snippet/src/streaming-manager.d.ts +24 -0
- package/es/components/code-snippet/src/streaming-manager.js +120 -0
- package/es/components/code-snippet/src/streaming-manager.js.map +1 -0
- package/es/components/feedback/index.d.ts +7 -0
- package/es/components/feedback/index.js +12 -0
- package/es/components/feedback/index.js.map +1 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.d.ts +15 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js +36 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js.map +1 -0
- package/es/components/feedback/src/cds-aichat-feedback.d.ts +15 -0
- package/es/components/feedback/src/cds-aichat-feedback.js +36 -0
- package/es/components/feedback/src/cds-aichat-feedback.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.d.ts +56 -0
- package/es/components/feedback/src/feedback-buttons.js +104 -0
- package/es/components/feedback/src/feedback-buttons.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.scss.js +13 -0
- package/es/components/feedback/src/feedback-buttons.scss.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.template.d.ts +4 -0
- package/es/components/feedback/src/feedback-buttons.template.js +79 -0
- package/es/components/feedback/src/feedback-buttons.template.js.map +1 -0
- package/es/components/feedback/src/feedback.d.ts +114 -0
- package/es/components/feedback/src/feedback.js +182 -0
- package/es/components/feedback/src/feedback.js.map +1 -0
- package/es/components/feedback/src/feedback.scss.js +13 -0
- package/es/components/feedback/src/feedback.scss.js.map +1 -0
- package/es/components/feedback/src/feedback.template.d.ts +12 -0
- package/es/components/feedback/src/feedback.template.js +115 -0
- package/es/components/feedback/src/feedback.template.js.map +1 -0
- package/es/components/markdown/index.d.ts +2 -0
- package/es/components/markdown/index.js +9 -0
- package/es/components/markdown/index.js.map +1 -0
- package/es/components/markdown/src/cds-aichat-markdown.d.ts +13 -0
- package/es/components/markdown/src/cds-aichat-markdown.js +35 -0
- package/es/components/markdown/src/cds-aichat-markdown.js.map +1 -0
- package/es/components/markdown/src/markdown-renderer.d.ts +62 -0
- package/es/components/markdown/src/markdown-renderer.js +353 -0
- package/es/components/markdown/src/markdown-renderer.js.map +1 -0
- package/es/components/markdown/src/markdown-token-tree.d.ts +32 -0
- package/es/components/markdown/src/markdown-token-tree.js +178 -0
- package/es/components/markdown/src/markdown-token-tree.js.map +1 -0
- package/es/components/markdown/src/markdown.d.ts +44 -0
- package/es/components/markdown/src/markdown.js +238 -0
- package/es/components/markdown/src/markdown.js.map +1 -0
- package/es/components/markdown/src/markdown.scss.js +13 -0
- package/es/components/markdown/src/markdown.scss.js.map +1 -0
- package/es/components/markdown/src/markdown.template.d.ts +3 -0
- package/es/components/markdown/src/markdown.template.js +24 -0
- package/es/components/markdown/src/markdown.template.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.d.ts +7 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.js +84 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.d.ts +7 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.js +59 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.d.ts +12 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.js +73 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.d.ts +26 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.js +330 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.d.ts +6 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js +63 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.d.ts +6 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js +43 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.d.ts +5 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js +55 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.d.ts +19 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js +210 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.d.ts +13 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js +156 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.d.ts +13 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js +216 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.d.ts +34 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.js +8 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.d.ts +25 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.js +62 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.js.map +1 -0
- package/es/components/markdown/src/utils/html-helpers.d.ts +2 -0
- package/es/components/markdown/src/utils/html-helpers.js +204 -0
- package/es/components/markdown/src/utils/html-helpers.js.map +1 -0
- package/es/components/markdown/src/utils/table-helpers.d.ts +31 -0
- package/es/components/markdown/src/utils/table-helpers.js +106 -0
- package/es/components/markdown/src/utils/table-helpers.js.map +1 -0
- package/es/components/markdown/src/utils.d.ts +8 -0
- package/es/components/markdown/src/utils.js +31 -0
- package/es/components/markdown/src/utils.js.map +1 -0
- package/es/components/reasoning-steps/index.d.ts +2 -0
- package/es/components/reasoning-steps/index.js +10 -0
- package/es/components/reasoning-steps/index.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.d.ts +29 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js +231 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.d.ts +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js +96 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js.map +1 -0
- package/es/components/table/index.d.ts +3 -0
- package/es/components/table/index.js +9 -0
- package/es/components/table/index.js.map +1 -0
- package/es/components/table/src/cds-aichat-table.d.ts +262 -0
- package/es/components/table/src/cds-aichat-table.js +511 -0
- package/es/components/table/src/cds-aichat-table.js.map +1 -0
- package/es/components/table/src/table-loader.d.ts +4 -0
- package/es/components/table/src/table-loader.js +28 -0
- package/es/components/table/src/table-loader.js.map +1 -0
- package/es/components/table/src/table-pagination.template.d.ts +27 -0
- package/es/components/table/src/table-pagination.template.js +55 -0
- package/es/components/table/src/table-pagination.template.js.map +1 -0
- package/es/components/table/src/table-runtime.d.ts +2 -0
- package/es/components/table/src/table-runtime.js +10 -0
- package/es/components/table/src/table-runtime.js.map +1 -0
- package/es/components/table/src/table-skeleton.template.d.ts +6 -0
- package/es/components/table/src/table-skeleton.template.js +34 -0
- package/es/components/table/src/table-skeleton.template.js.map +1 -0
- package/es/components/table/src/table.scss.js +13 -0
- package/es/components/table/src/table.scss.js.map +1 -0
- package/es/components/table/src/table.template.d.ts +10 -0
- package/es/components/table/src/table.template.js +89 -0
- package/es/components/table/src/table.template.js.map +1 -0
- package/es/components/table/src/types.d.ts +13 -0
- package/es/components/table/src/types.js +8 -0
- package/es/components/table/src/types.js.map +1 -0
- package/es/components/tile-container/src/styles.scss.js +1 -1
- package/es/components/toolbar/index.d.ts +1 -0
- package/es/components/toolbar/index.js +9 -0
- package/es/components/toolbar/index.js.map +1 -0
- package/es/components/toolbar/src/toolbar.d.ts +39 -0
- package/es/components/toolbar/src/toolbar.js +179 -0
- package/es/components/toolbar/src/toolbar.js.map +1 -0
- package/es/components/toolbar/src/toolbar.scss.js +13 -0
- package/es/components/toolbar/src/toolbar.scss.js.map +1 -0
- package/es/components/workspace-shell/index.d.ts +5 -0
- package/es/components/workspace-shell/index.js +13 -0
- package/es/components/workspace-shell/index.js.map +1 -0
- package/es/components/workspace-shell/src/styles.scss.js +13 -0
- package/es/components/workspace-shell/src/styles.scss.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-body.d.ts +16 -0
- package/es/components/workspace-shell/src/workspace-shell-body.js +50 -0
- package/es/components/workspace-shell/src/workspace-shell-body.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.d.ts +19 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.js +53 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-header.d.ts +27 -0
- package/es/components/workspace-shell/src/workspace-shell-header.js +77 -0
- package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.d.ts +22 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js +61 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell.d.ts +20 -0
- package/es/components/workspace-shell/src/workspace-shell.js +83 -0
- package/es/components/workspace-shell/src/workspace-shell.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell.scss.js +13 -0
- package/es/components/workspace-shell/src/workspace-shell.scss.js.map +1 -0
- package/es/globals/utils/uuid.d.ts +5 -0
- package/es/globals/utils/uuid.js +32 -0
- package/es/globals/utils/uuid.js.map +1 -0
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js +9 -0
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js.map +1 -0
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js +11 -0
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js.map +1 -0
- package/es/node_modules/@codemirror/autocomplete/dist/index.js +258 -0
- package/es/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
- package/es/node_modules/@codemirror/commands/dist/index.js +1140 -0
- package/es/node_modules/@codemirror/commands/dist/index.js.map +1 -0
- package/es/node_modules/@codemirror/lint/dist/index.js +636 -0
- package/es/node_modules/@codemirror/lint/dist/index.js.map +1 -0
- package/es/node_modules/@lezer/common/dist/index.js +253 -0
- package/es/node_modules/@lezer/common/dist/index.js.map +1 -0
- package/es/node_modules/crelt/index.js +37 -0
- package/es/node_modules/crelt/index.js.map +1 -0
- package/es/react/ai-label.d.ts +2 -1
- package/es/react/ai-label.js +3 -2
- package/es/react/ai-label.js.map +1 -1
- package/es/react/button.d.ts +2 -1
- package/es/react/button.js +3 -2
- package/es/react/button.js.map +1 -1
- package/es/react/chain-of-thought.d.ts +7 -0
- package/es/react/chain-of-thought.js +29 -0
- package/es/react/chain-of-thought.js.map +1 -0
- package/es/react/chat-button.d.ts +4 -4
- package/es/react/chat-button.js +6 -4
- package/es/react/chat-button.js.map +1 -1
- package/es/react/code-snippet-tile-container.d.ts +5 -0
- package/es/react/code-snippet-tile-container.js +30 -0
- package/es/react/code-snippet-tile-container.js.map +1 -0
- package/es/react/code-snippet.d.ts +4 -0
- package/es/react/code-snippet.js +31 -0
- package/es/react/code-snippet.js.map +1 -0
- package/es/react/content-switcher.d.ts +7 -0
- package/es/react/content-switcher.js +37 -0
- package/es/react/content-switcher.js.map +1 -0
- package/es/react/feedback-buttons.d.ts +4 -0
- package/es/react/feedback-buttons.js +28 -0
- package/es/react/feedback-buttons.js.map +1 -0
- package/es/react/feedback.d.ts +6 -0
- package/es/react/feedback.js +32 -0
- package/es/react/feedback.js.map +1 -0
- package/es/react/icon-button.d.ts +2 -1
- package/es/react/icon-button.js +3 -2
- package/es/react/icon-button.js.map +1 -1
- package/es/react/icon.d.ts +4 -0
- package/es/react/icon.js +28 -0
- package/es/react/icon.js.map +1 -0
- package/es/react/markdown.d.ts +4 -0
- package/es/react/markdown.js +28 -0
- package/es/react/markdown.js.map +1 -0
- package/es/react/overflow-menu.d.ts +9 -0
- package/es/react/overflow-menu.js +40 -0
- package/es/react/overflow-menu.js.map +1 -0
- package/es/react/processing.d.ts +2 -1
- package/es/react/processing.js +3 -2
- package/es/react/processing.js.map +1 -1
- package/es/react/reasoning-step.d.ts +6 -0
- package/es/react/reasoning-step.js +31 -0
- package/es/react/reasoning-step.js.map +1 -0
- package/es/react/reasoning-steps.d.ts +3 -0
- package/es/react/reasoning-steps.js +27 -0
- package/es/react/reasoning-steps.js.map +1 -0
- package/es/react/tile-container.d.ts +2 -1
- package/es/react/tile-container.js +3 -2
- package/es/react/tile-container.js.map +1 -1
- package/es/react/tile.d.ts +3 -2
- package/es/react/tile.js +5 -4
- package/es/react/tile.js.map +1 -1
- package/es/react/toolbar.d.ts +4 -0
- package/es/react/toolbar.js +28 -0
- package/es/react/toolbar.js.map +1 -0
- package/es/react/utils/withWebComponentBridge.d.ts +15 -0
- package/es/react/utils/withWebComponentBridge.js +95 -0
- package/es/react/utils/withWebComponentBridge.js.map +1 -0
- package/es/testing/load-all-lazy-deps.d.ts +10 -0
- package/es/testing/load-all-lazy-deps.js +30 -0
- package/es/testing/load-all-lazy-deps.js.map +1 -0
- package/package.json +39 -5
- package/dist/carbon-element-CMR7BOhG.js +0 -24
- package/dist/class-map-h7IEvsL_.js +0 -39
- package/es/components/chat-button/chat-button.d.ts +0 -23
- package/es/components/chat-button/chat-button.js.map +0 -1
- package/es/components/chat-button/src/chat-button.template.d.ts +0 -16
- package/es/components/chat-button/src/chat-button.template.js +0 -27
- package/es/components/chat-button/src/chat-button.template.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Token } from "markdown-it";
|
|
2
|
+
import type { MarkdownItAttrsOptions, AttributePair, DetectingStrRule, DetectingRule, MatchedResult } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parses attribute strings in the format {.class #id key=val} and returns an array of attribute key-value pairs.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getAttrs(str: string, start: number, options: Required<MarkdownItAttrsOptions>): AttributePair[];
|
|
7
|
+
/**
|
|
8
|
+
* Applies an array of attribute pairs to a token, handling special cases for class and css-module attributes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function addAttrs(attrs: AttributePair[], token: Token): Token;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a function that tests whether a string contains attribute delimiters at a specified position (start, end, or only).
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasDelimiters(where: "start" | "end" | "only", options: Required<MarkdownItAttrsOptions>): DetectingStrRule;
|
|
15
|
+
/**
|
|
16
|
+
* Removes attribute delimiters and their contents from the end of a string.
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeDelimiter(str: string, options: Required<MarkdownItAttrsOptions>): string;
|
|
19
|
+
/**
|
|
20
|
+
* Finds the matching opening token for a given closing token by searching backwards through the token array.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMatchingOpeningToken(tokens: Token[], closingTokenIndex: number): Token | false;
|
|
23
|
+
/**
|
|
24
|
+
* Tests whether a token at a given index matches a detecting rule, recursively checking nested rules.
|
|
25
|
+
*/
|
|
26
|
+
export declare function test(tokens: Token[], baseIndex: number, rule: DetectingRule): MatchedResult;
|
|
@@ -0,0 +1,330 @@
|
|
|
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 { get, isArrayOfObjects, last, isArrayOfFunctions, escapeRegExp } from './utils.js';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright IBM Corp. 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
* @license
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Parses attribute strings in the format {.class #id key=val} and returns an array of attribute key-value pairs.
|
|
20
|
+
*/
|
|
21
|
+
function getAttrs(str, start, options) {
|
|
22
|
+
const allowedKeyChars = /[^\t\n\f />"'=]/;
|
|
23
|
+
const pairSeparator = " ";
|
|
24
|
+
const keySeparator = "=";
|
|
25
|
+
const classChar = ".";
|
|
26
|
+
const idChar = "#";
|
|
27
|
+
const attrs = [];
|
|
28
|
+
let key = "";
|
|
29
|
+
let value = "";
|
|
30
|
+
let parsingKey = true;
|
|
31
|
+
let valueInsideQuotes = false;
|
|
32
|
+
// Iterate through the string starting after the left delimiter
|
|
33
|
+
for (let characterIndex = start + options.leftDelimiter.length; characterIndex < str.length; characterIndex++) {
|
|
34
|
+
// Check if we've reached the right delimiter (end of attributes)
|
|
35
|
+
if (str.slice(characterIndex, characterIndex + options.rightDelimiter.length) === options.rightDelimiter) {
|
|
36
|
+
if (key !== "") {
|
|
37
|
+
attrs.push([key, value]);
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
const char_ = str.charAt(characterIndex);
|
|
42
|
+
// Switch from parsing key to parsing value when we hit '='
|
|
43
|
+
if (char_ === keySeparator && parsingKey) {
|
|
44
|
+
parsingKey = false;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Handle class shorthand syntax: .classname or ..css-module
|
|
48
|
+
if (char_ === classChar && key === "") {
|
|
49
|
+
if (str.charAt(characterIndex + 1) === classChar) {
|
|
50
|
+
key = "css-module";
|
|
51
|
+
characterIndex += 1;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
key = "class";
|
|
55
|
+
}
|
|
56
|
+
parsingKey = false;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
// Handle id shorthand syntax: #idname
|
|
60
|
+
if (char_ === idChar && key === "") {
|
|
61
|
+
key = "id";
|
|
62
|
+
parsingKey = false;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
// Handle opening quote for attribute values
|
|
66
|
+
if (char_ === '"' && value === "" && !valueInsideQuotes) {
|
|
67
|
+
valueInsideQuotes = true;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
// Handle closing quote for attribute values
|
|
71
|
+
if (char_ === '"' && valueInsideQuotes) {
|
|
72
|
+
valueInsideQuotes = false;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
// Space separates attribute pairs (unless inside quotes)
|
|
76
|
+
if (char_ === pairSeparator && !valueInsideQuotes) {
|
|
77
|
+
if (key === "") {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
attrs.push([key, value]);
|
|
81
|
+
key = "";
|
|
82
|
+
value = "";
|
|
83
|
+
parsingKey = true;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
// Skip invalid characters in key names
|
|
87
|
+
if (parsingKey && char_.search(allowedKeyChars) === -1) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// Append character to either key or value
|
|
91
|
+
if (parsingKey) {
|
|
92
|
+
key += char_;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
value += char_;
|
|
96
|
+
}
|
|
97
|
+
// Filter attributes based on allowedAttributes option
|
|
98
|
+
if (options.allowedAttributes && options.allowedAttributes.length) {
|
|
99
|
+
return attrs.filter((attrPair) => {
|
|
100
|
+
const attr = attrPair[0];
|
|
101
|
+
return options.allowedAttributes.some((allowedAttribute) => allowedAttribute instanceof RegExp
|
|
102
|
+
? allowedAttribute.test(attr)
|
|
103
|
+
: attr === allowedAttribute);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return attrs;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Applies an array of attribute pairs to a token, handling special cases for class and css-module attributes.
|
|
110
|
+
*/
|
|
111
|
+
function addAttrs(attrs, token) {
|
|
112
|
+
for (let attributeIndex = 0; attributeIndex < attrs.length; attributeIndex += 1) {
|
|
113
|
+
const key = attrs[attributeIndex][0];
|
|
114
|
+
if (key === "class") {
|
|
115
|
+
token.attrJoin("class", attrs[attributeIndex][1]);
|
|
116
|
+
}
|
|
117
|
+
else if (key === "css-module") {
|
|
118
|
+
token.attrJoin("css-module", attrs[attributeIndex][1]);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
token.attrPush(attrs[attributeIndex]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return token;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Creates a function that tests whether a string contains attribute delimiters at a specified position (start, end, or only).
|
|
128
|
+
*/
|
|
129
|
+
function hasDelimiters(where, options) {
|
|
130
|
+
if (!where) {
|
|
131
|
+
throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');
|
|
132
|
+
}
|
|
133
|
+
return function (str) {
|
|
134
|
+
// Minimum length needed: { + at least one char + }
|
|
135
|
+
const minCurlyLength = options.leftDelimiter.length + 1 + options.rightDelimiter.length;
|
|
136
|
+
if (!str || typeof str !== "string" || str.length < minCurlyLength) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
// Class/ID syntax requires an extra character (.class or #id)
|
|
140
|
+
function validCurlyLength(curly) {
|
|
141
|
+
const isClass = curly.charAt(options.leftDelimiter.length) === ".";
|
|
142
|
+
const isId = curly.charAt(options.leftDelimiter.length) === "#";
|
|
143
|
+
return isClass || isId
|
|
144
|
+
? curly.length >= minCurlyLength + 1
|
|
145
|
+
: curly.length >= minCurlyLength;
|
|
146
|
+
}
|
|
147
|
+
let start, end, slice, nextChar;
|
|
148
|
+
const rightDelimiterMinimumShift = minCurlyLength - options.rightDelimiter.length;
|
|
149
|
+
switch (where) {
|
|
150
|
+
case "start":
|
|
151
|
+
// Check if delimiters are at the start of the string
|
|
152
|
+
slice = str.slice(0, options.leftDelimiter.length);
|
|
153
|
+
start = slice === options.leftDelimiter ? 0 : -1;
|
|
154
|
+
end =
|
|
155
|
+
start === -1
|
|
156
|
+
? -1
|
|
157
|
+
: str.indexOf(options.rightDelimiter, rightDelimiterMinimumShift);
|
|
158
|
+
// Ensure the character after closing delimiter isn't part of the delimiter itself
|
|
159
|
+
nextChar = str.charAt(end + options.rightDelimiter.length);
|
|
160
|
+
if (nextChar && options.rightDelimiter.indexOf(nextChar) !== -1) {
|
|
161
|
+
end = -1;
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case "end":
|
|
165
|
+
// Check if delimiters are at the end of the string
|
|
166
|
+
start = str.lastIndexOf(options.leftDelimiter);
|
|
167
|
+
end =
|
|
168
|
+
start === -1
|
|
169
|
+
? -1
|
|
170
|
+
: str.indexOf(options.rightDelimiter, start + rightDelimiterMinimumShift);
|
|
171
|
+
// Verify the closing delimiter is actually at the string's end
|
|
172
|
+
end = end === str.length - options.rightDelimiter.length ? end : -1;
|
|
173
|
+
break;
|
|
174
|
+
case "only":
|
|
175
|
+
// Check if the entire string is delimiters with content inside
|
|
176
|
+
slice = str.slice(0, options.leftDelimiter.length);
|
|
177
|
+
start = slice === options.leftDelimiter ? 0 : -1;
|
|
178
|
+
slice = str.slice(str.length - options.rightDelimiter.length);
|
|
179
|
+
end =
|
|
180
|
+
slice === options.rightDelimiter
|
|
181
|
+
? str.length - options.rightDelimiter.length
|
|
182
|
+
: -1;
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
throw new Error(`Unexpected case ${where}, expected 'start', 'end' or 'only'`);
|
|
186
|
+
}
|
|
187
|
+
// Valid if we found both delimiters and the content between them is valid
|
|
188
|
+
return (start !== -1 &&
|
|
189
|
+
end !== -1 &&
|
|
190
|
+
validCurlyLength(str.substring(start, end + options.rightDelimiter.length)));
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Removes attribute delimiters and their contents from the end of a string.
|
|
195
|
+
*/
|
|
196
|
+
function removeDelimiter(str, options) {
|
|
197
|
+
const start = escapeRegExp(options.leftDelimiter);
|
|
198
|
+
const end = escapeRegExp(options.rightDelimiter);
|
|
199
|
+
const curly = new RegExp("[ \\n]?" + start + "[^" + start + end + "]+" + end + "$");
|
|
200
|
+
const pos = str.search(curly);
|
|
201
|
+
return pos !== -1 ? str.slice(0, pos) : str;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Finds the matching opening token for a given closing token by searching backwards through the token array.
|
|
205
|
+
*/
|
|
206
|
+
function getMatchingOpeningToken(tokens, closingTokenIndex) {
|
|
207
|
+
if (tokens[closingTokenIndex].type === "softbreak") {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
if (tokens[closingTokenIndex].nesting === 0) {
|
|
211
|
+
return tokens[closingTokenIndex];
|
|
212
|
+
}
|
|
213
|
+
const targetLevel = tokens[closingTokenIndex].level;
|
|
214
|
+
const expectedType = tokens[closingTokenIndex].type.replace("_close", "_open");
|
|
215
|
+
for (let searchIndex = closingTokenIndex; searchIndex >= 0; searchIndex--) {
|
|
216
|
+
if (tokens[searchIndex].type === expectedType &&
|
|
217
|
+
tokens[searchIndex].level === targetLevel) {
|
|
218
|
+
return tokens[searchIndex];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Tests whether a token at a given index matches a detecting rule, recursively checking nested rules.
|
|
225
|
+
*/
|
|
226
|
+
function test(tokens, baseIndex, rule) {
|
|
227
|
+
const result = {
|
|
228
|
+
match: false,
|
|
229
|
+
j: null,
|
|
230
|
+
};
|
|
231
|
+
// Calculate the actual token index using shift (relative) or position (absolute)
|
|
232
|
+
const targetIndex = rule.shift !== undefined ? baseIndex + rule.shift : rule.position;
|
|
233
|
+
// Negative indices are invalid when using shift
|
|
234
|
+
if (rule.shift !== undefined &&
|
|
235
|
+
targetIndex !== undefined &&
|
|
236
|
+
targetIndex < 0) {
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
// Get the token at the calculated index
|
|
240
|
+
const token = get(tokens, targetIndex ?? 0);
|
|
241
|
+
if (token === undefined) {
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
// Test each property in the detecting rule
|
|
245
|
+
for (const key of Object.keys(rule)) {
|
|
246
|
+
// Skip internal position markers
|
|
247
|
+
if (key === "shift" || key === "position") {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
// Token must have the property being tested
|
|
251
|
+
if (token[key] === undefined) {
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
// Special handling for children array matching
|
|
255
|
+
if (key === "children" && isArrayOfObjects(rule.children)) {
|
|
256
|
+
if (!token.children || token.children.length === 0) {
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
let match;
|
|
260
|
+
const childTests = rule.children;
|
|
261
|
+
const children = token.children;
|
|
262
|
+
// If all child tests use absolute positions, test those specific positions
|
|
263
|
+
if (childTests.every((childRule) => childRule.position !== undefined)) {
|
|
264
|
+
match = childTests.every((childRule) => test(children, childRule.position, childRule).match);
|
|
265
|
+
if (match) {
|
|
266
|
+
// Calculate the actual index (handling negative positions)
|
|
267
|
+
const childPosition = last(childTests).position;
|
|
268
|
+
result.j =
|
|
269
|
+
childPosition >= 0
|
|
270
|
+
? childPosition
|
|
271
|
+
: children.length + childPosition;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// Otherwise, scan through all children to find a matching sequence
|
|
276
|
+
match = false;
|
|
277
|
+
for (let childIndex = 0; childIndex < children.length; childIndex++) {
|
|
278
|
+
match = childTests.every((childRule) => test(children, childIndex, childRule).match);
|
|
279
|
+
if (match) {
|
|
280
|
+
result.j = childIndex;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (match === false) {
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
// Get the values to compare
|
|
291
|
+
const ruleValue = rule[key];
|
|
292
|
+
const tokenValue = token[key];
|
|
293
|
+
// Match based on the type of the test value
|
|
294
|
+
switch (typeof ruleValue) {
|
|
295
|
+
case "boolean":
|
|
296
|
+
case "number":
|
|
297
|
+
case "string":
|
|
298
|
+
// Direct value comparison
|
|
299
|
+
if (tokenValue !== ruleValue) {
|
|
300
|
+
return result;
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case "function":
|
|
304
|
+
// Function predicate test
|
|
305
|
+
if (!ruleValue(tokenValue)) {
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
case "object":
|
|
310
|
+
// Array of function predicates (all must pass)
|
|
311
|
+
if (isArrayOfFunctions(ruleValue)) {
|
|
312
|
+
const allPass = ruleValue.every((predicate) => predicate(tokenValue));
|
|
313
|
+
if (allPass === false) {
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
// For objects !== arrays of functions, throw error
|
|
319
|
+
throw new Error(`Unknown type of pattern test (key: ${key}). Test should be of type boolean, number, string, function or array of functions.`);
|
|
320
|
+
default:
|
|
321
|
+
throw new Error(`Unknown type of pattern test (key: ${key}). Test should be of type boolean, number, string, function or array of functions.`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// All tests passed
|
|
325
|
+
result.match = true;
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export { addAttrs, getAttrs, getMatchingOpeningToken, hasDelimiters, removeDelimiter, test };
|
|
330
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../../../../../../src/components/markdown/src/plugins/markdownItAttrs/core.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAkBH;;AAEG;SACa,QAAQ,CACtB,GAAW,EACX,KAAa,EACb,OAAyC,EAAA;IAEzC,MAAM,eAAe,GAAG,iBAAiB;IACzC,MAAM,aAAa,GAAG,GAAG;IACzB,MAAM,YAAY,GAAG,GAAG;IACxB,MAAM,SAAS,GAAG,GAAG;IACrB,MAAM,MAAM,GAAG,GAAG;IAElB,MAAM,KAAK,GAAoB,EAAE;IACjC,IAAI,GAAG,GAAG,EAAE;IACZ,IAAI,KAAK,GAAG,EAAE;IACd,IAAI,UAAU,GAAG,IAAI;IACrB,IAAI,iBAAiB,GAAG,KAAK;;IAG7B,KACE,IAAI,cAAc,GAAG,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,EACzD,cAAc,GAAG,GAAG,CAAC,MAAM,EAC3B,cAAc,EAAE,EAChB;;AAEA,QAAA,IACE,GAAG,CAAC,KAAK,CACP,c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,gBAAA,IAAI,CAAE,SAAuC,CAAC,UAAU,CAAC,EAAE;AACzD,oBAAA,OAAO,MAAM;gBACf;gBACA;AACF,YAAA,KAAK,QAAQ;;AAEX,gBAAA,IAAI,kBAAkB,CAAC,SAAS,CAAC,EAAE;AACjC,oBAAA,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU,CAAC,CAAC;AACrE,oBAAA,IAAI,OAAO,KAAK,KAAK,EAAE;AACrB,wBAAA,OAAO,MAAM;oBACf;oBACA;gBACF;;AAEA,gBAAA,MAAM,IAAI,KAAK,CACb,sCAAsC,GAAG,CAAA,kFAAA,CAAoF,CAC9H;AACH,YAAA;AACE,gBAAA,MAAM,IAAI,KAAK,CACb,sCAAsC,GAAG,CAAA,kFAAA,CAAoF,CAC9H;;IAEP;;AAGA,IAAA,MAAM,CAAC,KAAK,GAAG,IAAI;AACnB,IAAA,OAAO,MAAM;AACf;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MarkdownItAttrsOptions, CurlyAttrsPattern } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pattern for horizontal rules with attributes.
|
|
4
|
+
* Example: --- {.class}
|
|
5
|
+
*/
|
|
6
|
+
export declare function createHorizontalRulePattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|
|
@@ -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
|
+
import { getAttrs, addAttrs } from '../core.js';
|
|
9
|
+
import { escapeRegExp } from '../utils.js';
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Copyright IBM Corp. 2025
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
* @license
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Pattern for horizontal rules with attributes.
|
|
21
|
+
* Example: --- {.class}
|
|
22
|
+
*/
|
|
23
|
+
function createHorizontalRulePattern(options) {
|
|
24
|
+
const __hr = new RegExp("^ {0,3}[-*_]{3,} ?" +
|
|
25
|
+
escapeRegExp(options.leftDelimiter) +
|
|
26
|
+
"[^" +
|
|
27
|
+
escapeRegExp(options.rightDelimiter) +
|
|
28
|
+
"]");
|
|
29
|
+
return {
|
|
30
|
+
name: "horizontal rule",
|
|
31
|
+
tests: [
|
|
32
|
+
{
|
|
33
|
+
shift: 0,
|
|
34
|
+
type: "paragraph_open",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
shift: 1,
|
|
38
|
+
type: "inline",
|
|
39
|
+
children: (arr) => arr.length === 1,
|
|
40
|
+
content: (str) => str.match(__hr) !== null,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
shift: 2,
|
|
44
|
+
type: "paragraph_close",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
transform: (tokens, tokenIndex) => {
|
|
48
|
+
const token = tokens[tokenIndex];
|
|
49
|
+
token.type = "hr";
|
|
50
|
+
token.tag = "hr";
|
|
51
|
+
token.nesting = 0;
|
|
52
|
+
const content = tokens[tokenIndex + 1].content;
|
|
53
|
+
const attrStart = content.lastIndexOf(options.leftDelimiter);
|
|
54
|
+
const attrs = getAttrs(content, attrStart, options);
|
|
55
|
+
addAttrs(attrs, token);
|
|
56
|
+
token.markup = content;
|
|
57
|
+
tokens.splice(tokenIndex + 1, 2);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { createHorizontalRulePattern };
|
|
63
|
+
//# sourceMappingURL=blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.js","sources":["../../../../../../../src/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAMH;;;AAGG;AACG,SAAU,2BAA2B,CACzC,OAAyC,EAAA;AAEzC,IAAA,MAAM,IAAI,GAAG,IAAI,MAAM,CACrB,oBAAoB;AAClB,QAAA,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC;QACnC,IAAI;AACJ,QAAA,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC;AACpC,QAAA,GAAG,CACN;IAED,OAAO;AACL,QAAA,IAAI,EAAE,iBAAiB;AACvB,QAAA,KAAK,EAAE;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,IAAI,EAAE,gBAAgB;AACvB,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,GAAc,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC;AAC9C,gBAAA,OAAO,EAAE,CAAC,GAAW,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI;AACnD,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,IAAI,EAAE,iBAAiB;AACxB,aAAA;AACF,SAAA;AACD,QAAA,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAI;AAChC,YAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,YAAA,KAAK,CAAC,IAAI,GAAG,IAAI;AACjB,YAAA,KAAK,CAAC,GAAG,GAAG,IAAI;AAChB,YAAA,KAAK,CAAC,OAAO,GAAG,CAAC;YACjB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,OAAO;YAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC;YAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;AACnD,YAAA,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;AACtB,YAAA,KAAK,CAAC,MAAM,GAAG,OAAO;YACtB,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,CAAC;KACF;AACH;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MarkdownItAttrsOptions, CurlyAttrsPattern } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pattern for fenced code blocks with attributes.
|
|
4
|
+
* Example: ```js {.highlight}
|
|
5
|
+
*/
|
|
6
|
+
export declare function createFencedCodeBlockPattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { hasDelimiters, getAttrs, addAttrs, removeDelimiter } from '../core.js';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright IBM Corp. 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
* @license
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Pattern for fenced code blocks with attributes.
|
|
20
|
+
* Example: ```js {.highlight}
|
|
21
|
+
*/
|
|
22
|
+
function createFencedCodeBlockPattern(options) {
|
|
23
|
+
return {
|
|
24
|
+
name: "fenced code blocks",
|
|
25
|
+
tests: [
|
|
26
|
+
{
|
|
27
|
+
shift: 0,
|
|
28
|
+
block: true,
|
|
29
|
+
info: hasDelimiters("end", options),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
transform: (tokens, tokenIndex) => {
|
|
33
|
+
const token = tokens[tokenIndex];
|
|
34
|
+
const attrStart = token.info.lastIndexOf(options.leftDelimiter);
|
|
35
|
+
const attrs = getAttrs(token.info, attrStart, options);
|
|
36
|
+
addAttrs(attrs, token);
|
|
37
|
+
token.info = removeDelimiter(token.info, options);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { createFencedCodeBlockPattern };
|
|
43
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sources":["../../../../../../../src/components/markdown/src/plugins/markdownItAttrs/patterns/code.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAKH;;;AAGG;AACG,SAAU,4BAA4B,CAC1C,OAAyC,EAAA;IAEzC,OAAO;AACL,QAAA,IAAI,EAAE,oBAAoB;AAC1B,QAAA,KAAK,EAAE;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,CAAC;AACR,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC;AACpC,aAAA;AACF,SAAA;AACD,QAAA,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAI;AAChC,YAAA,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,YAAA,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC;AAC/D,YAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;AACtD,YAAA,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;YACtB,KAAK,CAAC,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;QACnD,CAAC;KACF;AACH;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MarkdownItAttrsOptions, CurlyAttrsPattern } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of patterns used to detect and transform markdown tokens with attribute syntax.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPatterns(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern[];
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { createFencedCodeBlockPattern } from './code.js';
|
|
9
|
+
import { createInlineNesting0Pattern, createInlineAttributesPattern, createSoftbreakCurlyPattern, createEndOfBlockPattern } from './inline.js';
|
|
10
|
+
import { createTablePattern, createTableTheadMetadataPattern, createTableTbodyCalculatePattern } from './tables.js';
|
|
11
|
+
import { createListSoftbreakPattern, createListDoubleSoftbreakPattern, createListItemEndPattern } from './lists.js';
|
|
12
|
+
import { createHorizontalRulePattern } from './blocks.js';
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Copyright IBM Corp. 2025
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
20
|
+
* @license
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Creates an array of patterns used to detect and transform markdown tokens with attribute syntax.
|
|
24
|
+
*/
|
|
25
|
+
function createPatterns(options) {
|
|
26
|
+
return [
|
|
27
|
+
// Fenced code blocks: ```js {.highlight}
|
|
28
|
+
createFencedCodeBlockPattern(options),
|
|
29
|
+
// Inline elements with nesting 0: {.class} or `code`{.class}
|
|
30
|
+
createInlineNesting0Pattern(options),
|
|
31
|
+
// Tables with attributes
|
|
32
|
+
createTablePattern(options),
|
|
33
|
+
// Table header metadata calculation (used for colspan/rowspan)
|
|
34
|
+
createTableTheadMetadataPattern(),
|
|
35
|
+
// Table body calculation for handling colspan/rowspan
|
|
36
|
+
createTableTbodyCalculatePattern(),
|
|
37
|
+
// Inline attributes on emphasized/strong text: **bold**{.class}
|
|
38
|
+
createInlineAttributesPattern(options),
|
|
39
|
+
// List items with attributes after softbreak
|
|
40
|
+
createListSoftbreakPattern(options),
|
|
41
|
+
// Lists with double softbreak before attributes
|
|
42
|
+
createListDoubleSoftbreakPattern(options),
|
|
43
|
+
// List items with attributes at the end
|
|
44
|
+
createListItemEndPattern(options),
|
|
45
|
+
// Softbreak followed by attributes at start of line
|
|
46
|
+
createSoftbreakCurlyPattern(options),
|
|
47
|
+
// Horizontal rules with attributes: --- {.class}
|
|
48
|
+
createHorizontalRulePattern(options),
|
|
49
|
+
// Attributes at the end of a block
|
|
50
|
+
createEndOfBlockPattern(options),
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { createPatterns };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../src/components/markdown/src/plugins/markdownItAttrs/patterns/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsBH;;AAEG;AACG,SAAU,cAAc,CAC5B,OAAyC,EAAA;IAEzC,OAAO;;QAEL,4BAA4B,CAAC,OAAO,CAAC;;QAGrC,2BAA2B,CAAC,OAAO,CAAC;;QAGpC,kBAAkB,CAAC,OAAO,CAAC;;AAG3B,QAAA,+BAA+B,EAAE;;AAGjC,QAAA,gCAAgC,EAAE;;QAGlC,6BAA6B,CAAC,OAAO,CAAC;;QAGtC,0BAA0B,CAAC,OAAO,CAAC;;QAGnC,gCAAgC,CAAC,OAAO,CAAC;;QAGzC,wBAAwB,CAAC,OAAO,CAAC;;QAGjC,2BAA2B,CAAC,OAAO,CAAC;;QAGpC,2BAA2B,CAAC,OAAO,CAAC;;QAGpC,uBAAuB,CAAC,OAAO,CAAC;KACjC;AACH;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MarkdownItAttrsOptions, CurlyAttrsPattern } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pattern for inline elements with nesting level 0 (images, inline code).
|
|
4
|
+
* Example: {.class} or `code`{.class}
|
|
5
|
+
*/
|
|
6
|
+
export declare function createInlineNesting0Pattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|
|
7
|
+
/**
|
|
8
|
+
* Pattern for inline attributes on emphasized/strong text.
|
|
9
|
+
* Example: **bold**{.class}
|
|
10
|
+
*/
|
|
11
|
+
export declare function createInlineAttributesPattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|
|
12
|
+
/**
|
|
13
|
+
* Pattern for softbreak followed by attributes at start of line.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createSoftbreakCurlyPattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|
|
16
|
+
/**
|
|
17
|
+
* Pattern for attributes at the end of a block.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createEndOfBlockPattern(options: Required<MarkdownItAttrsOptions>): CurlyAttrsPattern;
|