@microsoft/teams.cards
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta
1 lines • 2.06 kB
Source Map (JSON)
{"version":3,"sources":["../../src/medias/rich-text-block.ts"],"names":[],"mappings":";;;AAqBO,MAAM,sBAAsB,OAAkC,CAAA;AAAA,EACnE,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA,EAEA,eAAe,OAAgC,EAAA;AAC7C,IAAM,KAAA,EAAA;AACN,IAAA,IAAA,CAAK,IAAO,GAAA,eAAA;AACZ,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA;AAAA;AACjB,EAEA,OAAO,KAAK,OAAuC,EAAA;AACjD,IAAA,MAAM,KAAQ,GAAA,IAAI,aAAc,CAAA,GAAG,QAAQ,OAAO,CAAA;AAClD,IAAO,MAAA,CAAA,MAAA,CAAO,OAAO,OAAO,CAAA;AAC5B,IAAO,OAAA,KAAA;AAAA;AACT,EAEA,WAAW,KAA8B,EAAA;AACvC,IAAK,IAAA,CAAA,OAAA,CAAQ,IAAK,CAAA,GAAG,KAAK,CAAA;AAC1B,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,QAAA,CAAS,QAAQ,EAAI,EAAA;AACnB,IAAA,OAAO,KAAK,OACT,CAAA,GAAA,CAAI,CAAC,CAAA,KAAO,OAAO,CAAM,KAAA,QAAA,GAAW,CAAI,GAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAE,UAAW,CAAA,CACnE,KAAK,KAAK,CAAA;AAAA;AAEjB","file":"rich-text-block.mjs","sourcesContent":["import { IElement, Element } from '../base';\n\nimport { ITextRun, TextRun } from './text-run';\n\n/**\n * Defines an array of inlines, allowing for inline text formatting.\n */\nexport interface IRichTextBlock extends IElement {\n type: 'RichTextBlock';\n\n /**\n * The array of inlines.\n */\n inlines: (ITextRun | string)[];\n}\n\nexport type RichTextBlockOptions = Omit<IRichTextBlock, 'type' | 'inlines'>;\n\n/**\n * Defines an array of inlines, allowing for inline text formatting.\n */\nexport class RichTextBlock extends Element implements IRichTextBlock {\n type: 'RichTextBlock';\n\n /**\n * The array of inlines.\n */\n inlines: (ITextRun | string)[];\n\n constructor(...inlines: (ITextRun | string)[]) {\n super();\n this.type = 'RichTextBlock';\n this.inlines = inlines;\n }\n\n static from(options: Omit<IRichTextBlock, 'type'>) {\n const block = new RichTextBlock(...options.inlines);\n Object.assign(block, options);\n return block;\n }\n\n addText(...value: (ITextRun | string)[]) {\n this.inlines.push(...value);\n return this;\n }\n\n toString(delim = '') {\n return this.inlines\n .map((v) => (typeof v === 'string' ? v : TextRun.from(v).toString()))\n .join(delim);\n }\n}\n"]}