1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import * as babel from '@babel/types';
|
15 | import * as dom5 from 'dom5/lib/index-next';
|
16 | import { Annotation as JsDocAnnotation } from '../javascript/jsdoc';
|
17 | import { ImmutableArray } from '../model/immutable';
|
18 | import { AstNodeWithLanguage, Class, Document, Element, ElementBase, LiteralValue, Privacy, Property, ScannedAttribute, ScannedElement, ScannedElementBase, ScannedEvent, ScannedMethod, ScannedProperty, SourceRange, Warning } from '../model/model';
|
19 | import { ScannedReference } from '../model/reference';
|
20 | import { Behavior } from './behavior';
|
21 | import { JavascriptDatabindingExpression } from './expression-scanner';
|
22 | export interface BasePolymerProperty {
|
23 | published?: boolean;
|
24 | notify?: boolean;
|
25 | observer?: string;
|
26 | observerNode?: babel.Expression | babel.Pattern;
|
27 | observerExpression?: JavascriptDatabindingExpression;
|
28 | reflectToAttribute?: boolean;
|
29 | computedExpression?: JavascriptDatabindingExpression;
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 | isConfiguration?: boolean;
|
36 | |
37 |
|
38 |
|
39 | attributeType?: string;
|
40 | }
|
41 | export interface ScannedPolymerProperty extends ScannedProperty, BasePolymerProperty {
|
42 | }
|
43 | export interface PolymerProperty extends Property, BasePolymerProperty {
|
44 | }
|
45 | export declare function mergePropertyDeclarations(propA: Readonly<ScannedPolymerProperty>, propB: Readonly<ScannedPolymerProperty>): ScannedPolymerProperty;
|
46 | export declare class LocalId {
|
47 | name: string;
|
48 | range: SourceRange;
|
49 | nodeName: string;
|
50 | constructor(name: string, range: SourceRange, nodeName: string);
|
51 | }
|
52 | export interface Observer {
|
53 | javascriptNode: babel.Expression | babel.SpreadElement;
|
54 | expression: LiteralValue;
|
55 | parsedExpression: JavascriptDatabindingExpression | undefined;
|
56 | }
|
57 | export interface Options {
|
58 | tagName: string | undefined;
|
59 | className: string | undefined;
|
60 | superClass: ScannedReference<'class'> | undefined;
|
61 | mixins: ScannedReference<'element-mixin'>[];
|
62 | extends: string | undefined;
|
63 | jsdoc: JsDocAnnotation;
|
64 | description: string | undefined;
|
65 | properties: ScannedProperty[];
|
66 | methods: Map<string, ScannedMethod>;
|
67 | staticMethods: Map<string, ScannedMethod>;
|
68 | attributes: Map<string, ScannedAttribute>;
|
69 | observers: Observer[];
|
70 | listeners: {
|
71 | event: string;
|
72 | handler: string;
|
73 | }[];
|
74 | behaviors: ScannedReference<'behavior'>[];
|
75 | events: Map<string, ScannedEvent>;
|
76 | abstract: boolean;
|
77 | privacy: Privacy;
|
78 | astNode: AstNodeWithLanguage;
|
79 | statementAst: babel.Statement | undefined;
|
80 | sourceRange: SourceRange | undefined;
|
81 |
|
82 | isLegacyFactoryCall: boolean | undefined;
|
83 | }
|
84 | export interface ScannedPolymerExtension extends ScannedElementBase {
|
85 | properties: Map<string, ScannedPolymerProperty>;
|
86 | methods: Map<string, ScannedMethod>;
|
87 | observers: Observer[];
|
88 | listeners: {
|
89 | event: string;
|
90 | handler: string;
|
91 | }[];
|
92 | behaviorAssignments: ScannedReference<'behavior'>[];
|
93 | pseudo: boolean;
|
94 | addProperty(prop: ScannedPolymerProperty): void;
|
95 | }
|
96 | export declare function addProperty(target: ScannedPolymerExtension, prop: ScannedPolymerProperty): void;
|
97 | export declare function addMethod(target: ScannedPolymerExtension, method: ScannedMethod): void;
|
98 | export declare function addStaticMethod(target: ScannedPolymerExtension, method: ScannedMethod): void;
|
99 |
|
100 |
|
101 |
|
102 | export declare class ScannedPolymerElement extends ScannedElement implements ScannedPolymerExtension {
|
103 | properties: Map<string, ScannedPolymerProperty>;
|
104 | methods: Map<string, ScannedMethod>;
|
105 | staticMethods: Map<string, ScannedMethod>;
|
106 | observers: Observer[];
|
107 | listeners: {
|
108 | event: string;
|
109 | handler: string;
|
110 | }[];
|
111 | behaviorAssignments: ScannedReference<'behavior'>[];
|
112 | pseudo: boolean;
|
113 | abstract: boolean;
|
114 | isLegacyFactoryCall: boolean;
|
115 | constructor(options: Options);
|
116 | addProperty(prop: ScannedPolymerProperty): void;
|
117 | addMethod(method: ScannedMethod): void;
|
118 | addStaticMethod(method: ScannedMethod): void;
|
119 | resolve(document: Document): PolymerElement;
|
120 | }
|
121 | export interface PolymerExtension extends ElementBase {
|
122 | properties: Map<string, PolymerProperty>;
|
123 | observers: ImmutableArray<{
|
124 | javascriptNode: babel.Expression | babel.SpreadElement;
|
125 | expression: LiteralValue;
|
126 | parsedExpression: JavascriptDatabindingExpression | undefined;
|
127 | }>;
|
128 | listeners: ImmutableArray<{
|
129 | event: string;
|
130 | handler: string;
|
131 | }>;
|
132 | behaviorAssignments: ImmutableArray<ScannedReference<'behavior'>>;
|
133 | localIds: ImmutableArray<LocalId>;
|
134 | emitPropertyMetadata(property: PolymerProperty): any;
|
135 | }
|
136 | declare module '../model/queryable' {
|
137 | interface FeatureKindMap {
|
138 | 'polymer-element': PolymerElement;
|
139 | 'pseudo-element': Element;
|
140 | }
|
141 | }
|
142 | export declare class PolymerElement extends Element implements PolymerExtension {
|
143 | readonly properties: Map<string, PolymerProperty>;
|
144 | readonly observers: ImmutableArray<Observer>;
|
145 | readonly listeners: ImmutableArray<{
|
146 | event: string;
|
147 | handler: string;
|
148 | }>;
|
149 | readonly behaviorAssignments: ImmutableArray<ScannedReference<'behavior'>>;
|
150 | readonly domModule?: dom5.Node;
|
151 | readonly localIds: ImmutableArray<LocalId>;
|
152 |
|
153 | readonly isLegacyFactoryCall: boolean;
|
154 | constructor(scannedElement: ScannedPolymerElement, document: Document);
|
155 | emitPropertyMetadata(property: PolymerProperty): {
|
156 | polymer: {
|
157 | notify: boolean | undefined;
|
158 | observer: string | undefined;
|
159 | readOnly: boolean | undefined;
|
160 | attributeType: string | undefined;
|
161 | };
|
162 | };
|
163 | protected _getSuperclassAndMixins(document: Document, init: ScannedPolymerElement): Class[];
|
164 | }
|
165 | export declare function getBehaviors(behaviorReferences: Iterable<ScannedReference<'behavior'>>, document: Document): {
|
166 | warnings: Warning[];
|
167 | behaviors: Behavior[];
|
168 | };
|