1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import * as babel from '@babel/types';
|
15 | import { ElementMixin } from '..';
|
16 | import * as jsdocLib from '../javascript/jsdoc';
|
17 | import { AstNodeWithLanguage, Document, Feature, Method, Privacy, Property, Resolvable, ScannedFeature, ScannedMethod, ScannedProperty, ScannedReference, SourceRange, Warning } from '../model/model';
|
18 | import { DeclaredWithStatement } from './document';
|
19 | import { Demo } from './element-base';
|
20 | import { ImmutableMap } from './immutable';
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export declare class ScannedClass implements ScannedFeature, Resolvable {
|
34 | readonly name: string | undefined;
|
35 |
|
36 | readonly localName: string | undefined;
|
37 | readonly astNode: AstNodeWithLanguage;
|
38 | readonly statementAst: babel.Statement | undefined;
|
39 | readonly jsdoc: jsdocLib.Annotation;
|
40 | readonly description: string;
|
41 | readonly summary: string;
|
42 | readonly sourceRange: SourceRange;
|
43 | readonly properties: Map<string, ScannedProperty>;
|
44 | readonly staticMethods: ImmutableMap<string, ScannedMethod>;
|
45 | readonly methods: ImmutableMap<string, ScannedMethod>;
|
46 | readonly constructorMethod?: ScannedMethod;
|
47 | readonly superClass: ScannedReference<'class'> | undefined;
|
48 | readonly mixins: ScannedReference<'element-mixin'>[];
|
49 | readonly abstract: boolean;
|
50 | readonly privacy: Privacy;
|
51 | readonly warnings: Warning[];
|
52 | readonly demos: Demo[];
|
53 | constructor(className: string | undefined, localClassName: string | undefined, astNode: AstNodeWithLanguage, statementAst: babel.Statement | undefined, jsdoc: jsdocLib.Annotation, description: string, sourceRange: SourceRange, properties: Map<string, ScannedProperty>, methods: Map<string, ScannedMethod>, constructorMethod: ScannedMethod | undefined, staticMethods: Map<string, ScannedMethod>, superClass: ScannedReference<'class'> | undefined, mixins: Array<ScannedReference<'element-mixin'>>, privacy: Privacy, warnings: Warning[], abstract: boolean, demos: Demo[]);
|
54 | resolve(document: Document): Feature | undefined;
|
55 | /**
|
56 | * Allows additional properties and methods
|
57 | * to be added to the class after initialization.
|
58 | * For example, members found attached to the
|
59 | * prototype at a later place in the document
|
60 | */
|
61 | finishInitialization(methods: Map<string, ScannedMethod>, properties: Map<string, ScannedProperty>): void;
|
62 | }
|
63 | declare module '../model/queryable' {
|
64 | interface FeatureKindMap {
|
65 | 'class': Class;
|
66 | }
|
67 | }
|
68 | export interface ClassInit {
|
69 | readonly sourceRange: SourceRange | undefined;
|
70 | readonly astNode: AstNodeWithLanguage | undefined;
|
71 | readonly statementAst: babel.Statement | undefined;
|
72 | readonly warnings?: Warning[];
|
73 | readonly summary: string;
|
74 | readonly name?: string;
|
75 | readonly className?: string;
|
76 | readonly jsdoc?: jsdocLib.Annotation;
|
77 | readonly description: string;
|
78 | readonly properties?: ImmutableMap<string, Property>;
|
79 | readonly staticMethods: ImmutableMap<string, Method>;
|
80 | readonly methods?: ImmutableMap<string, Method>;
|
81 | readonly constructorMethod?: Method;
|
82 | readonly superClass?: ScannedReference<'class'> | undefined;
|
83 | readonly mixins?: Array<ScannedReference<'element-mixin'>>;
|
84 | readonly abstract: boolean;
|
85 | readonly privacy: Privacy;
|
86 | readonly demos?: Demo[];
|
87 | }
|
88 | export declare class Class implements Feature, DeclaredWithStatement {
|
89 | readonly kinds: Set<string>;
|
90 | readonly identifiers: Set<string>;
|
91 | readonly sourceRange: SourceRange | undefined;
|
92 | readonly astNode: AstNodeWithLanguage | undefined;
|
93 | readonly statementAst: babel.Statement | undefined;
|
94 | readonly warnings: Warning[];
|
95 | readonly summary: string;
|
96 | readonly name: string | undefined;
|
97 | |
98 |
|
99 |
|
100 | readonly className: string | undefined;
|
101 | readonly jsdoc: jsdocLib.Annotation | undefined;
|
102 | description: string;
|
103 | readonly properties: Map<string, Property>;
|
104 | readonly methods: Map<string, Method>;
|
105 | constructorMethod?: Method;
|
106 | readonly staticMethods: Map<string, Method>;
|
107 | readonly superClass: ScannedReference<'class'> | undefined;
|
108 | |
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | readonly mixins: ReadonlyArray<ScannedReference<'element-mixin'>>;
|
117 | readonly abstract: boolean;
|
118 | readonly privacy: Privacy;
|
119 | demos: Demo[];
|
120 | private readonly _parsedDocument;
|
121 | constructor(init: ClassInit, document: Document);
|
122 | protected inheritFrom(superClass: Class): void;
|
123 | /**
|
124 | * This method is applied to an array of members to overwrite members lower in
|
125 | * the prototype graph (closer to Object) with members higher up (closer to
|
126 | * the final class we're constructing).
|
127 | *
|
128 | * @param . existing The array of members so far. N.B. *This param is
|
129 | * mutated.*
|
130 | * @param . overriding The array of members from this new, higher prototype in
|
131 | * the graph
|
132 | * @param . overridingClassName The name of the prototype whose members are
|
133 | * being applied over the existing ones. Should be `undefined` when
|
134 | * applyingSelf is true
|
135 | * @param . applyingSelf True on the last call to this method, when we're
|
136 | * applying the class's own local members.
|
137 | */
|
138 | protected _overwriteInherited<P extends PropertyLike>(existing: Map<string, P>, overriding: ImmutableMap<string, P>, overridingClassName: string | undefined, applyingSelf?: boolean): void;
|
139 | /**
|
140 | * This method is applied to a single member to overwrite members lower in
|
141 | * the prototype graph (closer to Object) with members higher up (closer to
|
142 | * the final class we're constructing).
|
143 | *
|
144 | * @param . existing The existin property on the class
|
145 | * @param . overriding The array of members from this new, higher prototype in
|
146 | * the graph
|
147 | * @param . overridingClassName The name of the prototype whose members are
|
148 | * being applied over the existing ones. Should be `undefined` when
|
149 | * applyingSelf is true
|
150 | * @param . applyingSelf True on the last call to this method, when we're
|
151 | * applying the class's own local members.
|
152 | */
|
153 | protected _overwriteSingleInherited<P extends PropertyLike>(existing: P | undefined, overridingVal: P | undefined, overridingClassName: string | undefined): P | undefined;
|
154 | /**
|
155 | * Returns the elementLikes that make up this class's prototype chain.
|
156 | *
|
157 | * Should return them in the order that they're constructed in JS
|
158 | * engine (i.e. closest to HTMLElement first, closest to `this` last).
|
159 | */
|
160 | protected _getSuperclassAndMixins(document: Document, _init: ClassInit): Class[];
|
161 | protected _resolveReferenceToSuperClass(scannedReference: ScannedReference<'class' | 'element-mixin'> | undefined, document: Document): Class | ElementMixin | undefined;
|
162 | emitMetadata(): object;
|
163 | emitPropertyMetadata(_property: Property): object;
|
164 | emitMethodMetadata(_method: Method): object;
|
165 | }
|
166 | export interface PropertyLike {
|
167 | name: string;
|
168 | sourceRange?: SourceRange;
|
169 | inheritedFrom?: string;
|
170 | privacy?: Privacy;
|
171 | }
|