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 6.5 kB
{"version":3,"sources":["../src/base.ts"],"names":[],"mappings":"AA4DO,MAAM,OAA4B,CAAA;AAAA;AAAA;AAAA;AAAA,EAIvC,EAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,mBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,WAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA,EAEA,WAAA,CAAY,KAA2B,GAAA,EAAI,EAAA;AACzC,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,KAAK,CAAA;AAAA;AAC3B,EAEA,OAAO,KAAe,EAAA;AACpB,IAAA,IAAA,CAAK,EAAK,GAAA,KAAA;AACV,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,cAAc,KAAgB,EAAA;AAC5B,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA;AACjB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,aAAa,KAA+B,EAAA;AAC1C,IAAA,IAAA,CAAK,QAAW,GAAA,KAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,WAAA,CAAY,KAAa,KAAe,EAAA;AACtC,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAClB,MAAA,IAAA,CAAK,WAAW,EAAC;AAAA;AAGnB,IAAK,IAAA,CAAA,QAAA,CAAS,GAAG,CAAI,GAAA,KAAA;AACrB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,WAAW,KAAuE,EAAA;AAChF,IAAA,IAAA,CAAK,MAAS,GAAA,KAAA;AACd,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,cAAc,KAAgB,EAAA;AAC5B,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA;AACjB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,YAAY,KAAgB,EAAA;AAC1B,IAAA,IAAA,CAAK,OAAU,GAAA,KAAA;AACf,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,aAAa,KAAe,EAAA;AAC1B,IAAA,IAAA,CAAK,WAAW,CAAI,GAAA,KAAA;AAAA;AACtB,EAEA,wBAAwB,KAA4B,EAAA;AAClD,IAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA;AAC3B,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,gBAAgB,KAAoB,EAAA;AAClC,IAAA,IAAA,CAAK,WAAc,GAAA,KAAA;AACnB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,SAAS,KAAe,EAAA;AACtB,IAAA,IAAA,CAAK,IAAO,GAAA,KAAA;AACZ,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,aAAa,KAAmD,EAAA;AAC9D,IAAA,IAAA,CAAK,QAAW,GAAA,KAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAEX","file":"base.mjs","sourcesContent":["import { HorizontalAlignment, Spacing, TargetWidth } from './common';\nimport { Element as AnyElement } from './element';\n\nexport interface IElement {\n /**\n * A unique identifier associated with the item\n */\n id?: string;\n\n /**\n * If false, this item will be removed from the visual tree.\n */\n isVisible?: boolean;\n\n /**\n * A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered.\n */\n requires?: Record<string, string>;\n\n /**\n * Specifies the height of the element.\n */\n height?: 'auto' | 'stretch' | Omit<string | number, 'auto' | 'stretch'>;\n\n /**\n * When `true`, draw a separating line at the top of the element.\n */\n separator?: boolean;\n\n /**\n * Controls the amount of spacing between this element and the preceding element.\n */\n spacing?: Spacing;\n\n /**\n * the area of a `Layout.AreaGrid` layout in which an element should be displayed.\n */\n 'grid.area'?: string;\n\n /**\n * controls how the element should be horizontally aligned.\n */\n horizontalAlignment?: HorizontalAlignment | null;\n\n /**\n * Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space.\n */\n targetWidth?: TargetWidth;\n\n /**\n * The locale associated with the element.\n */\n lang?: string;\n\n /**\n * Describes what to do when an unknown item is encountered or the requires of this or any children can't be met.\n */\n fallback?: AnyElement | 'drop' | Omit<string, 'drop'>;\n}\n\nexport class Element implements IElement {\n /**\n * A unique identifier associated with the item\n */\n id?: string;\n\n /**\n * If false, this item will be removed from the visual tree.\n */\n isVisible?: boolean;\n\n /**\n * A series of key/value pairs indicating features that the item requires with corresponding minimum version. When a feature is missing or of insufficient version, fallback is triggered.\n */\n requires?: Record<string, string>;\n\n /**\n * Specifies the height of the element.\n */\n height?: 'auto' | 'stretch' | Omit<string | number, 'auto' | 'stretch'>;\n\n /**\n * When `true`, draw a separating line at the top of the element.\n */\n separator?: boolean;\n\n /**\n * Controls the amount of spacing between this element and the preceding element.\n */\n spacing?: Spacing;\n\n /**\n * the area of a `Layout.AreaGrid` layout in which an element should be displayed.\n */\n 'grid.area'?: string;\n\n /**\n * controls how the element should be horizontally aligned.\n */\n horizontalAlignment?: HorizontalAlignment | null;\n\n /**\n * Controls for which card width the element should be displayed. If targetWidth isn't specified, the element is rendered at all card widths. Using targetWidth makes it possible to author responsive cards that adapt their layout to the available horizontal space.\n */\n targetWidth?: TargetWidth;\n\n /**\n * The locale associated with the element.\n */\n lang?: string;\n\n /**\n * Describes what to do when an unknown item is encountered or the requires of this or any children can't be met.\n */\n fallback?: AnyElement | 'drop' | Omit<string, 'drop'>;\n\n constructor(value: Partial<IElement> = {}) {\n Object.assign(this, value);\n }\n\n withId(value: string) {\n this.id = value;\n return this;\n }\n\n withIsVisible(value: boolean) {\n this.isVisible = value;\n return this;\n }\n\n withRequires(value: Record<string, string>) {\n this.requires = value;\n return this;\n }\n\n withRequire(key: string, value: string) {\n if (!this.requires) {\n this.requires = {};\n }\n\n this.requires[key] = value;\n return this;\n }\n\n withHeight(value: 'auto' | 'stretch' | Omit<string | number, 'auto' | 'stretch'>) {\n this.height = value;\n return this;\n }\n\n withSeperator(value: boolean) {\n this.separator = value;\n return this;\n }\n\n withSpacing(value: Spacing) {\n this.spacing = value;\n return this;\n }\n\n withGridArea(value: string) {\n this['grid.area'] = value;\n }\n\n withHorizontalAlignment(value: HorizontalAlignment) {\n this.horizontalAlignment = value;\n return this;\n }\n\n withTargetWidth(value: TargetWidth) {\n this.targetWidth = value;\n return this;\n }\n\n withLang(value: string) {\n this.lang = value;\n return this;\n }\n\n withFallback(value: AnyElement | 'drop' | Omit<string, 'drop'>) {\n this.fallback = value;\n return this;\n }\n}\n"]}