UNPKG

2.53 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const model_1 = require("../model/model");
4const polymer_element_1 = require("./polymer-element");
5class ScannedPolymerElementMixin extends model_1.ScannedElementMixin {
6 constructor({ name, jsdoc, description, summary, privacy, sourceRange, mixins, astNode, statementAst, classAstNode }) {
7 super({ name });
8 this.properties = new Map();
9 this.methods = new Map();
10 this.staticMethods = new Map();
11 this.observers = [];
12 this.listeners = [];
13 this.behaviorAssignments = [];
14 this.pseudo = false;
15 this.abstract = false;
16 this.jsdoc = jsdoc;
17 this.description = description;
18 this.summary = summary;
19 this.privacy = privacy;
20 this.sourceRange = sourceRange;
21 this.mixins = mixins;
22 this.astNode = astNode;
23 this.statementAst = statementAst;
24 this.classAstNode = classAstNode;
25 }
26 addProperty(prop) {
27 polymer_element_1.addProperty(this, prop);
28 }
29 addMethod(method) {
30 polymer_element_1.addMethod(this, method);
31 }
32 resolve(document) {
33 return new PolymerElementMixin(this, document);
34 }
35}
36exports.ScannedPolymerElementMixin = ScannedPolymerElementMixin;
37class PolymerElementMixin extends model_1.ElementMixin {
38 constructor(scannedMixin, document) {
39 super(scannedMixin, document);
40 this.listeners = [];
41 this.behaviorAssignments = [];
42 this.localIds = [];
43 this.kinds.add('polymer-element-mixin');
44 this.pseudo = scannedMixin.pseudo;
45 this.behaviorAssignments = Array.from(scannedMixin.behaviorAssignments);
46 this.observers = Array.from(scannedMixin.observers);
47 }
48 emitPropertyMetadata(property) {
49 return {
50 polymer: {
51 notify: property.notify,
52 observer: property.observer,
53 readOnly: property.readOnly,
54 attributeType: property.attributeType,
55 }
56 };
57 }
58 _getSuperclassAndMixins(document, init) {
59 const prototypeChain = super._getSuperclassAndMixins(document, init);
60 const { warnings, behaviors } = polymer_element_1.getBehaviors(init.behaviorAssignments, document);
61 this.warnings.push(...warnings);
62 prototypeChain.push(...behaviors);
63 return prototypeChain;
64 }
65}
66exports.PolymerElementMixin = PolymerElementMixin;
67//# sourceMappingURL=polymer-element-mixin.js.map
\No newline at end of file