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Q,IAAM,IAAIoV,IACnCsE,GAAa1Z,IAAI,GAAY,IAAM,IAAIgW,IACvC0D,GAAa1Z,IAAI,GAAW,IAAM,IAAIkX,IACtCwC,GAAa1Z,IAAI,IAAM,IAAM,IAAImY,KCvC1B,SAAejE,GAAK7G,G,qCACvBiD,EAAMjD,EAAQoM,IAEX,cAAepM,EAAOjM,KxBgNtB,SAAe8R,GACrB,IAAIrK,EAAW,IAAI8I,EAAUuB,EAAKlN,MAG9BkN,EAAKpJ,WAAWjB,EAAS/G,QAAQgI,SAAWoJ,EAAKpJ,UAGjDoJ,EAAK9R,OAAOyH,EAAS/G,QAAQV,KAAO8R,EAAK9R,MAE7CyH,EAAS5H,SwBxNF0Y,CAAK,CAAE3T,KAAMkL,SAASG,KAAMvH,SAAU4P,GAActY,KAAMiM,EAAOjM,OAGjE8S,SAAW1D,EAAM,UAAUhC,S","sources":["webpack://main/webpack/bootstrap","webpack://main/webpack/runtime/define property getters","webpack://main/webpack/runtime/hasOwnProperty shorthand","webpack://main/webpack/runtime/make namespace object","webpack://main/./node_modules/@lernetz/ts-lib/src/Registry.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/Compiler.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/Expression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Signal.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Observer.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/ClosureExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/RenderExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/ViewExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/View.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Scope.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Lang.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Setup.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Model.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Request.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/Template.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Repeat.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Show.ts","webpack://main/./typescript/animation/navigation/Navigation.ts","webpack://main/./typescript/animation/navigation/Navigation.html","webpack://main/./typescript/animation/Animation.ts","webpack://main/./typescript/animation/Animation.html","webpack://main/./typescript/audio/Audio.ts","webpack://main/./typescript/animation/Script.ts","webpack://main/./typescript/animation/text/Text.ts","webpack://main/./typescript/animation/text/Text.html","webpack://main/./typescript/animation/Command.ts","webpack://main/./typescript/animation/commands/ClearText.ts","webpack://main/./typescript/animation/commands/PopText.ts","webpack://main/./typescript/animation/commands/PushText.ts","webpack://main/./typescript/animation/commands/ResumeAnimation.ts","webpack://main/./typescript/animation/commands/ResumeAudio.ts","webpack://main/./typescript/animation/commands/SetAnimationPosition.ts","webpack://main/./typescript/animation/commands/SetNavigation.ts","webpack://main/./typescript/animation/commands/SetTitle.ts","webpack://main/./typescript/animation/commands/StartAudio.ts","webpack://main/./typescript/animation/commands/StopAnimation.ts","webpack://main/./typescript/animation/commands/StopAudio.ts","webpack://main/./typescript/register.ts","webpack://main/./typescript/Main.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","interface RegistryFactoryClosure {\n\t( value:FactoryIn ): FactoryOut;\n}\n\n\n/**\n * A class that handles key value mappings with sub mappings\n */\nexport class Registry {\n\n\tprotected entries:Map>;\n\n\tconstructor() {\n\t\tthis.entries = new Map();\n\t}\n\n\tadd( key:any, closure:RegistryFactoryClosure ) {\n\t\tthis.entries.set( key, closure );\n\t\treturn this;\n\t}\n\n\tget( key:any ) {\n\t\t// check for entry\n\t\tlet found = this.entries.get( key );\n\n\t\t// return entry if it has and search on constructor if available\n\t\treturn found ? found : ( key && key.constructor ) ? this.entries.get( key.constructor ) : undefined;\n\n\t}\n}\n\n","\n\nvar pass = {\n\tregex:/\\[\\[([\\s\\S]+?)\\]\\]/g,\n\tmapper: function( match, inner ) {\n\t\treturn \"function() {\\n try { with( data ) {\\n return \" + inner + \" } } catch (error) { this.log( error ) } }.call( this )\";\n\t}\n};\n\nvar cache = {};\n\n\n/**\n * Compiles a template string into a template function.\n */\nexport function compile( templateString:string, args:string[] = [ 'data' ] ):Function {\n\n\tlet key = templateString + args.join( ' ' );\n\n\t// handle caching\n\tif( cache[ key ] ) return cache[ key ]\n\n\t// check if template is one single [[ .. ]] expression\n\tlet matches = templateString.match( /\\[\\[([\\s\\S]+?)\\]\\]/ );\n\tif( matches && matches[0] == templateString ) {\n\t\tvar source = parseValue( templateString );\n\t} else {\n\t\tvar source = parseString( templateString );\n\t}\n\n\tvar render = new Function( ...args, source );\n\n\t// store for caching\n\tcache[ key ] = render;\n\n\treturn render;\n}\n\n\n/**\n* Turns the given template into a function body code.\n*/\nfunction parseString( template:string ):string {\n\n\ttemplate = template.replace( pass.regex, ( match, inner:string ) => {\n\t\treturn \"` + this.empty( \" + pass.mapper( match, inner ) + \" ) + `\";\n\t});\n\n\treturn \"return `\" + template + \"`;\";\n}\n\n/**\n* Turns the given template into a function body code.\n*/\nfunction parseValue( template:string ):string {\n\t// simply return the inner template content\n\treturn template.replace( pass.regex, ( match, inner:string ) => {\n\t\treturn \"return \" + pass.mapper( match, inner ) + \";\";\n\t});\n}\n\n/**\n * Tests if the value of the template is empty or not\n */\nexport function empty( data:any ):string {\n\treturn data || data === 0 ? data : '';\n}\n\n/**\n * Logs errors to the console\n */\nexport function log( ...params ) {\n\tif( console ) {\n\t\t( console.trace ) ? console.trace( ...params ) : console.log( ...params );\n\t}\n}\n\n/**\n * Stops the debugger\n */\nexport function debug() {\n\tdebugger;\n}\n\n/**\n * Tests if the given string has an expression\n * @param string\n */\nexport function hasExpression( string:string ):boolean {\n\tpass.regex.lastIndex = 0; // reset global regex\n\treturn pass.regex.test( string );\n}\n\n/**\n * Returns only the content of the expressions [[...]] within the given string\n */\nexport function getContent( string:string ) {\n\tlet content = '';\n\tstring.replace( pass.regex, ( match, inner ) => {\n\t\tcontent += inner;\n\t\treturn '';\n\t});\n\treturn content;\n}\n\n/**\n * Replaces the expression of the given templatee with the content of the closure\n */\nexport function replace( template:string, replacer:( match:string, inner ) => string ) {\n\treturn template.replace( pass.regex, replacer );\n}\n","import { Subscription } from \"../../Signal\";\nimport { TemplateContext } from \"../Template\";\n\n\n\n/**\n * Super class of all expressions to store the expression and its context.\n * It handles also the subscription on observables\n */\nexport abstract class Expression {\n\n\texpression:Function;\n\tcontext:TemplateContext;\n\n\tconstructor( context:TemplateContext ) {\n\t\tthis.context = context;\n\t}\n\n\tabstract destroy();\n}\n\n\nexport interface ExpressionWithInital {\n\tinital();\n}\n\n/**\n * A guard that checks whether the specified object has an inital function to invoke\n *\n * @param obj The object that should be tested.\n */\nexport function hasInital( obj:any ):obj is ExpressionWithInital {\n\treturn obj && obj[ 'inital' ];\n}\n\n\n\n\nexport function snakeToCamel( string ):string {\n\treturn string.replace( /(\\-\\w)/g, match => match[1].toUpperCase() );\n}\n\nexport function camelToSnake( string ) {\n\treturn string.split(/(?=[A-Z])/).join('-').toLowerCase();\n}\n\n","/**\n * This module contains the [[Observable]] interface and its principal implementation, [[Signal]].\n * See https://tc39.es/proposal-observable/ and https://rxjs.dev/ for more in-depth information\n * about observables.\n */\n\n\n/**\n * An [[Observer]] is a callback function that will receive `T` values from a [[Observable]]\n * after it has been [[subscribe]]d to it.\n */\nexport type Observer = (arg: T) => void;\n\n\n/**\n * A subscription gets returned to you when you [[Observable.subscribe]] an [[Observer]] to an [[Observable]].\n * It is via this object that you can [[unsubscribe]] the observer again.\n */\nexport interface Subscription {\n\n\t/**\n\t * Unsubscribes the observer from the [[Observable]] so it will no longer receive its values.\n\t */\n unsubscribe(): void;\n}\n\n\n/**\n * An [[Observable]] is a composable sequence of `T` values that will be *pushed* to observers\n * as they become available. This is the reverse of collections, which allow you to *pull* values\n * out of it via iteration.\n *\n * * `subscription = subscribe(observer)` to start receiving values.\n *\n * * `subscription.unsubscribe()` to stop receiving values.\n *\n * @example\n *\n * ```typescript\n * import {node} from '.../core/node/Node';\n *\n * const clicks = node(document.querySelector('#someElement')).clicks;\n * const subscription = clicks.subscribe(e => console.log('You clicked on ', e.target));\n * ...\n * subscription.unsubscribe();\n * ```\n *\n * @seealso https://tc39.es/proposal-observable/\n * @seealso https://rxjs.dev/\n */\nexport class Observable {\n\n private readonly subscribe_: (observer: Observer) => Subscription;\n\n\t/**\n\t * Initializes a new instance of the [[Observable]] class.\n\t *\n\t * @param subscribe The implementation of the [[subscribe]] method.\n\t */\n public constructor(subscribe: (observer: Observer) => Subscription) {\n this.subscribe_ = subscribe;\n }\n\n\t/**\n\t * Returns a new observable where all values of the original observable are delayed\n\t * as long as new values are pushed to observers. Once there hasn't been a new value for\n\t * `wait` milliseconds, the last value gets pushed.\n\t *\n\t * @param wait The number of milliseconds to wait after the last value before it is pushed.\n\t */\n public debounce(wait: number): Observable {\n return new Observable(observer => {\n let timeout;\n return this.subscribe(arg => {\n const later = () => {\n timeout = null;\n observer(arg);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n });\n });\n }\n\n\t/**\n\t * Gets a new observable containing only the values that fulfill the given predicate `fn`.\n\t * Think [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\t *\n\t * @param fn A predicate that specifies which values from the original observable to keep.\n\t */\n public filter(fn: (arg: T) => boolean): Observable {\n return new Observable(observer => {\n return this.subscribe(arg => {\n if (fn(arg)) {\n observer(arg);\n }\n });\n });\n }\n\n\t/**\n\t * Gets a new observable where each value has been transformed by the given function `fn`.\n\t * Think [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).\n\t *\n\t * @param fn A function that maps a value to another value.\n\t */\n public map(fn: (arg: T) => U): Observable {\n return new Observable(observer => {\n return this.subscribe(arg => {\n observer(fn(arg));\n });\n });\n }\n\n\t/**\n\t * Subscribes the given `observer` (a callback function) to this observable which will start\n\t * receiving its values. Returns a [[Subscription]] via which you can [[unsubscribe]] the observer.\n\t *\n\t * @param observer The callback function that should receive `T` values from this observable.\n\t */\n public subscribe(observer: Observer): Subscription {\n return this.subscribe_(observer);\n }\n}\n\n\n/**\n * A kind of [[Observable]] that can dispatch `T` values via [[Signal.dispatch]].\n */\nexport class Signal extends Observable {\n\n private observers_?: Observer[];\n\n\t/**\n\t * Initializes a new instance of the [[Signal]] class.\n\t */\n public constructor() {\n super(observer => {\n if (!this.observers_) {\n this.observers_ = [observer];\n }\n else if (this.observers_.indexOf(observer) < 0) {\n this.observers_.push(observer);\n }\n const observers = this.observers_;\n return {\n unsubscribe: () => {\n const index = observers.indexOf(observer);\n if (index >= 0) {\n observers.splice(index, 1);\n }\n }\n };\n });\n this.observers_ = [];\n }\n\n\t/**\n\t * Dispatches the given value `arg` to this signal's observers.\n\t *\n\t * @param arg The value to dispatch to observers.\n\t */\n public dispatch(arg: T) {\n if (this.observers_) {\n for (const observer of [...this.observers_]) {\n observer(arg);\n }\n }\n }\n}\n\n/**\n * Listens to an event target event and creates an observable instance\n * @param el the event target tzo listen to\n * @param event the name of the event to listen to\n */\nexport function observable( event:string, el:EventTarget ):Observable {\n\treturn new Observable( observer => {\n\t\tlet handler = ( event ) => observer( event );\n\t\tel.addEventListener( event, handler );\n\t\treturn {\n\t\t\tunsubscribe:() => {\n\t\t\t\tel.removeEventListener( event, handler );\n\t\t\t}\n\t\t}\n\t});\n}\n","import { Signal } from './Signal';\n\n/**\n * Checks whether the specified object implements [[PropertyObserver]].\n * If its possible to observe its properties\n *\n * @param obj The object that should be tested.\n */\nexport function isPropertyObserver( obj:any ):obj is PropertyObserver {\n\treturn obj && obj[ 'propertyChange' ] instanceof Signal;\n}\n\n\n/**\n * Describes the payload of the [[PropertyChangedSignal.propertyChanged]] observable.\n */\nexport interface PropertyChanged {\n\tname:string\n}\n\n\n/**\n * Types that implement this interface publish all property value changes as an [[Observable]].\n *\n * @see observeProperties that turns an object into a PropertyObserver\n */\nexport interface PropertyObserver {\n\n\t/**\n\t * Raised when a property's value has changed.\n\t *\n\t * @event\n\t */\n\tpropertyChange:Signal;\n}\n\n\n\nexport function dependProperty( target:T, targetProperty:( keyof T ), source:S, sourceProperty:( keyof S ) ) {\n\n\t// make sure the properties are observed\n\tlet targetObserved = observeProperties( target, targetProperty );\n\tlet sourceObserved = observeProperties( source, sourceProperty );\n\n\tsourceObserved.propertyChange.filter( e => e.name == sourceProperty ).subscribe( () => {\n\t\ttargetObserved.propertyChange.dispatch( { name:targetProperty as string } );\n\t});\n}\n\n\n/**\n * Observes a list of properties\n * @param target The model to observe properties on\n * @param properties The list of property name to observe\n */\nexport function observeProperties(target:T, ...properties:(keyof T)[] ):T&PropertyObserver {\n\n\t// do not observe any null / undefined targets\n\tif( !target ) return;\n\n\tlet t = target as T&PropertyObserver;\n\n\t// make sure signal exists\n\tif( !t.propertyChange ) t.propertyChange = new Signal();\n\n\t// if there are no properties take all properties of the target\n\tif( properties.length == 0 ) properties = Object.keys( t ) as (keyof T)[];\n\n\t// loop over properties an check if there are accessors\n\tlet obj:any = {};\n\tfor ( const prop of properties ) {\n\n\t\t// no accessors for propertyChanged\n\t\tif( prop == 'propertyChange' ) continue;\n\n\t\t// lookup prototype chain for property descriptor\n\t\tlet c = t;\n\t\tlet desc;\n\t\twhile( c != null && desc == null ) {\n\t\t\tdesc = Object.getOwnPropertyDescriptor( c, prop );\n\t\t\tc = Object.getPrototypeOf( c );\n\t\t}\n\n\t\t// if property does not exist on target add undefined accessor\n\t\tif( !desc ) {\n\t\t\tobj[ prop ] = undefined;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// check if it has already a getter/setter - do nothing\n\t\tif( desc.get || desc.set ) continue;\n\n\t\tobj[ prop ] = target[ prop ];\n\t}\n\n\t// generate accessors for all props\n\tfor( let attr in obj ) {\n\n\t\t// create dynamic property\n\t\tObject.defineProperty( t, attr, {\n\t\t\tget() {\n\t\t\t\treturn obj[ attr ];\n\t\t\t},\n\t\t\tset( value ) {\n\t\t\t\tlet old = obj[ attr ];\n\t\t\t\tif( old !== value ) {\n\t\t\t\t\tobj[ attr ] = value;\n\t\t\t\t\tt.propertyChange.dispatch( { name:attr } );\n\t\t\t\t}\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true\n\t\t});\n\t}\n\n\treturn t;\n}\n\n\n\n\n/**\n * A guard that checks whether the specified object implements [[ArrayObserver]].\n *\n * @param obj The object that should be tested.\n */\nexport function isArrayObserver( obj:any ):obj is ArrayObserver {\n\treturn obj && obj[ 'arrayChange' ] instanceof Signal;\n}\n\n\n/**\n * Arrays that implement this interface observe changes on the array itself\n *\n */\nexport interface ArrayObserver {\n\n\t/**\n\t * Raised when the items of the array have changed.\n\t *\n\t * @event\n\t */\n\tarrayChange:Signal<{}>;\n}\n\n/**\n * Observes an array on changes\n */\nexport function observeArray( a:Array ):Array&ArrayObserver {\n\n\t// do not observe other than arrays\n\tif( !Array.isArray( a ) ) return;\n\n\tlet t = a as Array&ArrayObserver;\n\n\t// check if its already observed\n\tif( t.arrayChange ) return t;\n\n\tt.arrayChange = new Signal();\n\n\tfor (const method of [ 'push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse' ] ) {\n\t\tconst org = t[method];\n\t\t// overwrite function to inject signal notification\n\t\tt[method] = function ( ...args ) {\n\t\t\tconst res = org.apply( this, args );\n\t\t\tt.arrayChange.dispatch({});\n\t\t\treturn res;\n\t\t}\n\t}\n\n\treturn t;\n}\n","import { Expression } from \"./Expression\";\nimport { TemplateContext } from \"../Template\";\nimport { Observable, observable, Signal, Subscription } from \"../../Signal\";\nimport { compile } from \"../Compiler\";\n\n/**\n * Super class of expressions that will invoke a closure on observable dispatch.\n */\nexport class ClosureExpression extends Expression {\n\n\tsubscription: Subscription;\n\n\n\tconstructor( context:TemplateContext, expression:string ) {\n\t\tsuper( context );\n\t\tthis.expression = compile( expression, [ 'event','data' ] );\n\t}\n\n\tsubscribe( observable:Observable ) {\n\t\tthis.unsubscribe();\n\t\tthis.subscription = observable.subscribe( this.invoke.bind( this ) );\n\t}\n\n\tunsubscribe() {\n\t\tif( this.subscription ) this.subscription.unsubscribe();\n\t}\n\n\tinvoke( event ) {\n\t\tthis.expression.call( this.context, event, this.context.data );\n\t}\n\n\tdestroy() {\n\t\tthis.unsubscribe();\n\t}\n}\n\n\n/**\n * This class subscribes node events and invokes the corresponding closure like:
\n */\nexport class NodeEventExpression extends ClosureExpression {\n\n\tevent:string;\n\tnode:Node;\n\n\tconstructor( context:TemplateContext, expression:string, event:string, node:Node ) {\n\t\tsuper( context, expression );\n\t\tthis.event = event;\n\t\tthis.node = node;\n\n\t\tthis.updateSubscription();\n\t}\n\n\tupdateSubscription() {\n\t\tthis.subscribe( observable( this.event, this.node ) );\n\t}\n}\n\n\n\n","import { Expression } from \"./Expression\";\nimport { TemplateContext } from \"../Template\";\nimport { compile, getContent, replace } from \"../Compiler\";\nimport { isPropertyObserver, PropertyChanged, observeProperties, PropertyObserver, observeArray } from \"../../Observer\";\nimport { Subscription } from \"../../Signal\";\n\n/**\n * Super class of expression that will render something into to dom\n */\nexport abstract class RenderExpression extends Expression {\n\n\n\troot:ObjectSubscriber;\n\n\n\tconstructor( context:TemplateContext, expression:string ) {\n\t\tsuper( context );\n\t\tthis.expression = compile( expression, [ 'data' ] );\n\t\tthis.trace();\n\t\tthis.subscribe();\n\t}\n\n\n\t/**\n\t * updates the dom when the data changes\n\t */\n\tabstract update();\n\n\n\t/**\n\t * The inital render call is called to render the first time\n\t */\n\tinital() {\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Implements subscribe to listen on changes of context data\n\t */\n\tsubscribe() {\n\t\tthis.root.subscribeTo( this.context.data );\n\t}\n\n\n\tdestroy() {\n\t\tthis.root.destroy();\n\t}\n\n\n\t/**\n\t * Traces the expression to collect property access\n\t */\n\ttrace() {\n\n\t\tthis.root = new ObjectSubscriber( this );\n\n\t\tvar trapper = {\n\t\t\thas: () => {\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tget:( t, key, p ) => {\n\n\t\t\t\tif( key == Symbol.unscopables ) return {};\n\t\t\t\tif( key == Symbol.toPrimitive ) return ( hint ) => {\n\t\t\t\t\tif( hint == 'number' ) return 1;\n\t\t\t\t\treturn '';\n\t\t\t\t};\n\n\t\t\t\t// check blacklisted global vars\n\t\t\t\t// *this* is the access on the this context in IE Edge Legacy\n\t\t\t\tif( [ 'JSON', 'Math', '*this*' ].indexOf( key ) >= 0 ) return;\n\n\t\t\t\t// handle data access\n\t\t\t\tif( key == 'data' && t == this.root ) return t;\n\n\n\t\t\t\t// create objectobserver for property if there is not already one.\n\t\t\t\tif( !t.properties.has( key ) ) {\n\t\t\t\t\tt.properties.set( key, new ObjectSubscriber( t.expression ) );\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy( t.properties.get( key ), trapper );\n\t\t\t},\n\t\t}\n\n\n\t\tthis.expression.call( this.context, new Proxy( this.root, trapper ) );\n\t}\n\n\n\t/**\n\t * Helper function that returns the value of the expression\n\t */\n\tgetExpressionValue() {\n\t\treturn this.expression.call( this.context, this.context.data );\n\t}\n}\n\n\nconst booleanAttributes = {\n\t'checked': [\n\t\tHTMLInputElement,\n\t],\n\t'disabled': [\n\t\tHTMLButtonElement,\n\t\tHTMLFieldSetElement,\n\t\tHTMLInputElement,\n\t\tHTMLOptGroupElement,\n\t\tHTMLOptionElement,\n\t\tHTMLSelectElement,\n\t\tHTMLTextAreaElement,\n\t],\n\t'selected': [\n\t\tHTMLOptionElement,\n\t],\n\t'hidden': [\n\t\tElement,\n\t],\n\t'readonly': [\n\t\tHTMLInputElement,\n\t\tHTMLTextAreaElement,\n\t],\n\t'required': [\n\t\tHTMLInputElement,\n\t\tHTMLTextAreaElement,\n\t\tHTMLSelectElement,\n\t],\n};\n\n/**\n * This class monitors expression on node attributes like:
\n */\nexport class AttributeExpression extends RenderExpression {\n\n\tnode:Element;\n\tattribute:Attr;\n\tboolean:boolean;\n\n\tconstructor( node:Element, attribute:Attr, context:TemplateContext ) {\n\t\tsuper( context, attribute.value );\n\t\tthis.node = node;\n\t\tthis.attribute = attribute;\n\t\tthis.boolean = booleanAttributes[ attribute.name ]?.some( elementType => node instanceof elementType );\n\t}\n\n\tupdate() {\n\t\t// handle input value\n if( this.node instanceof HTMLInputElement || this.node instanceof HTMLTextAreaElement ) {\n if( this.attribute.name == 'value' || this.attribute.name == 'checked' ) {\n this.node[ this.attribute.name ] = this.getExpressionValue();\n }\n }\n\n\t\tif( this.boolean ) {\n\t\t\tif( this.getExpressionValue() ) {\n\t\t\t\tthis.node.setAttribute( this.attribute.name, 'true' );\n\t\t\t} else {\n\t\t\t\tthis.node.removeAttribute( this.attribute.name );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.node.setAttribute( this.attribute.name, this.getExpressionValue() );\n\t\t}\n\t}\n}\n\n\n/**\n * This class monitors expression on node class attibute like:
\n * It supports the object syntax for classes: [[ { 'demo':true } ]]\n */\nexport class CSSExpression extends AttributeExpression {\n\n\texpressionString:string;\n\n\tconstructor( node:Element, attribute:Attr, context:TemplateContext ) {\n\t\tsuper( node, attribute, context );\n\t\tthis.expressionString = attribute.value;\n\t}\n\n\tgetExpressionValue() {\n\t\t// replace all parts of the template for exp. \"static [[ exp1 ]] demo [[ exp2 ]]\"\n\t\treturn replace( this.expressionString, ( match ) => {\n\t\t\tlet value = compile( match ).call( this.context, this.context.data );\n\n\t\t\t// if its an object handle\n\t\t\tif( value && typeof value == 'object' ) return Object.keys( value ).filter( key => value[key] ).join( ' ' );\n\n\t\t\treturn value;\n\t\t});\n\t}\n}\n\n\n\n/**\n * This class monitors expression on text nodes like:
[[ my expression ]]
\n */\nexport class TextExpression extends RenderExpression {\n\n\tnode:Node;\n\n\tconstructor( node:Node, context:TemplateContext ) {\n\t\tsuper( context, node.nodeValue );\n\t\tthis.node = node;\n\t}\n\n\tupdate() {\n\t\tthis.node.nodeValue = this.context.empty( this.getExpressionValue() );\n\t}\n}\n\n\n\n/**\n * A helper class to manage subscriptions on objects with a given set of properties\n */\nclass ObjectSubscriber {\n\n\tsubscription:Subscription;\n\tproperties:Map;\n\texpression:RenderExpression;\n\n\tconstructor( exp:RenderExpression ) {\n\t\tthis.properties = new Map();\n\t\tthis.expression = exp;\n\t}\n\n\n\tsubscribeTo( obj:any ) {\n\n\t\tthis.unsubscribe();\n\n\t\t// do not subscribe on undefined\n\t\tif( !obj ) return;\n\n\t\t// do not subscribe on anythinf else than object\n\t\tif( !( obj instanceof Object) ) return;\n\n\t\t// check if we have properties to listen\n\t\tif( !this.hasProperties() ) return;\n\n\t\t// subscribe on arrays\n\t\tif( Array.isArray( obj ) ) {\n\t\t\tthis.subscription = observeArray( obj ).arrayChange.subscribe( this.onArrayChange.bind( this ) );\n\n\t\t// subscribe to object\n\t\t} else {\n\t\t\t// observe properties of expression in given obj\n\t\t\tlet props =[ ...this.properties.keys() ];\n\t\t\tprops.unshift( obj );\n\t\t\tlet obs = observeProperties.apply( null, props ) as PropertyObserver;\n\n\t\t\t// subscribe to changes on obj\n\t\t\tthis.subscription = obs.propertyChange.subscribe( this.onObjectChange.bind( this ) );\n\t\t}\n\n\n\t\t// subscribe child properties\n\t\tthis.properties.forEach( ( value, key ) => {\n\t\t\tvalue.subscribeTo( obj[ key ] );\n\t\t});\n\t}\n\n\n\tunsubscribe() {\n\t\tif( this.subscription ) this.subscription.unsubscribe();\n\t\tthis.properties.forEach( ( value, key ) => {\n\t\t\tvalue.unsubscribe();\n\t\t});\n\t}\n\n\n\tonObjectChange( e:{ name:string } ) {\n\n\t\t// check if this expression has the changed property\n\t\tlet obj = this.properties.get( e.name );\n\t\tif( obj ) {\n\n\t\t\t// update expression content\n\t\t\tthis.expression.update();\n\n\t\t\t// if the changed propery has sub properties we need to resubscribe\n\t\t\tif( obj.hasProperties() ) this.expression.subscribe();\n\t\t}\n\t}\n\n\tonArrayChange( e ) {\n\t\t// update expression content\n\t\tthis.expression.update();\n\n\t\t// resubscribe if there is an access on array indices/properties = 0,1,...\n\t\tif( this.properties.size > 0 ) {\n\t\t\tthis.expression.subscribe();\n\t\t}\n\t}\n\n\n\thasProperties() {\n\t\treturn this.properties.size > 0;\n\t}\n\n\tdestroy() {\n\n\t\tthis.unsubscribe();\n\n\t\tfor (const child of this.properties.values() ) {\n\t\t\tchild.destroy();\n\t\t}\n\n\t\tthis.properties = new Map();\n\t}\n}\n","import { isScope } from '../../components/Scope';\nimport { isPropertyObserver, observeArray, observeProperties } from '../../Observer';\nimport { Observable, Signal, Subscription } from '../../Signal';\nimport { compile } from '../Compiler';\nimport { Template } from '../Template';\nimport { create, invokeInit, View } from '../View';\nimport { ClosureExpression, NodeEventExpression } from './ClosureExpression';\nimport { Expression, hasInital, snakeToCamel } from './Expression';\nimport { AttributeExpression, RenderExpression } from './RenderExpression';\n\n\n/**\n * This class monitors expression on the node view attribute like:
\n */\nexport class ViewExpression extends AttributeExpression {\n\n\texpressions: Expression[];\n\ttemplate: Template;\n\tview: View;\n\tmergers: Array;\n\trerenderCheck: RerenderCheck;\n\tinnerTemplates: Array<{ name:string, template:string, data:string }>;\n\n\tconstructor( node: Element, template: Template ) {\n\t\tsuper( node, node.attributes.getNamedItem( 'view' ), template.context );\n\t\tthis.template = template;\n\t\tthis.expressions = [];\n\t\tthis.mergers = [];\n\n\t\tthis.parseAttributes();\n\t\tthis.parseInnerTemplates();\n\n\t\tthis.rerenderCheck = new RerenderCheck( this );\n\t}\n\n\tinital() {\n\t\tthis.renderView();\n\t}\n\n\n\tupdate() {\n\t\t// flag rerendering\n\t\tthis.rerenderCheck.flag = true;\n\t}\n\n\trenderView() {\n\n\t\t// remove render checker\n\t\tthis.rerenderCheck.unsubscribe();\n\n\t\t// restore original attribute values from mergers\n\t\tfor( const merger of this.mergers ) {\n\t\t\tmerger.reset();\n\t\t}\n\t\t// delete old mergers\n\t\tthis.mergers = [];\n\n\t\t// destroy old view if there is any\n\t\tif( this.view ) this.view.destroy();\n\n\t\tlet viewName = this.getExpressionValue();\n\n\t\t// create view baed on its context\n\t\tthis.view = create( viewName, this.context );\n\n\t\t// stop rendering if there is no valid view\n\t\tif( !this.view ) return;\n\n\n\t\t// inital execute render expression so the view data is correctly set\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( hasInital( expr ) ) expr.inital();\n\t\t} );\n\n\t\t// check for scope view that need the inner content of this node\n\t\tif( isScope( this.view ) ) this.view.prepareContent( this.node, this.template );\n\n\t\t// register inner templates\n\t\tfor (const template of this.innerTemplates ) {\n\t\t\t// if there is a template expression for the data invoke it with this context.\n\t\t\tconst data = ( template.data ) ? compile( template.data, [ 'data' ] ).call( this.context, this.context.data ) : this.context.data;\n\t\t\tthis.view.registry.add( template.name, () => new View( { template:template.template, data } ) );\n\t\t}\n\n\t\t// render the view to merge it afterwards\n\t\tthis.view.template.render();\n\n\t\t// properly set the view attribute based on the registred key\n\t\tthis.node.setAttribute( 'view', this.getViewName( viewName ) );\n\n\t\t// define what attributes should merge from outside/inside\n\t\tthis.mergeNodes();\n\n\n\t\t// subscribe on data events after render\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( expr instanceof DataEventExpression ) expr.updateSubscription();\n\t\t} );\n\n\t\t// make sure rerender check is last\n\t\tthis.rerenderCheck.subscribe();\n\n\t\t// call init after node is correctly set\n\t\tinvokeInit( this.view );\n\t}\n\n\n\n\n\t/**\n\t * Parses node attributes of this view node\n\t */\n\tparseAttributes() {\n\n\t\tlet attrs = Array.prototype.slice.call( this.node.attributes );\n\n\t\tfor( const attr of attrs ) {\n\n\n\t\t\t// check on data expression\n\t\t\tif( attr.name == 'data' ) {\n\t\t\t\tlet dataExpr = new DataExpression( this, attr.value );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.unshift( dataExpr ); // make sure data is set first\n\t\t\t}\n\n\t\t\t// check on data attribite expression\n\t\t\tif( attr.name.indexOf( 'data-' ) == 0 ) {\n\t\t\t\tlet expr = new DataAttributeExpression( this, attr.value, snakeToCamel( attr.name.substring( 5 ) ) );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\n\t\t\t// handle propertyChanged events\n\t\t\tif( attr.name.indexOf( 'on-data-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-data-', '' ) );\n\t\t\t\tlet eventExpression = new AttributeEventExpression( this, attr.value, event );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( eventExpression );\n\t\t\t}\n\n\t\t\t// handle custom signal events\n\t\t\tif( attr.name.indexOf( 'on-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-', '' ) );\n\t\t\t\tlet expr = new SignalEventExpression( this, attr.value, event );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\n\t\t}\n\t}\n\n\n\tparseInnerTemplates( ) {\n\t\tconst templateNodes = this.node.querySelectorAll( 'template' );\n\t\tthis.innerTemplates = Array.from( templateNodes ).map( node => {\n\t\t\treturn {\n\t\t\t\tname: node.getAttribute( 'name' ),\n\t\t\t\ttemplate: node.innerHTML,\n\t\t\t\tdata: node.getAttribute( 'data' )\n\t\t\t}\n\t\t});\n\t}\n\n\n\tdestroy() {\n\t\tif( this.view ) this.view.destroy();\n\t\tfor( const exp of this.expressions ) {\n\t\t\texp.destroy();\n\t\t}\n\t\tthis.rerenderCheck.unsubscribe();\n\t}\n\n\n\n\t/**\n\t * Merges inner view node with the other view node.\n\t */\n\tmergeNodes() {\n\n\t\t// get all attributes from outside and inside and make them unique\n\t\tlet attributes = Array.prototype.slice.call( this.node.attributes ).concat( Array.prototype.slice.call( this.view.node.attributes ) ).map( attr => attr.name );\n\t\tattributes = attributes.filter( ( item, i ) => attributes.indexOf( item ) === i );\n\n\t\t// merge each attribute\n\t\tattributes.forEach( attr => {\n\n\t\t\tlet merger = new AttributeMerger( this.node, attr );\n\t\t\tmerger.setupInner( this.view.template );\n\t\t\tmerger.setupOuter( this.template );\n\t\t\tmerger.update();\n\n\t\t\tthis.mergers.push( merger );\n\t\t} );\n\n\t\t// empty target node\n\t\tthis.node.innerHTML = '';\n\n\t\t// copy children\n\t\twhile( this.view.node.hasChildNodes() ) {\n\t\t\tthis.node.appendChild( this.view.node.firstChild );\n\t\t}\n\n\n\t\t// adjust event expressions to new node\n\t\tlet eventExpressions = this.view.template.filterExpressions( expr => expr instanceof NodeEventExpression && expr.node == this.view.node ) as NodeEventExpression[];\n\t\teventExpressions.forEach( expr => {\n\t\t\texpr.node = this.node;\n\t\t\texpr.updateSubscription(); // will reregister on new target\n\t\t} );\n\n\t\t// properly setup node refenrence\n\t\tthis.view.template.node = this.node;\n\n\t}\n\n\n\tgetViewName( key: any ) {\n\t\tif( typeof key == 'string' ) return key;\n\t\tif( typeof key == 'function' ) return key.toString().match( /function\\s(.*?)\\(/ )[ 1 ];\n\t\tif( typeof key == 'object' && key !== null ) {\n\t\t\t// match es6 class\n\t\t\tlet m = key.constructor.toString().match( /class\\s(.*?)\\s/ );\n\t\t\tif( m ) return m[ 1 ];\n\t\t\t// match es5 class\n\t\t\tm = key.constructor.toString().match( /function\\s(.*?)\\(/ );\n\t\t\tif( m ) return m[ 1 ];\n\t\t}\n\t\treturn '';\n\t}\n\n}\n\n\n/**\n * This class monitors expression on data attributes like:
\n */\nclass DataAttributeExpression extends RenderExpression {\n\n\tattribute: string;\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, attribute: string ) {\n\t\tsuper( viewExpression.context, expression );\n\t\tthis.attribute = attribute;\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdate() {\n\t\tthis.viewExpression.view.data[ this.attribute ] = this.getExpressionValue();\n\t}\n}\n\n/**\n * This class monitors expression on data the attributes like:
\n */\nclass DataExpression extends RenderExpression {\n\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, templateString: string ) {\n\t\tsuper( viewExpression.context, templateString );\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tinital() {\n\t\tthis.viewExpression.view.data = this.getExpressionValue();\n\t}\n\n\tupdate() {\n\t\t// flag rerendering\n\t\tthis.viewExpression.rerenderCheck.flag = true;\n\t}\n}\n\n\n\n\n/**\n * Super\n */\nclass DataEventExpression extends ClosureExpression {\n\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, expression: string ) {\n\t\tsuper( viewExpression.context, expression );\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdateSubscription() {\n\n\t}\n}\n/**\n * This class monitors expression of data events like:
\n */\nclass AttributeEventExpression extends DataEventExpression {\n\n\tattribute: string;\n\tarraySubscription:Subscription;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, attribute: string ) {\n\t\tsuper( viewExpression, expression );\n\t\tthis.attribute = attribute;\n\t}\n\n\tupdateSubscription() {\n\n\t\tlet data = this.viewExpression.view.data as any;\n\n\t\t// register on view data\n\t\tlet d = observeProperties( data, this.attribute );\n\t\tthis.subscribe( d.propertyChange.filter( e => e.name == this.attribute ) );\n\n\t\t// register on array changes if its an array attribute\n\t\tlet value = data[ this.attribute ];\n\t\tif( Array.isArray( value ) ) this.subscribeArray( observeArray( value ).arrayChange );\n\n\t\t// inital invoke to adjust values outside\n\t\tthis.invoke();\n\t}\n\n\tinvoke() {\n\t\tsuper.invoke( { name: this.attribute, value: this.viewExpression.view.data[ this.attribute ] } );\n\t}\n\n\tsubscribeArray( observable:Observable ) {\n\t\tthis.unsubscribeArray();\n\t\tthis.arraySubscription = observable.subscribe( this.invoke.bind( this ) );\n\t}\n\n\tunsubscribeArray() {\n\t\tif( this.arraySubscription ) this.subscription.unsubscribe();\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\tthis.unsubscribeArray();\n\t}\n}\n\n/**\n * This class subscribes model signals and invokes the corresponding closure like:
\n */\nclass SignalEventExpression extends DataEventExpression {\n\n\tsignalName: string;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, signalName: string ) {\n\t\tsuper( viewExpression, expression );\n\t\tthis.signalName = signalName;\n\t}\n\n\tupdateSubscription() {\n\n\t\t// check for valid signal and subscribe\n\t\tlet signal = this.viewExpression.view.data[ this.signalName ];\n\t\tif( signal instanceof Signal ) {\n\t\t\tthis.subscribe( signal );\n\t\t}\n\t}\n}\n\n\nclass AttributeMerger {\n\n\tnode: Element;\n\tattr: string;\n\tinner: AttributeExpression;\n\touter: AttributeExpression;\n\n\tconstructor( node: Element, attr: string ) {\n\t\tthis.node = node;\n\t\tthis.attr = attr;\n\t}\n\n\tsetupInner( template: Template ) {\n\t\tthis.inner = template.filterExpressions( expr => expr instanceof AttributeExpression && expr.node == template.node && expr.attribute.name == this.attr )[ 0 ] as AttributeExpression;\n\t\tif( this.inner && !( this.inner instanceof ViewExpression ) ) {\n\t\t\t// use merge function to update\n\t\t\tthis.inner.update = this.update.bind( this );\n\t\t} else {\n\t\t\t// create dummy expression for later use\n\t\t\tthis.inner = new AttributeExpression( template.node, this.getAttrOf( template.node ), template.context );\n\t\t}\n\t}\n\n\tsetupOuter( template: Template ) {\n\t\tthis.outer = template.filterExpressions( expr => expr instanceof AttributeExpression && expr.node == this.node && expr.attribute.name == this.attr )[ 0 ] as AttributeExpression;\n\t\tif( this.outer && !( this.outer instanceof ViewExpression ) ) {\n\t\t\tthis.outer.update = this.update.bind( this );\n\t\t} else {\n\t\t\tthis.outer = new AttributeExpression( this.node, this.getAttrOf( this.node ), template.context );\n\t\t}\n\t}\n\n\n\tupdate() {\n\n\t\tlet outerContent = this.outer.getExpressionValue();\n\t\tlet innerContent = this.inner.getExpressionValue();\n\n\t\t// handle class attribute to join inner & outer classes\n\t\tif( this.attr == 'class' ) {\n\n\t\t\tlet classes = ( outerContent + ' ' + innerContent ).split( ' ' ).filter( c => c.length > 0 );\n\t\t\tlet list = this.node.classList;\n\n\t\t\tthis.node.setAttribute( 'class', '' ); // reset\n\t\t\tlist.add.apply( list, classes );\n\n\t\t\t// handle all regular attributes where inner wins\n\t\t} else {\n\t\t\tthis.node.setAttribute( this.attr, innerContent ? innerContent : outerContent );\n\t\t}\n\t}\n\n\tgetAttrOf( node: Element ) {\n\t\tlet attr = node.attributes[ this.attr ];\n\t\tif( !attr ) attr = { name: this.attr, value: '' };\n\t\treturn attr;\n\t}\n\n\treset() {\n\t\tthis.node.setAttribute( this.attr, this.outer.getExpressionValue() );\n\t}\n\n}\n\n\n\nclass RerenderCheck {\n\n\tsubscription: Subscription;\n\tflag: boolean = false;\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression ) {\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdate() {\n\t\tif( this.flag ) this.viewExpression.renderView();\n\t\tthis.flag = false;\n\t}\n\n\tsubscribe() {\n const data = this.viewExpression.context.data;\n this.subscription = isPropertyObserver( data ) ? data.propertyChange.subscribe( this.update.bind( this ) ) : null;\n\t}\n\n\tunsubscribe() {\n\t\tthis.subscription?.unsubscribe();\n\t}\n}\n","import { Registry } from '../Registry';\nimport { Template, TemplateContext } from './Template';\n\n\n\n\nexport interface ViewConfig {\n\tdata?:TData,\n\ttemplate?:string|Element,\n\tregistry?:ViewRegistry,\n}\n\n\n/**\n * A common view class that has a container to render content/template into.\n */\nexport class View {\n\n\tprivate _template:Template;\n\n\tconstructor( config:ViewConfig = {} ) {\n\n\t\tthis._template = new Template( config.template );\n\n\t\tif( config.registry ) this._template.context.registry = config.registry;\n\t\tif( config.data ) this._template.context.data = config.data;\n\n\t\tthis._template.context.view = this;\n\t}\n\n\n\t/**\n\t * Renders the view template.\n\t * If an empty target is given, the template is rendered into to given target.\n\t * If the target is not empty, the content of the target is used as the template.\n\t */\n\tpublic render() {\n\n\t\t// do rendering of template\n\t\tthis._template.render();\n\n\t\t// everything is ready now we can invoke view's init\n\t\tinvokeInit( this );\n\t}\n\n\t/**\n\t * The init function is automatically called after the render function.\n\t * So everything is rendered and the node is ready to be used.\n\t * Overwrite the init function for custom dom manipulations.\n\t */\n\tpublic init() {\n\n\t}\n\n\t/**\n\t * Destroys properly the view\n\t */\n\tdestroy() {\n\t\tthis._template.destroy();\n\t\tinvokeDeinit( this );\n\t}\n\n\t/**\n\t * The deinit function is automatically called after the view is destroyed.\n\t * Use it to unsubscribe signals etc\n\t */\n\tpublic deinit() {\n\n\t}\n\n\n\t/**\n\t * Returns the root node of the view\n\t */\n\tget node():Element {\n\t\treturn this._template.node;\n\t}\n\n\tget data():TData {\n\t\treturn this._template.context.data as TData;\n\t}\n\tset data( d:TData ) {\n\t\tthis._template.context.data = d;\n\t}\n\n\tget context() {\n\t\treturn this._template.context;\n\t}\n\tget registry() {\n\t\treturn this._template.context.registry;\n\t}\n\tget template() {\n\t\treturn this._template;\n\t}\n}\n\n\n/**\n * A registry to lookup views\n */\nexport class ViewRegistry extends Registry {}\n\n\n/**\n * A factory function that creates a view based on the given key to lookup and its context\n */\nexport function create( key:any, context:TemplateContext ) {\n\n\t/**\n\t * Lookups the viewName in the template context registry.\n\t * Furthermore it lookups in all parent template contexts\n\t */\n\tfunction lookup( key:any, context:TemplateContext ) {\n\n\t\twhile( context ) {\n\t\t\tlet found = context.registry.get( key );\n\t\t\tif( found ) return found;\n\t\t\tcontext = context.parent;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tlet factory = lookup( key, context );\n\n\t// no view found with name\n\tif( !factory ) throw new Error( \"No registered view found with name: \" + key );\n\n\tlet view = factory( key );\n\n\t/// inject parent template in context\n\tview.template.extendContext( context );\n\n\treturn view;\n}\n\n\n/**\n * Internal helper function that executes init functions on view & data\n */\nexport function invokeInit( v:View ) {\n\tif( v.data && typeof v.data[ 'init' ] == 'function' ) v.data.init();\n\tv.init();\n}\n\n/**\n * Internal helper function that executes init functions on view & data\n */\nexport function invokeDeinit( v:View ) {\n\tif( v.data && typeof v.data[ 'deinit' ] == 'function' ) v.data.deinit();\n\tv.deinit();\n}\n","import { Template } from \"../view/Template\";\n\nexport interface Scope {\n\tprepareContent( node:Element, template:Template );\n}\n\n/**\n * A guard that checks whether the specified object is a [[Scope]].\n *\n * @param obj The object that should be tested.\n */\nexport function isScope( obj:any ):obj is Scope {\n\treturn obj && obj[ 'prepareContent' ];\n}\n\n","import { compile } from './view/Compiler';\nimport { context } from './view/Template';\n\nvar _source = {};\n\nexport function source( obj:{} ) {\n\t_source = obj;\n};\n\n/**\n * translates the given key.\n */\nexport function translate( key:string, opts:{ data?:any, condition?:number } = {} ):any {\n\tif( key == undefined ) return '';\n\n\tvar def = lookup( key );\n\tif( opts.condition != undefined ) def = matchCondition( def, opts.condition );\n\tif( opts.data ) def = compile( def ).call( context, opts.data );\n\n\treturn def;\n}\n\nfunction matchCondition( value:string, num:number ) {\n\n\tvar parts = value.split( '|' );\n\n\t// check conditions\n\tvar found = parseConditions( parts, num )\n\tif( found ) return found.trim();\n\n\tif( parts.length == 1 ) return clearConditions( parts[0] );\n\n\t// check simple | split\n\treturn clearConditions( parts[ ( num == 1 ) ? 0 : 1 ] );\n}\n\n\nfunction parseConditions( parts, number:number ):string {\n\t// loop over parts\n\tfor( var i = 0; i < parts.length; i++ ) {\n\t\tvar regex = /^[\\{\\[]([^\\[\\]\\{\\}]*)[\\}\\]](.*)/;\n\t\tvar match = regex.exec( parts[i] );\n\n\t\t// no proper condition\n\t\tif( match == null || match.length != 3 ) continue;\n\n\t\tvar value = match[2];\n\t\tvar condition = match[1];\n\t\tvar num = number;\n\n\t\t// range condition\n\t\tif( condition.indexOf( ',' ) > -1 ) {\n\n\t\t\tvar [ from , to ] = condition.split( ',' );\n\n\t\t\tif ( to == '*' && num >= parseInt( from ) ) {\n\t\t\t\treturn value;\n\t\t\t} else if ( from == '*' && num <= parseInt( to ) ) {\n\t\t\t\treturn value;\n\t\t\t} else if ( num >= parseInt( from ) && num <= parseInt( to ) ) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t// exact condition\n\t\t} else if( parseInt( condition ) == num ) {\n\t\t\treturn value;\n\t\t}\n\t}\n}\n\nfunction clearConditions( s:string ):string {\n\treturn s.replace( /^[\\{\\[]([^\\[\\]\\{\\}]*)[\\}\\]]/, '' ).trim();\n}\n\nfunction lookup( key:string ) {\n\n\t// translate `x.y` to `data[\"x\"][\"y\"]` which is safe even when special chars are present:\n\tlet template = '[[ data' + key.split( '.' ).map( k => '[\"' + k + '\"]' ).join( '' ) + ' ]]';\n\n\t// lookup property / string in source\n\tlet result = compile( template ).call( context, _source );\n\n\t// return result only if its a valid string otherwise return key\n\treturn ( typeof result == 'string' ) ? result : key;\n}\n","import { source } from './Lang';\nimport { map, ModelRegistry } from './Model';\nimport { HttpRequest } from './Request';\nimport { compile, empty, log } from './view/Compiler';\n\n\nexport interface SetupConfig {\n\troutes?:{ [key:string]:{ url:string, method?:string, headers?:{ [key:string]:string } } },\n\tdata?:{ [key:string]:{} },\n\tassets?:{ [key:string]:{ url:string, type?:'js'|'css' } },\n\tlang?:{},\n}\n\nvar config:SetupConfig;\n\nexport function setup( c:SetupConfig, registry?:ModelRegistry ) {\n\tconfig = c;\n\n\t// setup lang translations\n\tif( config.lang ) source( config.lang );\n\n\t// map data if there is data and a registry\n\tif( config.data && registry ) {\n\t\tconfig.data = map( config.data, registry );\n\t}\n}\n\nexport function data( key:string ):any {\n\treturn lookup( key, config.data );\n}\n\nexport function asset( key ):Asset {\n\treturn new Asset( lookup( key, config.assets ) );\n}\n\n\nexport function route( key:string, urlParams:{} = {} ):HttpRequest {\n\tlet c = lookup( key, config.routes );\n\n\tif( !c ) throw new Error( \"Route: '\" + key + \"' could not be found in setup routes.\" );\n\n\tlet url = compile( c.url ).call( { empty:empty, log:log }, urlParams );\n\tlet request = new HttpRequest( url );\n\n\tif( c.method ) request.method( c.method );\n\tif( c.headers ) request.headers( c.headers );\n\n\treturn request;\n}\n\nfunction lookup( key:string, data:any ) {\n\treturn compile( '[[ ' + key + ' ]]' ).call( { empty:empty, log:log }, data );\n}\n\n\n\ninterface AssetConfig {\n\turl: string,\n\ttype?: \"js\" | \"css\",\n}\n\n\n\nclass Asset {\n\n\t// store which assets are already loaded.\n\tstatic promises:{ [index:string]: Promise } = {};\n\n\tconfig:AssetConfig;\n\n\n\tconstructor( config:AssetConfig ) {\n\t\tif( !config.type ) config.type = this.guessType( config.url );\n\t\tthis.config = config;\n\t}\n\n\n\tload():Promise {\n\n\t\t// if not loaded create promise\n\t\tif( !Asset.promises[ this.config.url ] ) {\n\t\t\t( this.config.type == \"js\" ) ? this.loadScript() : this.loadCSS();\n\t\t}\n\n\t\treturn Asset.promises[ this.config.url ];\n\t}\n\n\t/**\n\t * Loads a js file into dom\n\t */\n\tprivate loadScript() {\n\n\t\tvar url = this.config.url;\n\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => {\n\t\t\tvar element = document.createElement( 'script' );\n\t\t\telement.src = url;\n\t\t\telement.addEventListener( 'load', event => resolve() );\n\t\t\telement.addEventListener( 'error', event => reject() );\n\t\t\tdocument.body.appendChild( element );\n\t\t}).then( event => {\n\t\t\tthis.finalize( url );\n\t\t});\n\t}\n\n\t/**\n\t * Loads a css file into the dom\n\t */\n\tprivate loadCSS() {\n\n\t\tvar url = this.config.url;\n\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => {\n\t\t\tvar element = document.createElement( 'link' );\n\t\t\telement.type = 'text/css';\n\t\t\telement.rel = 'stylesheet';\n\t\t\telement.href = url;\n\t\t\telement.addEventListener( 'load', event => resolve() );\n\t\t\telement.addEventListener( 'error', event => reject() );\n\t\t\tdocument.head.appendChild( element );\n\t\t}).then( event => {\n\t\t\tthis.finalize( url );\n\t\t});\n\t}\n\n\tprivate finalize( url:string ) {\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => resolve() );\n\t}\n\n\t/**\n\t * Guesses the type based on the given url\n\t */\n\tprivate guessType( url:string ):\"js\"|\"css\" {\n\t\treturn ( url.split('.').pop() == \"js\" ) ? 'js' : 'css';\n\t}\n}\n\n","import { Signal } from './Signal';\nimport { Registry } from './Registry';\nimport { PropertyObserver, PropertyChanged, observeProperties } from './Observer';\n\n\n\n\n/**\n * A common model class that has getters and setters\n */\nexport class Model implements PropertyObserver {\n\n\t/**\n\t * Raised when a property's value has changed.\n\t *\n\t * @event\n\t */\n\tpublic propertyChange:Signal;\n\n\n\tconstructor( dto?:object ) {\n\t\tif( dto ) {\n\t\t\tObject.assign( this, dto );\n\t\t\tobserveProperties( this );\n\t\t}\n\t}\n}\n\n\n\n\n\n\n\n/**\n * A registry for modelName to Model class mappings\n */\nexport class ModelRegistry extends Registry {}\n\n/**\n * This helper function maps objects in the given data on registered models\n * @param data The data structure to map models\n * @param registry The registry to lookup model defintions\n * @param property the object property to lookup keys\n */\nexport function map( data:any, registry:ModelRegistry, lookup?:( obj:object ) => string ) {\n\n\tif( !lookup ) lookup = ( obj:any ) => obj.modelName || 'default';\n\n\t// handle arrays\n\tif( Array.isArray( data ) ) {\n\t\tdata = data.map( item => map( item, registry, lookup ) );\n\t}\n\n\t// handle objects\n\tif( data && data.constructor == Object ) {\n\n\t\tlet factory = registry.get( lookup( data ) );\n\n\t\tObject.keys( data ).forEach( name => {\n\t\t\tdata[ name ] = map( data[ name ], registry, lookup );\n\t\t});\n\n\t\treturn ( factory ) ? factory( data ) : data;\n\t}\n\n\treturn data;\n}\n","import { Signal } from \"./Signal\";\n\n\ninterface ProgressSignal {\n\tloaded: number,\n\ttotal: number\n}\n\n/**\n * HttpRequest Class\n */\n\nexport class HttpRequest {\n\n\tprotected _method: string = 'GET';\n\tprotected _url: string;\n\tprotected _headers: { [key: string]: string } = {};\n\tprotected request: XMLHttpRequest;\n\n\t/** @event */\n\tpublic progress: Signal = new Signal();\n\n\n\t/**\n\t * Create a new instance with the given url\n\t * @param url\n\t */\n\tconstructor(url: string) {\n\t\tthis._url = url;\n\n\t\tthis.request = new XMLHttpRequest();\n\t\tthis.request.onprogress = (event) => {\n\t\t\tthis.progress.dispatch(event);\n\t\t}\n\t}\n\n\t/**\n\t * Set the method for the request\n\t * @param method\n\t */\n\tpublic method(method: string): HttpRequest {\n\t\tthis._method = method;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the headers for the request\n\t * @param headers\n\t */\n\tpublic headers(headers: {}): HttpRequest {\n\t\tthis._headers = headers;\n\t\treturn this\n\t}\n\n\t/**\n\t * Send/Load the request without sending data\n\t */\n\tpublic load(): Promise {\n\t\treturn this.sendRequest().then(this.parseJson);\n\t}\n\n\t/**\n\t * Send the request with the given data\n\t * @param data\n\t */\n\tpublic send(data: any): Promise {\n\t\treturn this.sendRequest(data).then(this.parseJson);\n\t}\n\n\t/**\n\t * Returns the full url of the request\n\t * @returns The url of the request\n\t */\n\tpublic url(): string {\n\t\treturn this._url;\n\t}\n\n\t/**\n\t * Creates a json api request to a specific subpath.\n\t * It presets the method to POST and the headers to application/json.\n\t * It further sends the given data as json body.\n\t * @param path The relative path for the json api request\n\t * @param data The data for the json api requests\n\t */\n\tpublic jsonApi(path: string, data: object = {}): Promise {\n\t\tlet fullPath = (this._url.endsWith('/') ? this._url.slice(0, -1) : this._url) + (path.startsWith('/') ? path : '/' + path);\n\t\tlet sub = new HttpRequest(fullPath);\n\t\tsub.headers({ 'Accept': 'application/json', 'Content-Type': 'application/json', ...this._headers });\n\t\tsub.method('POST');\n\t\treturn sub.send(JSON.stringify(data)).then((reponse: { data?: object, errors?: Array; }) => {\n\t\t\tif (reponse.data) return reponse.data as unknown as Response;\n\t\t\tif (reponse.errors) {\n\t\t\t\t// TODO: Better handling of errors\n\t\t\t\tRequest.error.dispatch({ error: reponse.errors.join(',') });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Open and send the request with the given parameters\n\t * and data\n\t * @param data\n\t */\n\tprivate sendRequest(data: any = null): Promise {\n\n\t\tvar request = this.request;\n\t\tvar promise = this.promise(request);\n\n\t\trequest.open(this._method, this._url);\n\n\t\tObject.keys(this._headers).forEach(key => {\n\t\t\trequest.setRequestHeader(key, this._headers[key]);\n\t\t});\n\n\t\trequest.send(data);\n\n\t\treturn promise;\n\t}\n\n\t/**\n\t * Create a promise with the request\n\t * The promise resolves in case of a successful request - jejects otherwise\n\t */\n\tprivate promise(request: XMLHttpRequest) {\n\t\treturn new Promise((resolve, reject) => {\n\n\t\t\tvar errorHandler = function () {\n\t\t\t\tRequest.error.dispatch({ error: request.statusText });\n\t\t\t\treject(Error(request.statusText));\n\t\t\t}\n\n\t\t\trequest.onload = function () {\n\t\t\t\tif (request.status >= 200 && request.status < 300) {\n\t\t\t\t\tresolve(request.responseText);\n\t\t\t\t} else {\n\t\t\t\t\terrorHandler();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\trequest.onerror = errorHandler;\n\t\t});\n\t}\n\n\t/**\n\t * tries to parse response otherwise returns original string data\n\t */\n\tprivate parseJson(data: string): string | {} {\n\t\ttry {\n\t\t\tdata = JSON.parse(data)\n\t\t\treturn data;\n\t\t} catch (e) {\n\t\t\treturn data;\n\t\t}\n\t}\n}\n\ninterface ErrorSignal {\n\terror: string\n}\n\n/**\n * Static Request Class\n */\nexport class Request {\n\n\t/** @event */\n\tpublic static error: Signal = new Signal();\n\t/**\n\t * Creates a new post HttpRequest\n\t */\n\tpublic static post(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('POST');\n\t}\n\n\t/**\n\t * Creates a new get HttpRequest\n\t */\n\tpublic static get(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('GET');\n\t}\n\n\t/**\n\t * Creates a new put HttpRequest\n\t */\n\tpublic static put(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('PUT');\n\t}\n\n\t/**\n\t * Creates a new delete HttpRequest\n\t */\n\tpublic static delete(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('DELETE');\n\t}\n}\n","import { Subscription, observable } from '../Signal';\nimport { empty, hasExpression, log, debug } from './Compiler';\nimport { Expression, snakeToCamel } from './expressions/Expression';\nimport { ViewExpression } from './expressions/ViewExpression';\nimport { ViewRegistry } from './View';\nimport { translate } from '../Lang';\nimport { data, route, asset } from '../Setup';\nimport { isPropertyObserver } from '../Observer';\nimport { RenderExpression, TextExpression, CSSExpression, AttributeExpression } from './expressions/RenderExpression';\nimport { NodeEventExpression } from './expressions/ClosureExpression';\n\n\nexport interface TemplateContext {\n\tregistry:ViewRegistry,\n\tdata: {},\n\t[x: string]: any\n}\n\n\nexport class Template {\n\n\tpublic node:Element;\n\tpublic context:TemplateContext;\n\tpublic expressions:Array = [];\n\tpublic content:string|Element;\n\n\tprivate dataSubscription:Subscription;\n\n\tconstructor( content:string|Element ) {\n\t\tthis.content = content;\n\t\tthis.context = {\n\t\t\tdata: {},\n\t\t\tregistry: new ViewRegistry(),\n\t\t}\n\n\t\tObject.setPrototypeOf( this.context, context );\n\t}\n\n\trender() {\n\n\t\tthis.node = ( this.content instanceof Element ) ? this.content : createNode( this.content );\n\n\t\t// inject template reference\n\t\tthis.node['template'] = this;\n\n\t\t// recusive search for expression\n\t\tthis.traverse();\n\n\t\t// initial render\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( expr instanceof RenderExpression ) expr.inital();\n\t\t})\n\t}\n\n\ttraverse() {\n\n\t\t// handle children\n\t\tlet treeWalker = document.createTreeWalker( this.node, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null, false );\n\n\t\tlet current:Node = this.node;\n\n\t\twhile( current ) {\n\t\t\tthis.processNode( current as Element|Text );\n\n\t\t\t// dont dig into view nodes\n\t\t\tif( current instanceof Element && current.getAttribute( 'view' ) ) {\n\t\t\t\tcurrent = treeWalker.nextSibling();\n\t\t\t\t// there is no sibling if it is the last child - goto ancestor's sibling\n\t\t\t\tif( !current ) {\n\t\t\t\t\twhile( treeWalker.parentNode() ) {\n\t\t\t\t\t\tif( current = treeWalker.nextSibling() ) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrent = treeWalker.nextNode();\n\t\t}\n\t}\n\n\tprocessNode( node:Element|Text ) {\n\n\t\t// check on text node\n\t\tif( node instanceof Text ) {\n\n\t\t\t// only if there is an expression\n\t\t\tif( hasExpression( node.nodeValue ) ) {\n\t\t\t\tthis.expressions.push( new TextExpression( node, this.context ) );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// handle <.. view=\"...\"> nodes\n\t\tif( node.getAttribute( 'view' ) ) {\n\t\t\tthis.processAttributes( node );\n\n\t\t\tlet expr = new ViewExpression( node, this );\n\t\t\tthis.expressions.push( expr );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// handle events and attribute expressions\n\t\tthis.processAttributes( node );\n\t}\n\n\n\n\tprocessAttributes( node:Element ) {\n\n\t\tArray.prototype.slice.call( node.attributes ).forEach( ( attr:Attr ) => {\n\n\t\t\t// do not create expressions for view= and data-..= attributes\n\t\t\tif( attr.name.indexOf( 'data' ) >= 0 || attr.name == 'view' ) return;\n\n\t\t\t// handle node events\n\t\t\tif( attr.name.indexOf( 'on-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-', '' ) );\n\n\t\t\t\t// check if its a native node event - check on \"on..\" property like \"onclick\"\n\t\t\t\tif( node[ 'on' + event ] !== undefined ) {\n\t\t\t\t\tlet expr = new NodeEventExpression( this.context, attr.value, event, node );\n\t\t\t\t\tthis.expressions.push( expr );\n\t\t\t\t\tnode.removeAttribute( attr.name );\n\t\t\t\t}\n\n\t\t\t// handle attribute expressions & ignore view data attributes & ignore\n\t\t\t} else if( hasExpression( attr.value ) ) {\n\t\t\t\tlet kind = ( attr.name == \"class\" ) ? CSSExpression : AttributeExpression;\n\t\t\t\tlet expr = new kind( node, attr, this.context );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\t\t});\n\t}\n\n\n\n\tdestroy() {\n\t\tthis.expressions.forEach( expr => expr.destroy() );\n\t}\n\n\t/**\n\t * Returns an array of expressions with the given filter\n\t * @param filter the callback for the filter\n\t */\n\tfilterExpressions( filter:( expr:Expression ) => boolean ) {\n\t\treturn this.expressions.filter( filter );\n\t}\n\n\t/**\n\t * Extends this context from the given parent context.\n\t * Injecting the parent reference and setup prototype chain\n\t * @param parent The parent context\n\t */\n\textendContext( parent:TemplateContext ) {\n\t\tthis.context.parent = parent;\n\t\tObject.setPrototypeOf( this.context, parent );\n\t}\n\n}\n\n\nfunction createNode( html:string ) {\n\n\tlet template = document.createElement( 'template' );\n\ttemplate.innerHTML = html;\n\n\t// if template has one root node, return that\n\tif( template.content.children.length == 1 ) {\n\t\treturn template.content.children[0];\n\n\t// if template has multiple root nodes wrap them into a div\n\t} else {\n\t\tlet temp = document.createElement('div' );\n\t\ttemp.appendChild( template.content );\n\t\treturn temp;\n\t}\n}\n\n\n\n\n\n/**\n * The global template context that is available as \"this...\" in all template expressions\n */\nexport var context:any = {\n\tlogging: false,\n\tempty: empty,\n\tlog: ( ...params ) => {\n\t\tif( !context.logging ) return;\n\t\tlog( ...params );\n\t},\n\t// inject translations\n\ttrans: translate,\n\t// inject setup helpers\n\tsetup: {\n\t\tdata:data,\n\t\troute:route,\n\t\tasset:asset\n\t},\n\t// inject debugger\n\tdebug: () => {\n\t\tdebugger;\n\t}\n}\n\n\n/**\n * A helper function to template scan on a node or a html string.\n * @param opts.root The root node or html string to scan for expressions\n * @param opts.registry The view registry to lookup views in view=\"..\" expressions\n * @param opts.data The data passed into the template.\n */\nexport function scan( opts:{ root:Element|string, registry?:ViewRegistry, data?:any } ) {\n\tlet template = new Template( opts.root );\n\n\t// setup registry\n\tif( opts.registry ) template.context.registry = opts.registry;\n\n\t// setup data\n\tif( opts.data ) template.context.data = opts.data;\n\n\ttemplate.render();\n\n\treturn template;\n}\n\n\n\n\n\n\n\n","import { Model } from \"../Model\";\nimport { observeArray, observeProperties } from \"../Observer\";\nimport { Subscription } from \"../Signal\";\nimport { Template } from \"../view/Template\";\nimport { View } from \"../view/View\";\nimport { Scope } from \"./Scope\";\n\n\nexport class Repeat extends View implements Scope {\n\n\tprotected itemTemplate: string;\n\tprotected arraySubscription: Subscription;\n\tprotected dataSubscription: Subscription;\n\n\tprotected cache: Map = new Map();\n\tprotected templates: Array