UNPKG

@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

108 lines (106 loc) 2.06 kB
'use strict'; class TextRun { type; /** * Text to display. Markdown is not supported. */ text; /** * Controls the color of the text. */ color; /** * The type of font to use */ fontType; /** * If true, displays the text highlighted. */ highlight; /** * If true, displays text slightly toned down to appear less prominent. */ isSubtle; /** * If true, displays the text using italic font. */ italic; /** * Action to invoke when this text run is clicked. Visually changes the text run into a hyperlink. Action.ShowCard is not supported. */ selectAction; /** * Controls size of text. */ size; /** * If true, displays the text with strikethrough. */ strikethrough; /** * If true, displays the text with an underline. */ underline; /** * Controls the weight of the text. */ weight; constructor(text, options = {}) { this.type = "TextRun"; this.text = text; Object.assign(this, options); } static from(options) { return new TextRun(options.text, options); } withColor(value) { this.color = value; return this; } withFontType(value) { this.fontType = value; return this; } withHighlight(value = true) { this.highlight = value; return this; } withSubtle(value = true) { this.isSubtle = value; return this; } withItalic(value = true) { this.italic = value; return this; } withSelectAction(value) { this.selectAction = value; return this; } withSize(value) { this.size = value; return this; } withStrikeThrough(value = true) { this.strikethrough = value; return this; } withUnderline(value = true) { this.underline = value; return this; } withWeight(value) { this.weight = value; return this; } addText(...value) { this.text += value.join(""); return this; } toString() { return this.text; } } exports.TextRun = TextRun; //# sourceMappingURL=text-run.js.map //# sourceMappingURL=text-run.js.map