|
|
@ -291,42 +291,40 @@ export default function dom ( parsed, source, options, names ) {
|
|
|
|
|
|
|
|
|
|
|
|
this._handlers = Object.create( null );
|
|
|
|
this._handlers = Object.create( null );
|
|
|
|
|
|
|
|
|
|
|
|
this.get = get;
|
|
|
|
|
|
|
|
this.fire = fire;
|
|
|
|
|
|
|
|
this.observe = observe;
|
|
|
|
|
|
|
|
this.on = on;
|
|
|
|
|
|
|
|
this.set = set;
|
|
|
|
|
|
|
|
this.teardown = teardown;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._root = options._root;
|
|
|
|
this._root = options._root;
|
|
|
|
this._yield = options._yield;
|
|
|
|
this._yield = options._yield;
|
|
|
|
|
|
|
|
|
|
|
|
${builders.init}
|
|
|
|
${builders.init}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
` );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( templateProperties.methods ) {
|
|
|
|
|
|
|
|
builders.main.addBlock( `${name}.prototype = template.methods;` );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
builders.main.addBlock( deindent`
|
|
|
|
|
|
|
|
${name}.prototype.get = ${shared.get};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${name}.prototype.fire = ${shared.fire};
|
|
|
|
|
|
|
|
|
|
|
|
function set ( newState ) {
|
|
|
|
${name}.prototype.observe = ${shared.observe};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${name}.prototype.on = ${shared.on};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${name}.prototype.set = function set ( newState ) {
|
|
|
|
${builders.set}
|
|
|
|
${builders.set}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function teardown ( detach ) {
|
|
|
|
${name}.prototype.teardown = function teardown ( detach ) {
|
|
|
|
this.fire( 'teardown' );${templateProperties.onteardown ? `\ntemplate.onteardown.call( this );` : ``}
|
|
|
|
this.fire( 'teardown' );${templateProperties.onteardown ? `\ntemplate.onteardown.call( this );` : ``}
|
|
|
|
|
|
|
|
|
|
|
|
this._fragment.teardown( detach !== false );
|
|
|
|
this._fragment.teardown( detach !== false );
|
|
|
|
this._fragment = null;
|
|
|
|
this._fragment = null;
|
|
|
|
|
|
|
|
|
|
|
|
this._state = {};
|
|
|
|
this._state = {};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
` );
|
|
|
|
` );
|
|
|
|
|
|
|
|
|
|
|
|
if ( templateProperties.methods ) {
|
|
|
|
|
|
|
|
builders.main.addBlock( `${name}.prototype = template.methods;` );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
builders.main.addBlock( shared.fire.toString() );
|
|
|
|
|
|
|
|
builders.main.addBlock( shared.get.toString() );
|
|
|
|
|
|
|
|
builders.main.addBlock( shared.observe.toString() );
|
|
|
|
|
|
|
|
builders.main.addBlock( shared.on.toString() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
builders.main.addBlock( shared.dispatchObservers.toString() );
|
|
|
|
builders.main.addBlock( shared.dispatchObservers.toString() );
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys( generator.uses ).forEach( key => {
|
|
|
|
Object.keys( generator.uses ).forEach( key => {
|
|
|
|