1 | /**
|
2 | * @license
|
3 | * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
4 | * This code may only be used under the BSD style license found at
|
5 | * http://polymer.github.io/LICENSE.txt
|
6 | * The complete set of authors may be found at
|
7 | * http://polymer.github.io/AUTHORS.txt
|
8 | * The complete set of contributors may be found at
|
9 | * http://polymer.github.io/CONTRIBUTORS.txt
|
10 | * Code distributed by Google as part of the polymer project is also
|
11 | * subject to an additional IP rights grant found at
|
12 | * http://polymer.github.io/PATENTS.txt
|
13 | */
|
14 | import { PropertyDeclaration } from './updating-element.js';
|
15 | export declare type Constructor<T> = {
|
16 | new (...args: any[]): T;
|
17 | };
|
18 | interface ClassDescriptor {
|
19 | kind: 'class';
|
20 | elements: ClassElement[];
|
21 | finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
22 | }
|
23 | interface ClassElement {
|
24 | kind: 'field' | 'method';
|
25 | key: PropertyKey;
|
26 | placement: 'static' | 'prototype' | 'own';
|
27 | initializer?: Function;
|
28 | extras?: ClassElement[];
|
29 | finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;
|
30 | descriptor?: PropertyDescriptor;
|
31 | }
|
32 | /**
|
33 | * Class decorator factory that defines the decorated class as a custom element.
|
34 | *
|
35 | * @param tagName the name of the custom element to define
|
36 | *
|
37 | * In TypeScript, the `tagName` passed to `customElement` should be a key of the
|
38 | * `HTMLElementTagNameMap` interface. To add your element to the interface,
|
39 | * declare the interface in this module:
|
40 | *
|
41 | * @customElement('my-element')
|
42 | * export class MyElement extends LitElement {}
|
43 | *
|
44 | * declare global {
|
45 | * interface HTMLElementTagNameMap {
|
46 | * 'my-element': MyElement;
|
47 | * }
|
48 | * }
|
49 | *
|
50 | */
|
51 | export declare const customElement: (tagName: string) => (classOrDescriptor: ClassDescriptor | Constructor<HTMLElement>) => any;
|
52 | /**
|
53 | * A property decorator which creates a LitElement property which reflects a
|
54 | * corresponding attribute value. A `PropertyDeclaration` may optionally be
|
55 | * supplied to configure property features.
|
56 | */
|
57 | export declare const property: (options?: PropertyDeclaration<any, any> | undefined) => (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any;
|
58 | /**
|
59 | * A property decorator that converts a class property into a getter that
|
60 | * executes a querySelector on the element's renderRoot.
|
61 | */
|
62 | export declare const query: (selector: string) => (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any;
|
63 | /**
|
64 | * A property decorator that converts a class property into a getter
|
65 | * that executes a querySelectorAll on the element's renderRoot.
|
66 | */
|
67 | export declare const queryAll: (selector: string) => (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any;
|
68 | /**
|
69 | * Adds event listener options to a method used as an event listener in a
|
70 | * lit-html template.
|
71 | *
|
72 | * @param options An object that specifis event listener options as accepted by
|
73 | * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
|
74 | *
|
75 | * Current browsers support the `capture`, `passive`, and `once` options. See:
|
76 | * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
|
77 | *
|
78 | * @example
|
79 | *
|
80 | * class MyElement {
|
81 | *
|
82 | * clicked = false;
|
83 | *
|
84 | * render() {
|
85 | * return html`<div @click=${this._onClick}`><button></button></div>`;
|
86 | * }
|
87 | *
|
88 | * @eventOptions({capture: true})
|
89 | * _onClick(e) {
|
90 | * this.clicked = true;
|
91 | * }
|
92 | * }
|
93 | */
|
94 | export declare const eventOptions: (options: AddEventListenerOptions) => any;
|
95 | export {};
|
96 | //# sourceMappingURL=decorators.d.ts.map |
\ | No newline at end of file |