UNPKG

3.46 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2015 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 */
14import * as babel from '@babel/types';
15import { ASTNode } from 'parse5';
16import * as jsdoc from '../javascript/jsdoc';
17import { ParsedDocument } from '../parser/document';
18import { Class, ClassInit } from './class';
19import { Privacy } from './feature';
20import { ImmutableArray } from './immutable';
21import { ScannedMethod } from './method';
22import { AstNodeWithLanguage, Attribute, Document, Event, Feature, Resolvable, ScannedAttribute, ScannedEvent, ScannedProperty, ScannedReference, SourceRange, Warning } from './model';
23import { FileRelativeUrl } from './url';
24export { Visitor } from '../javascript/estree-visitor';
25/**
26 * Base class for ScannedElement and ScannedElementMixin.
27 */
28export declare abstract class ScannedElementBase implements Resolvable {
29 properties: Map<string, ScannedProperty>;
30 attributes: Map<string, ScannedAttribute>;
31 description: string;
32 summary: string;
33 demos: Demo[];
34 events: Map<string, ScannedEvent>;
35 sourceRange: SourceRange | undefined;
36 staticMethods: Map<string, ScannedMethod>;
37 methods: Map<string, ScannedMethod>;
38 astNode: AstNodeWithLanguage | undefined;
39 statementAst: babel.Statement | undefined;
40 warnings: Warning[];
41 jsdoc?: jsdoc.Annotation;
42 'slots': Slot[];
43 mixins: Array<ScannedReference<'element-mixin'>>;
44 privacy: Privacy;
45 abstract: boolean;
46 superClass?: ScannedReference<'class'>;
47 applyHtmlComment(commentText: string | undefined, containingDocument: ParsedDocument | undefined): void;
48 abstract resolve(_document: Document): Feature;
49}
50export declare class Slot {
51 name: string;
52 range: SourceRange;
53 astNode?: AstNodeWithLanguage;
54 constructor(name: string, range: SourceRange, astNode: AstNodeWithLanguage | undefined);
55}
56export interface Demo {
57 desc?: string;
58 path: FileRelativeUrl;
59}
60export interface ElementBaseInit extends ClassInit {
61 readonly events?: Map<string, Event>;
62 readonly attributes?: Map<string, Attribute>;
63 readonly slots?: Slot[];
64}
65/**
66 * The element's runtime contents.
67 */
68export declare type ElementTemplate = {
69 /**
70 * HTML that is stamped out without data binding or other
71 * interpretation beyond normal HTML semantics.
72 */
73 kind: 'html';
74 contents: ASTNode;
75} | {
76 /**
77 * HTML that's interpreted with the polymer databinding
78 * system.
79 */
80 kind: 'polymer-databinding';
81 contents: ASTNode;
82};
83/**
84 * Base class for Element and ElementMixin.
85 */
86export declare abstract class ElementBase extends Class implements Feature {
87 attributes: Map<string, Attribute>;
88 events: Map<string, Event>;
89 'slots': ImmutableArray<Slot>;
90 constructor(init: ElementBaseInit, document: Document);
91 protected inheritFrom(superClass: Class): void;
92 emitAttributeMetadata(_attribute: Attribute): Object;
93 emitEventMetadata(_event: Event): Object;
94 template: undefined | ElementTemplate;
95}