1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | const jsdoc = require("../javascript/jsdoc");
|
17 | const class_1 = require("./class");
|
18 | const model_1 = require("./model");
|
19 | const warning_1 = require("./warning");
|
20 |
|
21 |
|
22 |
|
23 | class ScannedElementBase {
|
24 | constructor() {
|
25 | this.properties = new Map();
|
26 | this.attributes = new Map();
|
27 | this.description = '';
|
28 | this.summary = '';
|
29 | this.demos = [];
|
30 | this.events = new Map();
|
31 | this.staticMethods = new Map();
|
32 | this.methods = new Map();
|
33 | this.astNode = undefined;
|
34 | this.warnings = [];
|
35 | this['slots'] = [];
|
36 | this.mixins = [];
|
37 | this.abstract = false;
|
38 | this.superClass = undefined;
|
39 | }
|
40 | applyHtmlComment(commentText, containingDocument) {
|
41 | if (commentText && containingDocument) {
|
42 | const commentJsdoc = jsdoc.parseJsdoc(commentText);
|
43 |
|
44 |
|
45 | if (this.sourceRange &&
|
46 | (this.description || this.jsdoc && this.jsdoc.tags.length > 0)) {
|
47 | this.warnings.push(new model_1.Warning({
|
48 | severity: warning_1.Severity.WARNING,
|
49 | code: 'multiple-doc-comments',
|
50 | message: `${this.constructor.name} has both HTML doc and JSDoc comments.`,
|
51 | sourceRange: this.sourceRange,
|
52 | parsedDocument: containingDocument
|
53 | }));
|
54 | }
|
55 | this.jsdoc =
|
56 | this.jsdoc ? jsdoc.join(commentJsdoc, this.jsdoc) : commentJsdoc;
|
57 | this.description = [
|
58 | commentJsdoc.description || '',
|
59 | this.description || ''
|
60 | ].join('\n\n').trim();
|
61 | }
|
62 | }
|
63 | }
|
64 | exports.ScannedElementBase = ScannedElementBase;
|
65 | class Slot {
|
66 | constructor(name, range, astNode) {
|
67 | this.name = name;
|
68 | this.range = range;
|
69 | this.astNode = astNode;
|
70 | }
|
71 | }
|
72 | exports.Slot = Slot;
|
73 |
|
74 |
|
75 |
|
76 | class ElementBase extends class_1.Class {
|
77 | constructor(init, document) {
|
78 | super(init, document);
|
79 | this['slots'] = [];
|
80 | this.template = undefined;
|
81 | const { events, attributes, slots = [], } = init;
|
82 | this.slots = Array.from(slots);
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | this.attributes = this.attributes || new Map();
|
88 |
|
89 | this.events = this.events || new Map();
|
90 | if (attributes !== undefined) {
|
91 | this._overwriteInherited(this.attributes, attributes, undefined, true);
|
92 | }
|
93 | if (events !== undefined) {
|
94 | this._overwriteInherited(this.events, events, undefined, true);
|
95 | }
|
96 | }
|
97 | inheritFrom(superClass) {
|
98 |
|
99 |
|
100 | this.attributes = this.attributes || new Map();
|
101 | this.events = this.events || new Map();
|
102 | super.inheritFrom(superClass);
|
103 | if (superClass instanceof ElementBase) {
|
104 | this._overwriteInherited(this.attributes, superClass.attributes, superClass.name);
|
105 | this._overwriteInherited(this.events, superClass.events, superClass.name);
|
106 | }
|
107 |
|
108 |
|
109 | }
|
110 | emitAttributeMetadata(_attribute) {
|
111 | return {};
|
112 | }
|
113 | emitEventMetadata(_event) {
|
114 | return {};
|
115 | }
|
116 | }
|
117 | exports.ElementBase = ElementBase;
|
118 |
|
\ | No newline at end of file |