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

1 lines 4.63 kB
{"version":3,"sources":["../../src/medias/image.ts"],"names":[],"mappings":";;AAyDO,MAAM,cAAc,OAA0B,CAAA;AAAA,EACnD,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,GAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,eAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA,EAEA,WAAY,CAAA,GAAA,EAAa,OAAwB,GAAA,EAAI,EAAA;AACnD,IAAM,KAAA,EAAA;AACN,IAAA,IAAA,CAAK,IAAO,GAAA,OAAA;AACZ,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AACX,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,OAAO,CAAA;AAAA;AAC7B,EAEA,OAAO,KAAK,OAA+B,EAAA;AACzC,IAAA,OAAO,IAAI,KAAA,CAAM,OAAQ,CAAA,GAAA,EAAK,OAAO,CAAA;AAAA;AACvC,EAEA,YAAY,KAAe,EAAA;AACzB,IAAA,IAAA,CAAK,OAAU,GAAA,KAAA;AACf,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,eAAA,CAAgB,QAAQ,IAAM,EAAA;AAC5B,IAAA,IAAA,CAAK,WAAc,GAAA,KAAA;AACnB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,oBAAoB,KAAe,EAAA;AACjC,IAAA,IAAA,CAAK,eAAkB,GAAA,KAAA;AACvB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,iBAAiB,KAAqB,EAAA;AACpC,IAAA,IAAA,CAAK,YAAe,GAAA,KAAA;AACpB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,SAAS,KAAkB,EAAA;AACzB,IAAA,IAAA,CAAK,IAAO,GAAA,KAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAA6B,EAAA;AACrC,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAAe,EAAA;AACvB,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AAEX","file":"image.mjs","sourcesContent":["import { SelectAction } from '../actions';\nimport { IElement, Element } from '../base';\n\nexport type ImageSize = 'auto' | 'stretch' | 'small' | 'medium' | 'large';\n\n/**\n * Displays an image. Acceptable formats are PNG, JPEG, and GIF\n */\nexport interface IImage extends IElement {\n type: 'Image';\n\n /**\n * The URL to the image. Supports data URI in version 1.2+\n */\n url: string;\n\n /**\n * Alternate text describing the image.\n */\n altText?: string;\n\n /**\n * Controls if the image can be expanded to full screen.\n */\n allowExpand?: boolean;\n\n /**\n * Applies a background to a transparent image. This property will respect the image style.\n */\n backgroundColor?: string;\n\n /**\n * An Action that will be invoked when the Image is tapped or selected. Action.ShowCard is not supported.\n */\n selectAction?: SelectAction;\n\n /**\n * Controls the approximate size of the image. The physical dimensions will vary per host.\n */\n size?: ImageSize;\n\n /**\n * Controls how this Image is displayed.\n */\n style?: 'default' | 'person';\n\n /**\n * The desired on-screen width of the image, ending in ‘px’. E.g., 50px. This overrides the size property.\n */\n width?: string;\n}\n\nexport type ImageOptions = Omit<IImage, 'type' | 'url'>;\n\n/**\n * Displays an image. Acceptable formats are PNG, JPEG, and GIF\n */\nexport class Image extends Element implements IImage {\n type: 'Image';\n\n /**\n * The URL to the image. Supports data URI in version 1.2+\n */\n url: string;\n\n /**\n * Alternate text describing the image.\n */\n altText?: string;\n\n /**\n * Controls if the image can be expanded to full screen.\n */\n allowExpand?: boolean;\n\n /**\n * Applies a background to a transparent image. This property will respect the image style.\n */\n backgroundColor?: string;\n\n /**\n * An Action that will be invoked when the Image is tapped or selected. Action.ShowCard is not supported.\n */\n selectAction?: SelectAction;\n\n /**\n * Controls the approximate size of the image. The physical dimensions will vary per host.\n */\n size?: ImageSize;\n\n /**\n * Controls how this Image is displayed.\n */\n style?: 'default' | 'person';\n\n /**\n * The desired on-screen width of the image, ending in ‘px’. E.g., 50px. This overrides the size property.\n */\n width?: string;\n\n constructor(url: string, options: ImageOptions = {}) {\n super();\n this.type = 'Image';\n this.url = url;\n Object.assign(this, options);\n }\n\n static from(options: Omit<IImage, 'type'>) {\n return new Image(options.url, options);\n }\n\n withAltText(value: string) {\n this.altText = value;\n return this;\n }\n\n withAllowExpand(value = true) {\n this.allowExpand = value;\n return this;\n }\n\n withBackgroundColor(value: string) {\n this.backgroundColor = value;\n return this;\n }\n\n withSelectAction(value: SelectAction) {\n this.selectAction = value;\n return this;\n }\n\n withSize(value: ImageSize) {\n this.size = value;\n return this;\n }\n\n withStyle(value: 'default' | 'person') {\n this.style = value;\n return this;\n }\n\n withWidth(value: string) {\n this.width = value;\n return this;\n }\n}\n"]}