|
|
|
@ -260,6 +260,14 @@ export default function dom(
|
|
|
|
|
`}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const classMethods = [];
|
|
|
|
|
if (computations.length) {
|
|
|
|
|
classMethods.push(deindent`
|
|
|
|
|
_recompute(changed, state) {
|
|
|
|
|
${computationBuilder}
|
|
|
|
|
}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (generator.customElement) {
|
|
|
|
|
const props = generator.props || Array.from(generator.expectedProperties);
|
|
|
|
|
|
|
|
|
@ -283,8 +291,9 @@ export default function dom(
|
|
|
|
|
|
|
|
|
|
set ${prop}(value) {
|
|
|
|
|
this.set({ ${prop}: value });
|
|
|
|
|
}
|
|
|
|
|
`).join('\n\n')}
|
|
|
|
|
}`).join('\n\n')}
|
|
|
|
|
|
|
|
|
|
${classMethods.length && classMethods.join('\n\n')}
|
|
|
|
|
|
|
|
|
|
${generator.slots.size && deindent`
|
|
|
|
|
connectedCallback() {
|
|
|
|
@ -337,6 +346,8 @@ export default function dom(
|
|
|
|
|
super(options);
|
|
|
|
|
${constructorBody}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
${classMethods.length && classMethods.join('\n\n')}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
${templateProperties.methods && `@assign(${name}.prototype, %methods);`}
|
|
|
|
@ -355,12 +366,6 @@ export default function dom(
|
|
|
|
|
};
|
|
|
|
|
`}
|
|
|
|
|
|
|
|
|
|
${computations.length ? deindent`
|
|
|
|
|
${name}.prototype._recompute = function _recompute(changed, state) {
|
|
|
|
|
${computationBuilder}
|
|
|
|
|
}
|
|
|
|
|
` : (!sharedPath && `${name}.prototype._recompute = @noop;`)}
|
|
|
|
|
|
|
|
|
|
${templateProperties.setup && `%setup(${name});`}
|
|
|
|
|
|
|
|
|
|
${templateProperties.preload && `${name}.preload = %preload;`}
|
|
|
|
|