| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -74,10 +74,9 @@ export default function dom(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						});
 | 
					 | 
					 | 
					 | 
						});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						const builder = new CodeBuilder();
 | 
					 | 
					 | 
					 | 
						const builder = new CodeBuilder();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						const computationBuilder = new CodeBuilder();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (computations.length) {
 | 
					 | 
					 | 
					 | 
						if (computations.length) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							const computationBuilder = new CodeBuilder();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							computations.forEach(({ key, deps }) => {
 | 
					 | 
					 | 
					 | 
							computations.forEach(({ key, deps }) => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if (generator.readonly.has(key)) {
 | 
					 | 
					 | 
					 | 
								if (generator.readonly.has(key)) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									// <:Window> bindings
 | 
					 | 
					 | 
					 | 
									// <:Window> bindings
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -88,48 +87,18 @@ export default function dom(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								generator.readonly.add(key);
 | 
					 | 
					 | 
					 | 
								generator.readonly.add(key);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const condition = `isInitial || ${deps
 | 
					 | 
					 | 
					 | 
								const condition = `isInitial || ${deps.map(dep =>
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.map(
 | 
					 | 
					 | 
					 | 
									`( '${dep}' in changed )`
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										dep =>
 | 
					 | 
					 | 
					 | 
								).join(' || ')}`;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											`( '${dep}' in newState && @differs( state.${dep}, oldState.${dep} ) )`
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									)
 | 
					 | 
					 | 
					 | 
								const statement = `if ( @differs( ( state.${key} = @template.computed.${key}( ${deps
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.join(' || ')}`;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const statement = `state.${key} = newState.${key} = @template.computed.${key}( ${deps
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.map(dep => `state.${dep}`)
 | 
					 | 
					 | 
					 | 
									.map(dep => `state.${dep}`)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.join(', ')} );`;
 | 
					 | 
					 | 
					 | 
									.join(', ')} ) ), oldState.${key} ) ) changed.${key} = true;`;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								computationBuilder.addConditionalLine(condition, statement);
 | 
					 | 
					 | 
					 | 
								computationBuilder.addConditionalLine(condition, statement);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							});
 | 
					 | 
					 | 
					 | 
							});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							builder.addBlock(deindent`
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								function @recompute ( state, newState, oldState, isInitial ) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									${computationBuilder}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							`);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						const _set = deindent`
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							${options.dev &&
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								deindent`
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if ( typeof newState !== 'object' ) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									throw new Error( 'Component .set was called without an object of data key-values to update.' );
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${Array.from(generator.readonly).map(
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									prop =>
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										`if ( '${prop}' in newState && !this._updatingReadonlyProperty ) throw new Error( "Cannot set read-only property '${prop}'" );`
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								)}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							`}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var oldState = this._state;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							this._state = @assign( {}, oldState, newState );
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							${computations.length &&
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								`@recompute( this._state, newState, oldState, false )`}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							@dispatchObservers( this, this._observers.pre, newState, oldState );
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							${block.hasUpdateMethod && `this._fragment.update( newState, this._state );`}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							@dispatchObservers( this, this._observers.post, newState, oldState );
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						`;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (hasJs) {
 | 
					 | 
					 | 
					 | 
						if (hasJs) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							builder.addBlock(`[✂${parsed.js.content.start}-${parsed.js.content.end}✂]`);
 | 
					 | 
					 | 
					 | 
							builder.addBlock(`[✂${parsed.js.content.start}-${parsed.js.content.end}✂]`);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -174,7 +143,7 @@ export default function dom(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							? `@proto `
 | 
					 | 
					 | 
					 | 
							? `@proto `
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							: deindent`
 | 
					 | 
					 | 
					 | 
							: deindent`
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							{
 | 
					 | 
					 | 
					 | 
							{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${['destroy', 'get', 'fire', 'observe', 'on', 'set', 'teardown']
 | 
					 | 
					 | 
					 | 
								${['destroy', 'get', 'fire', 'observe', 'on', 'set', '_set', 'teardown']
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.map(n => `${n}: @${n === 'teardown' ? 'destroy' : n}`)
 | 
					 | 
					 | 
					 | 
									.map(n => `${n}: @${n === 'teardown' ? 'destroy' : n}`)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									.join(',\n')}
 | 
					 | 
					 | 
					 | 
									.join(',\n')}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							}`;
 | 
					 | 
					 | 
					 | 
							}`;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -190,7 +159,7 @@ export default function dom(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									? `@assign( @template.data(), options.data )`
 | 
					 | 
					 | 
					 | 
									? `@assign( @template.data(), options.data )`
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									: `options.data || {}`};
 | 
					 | 
					 | 
					 | 
									: `options.data || {}`};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${generator.metaBindings}
 | 
					 | 
					 | 
					 | 
								${generator.metaBindings}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${computations.length && `@recompute( this._state, this._state, {}, true );`}
 | 
					 | 
					 | 
					 | 
								${computations.length && `this._recompute( {}, this._state, {}, true );`}
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${options.dev &&
 | 
					 | 
					 | 
					 | 
								${options.dev &&
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									Array.from(generator.expectedProperties).map(
 | 
					 | 
					 | 
					 | 
									Array.from(generator.expectedProperties).map(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										prop =>
 | 
					 | 
					 | 
					 | 
										prop =>
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -259,9 +228,20 @@ export default function dom(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							@assign( ${prototypeBase}, ${proto});
 | 
					 | 
					 | 
					 | 
							@assign( ${prototypeBase}, ${proto});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							${name}.prototype._set = function _set ( newState ) {
 | 
					 | 
					 | 
					 | 
							${options.dev && deindent`
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								${_set}
 | 
					 | 
					 | 
					 | 
								${name}.prototype._checkReadOnly = function _checkReadOnly ( newState ) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							};
 | 
					 | 
					 | 
					 | 
									${Array.from(generator.readonly).map(
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
										prop =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
											`if ( '${prop}' in newState && !this._updatingReadonlyProperty ) throw new Error( "Cannot set read-only property '${prop}'" );`
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									)}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							`}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							${computations.length ? deindent`
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								${name}.prototype._recompute = function _recompute ( changed, state, oldState, isInitial ) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									${computationBuilder}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							` : (!sharedPath && `${name}.prototype._recompute = @noop;`)}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							${templateProperties.setup && `@template.setup( ${name} );`}
 | 
					 | 
					 | 
					 | 
							${templateProperties.setup && `@template.setup( ${name} );`}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						`);
 | 
					 | 
					 | 
					 | 
						`);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |