1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import { AttributePart, noChange } from '../lit-html.js';
|
7 | import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export interface StyleInfo {
|
16 | readonly [name: string]: string | undefined | null;
|
17 | }
|
18 | declare class StyleMapDirective extends Directive {
|
19 | _previousStyleProperties?: Set<string>;
|
20 | constructor(partInfo: PartInfo);
|
21 | render(styleInfo: StyleInfo): string;
|
22 | update(part: AttributePart, [styleInfo]: DirectiveParameters<this>): string | typeof noChange;
|
23 | }
|
24 | /**
|
25 | * A directive that applies CSS properties to an element.
|
26 | *
|
27 | * `styleMap` can only be used in the `style` attribute and must be the only
|
28 | * expression in the attribute. It takes the property names in the `styleInfo`
|
29 | * object and adds the property values as CSS properties. Property names with
|
30 | * dashes (`-`) are assumed to be valid CSS property names and set on the
|
31 | * element's style object using `setProperty()`. Names without dashes are
|
32 | * assumed to be camelCased JavaScript property names and set on the element's
|
33 | * style object using property assignment, allowing the style object to
|
34 | * translate JavaScript-style names to CSS property names.
|
35 | *
|
36 | * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':
|
37 | * '0'})` sets the `background-color`, `border-top` and `--size` properties.
|
38 | *
|
39 | * @param styleInfo
|
40 | */
|
41 | export declare const styleMap: (styleInfo: StyleInfo) => import("../directive.js").DirectiveResult<typeof StyleMapDirective>;
|
42 | /**
|
43 | * The type of the class that powers this directive. Necessary for naming the
|
44 | * directive's return type.
|
45 | */
|
46 | export type { StyleMapDirective };
|
47 |
|
\ | No newline at end of file |