From 2784ae0ade80ef8aff81bd401458466f995863fa Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 25 Apr 2017 16:09:41 -0400 Subject: [PATCH 01/31] parse transition directives --- src/parse/read/directives.js | 64 +++++++++++++----- src/parse/state/tag.js | 8 ++- .../samples/transition-intro/input.html | 1 + .../samples/transition-intro/output.json | 65 +++++++++++++++++++ 4 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 test/parser/samples/transition-intro/input.html create mode 100644 test/parser/samples/transition-intro/output.json diff --git a/src/parse/read/directives.js b/src/parse/read/directives.js index 28adc3078a92..9cc09392d70a 100644 --- a/src/parse/read/directives.js +++ b/src/parse/read/directives.js @@ -1,19 +1,11 @@ -import { parse, parseExpressionAt } from 'acorn'; +import { parseExpressionAt } from 'acorn'; import spaces from '../../utils/spaces.js'; -export function readEventHandlerDirective ( parser, start, name ) { - const quoteMark = ( - parser.eat( `'` ) ? `'` : - parser.eat( `"` ) ? `"` : - null - ); - - const expressionStart = parser.index; - +function readExpression ( parser, start, quoteMark ) { let str = ''; let escaped = false; - for ( let i = expressionStart; i < parser.template.length; i += 1 ) { + for ( let i = start; i < parser.template.length; i += 1 ) { const char = parser.template[i]; if ( quoteMark ) { @@ -21,7 +13,6 @@ export function readEventHandlerDirective ( parser, start, name ) { if ( escaped ) { str += quoteMark; } else { - parser.index = i + 1; break; } } else if ( escaped ) { @@ -35,7 +26,6 @@ export function readEventHandlerDirective ( parser, start, name ) { } else if ( /\s/.test( char ) ) { - parser.index = i; break; } @@ -44,13 +34,25 @@ export function readEventHandlerDirective ( parser, start, name ) { } } - const ast = parse( spaces( expressionStart ) + str ); + const expression = parseExpressionAt( spaces( start ) + str, start ); + parser.index = expression.end; - if ( ast.body.length > 1 ) { - parser.error( `Event handler should be a single call expression`, ast.body[1].start ); - } + parser.allowWhitespace(); + if ( quoteMark ) parser.eat( quoteMark, true ); - const expression = ast.body[0].expression; + return expression; +} + +export function readEventHandlerDirective ( parser, start, name ) { + const quoteMark = ( + parser.eat( `'` ) ? `'` : + parser.eat( `"` ) ? `"` : + null + ); + + const expressionStart = parser.index; + + const expression = readExpression( parser, expressionStart, quoteMark ); if ( expression.type !== 'CallExpression' ) { parser.error( `Expected call expression`, expressionStart ); @@ -127,3 +129,29 @@ export function readBindingDirective ( parser, start, name ) { value }; } + +export function readTransitionDirective ( parser, start, name, type ) { + const quoteMark = ( + parser.eat( `'` ) ? `'` : + parser.eat( `"` ) ? `"` : + null + ); + + const expressionStart = parser.index; + + const expression = readExpression( parser, expressionStart, quoteMark ); + + if ( expression.type !== 'ObjectExpression' ) { + parser.error( `Expected object expression`, expressionStart ); + } + + return { + start, + end: parser.index, + type: 'Transition', + name, + intro: type === 'in' || type === 'transition', + outro: type === 'out' || type === 'transition', + expression + }; +} \ No newline at end of file diff --git a/src/parse/state/tag.js b/src/parse/state/tag.js index 48e8cd197e02..901b250833f6 100644 --- a/src/parse/state/tag.js +++ b/src/parse/state/tag.js @@ -1,7 +1,7 @@ import readExpression from '../read/expression.js'; import readScript from '../read/script.js'; import readStyle from '../read/style.js'; -import { readEventHandlerDirective, readBindingDirective } from '../read/directives.js'; +import { readEventHandlerDirective, readBindingDirective, readTransitionDirective } from '../read/directives.js'; import { trimStart, trimEnd } from '../../utils/trim.js'; import { decodeCharacterReferences } from '../utils/html.js'; import isVoidElementName from '../../utils/isVoidElementName.js'; @@ -253,6 +253,12 @@ function readAttribute ( parser, uniqueNames ) { }; } + const match = /^(in|out|transition):/.exec( name ); + if ( match ) { + parser.eat( '=', true ); + return readTransitionDirective( parser, start, name.slice( match[0].length ), match[1] ); + } + let value; // :foo is shorthand for foo='{{foo}}' diff --git a/test/parser/samples/transition-intro/input.html b/test/parser/samples/transition-intro/input.html new file mode 100644 index 000000000000..db14cfcb2f0d --- /dev/null +++ b/test/parser/samples/transition-intro/input.html @@ -0,0 +1 @@ +
fades in
\ No newline at end of file diff --git a/test/parser/samples/transition-intro/output.json b/test/parser/samples/transition-intro/output.json new file mode 100644 index 000000000000..3f73ef3ce1e6 --- /dev/null +++ b/test/parser/samples/transition-intro/output.json @@ -0,0 +1,65 @@ +{ + "hash": 3160753914, + "html": { + "start": 0, + "end": 43, + "type": "Fragment", + "children": [ + { + "start": 0, + "end": 43, + "type": "Element", + "name": "div", + "attributes": [ + { + "start": 5, + "end": 28, + "type": "Transition", + "name": "style", + "intro": true, + "outro": false, + "expression": { + "start": 15, + "end": 27, + "type": "ObjectExpression", + "properties": [ + { + "start": 16, + "end": 26, + "type": "Property", + "method": false, + "computed": false, + "shorthand": false, + "kind": "init", + "key": { + "type": "Identifier", + "start": 16, + "end": 23, + "name": "opacity" + }, + "value": { + "start": 25, + "end": 26, + "type": "Literal", + "value": 0, + "raw": "0" + } + } + ] + } + } + ], + "children": [ + { + "start": 29, + "end": 37, + "type": "Text", + "data": "fades in" + } + ] + } + ] + }, + "css": null, + "js": null +} \ No newline at end of file From 4fa776561dd1f48c59bf1e82c65af7556de3159d Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 25 Apr 2017 16:10:41 -0400 Subject: [PATCH 02/31] failing test for intro transition --- .../samples/transition-intro/_config.js | 23 +++++++++++++++++++ .../samples/transition-intro/main.html | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 test/runtime/samples/transition-intro/_config.js create mode 100644 test/runtime/samples/transition-intro/main.html diff --git a/test/runtime/samples/transition-intro/_config.js b/test/runtime/samples/transition-intro/_config.js new file mode 100644 index 000000000000..bb60ad0e809d --- /dev/null +++ b/test/runtime/samples/transition-intro/_config.js @@ -0,0 +1,23 @@ +export default { + test ( assert, component, target, window ) { + let now = 0; + let callback; + + window.performance = { now: () => now }; + window.requestAnimationFrame = cb => callback = cb; + + component.set({ visible: true }); + const div = target.querySelector( 'div' ); + assert.equal( window.getComputedStyle( div ).opacity, 0 ); + + now = 200; + callback(); + assert.equal( window.getComputedStyle( div ).opacity, 0.5 ); + + now = 400; + callback(); + assert.equal( window.getComputedStyle( div ).opacity, 1 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-intro/main.html b/test/runtime/samples/transition-intro/main.html new file mode 100644 index 000000000000..80cd4aca4993 --- /dev/null +++ b/test/runtime/samples/transition-intro/main.html @@ -0,0 +1,3 @@ +{{#if visible}} +
fades in
+{{/if}} \ No newline at end of file From d0c0fbcef40d8998e55bac710e8c496be5150254 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 26 Apr 2017 01:08:51 -0400 Subject: [PATCH 03/31] add transitions property to default export, track intros/outros in Block --- src/generators/dom/Block.js | 14 ++++++++++++++ src/generators/dom/visitors/Element/Element.js | 7 +++++-- .../dom/visitors/Element/Transition.js | 7 +++++++ src/validate/js/propValidators/index.js | 4 +++- src/validate/js/propValidators/transitions.js | 17 +++++++++++++++++ 5 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 src/generators/dom/visitors/Element/Transition.js create mode 100644 src/validate/js/propValidators/transitions.js diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index 2e8d54f03c0c..c32cdba28068 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -33,6 +33,9 @@ export default class Block { this.variables = new Map(); this.getUniqueName = this.generator.getUniqueNameMaker( options.params ); + this.intros = []; + this.outros = []; + // unique names this.component = this.getUniqueName( 'component' ); this.target = this.getUniqueName( 'target' ); @@ -135,6 +138,17 @@ export default class Block { properties.addBlock( `key: ${localKey},` ); } + if ( this.intros.length ) { + properties.addBlock( `intro: ${this.generator.helper( 'transition' )}([ + // TODO + ]),` ); + } + + if ( this.outros.length ) { + // TODO + properties.addLine( `outro: null,` ); + } + if ( this.builders.mount.isEmpty() ) { properties.addBlock( `mount: ${this.generator.helper( 'noop' )},` ); } else { diff --git a/src/generators/dom/visitors/Element/Element.js b/src/generators/dom/visitors/Element/Element.js index 5ce0f6ba5b63..064321164545 100644 --- a/src/generators/dom/visitors/Element/Element.js +++ b/src/generators/dom/visitors/Element/Element.js @@ -6,6 +6,7 @@ import visitAttribute from './Attribute.js'; import visitEventHandler from './EventHandler.js'; import visitBinding from './Binding.js'; import visitRef from './Ref.js'; +import visitTransition from './Transition.js'; const meta = { ':Window': visitWindow @@ -15,14 +16,16 @@ const order = { Attribute: 1, Binding: 2, EventHandler: 3, - Ref: 4 + Ref: 4, + Transition: 5 }; const visitors = { Attribute: visitAttribute, EventHandler: visitEventHandler, Binding: visitBinding, - Ref: visitRef + Ref: visitRef, + Transition: visitTransition }; export default function visitElement ( generator, block, state, node ) { diff --git a/src/generators/dom/visitors/Element/Transition.js b/src/generators/dom/visitors/Element/Transition.js new file mode 100644 index 000000000000..fca15c6b35ad --- /dev/null +++ b/src/generators/dom/visitors/Element/Transition.js @@ -0,0 +1,7 @@ +export default function visitTransition ( generator, block, state, node, attribute ) { + ( attribute.intro ? block.intros : block.outros ).push({ + node: state.name, + transition: attribute.name, + params: block.contextualise( attribute.expression ).snippet + }); +} \ No newline at end of file diff --git a/src/validate/js/propValidators/index.js b/src/validate/js/propValidators/index.js index 0d5f6d8ffcb1..36dea150fbe1 100644 --- a/src/validate/js/propValidators/index.js +++ b/src/validate/js/propValidators/index.js @@ -9,6 +9,7 @@ import methods from './methods.js'; import components from './components.js'; import events from './events.js'; import namespace from './namespace.js'; +import transitions from './transitions.js'; export default { data, @@ -21,5 +22,6 @@ export default { methods, components, events, - namespace + namespace, + transitions }; diff --git a/src/validate/js/propValidators/transitions.js b/src/validate/js/propValidators/transitions.js new file mode 100644 index 000000000000..a7580cc92a38 --- /dev/null +++ b/src/validate/js/propValidators/transitions.js @@ -0,0 +1,17 @@ +import checkForDupes from '../utils/checkForDupes.js'; +import checkForComputedKeys from '../utils/checkForComputedKeys.js'; + +export default function transitions ( validator, prop ) { + if ( prop.value.type !== 'ObjectExpression' ) { + validator.error( `The 'transitions' property must be an object literal`, prop.start ); + return; + } + + checkForDupes( validator, prop.value.properties ); + checkForComputedKeys( validator, prop.value.properties ); + + prop.value.properties.forEach( () => { + // TODO probably some validation that can happen here... + // checking for use of `this` etc? + }); +} From 8ccad1f10793470162e5070d081acd3717cb41bf Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 26 Apr 2017 12:38:36 -0400 Subject: [PATCH 04/31] first working intro transition, woooo --- package.json | 2 + src/generators/Generator.js | 3 +- src/generators/dom/Block.js | 6 - src/generators/dom/index.js | 29 +- .../dom/visitors/Component/Component.js | 2 +- .../dom/visitors/Element/Transition.js | 23 + src/shared/index.js | 16 +- src/shared/transitions.js | 118 + src/shared/utils.js | 10 + src/utils/toSource.js | 44 + src/validate/html/validateElement.js | 2 +- yarn.lock | 2951 +++++++++++++++++ 12 files changed, 3177 insertions(+), 29 deletions(-) create mode 100644 src/shared/transitions.js create mode 100644 src/shared/utils.js create mode 100644 src/utils/toSource.js create mode 100644 yarn.lock diff --git a/package.json b/package.json index 0509466da65e..9568cda19b0d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "build:main": "rollup -c rollup/rollup.config.main.js", "build:shared": "rollup -c rollup/rollup.config.shared.js", "build:ssr": "rollup -c rollup/rollup.config.ssr.js", + "dev": "rollup -c rollup/rollup.config.main.js -w", "pretest": "npm run build", "prepublish": "npm run lint && npm run build" }, @@ -72,6 +73,7 @@ "rollup-plugin-commonjs": "^7.0.0", "rollup-plugin-json": "^2.1.0", "rollup-plugin-node-resolve": "^2.0.0", + "rollup-watch": "^3.2.2", "source-map": "^0.5.6", "source-map-support": "^0.4.8" }, diff --git a/src/generators/Generator.js b/src/generators/Generator.js index cf6ec0548c95..7a316adc85d1 100644 --- a/src/generators/Generator.js +++ b/src/generators/Generator.js @@ -24,6 +24,7 @@ export default class Generator { this.helpers = new Set(); this.components = new Set(); this.events = new Set(); + this.transitions = new Set(); this.importedComponents = new Map(); this.bindingGroups = []; @@ -328,7 +329,7 @@ export default class Generator { }); } - [ 'helpers', 'events', 'components' ].forEach( key => { + [ 'helpers', 'events', 'components', 'transitions' ].forEach( key => { if ( templateProperties[ key ] ) { templateProperties[ key ].value.properties.forEach( prop => { this[ key ].add( prop.key.name ); diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index c32cdba28068..e79423c55a82 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -138,12 +138,6 @@ export default class Block { properties.addBlock( `key: ${localKey},` ); } - if ( this.intros.length ) { - properties.addBlock( `intro: ${this.generator.helper( 'transition' )}([ - // TODO - ]),` ); - } - if ( this.outros.length ) { // TODO properties.addLine( `outro: null,` ); diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index 173b987aa1b4..abe0fba0e6d8 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -1,10 +1,11 @@ import MagicString from 'magic-string'; -import { parse } from 'acorn'; +import { parseExpressionAt } from 'acorn'; import annotateWithScopes from '../../utils/annotateWithScopes.js'; import isReference from '../../utils/isReference.js'; import { walk } from 'estree-walker'; import deindent from '../../utils/deindent.js'; import CodeBuilder from '../../utils/CodeBuilder.js'; +import toSource from '../../utils/toSource.js'; import visit from './visit.js'; import Generator from '../Generator.js'; import preprocess from './preprocess.js'; @@ -138,7 +139,7 @@ export default function dom ( parsed, source, options ) { builders.init.addLine( `if ( !${generator.alias( 'added_css' )} ) ${generator.alias( 'add_css' )}();` ); } - if ( generator.hasComponents ) { + if ( generator.hasComponents || generator.hasIntroTransitions ) { builders.init.addLine( `this._renderHooks = [];` ); } @@ -218,7 +219,7 @@ export default function dom ( parsed, source, options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; ${builders.init} @@ -275,9 +276,10 @@ export default function dom ( parsed, source, options ) { ); } else { generator.uses.forEach( key => { - const str = shared[ key ].toString(); // eslint-disable-line import/namespace + const value = shared[ key ]; // eslint-disable-line import/namespace + const str = toSource( value ); const code = new MagicString( str ); - const fn = parse( str ).body[0]; + const fn = parseExpressionAt( str, 0 ); let scope = annotateWithScopes( fn ); @@ -301,11 +303,22 @@ export default function dom ( parsed, source, options ) { } }); - const alias = generator.alias( fn.id.name ); - if ( alias !== fn.id.name ) code.overwrite( fn.id.start, fn.id.end, alias ); + if ( typeof value === 'function' ) { // exclude transitionManager — special case + const alias = generator.alias( fn.id.name ); + if ( alias !== fn.id.name ) code.overwrite( fn.id.start, fn.id.end, alias ); - builders.main.addBlock( code.toString() ); + builders.main.addBlock( code.toString() ); + } }); + + if ( generator.hasIntroTransitions || generator.hasOutroTransitions ) { + const global = `_svelteTransitionManager`; + const transitionManager = toSource( shared.transitionManager ); + + builders.main.addBlock( + `var ${generator.alias( 'transitionManager' )} = window.${global} || ( window.${global} = ${transitionManager});` + ); + } } return generator.generate( builders.main.toString(), options, { name, format } ); diff --git a/src/generators/dom/visitors/Component/Component.js b/src/generators/dom/visitors/Component/Component.js index b2768d6cf12a..e4685cf9dd3e 100644 --- a/src/generators/dom/visitors/Component/Component.js +++ b/src/generators/dom/visitors/Component/Component.js @@ -92,7 +92,7 @@ export default function visitComponent ( generator, block, state, node ) { const componentInitProperties = [ `target: ${!isToplevel ? state.parentNode: 'null'}`, - `_root: ${block.component}._root || ${block.component}` + `_root: ${block.component}._root` ]; // Component has children, put them in a separate {{yield}} block diff --git a/src/generators/dom/visitors/Element/Transition.js b/src/generators/dom/visitors/Element/Transition.js index fca15c6b35ad..9b9957d4a669 100644 --- a/src/generators/dom/visitors/Element/Transition.js +++ b/src/generators/dom/visitors/Element/Transition.js @@ -1,4 +1,27 @@ +import deindent from '../../../../utils/deindent.js'; + export default function visitTransition ( generator, block, state, node, attribute ) { + const name = block.getUniqueName( `${state.name}_${attribute.intro ? 'intro' : 'outro'}` ); + + block.addVariable( name ); + + if ( attribute.intro ) { + generator.hasIntroTransitions = true; + + const { snippet } = block.contextualise( attribute.expression ); + const fn = `${generator.alias( 'template' )}.transitions.${attribute.name}`; // TODO add built-in transitions? + + block.builders.create.addBlock( deindent` + ${block.component}._renderHooks.push({ + fn: function () { + ${name} = ${generator.helper( 'wrapTransition' )}( ${state.name}, ${fn}, ${snippet}, true ); + ${generator.helper( 'transitionManager' )}.add( ${name} ); + }, + context: ${block.component} + }); + ` ); + } + ( attribute.intro ? block.intros : block.outros ).push({ node: state.name, transition: attribute.name, diff --git a/src/shared/index.js b/src/shared/index.js index 9fa41f3122d9..476f343fa5cc 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -1,15 +1,7 @@ +import { assign } from './utils.js'; export * from './dom.js'; - -export function noop () {} - -export function assign ( target ) { - for ( var i = 1; i < arguments.length; i += 1 ) { - var source = arguments[i]; - for ( var k in source ) target[k] = source[k]; - } - - return target; -} +export * from './transitions.js'; +export * from './utils.js'; export function differs ( a, b ) { return ( a !== b ) || ( a && ( typeof a === 'object' ) || ( typeof a === 'function' ) ); @@ -107,7 +99,7 @@ export function onDev ( eventName, handler ) { export function set ( newState ) { this._set( assign( {}, newState ) ); - ( this._root || this )._flush(); + this._root._flush(); } export function _flush () { diff --git a/src/shared/transitions.js b/src/shared/transitions.js new file mode 100644 index 000000000000..2dc2444cb0a2 --- /dev/null +++ b/src/shared/transitions.js @@ -0,0 +1,118 @@ +import { noop } from './utils.js'; + +export function linear ( t ) { + return t; +} + +export function wrapTransition ( node, fn, params, isIntro ) { + var obj = fn( node, params, isIntro ); + + var start = window.performance.now() + ( obj.delay || 0 ); + var duration = obj.duration || 300; + var end = start + duration; + var ease = obj.easing || linear; + + if ( obj.tick ) { + // JS transition + if ( isIntro ) obj.tick( 0 ); + + return { + start: start, + end: end, + update: function ( now ) { + obj.tick( ease( ( now - start ) / duration ) ); + }, + done: function () { + obj.tick( isIntro ? 1 : 0 ); + }, + abort: noop + }; + } else { + // CSS transition + var started = false; + var inlineStyles = {}; + var computedStyles = getComputedStyle( node ); + + return { + start: start, + end: end, + init: function () { + for ( var key in obj.styles ) { + inlineStyles[ key ] = node.style[ key ]; + node.style[ key ] = isIntro ? obj.styles[ key ] : computedStyles[ key ]; + } + }, + update: function ( now ) { + if ( !started ) { + var keys = Object.keys( obj.styles ); + div.style.transition = keys.map( function ( key ) { + return key + ' ' + d; + }).join( ', ' ); + + // TODO use a keyframe animation for custom easing functions + + for ( var key in obj.styles ) { + node.style[ key ] = isIntro ? computedStyles[ key ] : obj.styles[ key ]; + } + + started = true; + } + }, + done: function () { + // TODO what if one of these styles was dynamic? + if ( isIntro ) { + for ( var key in obj.styles ) { + node.style[ key ] = inlineStyles[ key ]; + } + } + }, + abort: function () { + node.style.cssText = getComputedStyle( node ).cssText; + } + }; + } +} + +export var transitionManager = { + running: false, + transitions: [], + + add: function ( transition ) { + transitionManager.transitions.push( transition ); + + if ( !this.running ) { + this.running = true; + this.next(); + } + }, + + remove: function ( transitions ) { + var i = transitions.length; + while ( i-- ) { + var index = this.transitions.indexOf( transitions[i] ); + if ( ~index ) this.transitions.splice( index, 1 ); + } + }, + + next: function () { + transitionManager.running = false; + + var now = window.performance.now(); + var i = transitionManager.transitions.length; + + while ( i-- ) { + var transition = transitionManager.transitions[i]; + if ( now >= transition.end ) { + transition.done(); + transitionManager.transitions.splice( i, 1 ); + } else { + if ( now > transition.start ) transition.update( now ); + transitionManager.running = true; + } + } + + if ( transitionManager.running ) { + requestAnimationFrame( transitionManager.next ); + } + } +}; \ No newline at end of file diff --git a/src/shared/utils.js b/src/shared/utils.js new file mode 100644 index 000000000000..edd1da3a14d2 --- /dev/null +++ b/src/shared/utils.js @@ -0,0 +1,10 @@ +export function noop () {} + +export function assign ( target ) { + for ( var i = 1; i < arguments.length; i += 1 ) { + var source = arguments[i]; + for ( var k in source ) target[k] = source[k]; + } + + return target; +} \ No newline at end of file diff --git a/src/utils/toSource.js b/src/utils/toSource.js new file mode 100644 index 000000000000..8809cb15ffb8 --- /dev/null +++ b/src/utils/toSource.js @@ -0,0 +1,44 @@ +import deindent from './deindent.js'; + +export default function toSource ( thing ) { + if ( typeof thing === 'function' ) { + return normaliseIndentation( thing.toString() ); + } + + if ( Array.isArray( thing ) ) { + if ( thing.length === 0 ) return '[]'; + throw new Error( 'TODO' ); // not currently needed + } + + if ( thing && typeof thing === 'object' ) { + const keys = Object.keys( thing ); + if ( keys.length === 0 ) return '{}'; + + const props = keys.map( key => `${key}: ${toSource( thing[ key ] )}` ).join( ',\n' ); + return deindent` + { + ${props} + } + `; + } + + return JSON.stringify( thing ); +} + +function normaliseIndentation ( str ) { + const lines = str.split( '\n' ).slice( 1, -1 ); + let minIndentation = Infinity; + + lines.forEach( line => { + if ( !/\S/.test( line ) ) return; + const indentation = /^\t*/.exec( line )[0].length; + if ( indentation < minIndentation ) minIndentation = indentation; + }); + + if ( minIndentation !== Infinity && minIndentation !== 1 ) { + const pattern = new RegExp( `^\\t{${minIndentation - 1}}`, 'gm' ); + return str.replace( pattern, '' ); + } + + return str; +} \ No newline at end of file diff --git a/src/validate/html/validateElement.js b/src/validate/html/validateElement.js index beca2086ec73..d95ec14f867a 100644 --- a/src/validate/html/validateElement.js +++ b/src/validate/html/validateElement.js @@ -25,7 +25,7 @@ export default function validateElement ( validator, node ) { } if ( getType( validator, node ) !== 'checkbox' ) { - validator.error( `'checked' binding can only be used with ` ); + validator.error( `'checked' binding can only be used with `, attribute.start ); } } diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 000000000000..ba7fd4c73f55 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,2951 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +abab@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" + +acorn-es7-plugin@~1.1.0: + version "1.1.7" + resolved "https://registry.yarnpkg.com/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz#f2ee1f3228a90eead1245f9ab1922eb2e71d336b" + +acorn-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + +acorn-jsx@^3.0.0, acorn-jsx@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn-object-spread@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/acorn-object-spread/-/acorn-object-spread-1.0.0.tgz#48ead0f4a8eb16995a17a0db9ffc6acaada4ba68" + dependencies: + acorn "^3.1.0" + +acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.1, acorn@^4.0.4, acorn@~4.0.5: + version "4.0.11" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" + +acorn@^5.0.1: + version "5.0.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d" + +ajv-keywords@^1.0.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" + +ajv@^4.7.0, ajv@^4.9.1: + version "4.11.7" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.7.tgz#8655a5d86d0824985cc471a1d913fb6729a0ec48" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +argv@>=0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.3.tgz#a274ed85ac08849b6bd7847c4580745dc51adfb1" + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + +arrify@^1.0.0, arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +ast-types@^0.9.5: + version "0.9.11" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.11.tgz#371177bb59232ff5ceaa1d09ee5cad705b1a5aa9" + +async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + +babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +babel-core@^6.23.1, babel-core@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.1.tgz#8c428564dce1e1f41fb337ec34f4c3b022b5ad83" + dependencies: + babel-code-frame "^6.22.0" + babel-generator "^6.24.1" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + babylon "^6.11.0" + convert-source-map "^1.1.0" + debug "^2.1.1" + json5 "^0.5.0" + lodash "^4.2.0" + minimatch "^3.0.2" + path-is-absolute "^1.0.0" + private "^0.1.6" + slash "^1.0.0" + source-map "^0.5.0" + +babel-generator@^6.18.0, babel-generator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.1.tgz#e715f486c58ded25649d888944d52aa07c5d9497" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + +babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz#cce4517ada356f4220bcae8a02c2b346f9a56664" + dependencies: + babel-helper-explode-assignable-expression "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-call-delegate@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d" + dependencies: + babel-helper-hoist-variables "^6.24.1" + babel-runtime "^6.22.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-define-map@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.24.1.tgz#7a9747f258d8947d32d515f6aa1c7bd02204a080" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + lodash "^4.2.0" + +babel-helper-explode-assignable-expression@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-function-name@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" + dependencies: + babel-helper-get-function-arity "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-get-function-arity@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-hoist-variables@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz#1ecb27689c9d25513eadbc9914a73f5408be7a76" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-optimise-call-expression@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-helper-regex@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz#d36e22fab1008d79d88648e32116868128456ce8" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + lodash "^4.2.0" + +babel-helper-remap-async-to-generator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz#5ec581827ad723fecdd381f1c928390676e4551b" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helper-replace-supers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" + dependencies: + babel-helper-optimise-call-expression "^6.24.1" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-check-es2015-constants@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-istanbul@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-3.1.2.tgz#11d5abde18425ec24b5d648c7e0b5d25cd354a22" + dependencies: + find-up "^1.1.2" + istanbul-lib-instrument "^1.4.2" + object-assign "^4.1.0" + test-exclude "^3.3.0" + +babel-plugin-syntax-async-functions@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" + +babel-plugin-syntax-exponentiation-operator@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" + +babel-plugin-syntax-trailing-function-commas@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + +babel-plugin-transform-async-to-generator@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" + dependencies: + babel-helper-remap-async-to-generator "^6.24.1" + babel-plugin-syntax-async-functions "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-arrow-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoping@^6.23.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz#76c295dc3a4741b1665adfd3167215dcff32a576" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + lodash "^4.2.0" + +babel-plugin-transform-es2015-classes@^6.23.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db" + dependencies: + babel-helper-define-map "^6.24.1" + babel-helper-function-name "^6.24.1" + babel-helper-optimise-call-expression "^6.24.1" + babel-helper-replace-supers "^6.24.1" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-computed-properties@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-destructuring@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-duplicate-keys@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-for-of@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-function-name@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b" + dependencies: + babel-helper-function-name "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015-modules-amd@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz#3b3e54017239842d6d19c3011c4bd2f00a00d154" + dependencies: + babel-plugin-transform-es2015-modules-commonjs "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz#d3e310b40ef664a36622200097c6d440298f2bfe" + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-modules-systemjs@^6.23.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" + dependencies: + babel-helper-hoist-variables "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-modules-umd@^6.23.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468" + dependencies: + babel-plugin-transform-es2015-modules-amd "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-plugin-transform-es2015-object-super@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d" + dependencies: + babel-helper-replace-supers "^6.24.1" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-parameters@^6.23.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b" + dependencies: + babel-helper-call-delegate "^6.24.1" + babel-helper-get-function-arity "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-shorthand-properties@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-spread@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-sticky-regex@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc" + dependencies: + babel-helper-regex "^6.24.1" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-plugin-transform-es2015-template-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-typeof-symbol@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-unicode-regex@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9" + dependencies: + babel-helper-regex "^6.24.1" + babel-runtime "^6.22.0" + regexpu-core "^2.0.0" + +babel-plugin-transform-exponentiation-operator@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" + dependencies: + babel-helper-builder-binary-assignment-operator-visitor "^6.24.1" + babel-plugin-syntax-exponentiation-operator "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-regenerator@^6.22.0: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz#b8da305ad43c3c99b4848e4fe4037b770d23c418" + dependencies: + regenerator-transform "0.9.11" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-preset-env@^1.2.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.4.0.tgz#c8e02a3bcc7792f23cded68e0355b9d4c28f0f7a" + dependencies: + babel-plugin-check-es2015-constants "^6.22.0" + babel-plugin-syntax-trailing-function-commas "^6.22.0" + babel-plugin-transform-async-to-generator "^6.22.0" + babel-plugin-transform-es2015-arrow-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoping "^6.23.0" + babel-plugin-transform-es2015-classes "^6.23.0" + babel-plugin-transform-es2015-computed-properties "^6.22.0" + babel-plugin-transform-es2015-destructuring "^6.23.0" + babel-plugin-transform-es2015-duplicate-keys "^6.22.0" + babel-plugin-transform-es2015-for-of "^6.23.0" + babel-plugin-transform-es2015-function-name "^6.22.0" + babel-plugin-transform-es2015-literals "^6.22.0" + babel-plugin-transform-es2015-modules-amd "^6.22.0" + babel-plugin-transform-es2015-modules-commonjs "^6.23.0" + babel-plugin-transform-es2015-modules-systemjs "^6.23.0" + babel-plugin-transform-es2015-modules-umd "^6.23.0" + babel-plugin-transform-es2015-object-super "^6.22.0" + babel-plugin-transform-es2015-parameters "^6.23.0" + babel-plugin-transform-es2015-shorthand-properties "^6.22.0" + babel-plugin-transform-es2015-spread "^6.22.0" + babel-plugin-transform-es2015-sticky-regex "^6.22.0" + babel-plugin-transform-es2015-template-literals "^6.22.0" + babel-plugin-transform-es2015-typeof-symbol "^6.23.0" + babel-plugin-transform-es2015-unicode-regex "^6.22.0" + babel-plugin-transform-exponentiation-operator "^6.22.0" + babel-plugin-transform-regenerator "^6.22.0" + browserslist "^1.4.0" + invariant "^2.2.2" + +babel-register@^6.23.0, babel-register@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.1.tgz#7e10e13a2f71065bdfad5a1787ba45bca6ded75f" + dependencies: + babel-core "^6.24.1" + babel-runtime "^6.22.0" + core-js "^2.4.0" + home-or-tmp "^2.0.0" + lodash "^4.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.2" + +babel-runtime@^6.18.0, babel-runtime@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + +babel-template@^6.16.0, babel-template@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" + babylon "^6.11.0" + lodash "^4.2.0" + +babel-traverse@^6.18.0, babel-traverse@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.24.1.tgz#ab36673fd356f9a0948659e7b338d5feadb31695" + dependencies: + babel-code-frame "^6.22.0" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.24.1" + babylon "^6.15.0" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" + dependencies: + babel-runtime "^6.22.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babel@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel/-/babel-6.23.0.tgz#d0d1e7d803e974765beea3232d4e153c0efb90f4" + +babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" + +balanced-match@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" + +bcrypt-pbkdf@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + dependencies: + tweetnacl "^0.14.3" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +brace-expansion@^1.0.0: + version "1.1.7" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" + dependencies: + balanced-match "^0.4.1" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +browser-resolve@^1.11.0: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +browserslist@^1.4.0: + version "1.7.7" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.7.7.tgz#0bd76704258be829b2398bb50e4b62d1a166b0b9" + dependencies: + caniuse-db "^1.0.30000639" + electron-to-chromium "^1.2.7" + +buble@^0.15.0: + version "0.15.2" + resolved "https://registry.yarnpkg.com/buble/-/buble-0.15.2.tgz#547fc47483f8e5e8176d82aa5ebccb183b02d613" + dependencies: + acorn "^3.3.0" + acorn-jsx "^3.0.1" + acorn-object-spread "^1.0.0" + chalk "^1.1.3" + magic-string "^0.14.0" + minimist "^1.2.0" + os-homedir "^1.0.1" + +buffer-shims@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" + +builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +caching-transform@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1" + dependencies: + md5-hex "^1.2.0" + mkdirp "^0.5.1" + write-file-atomic "^1.1.4" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + +caniuse-db@^1.0.30000639: + version "1.0.30000662" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000662.tgz#616b17a525b52fec14611f88af3d5a9b5438c050" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +circular-json@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +codecov@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-1.0.1.tgz#97260ceac0e96b8eda8d562006558a53a139dffd" + dependencies: + argv ">=0.0.2" + execSync "1.0.2" + request ">=2.42.0" + urlgrey ">=0.4.0" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.5.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +console-group@^0.3.2: + version "0.3.3" + resolved "https://registry.yarnpkg.com/console-group/-/console-group-0.3.3.tgz#6d8eb6b9d6b757a2895284f62d09c7ad43f2bbce" + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + +content-type-parser@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" + +convert-source-map@^1.1.0, convert-source-map@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + +core-js@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cross-spawn@^4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" + dependencies: + lru-cache "^4.0.1" + which "^1.2.9" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +css-tree@1.0.0-alpha16: + version "1.0.0-alpha16" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha16.tgz#6cb2cdff6947259dfdaf790626333a862de948b0" + dependencies: + source-map "^0.5.3" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + +"cssstyle@>= 0.2.37 < 0.3.0": + version "0.2.37" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + dependencies: + cssom "0.3.x" + +d@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" + dependencies: + es5-ext "^0.10.9" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +debug-log@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + +debug@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + +debug@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +debug@^2.1.1, debug@^2.2.0: + version "2.6.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.4.tgz#7586a9b3c39741c0282ae33445c4e8ac74734fe0" + dependencies: + ms "0.7.3" + +decamelize@^1.0.0, decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + dependencies: + repeating "^2.0.0" + +diff@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" + +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +electron-to-chromium@^1.2.7: + version "1.3.8" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.8.tgz#b2c8a2c79bb89fbbfd3724d9555e15095b5f5fb6" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: + version "0.10.15" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + +es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" + dependencies: + d "1" + es5-ext "^0.10.14" + es6-symbol "^3.1" + +es6-map@^0.1.3: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-set "~0.1.5" + es6-symbol "~3.1.1" + event-emitter "~0.3.5" + +es6-set@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-symbol "3.1.1" + event-emitter "~0.3.5" + +es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + dependencies: + d "1" + es5-ext "~0.10.14" + +es6-weak-map@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + dependencies: + d "1" + es5-ext "^0.10.14" + es6-iterator "^2.0.1" + es6-symbol "^3.1.1" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escodegen@^1.6.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + dependencies: + esprima "^2.7.1" + estraverse "^1.9.1" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.2.0" + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-import-resolver-node@^0.2.0: + version "0.2.3" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" + dependencies: + debug "^2.2.0" + object-assign "^4.0.1" + resolve "^1.1.6" + +eslint-module-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.0.0.tgz#a6f8c21d901358759cdc35dbac1982ae1ee58bce" + dependencies: + debug "2.2.0" + pkg-dir "^1.0.0" + +eslint-plugin-import@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.2.0" + doctrine "1.5.0" + eslint-import-resolver-node "^0.2.0" + eslint-module-utils "^2.0.0" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + pkg-up "^1.0.0" + +eslint@^3.12.2: + version "3.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.5.2" + debug "^2.1.1" + doctrine "^2.0.0" + escope "^3.6.0" + espree "^3.4.0" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.14.0" + ignore "^3.2.0" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~2.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.4.0: + version "3.4.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.2.tgz#38dbdedbedc95b8961a1fbf04734a8f6a9c8c592" + dependencies: + acorn "^5.0.1" + acorn-jsx "^3.0.0" + +esprima@^2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esprima@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + dependencies: + estraverse "~4.1.0" + object-assign "^4.0.1" + +estraverse@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + +estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +estraverse@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" + +estree-walker@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" + +estree-walker@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@~0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + dependencies: + d "1" + es5-ext "~0.10.14" + +execSync@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/execSync/-/execSync-1.0.2.tgz#1f42eda582225180053224ecdd3fd1960fdb3139" + dependencies: + temp "~0.5.1" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +extend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + +extsprintf@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +filename-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.0.tgz#996e3e80479b98b9897f15a8a58b3d084e926775" + +fill-range@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^1.1.3" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + +find-up@^1.0.0, find-up@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +flat-cache@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + +foreground-child@^1.3.3, foreground-child@^1.5.3: + version "1.5.6" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-1.5.6.tgz#4fd71ad2dfde96789b980a5c0a295937cb2f5ce9" + dependencies: + cross-spawn "^4" + signal-exit "^3.0.0" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +function-bind@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" + +fuzzyset.js@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/fuzzyset.js/-/fuzzyset.js-0.0.1.tgz#979e22f9451b4b38f051f7937c919dbacc692958" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.0" + +get-caller-file@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + +glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.0.0, globals@^9.14.0: + version "9.17.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.17.0.tgz#0c0ca696d9b9bb694d2e5470bd37777caad50286" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +graceful-fs@~1: + version "1.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +handlebars@^4.0.3: + version "4.0.6" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +har-schema@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + +har-validator@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" + dependencies: + ajv "^4.9.1" + har-schema "^1.0.5" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +hosted-git-info@^2.1.4: + version "2.4.2" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.4.2.tgz#0076b9f46a270506ddbaaea56496897460612a67" + +html-encoding-sniffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.1.tgz#79bf7a785ea495fe66165e734153f363ff5437da" + dependencies: + whatwg-encoding "^1.0.1" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +iconv-lite@0.4.13: + version "0.4.13" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" + +ignore@^3.2.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.7.tgz#4810ca5f1d8eca5595213a34b94f2eb4ed926bbd" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +interpret@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" + +invariant@^2.2.0, invariant@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-dotfile@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-my-json-valid@^2.10.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-number@^2.0.2, is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +istanbul-lib-coverage@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz#87a0c015b6910651cb3b184814dfb339337e25e1" + +istanbul-lib-hook@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.5.tgz#6ca3d16d60c5f4082da39f7c5cd38ea8a772b88e" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.0.tgz#b8e0dc25709bb44e17336ab47b7bb5c97c23f659" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.13.0" + istanbul-lib-coverage "^1.0.2" + semver "^5.3.0" + +istanbul-lib-report@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0.tgz#d83dac7f26566b521585569367fe84ccfc7aaecb" + dependencies: + istanbul-lib-coverage "^1.0.2" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.1.1.tgz#f8c8c2e8f2160d1d91526d97e5bd63b2079af71c" + dependencies: + istanbul-lib-coverage "^1.0.2" + mkdirp "^0.5.1" + rimraf "^2.4.4" + source-map "^0.5.3" + +istanbul-reports@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.0.2.tgz#4e8366abe6fa746cc1cd6633f108de12cc6ac6fa" + dependencies: + handlebars "^4.0.3" + +jodid25519@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967" + dependencies: + jsbn "~0.1.0" + +js-tokens@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" + +js-yaml@^3.5.1: + version "3.8.3" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.3.tgz#33a05ec481c850c8875929166fe1beb61c728766" + dependencies: + argparse "^1.0.7" + esprima "^3.1.1" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + +jsdom@^9.9.1: + version "9.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" + dependencies: + abab "^1.0.3" + acorn "^4.0.4" + acorn-globals "^3.1.0" + array-equal "^1.0.0" + content-type-parser "^1.0.1" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" + escodegen "^1.6.1" + html-encoding-sniffer "^1.0.1" + nwmatcher ">= 1.3.9 < 2.0.0" + parse5 "^1.5.1" + request "^2.79.0" + sax "^1.2.1" + symbol-tree "^3.2.1" + tough-cookie "^2.3.2" + webidl-conversions "^4.0.0" + whatwg-encoding "^1.0.1" + whatwg-url "^4.3.0" + xml-name-validator "^2.0.1" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +json5@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +jsprim@^1.2.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.0.tgz#a3b87e40298d8c380552d8cc7628a0bb95a22918" + dependencies: + assert-plus "1.0.0" + extsprintf "1.0.2" + json-schema "0.2.3" + verror "1.3.6" + +kind-of@^3.0.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07" + dependencies: + is-buffer "^1.1.5" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + dependencies: + invert-kv "^1.0.0" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +locate-character@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-character/-/locate-character-2.0.0.tgz#8eb94df3a899e53c8d4cee6d13c9effb76213699" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash@^4.0.0, lodash@^4.13.1, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +lru-cache@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" + dependencies: + pseudomap "^1.0.1" + yallist "^2.0.0" + +magic-string@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.14.0.tgz#57224aef1701caeed273b17a39a956e72b172462" + dependencies: + vlq "^0.2.1" + +magic-string@^0.19.0, magic-string@~0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.0.tgz#198948217254e3e0b93080e01146b7c73b2a06b2" + dependencies: + vlq "^0.2.1" + +md5-hex@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" + dependencies: + md5-o-matic "^0.1.1" + +md5-o-matic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" + +merge-source-map@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.3.tgz#da1415f2722a5119db07b14c4f973410863a2abf" + dependencies: + source-map "^0.5.3" + +micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +mime-db@~1.27.0: + version "1.27.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.15" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed" + dependencies: + mime-db "~1.27.0" + +minimatch@^3.0.2, minimatch@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" + dependencies: + brace-expansion "^1.0.0" + +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.3.0.tgz#d29b7428d3f52c82e2e65df1ecb7064e1aabbfb5" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.0" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +ms@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +ms@0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff" + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +node-resolve@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/node-resolve/-/node-resolve-1.3.3.tgz#74c7f5d3373e4bb2f60182e3a96dde0f8aacb0ce" + dependencies: + is-builtin-module "^1.0.0" + lodash "^4.13.1" + +normalize-package-data@^2.3.2: + version "2.3.8" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.3.8.tgz#d819eda2a9dedbd1ffa563ea4071d936782295bb" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + dependencies: + remove-trailing-separator "^1.0.1" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +"nwmatcher@>= 1.3.9 < 2.0.0": + version "1.3.9" + resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.3.9.tgz#8bab486ff7fa3dfd086656bbe8b17116d3692d2a" + +nyc@^10.0.0: + version "10.2.2" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-10.2.2.tgz#1b1c8ca4636d810cb3e281558dc9fcb08389f204" + dependencies: + archy "^1.0.0" + arrify "^1.0.1" + caching-transform "^1.0.0" + convert-source-map "^1.3.0" + debug-log "^1.0.1" + default-require-extensions "^1.0.0" + find-cache-dir "^0.1.1" + find-up "^1.1.2" + foreground-child "^1.5.3" + glob "^7.0.6" + istanbul-lib-coverage "^1.0.2" + istanbul-lib-hook "^1.0.5" + istanbul-lib-instrument "^1.7.0" + istanbul-lib-report "^1.0.0" + istanbul-lib-source-maps "^1.1.1" + istanbul-reports "^1.0.2" + md5-hex "^1.2.0" + merge-source-map "^1.0.2" + micromatch "^2.3.11" + mkdirp "^0.5.0" + resolve-from "^2.0.0" + rimraf "^2.5.4" + signal-exit "^3.0.1" + spawn-wrap "1.2.4" + test-exclude "^4.0.0" + yargs "^7.0.2" + yargs-parser "^4.0.2" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.1, optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0, os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + dependencies: + lcid "^1.0.0" + +os-tmpdir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse5@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +performance-now@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pkg-up@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" + dependencies: + find-up "^1.0.0" + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +private@^0.1.6: + version "0.1.7" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + +pseudomap@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + +randomatic@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb" + dependencies: + is-number "^2.0.2" + kind-of "^3.0.2" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +readable-stream@^2.2.2: + version "2.2.9" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8" + dependencies: + buffer-shims "~1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~1.0.0" + util-deprecate "~1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +regenerate@^1.2.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" + +regenerator-runtime@^0.10.0: + version "0.10.4" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.4.tgz#74cb6598d3ba2eb18694e968a40e2b3b4df9cf93" + +regenerator-transform@0.9.11: + version "0.9.11" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.11.tgz#3a7d067520cb7b7176769eb5ff868691befe1283" + dependencies: + babel-runtime "^6.18.0" + babel-types "^6.19.0" + private "^0.1.6" + +regex-cache@^0.4.2: + version "0.4.3" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + dependencies: + is-equal-shallow "^0.1.3" + is-primitive "^2.0.0" + +regexpu-core@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" + dependencies: + regenerate "^1.2.1" + regjsgen "^0.2.0" + regjsparser "^0.1.4" + +regjsgen@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" + +regjsparser@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" + dependencies: + jsesc "~0.5.0" + +reify@^0.4.4: + version "0.4.16" + resolved "https://registry.yarnpkg.com/reify/-/reify-0.4.16.tgz#d852914a692beced4d32bc0549d9d13a8d466a77" + dependencies: + acorn "~4.0.5" + acorn-es7-plugin "~1.1.0" + ast-types "^0.9.5" + magic-string "~0.19.0" + +remove-trailing-separator@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz#615ebb96af559552d4bf4057c8436d486ab63cc4" + +repeat-element@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +request@>=2.42.0, request@^2.79.0: + version "2.81.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~4.2.1" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + performance-now "^0.2.0" + qs "~6.4.0" + safe-buffer "^5.0.1" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "^0.6.0" + uuid "^3.0.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + +require-relative@0.8.7: + version "0.8.7" + resolved "https://registry.yarnpkg.com/require-relative/-/require-relative-0.8.7.tgz#7999539fc9e047a37928fa196f8e1563dabd36de" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve-from@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6, resolve@^1.1.7: + version "1.3.3" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" + dependencies: + path-parse "^1.0.5" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.4, rimraf@^2.5.4: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + dependencies: + glob "^7.0.5" + +rimraf@~2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.1.4.tgz#5a6eb62eeda068f51ede50f29b3e5cd22f3d9bb2" + optionalDependencies: + graceful-fs "~1" + +rollup-plugin-buble@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-buble/-/rollup-plugin-buble-0.15.0.tgz#83c3e89c7fd2266c7918f41ba3980313519c7fd0" + dependencies: + buble "^0.15.0" + rollup-pluginutils "^1.5.0" + +rollup-plugin-commonjs@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-7.1.0.tgz#c3a772c2e4a5fa13507f5c578b66cc13b0cb8a79" + dependencies: + acorn "^4.0.1" + estree-walker "^0.3.0" + magic-string "^0.19.0" + resolve "^1.1.7" + rollup-pluginutils "^2.0.1" + +rollup-plugin-json@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-2.1.1.tgz#933390dff3c9e3e654157d61304c5e167fc58623" + dependencies: + rollup-pluginutils "^1.5.2" + +rollup-plugin-node-resolve@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.1.tgz#cbb783b0d15b02794d58915350b2f0d902b8ddc8" + dependencies: + browser-resolve "^1.11.0" + builtin-modules "^1.1.0" + resolve "^1.1.6" + +rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" + dependencies: + estree-walker "^0.2.1" + minimatch "^3.0.2" + +rollup-pluginutils@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0" + dependencies: + estree-walker "^0.3.0" + micromatch "^2.3.11" + +rollup-watch@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/rollup-watch/-/rollup-watch-3.2.2.tgz#5e574232e9ef36da9177f46946d8080cb267354b" + dependencies: + require-relative "0.8.7" + +rollup@^0.39.0: + version "0.39.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.39.2.tgz#858cf3020027cf74e0c5d7faa1c18275faf00df4" + dependencies: + source-map-support "^0.4.0" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + dependencies: + once "^1.3.0" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + +safe-buffer@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" + +sax@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.2.tgz#fd8631a23bc7826bef5d871bdb87378c95647828" + +"semver@2 || 3 || 4 || 5", semver@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shelljs@^0.7.5: + version "0.7.7" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +signal-exit@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-2.1.2.tgz#375879b1f92ebc3b334480d038dc546a6d558564" + +signal-exit@^3.0.0, signal-exit@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + +slide@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +source-map-support@^0.4.0, source-map-support@^0.4.2, source-map-support@^0.4.8: + version "0.4.14" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef" + dependencies: + source-map "^0.5.6" + +source-map@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + +source-map@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + dependencies: + amdefine ">=0.0.4" + +spawn-wrap@1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.2.4.tgz#920eb211a769c093eebfbd5b0e7a5d2e68ab2e40" + dependencies: + foreground-child "^1.3.3" + mkdirp "^0.5.0" + os-homedir "^1.0.1" + rimraf "^2.3.3" + signal-exit "^2.0.0" + which "^1.2.4" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.0.tgz#ff2a3e4fd04497555fed97b39a0fd82fafb3a33c" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jodid25519 "^1.0.0" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^3.0.0" + +string_decoder@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.0.tgz#f06f41157b664d86069f84bdbdc9b0d8ab281667" + dependencies: + buffer-shims "~1.0.0" + +stringstream@~0.0.4: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@3.1.2, supports-color@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +symbol-tree@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +temp@~0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.5.1.tgz#77ab19c79aa7b593cbe4fac2441768cad987b8df" + dependencies: + rimraf "~2.1.4" + +test-exclude@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-3.3.0.tgz#7a17ca1239988c98367b0621456dbb7d4bc38977" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +test-exclude@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.0.3.tgz#86a13ce3effcc60e6c90403cf31a27a60ac6c4e7" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +to-fast-properties@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" + +tough-cookie@^2.3.2, tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +uglify-js@^2.6: + version "2.8.22" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.22.tgz#d54934778a8da14903fa29a326fb24c0ab51a1a0" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +urlgrey@>=0.4.0: + version "0.4.4" + resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f" + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +uuid@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" + +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +verror@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" + dependencies: + extsprintf "1.0.2" + +vlq@^0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.2.tgz#e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + +webidl-conversions@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.1.tgz#8015a17ab83e7e1b311638486ace81da6ce206a0" + +whatwg-encoding@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz#3c6c451a198ee7aec55b1ec61d0920c67801a5f4" + dependencies: + iconv-lite "0.4.13" + +whatwg-url@^4.3.0: + version "4.7.1" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.7.1.tgz#df4dc2e3f25a63b1fa5b32ed6d6c139577d690de" + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + +which@^1.2.4, which@^1.2.9: + version "1.2.14" + resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" + dependencies: + isexe "^2.0.0" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write-file-atomic@^1.1.4: + version "1.3.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.3.tgz#831dd22d491bdc135180bb996a0eb3f8bf587791" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + slide "^1.1.5" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xml-name-validator@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + +yallist@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +yargs-parser@^4.0.2: + version "4.2.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + dependencies: + camelcase "^3.0.0" + +yargs-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + dependencies: + camelcase "^3.0.0" + +yargs@^7.0.2: + version "7.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^5.0.0" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" From 6ed2a6c78549624ca62eb464b0acf90deffe52a8 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 26 Apr 2017 12:38:43 -0400 Subject: [PATCH 05/31] update tests --- test/js/samples/collapses-text-around-comments/expected.js | 2 +- test/js/samples/computed-collapsed-if/expected.js | 2 +- test/js/samples/each-block-changed-check/expected.js | 2 +- test/js/samples/event-handlers-custom/expected.js | 2 +- test/js/samples/if-block-no-update/expected.js | 2 +- test/js/samples/if-block-simple/expected.js | 2 +- test/js/samples/use-elements-as-anchors/expected.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index dd6f2a3f2711..418bda27b482 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -55,7 +55,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index 96eb2a6202f7..df9295d28be2 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -38,7 +38,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 24ed9066ee9c..17b22c9a5093 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -131,7 +131,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index 5fcfff19e2ad..ed40aae9dfd4 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -51,7 +51,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index ef158af47d47..2d7d9662e5ed 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -80,7 +80,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index c31e4ae91442..cc2fe4d892fc 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -61,7 +61,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 792dac264e80..be71ab1d4889 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -211,7 +211,7 @@ function SvelteComponent ( options ) { this._handlers = Object.create( null ); - this._root = options._root; + this._root = options._root || this; this._yield = options._yield; this._torndown = false; From 53c5c32da3d845898074e1325ec9d8beed5413ff Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 26 Apr 2017 14:33:44 -0400 Subject: [PATCH 06/31] allow parameter-less transitions --- src/generators/dom/Block.js | 3 -- .../dom/visitors/Element/Transition.js | 16 ++++---- src/parse/read/directives.js | 22 ++++++----- src/parse/state/tag.js | 1 - .../transition-intro-no-params/input.html | 1 + .../transition-intro-no-params/output.json | 37 +++++++++++++++++++ 6 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 test/parser/samples/transition-intro-no-params/input.html create mode 100644 test/parser/samples/transition-intro-no-params/output.json diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index e79423c55a82..8c6bbec667f5 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -33,9 +33,6 @@ export default class Block { this.variables = new Map(); this.getUniqueName = this.generator.getUniqueNameMaker( options.params ); - this.intros = []; - this.outros = []; - // unique names this.component = this.getUniqueName( 'component' ); this.target = this.getUniqueName( 'target' ); diff --git a/src/generators/dom/visitors/Element/Transition.js b/src/generators/dom/visitors/Element/Transition.js index 9b9957d4a669..50f75349791f 100644 --- a/src/generators/dom/visitors/Element/Transition.js +++ b/src/generators/dom/visitors/Element/Transition.js @@ -5,12 +5,12 @@ export default function visitTransition ( generator, block, state, node, attribu block.addVariable( name ); + const snippet = attribute.expression ? block.contextualise( attribute.expression ).snippet : '{}'; + const fn = `${generator.alias( 'template' )}.transitions.${attribute.name}`; // TODO add built-in transitions? + if ( attribute.intro ) { generator.hasIntroTransitions = true; - const { snippet } = block.contextualise( attribute.expression ); - const fn = `${generator.alias( 'template' )}.transitions.${attribute.name}`; // TODO add built-in transitions? - block.builders.create.addBlock( deindent` ${block.component}._renderHooks.push({ fn: function () { @@ -22,9 +22,9 @@ export default function visitTransition ( generator, block, state, node, attribu ` ); } - ( attribute.intro ? block.intros : block.outros ).push({ - node: state.name, - transition: attribute.name, - params: block.contextualise( attribute.expression ).snippet - }); + if ( attribute.outro ) { + generator.hasOutroTransitions = true; + + throw new Error( 'TODO' ); + } } \ No newline at end of file diff --git a/src/parse/read/directives.js b/src/parse/read/directives.js index 9cc09392d70a..32e86a0a4d22 100644 --- a/src/parse/read/directives.js +++ b/src/parse/read/directives.js @@ -131,18 +131,22 @@ export function readBindingDirective ( parser, start, name ) { } export function readTransitionDirective ( parser, start, name, type ) { - const quoteMark = ( - parser.eat( `'` ) ? `'` : - parser.eat( `"` ) ? `"` : - null - ); + let expression = null; - const expressionStart = parser.index; + if ( parser.eat( '=' ) ) { + const quoteMark = ( + parser.eat( `'` ) ? `'` : + parser.eat( `"` ) ? `"` : + null + ); - const expression = readExpression( parser, expressionStart, quoteMark ); + const expressionStart = parser.index; + + expression = readExpression( parser, expressionStart, quoteMark ); - if ( expression.type !== 'ObjectExpression' ) { - parser.error( `Expected object expression`, expressionStart ); + if ( expression.type !== 'ObjectExpression' ) { + parser.error( `Expected object expression`, expressionStart ); + } } return { diff --git a/src/parse/state/tag.js b/src/parse/state/tag.js index 901b250833f6..475043f311c2 100644 --- a/src/parse/state/tag.js +++ b/src/parse/state/tag.js @@ -255,7 +255,6 @@ function readAttribute ( parser, uniqueNames ) { const match = /^(in|out|transition):/.exec( name ); if ( match ) { - parser.eat( '=', true ); return readTransitionDirective( parser, start, name.slice( match[0].length ), match[1] ); } diff --git a/test/parser/samples/transition-intro-no-params/input.html b/test/parser/samples/transition-intro-no-params/input.html new file mode 100644 index 000000000000..e5e417143449 --- /dev/null +++ b/test/parser/samples/transition-intro-no-params/input.html @@ -0,0 +1 @@ +
fades in
\ No newline at end of file diff --git a/test/parser/samples/transition-intro-no-params/output.json b/test/parser/samples/transition-intro-no-params/output.json new file mode 100644 index 000000000000..ae1f76a3bce6 --- /dev/null +++ b/test/parser/samples/transition-intro-no-params/output.json @@ -0,0 +1,37 @@ +{ + "hash": 1535528483, + "html": { + "start": 0, + "end": 27, + "type": "Fragment", + "children": [ + { + "start": 0, + "end": 27, + "type": "Element", + "name": "div", + "attributes": [ + { + "start": 5, + "end": 12, + "type": "Transition", + "name": "fade", + "intro": true, + "outro": false, + "expression": null + } + ], + "children": [ + { + "start": 13, + "end": 21, + "type": "Text", + "data": "fades in" + } + ] + } + ] + }, + "css": null, + "js": null +} \ No newline at end of file From 2a5b0ee1a44361900cbcacb25779a6e562afeaa2 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Wed, 26 Apr 2017 17:36:29 -0400 Subject: [PATCH 07/31] support very basic outro transitions --- src/generators/dom/Block.js | 33 +++++++++++-- src/generators/dom/index.js | 2 +- src/generators/dom/preprocess.js | 8 ++++ .../dom/visitors/Element/Element.js | 30 ++++++++---- .../dom/visitors/Element/Transition.js | 30 ------------ .../dom/visitors/Element/addTransitions.js | 48 +++++++++++++++++++ src/generators/dom/visitors/IfBlock.js | 27 ++++++++--- src/shared/index.js | 3 +- src/shared/transitions.js | 19 ++++---- 9 files changed, 139 insertions(+), 61 deletions(-) delete mode 100644 src/generators/dom/visitors/Element/Transition.js create mode 100644 src/generators/dom/visitors/Element/addTransitions.js diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index 8c6bbec667f5..d375676fb301 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -24,11 +24,16 @@ export default class Block { create: new CodeBuilder(), mount: new CodeBuilder(), update: new CodeBuilder(), + outro: new CodeBuilder(), detach: new CodeBuilder(), detachRaw: new CodeBuilder(), destroy: new CodeBuilder() }; + this.hasIntroTransitions = false; + this.hasOutroTransitions = false; + this.outros = 0; + this.aliases = new Map(); this.variables = new Map(); this.getUniqueName = this.generator.getUniqueNameMaker( options.params ); @@ -100,6 +105,12 @@ export default class Block { } render () { + let outroing; + if ( this.hasOutroTransitions ) { + outroing = this.getUniqueName( 'outroing' ); + this.addVariable( outroing ); + } + if ( this.variables.size ) { const variables = Array.from( this.variables.keys() ) .map( key => { @@ -135,11 +146,6 @@ export default class Block { properties.addBlock( `key: ${localKey},` ); } - if ( this.outros.length ) { - // TODO - properties.addLine( `outro: null,` ); - } - if ( this.builders.mount.isEmpty() ) { properties.addBlock( `mount: ${this.generator.helper( 'noop' )},` ); } else { @@ -162,6 +168,23 @@ export default class Block { } } + if ( this.hasOutroTransitions ) { + if ( this.builders.outro.isEmpty() ) { + properties.addBlock( `outro: ${this.generator.helper( 'noop' )},` ); + } else { + properties.addBlock( deindent` + outro: function ( ${this.alias( 'outrocallback' )} ) { + if ( ${outroing} ) return; + ${outroing} = true; + + var ${this.alias( 'outros' )} = ${this.outros}; + + ${this.builders.outro} + }, + ` ); + } + } + if ( this.builders.destroy.isEmpty() ) { properties.addBlock( `destroy: ${this.generator.helper( 'noop' )}` ); } else { diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index abe0fba0e6d8..8cf7226a228e 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -169,7 +169,7 @@ export default function dom ( parsed, source, options ) { if ( templateProperties.oncreate ) { builders.init.addBlock( deindent` if ( options._root ) { - options._root._renderHooks.push({ fn: ${generator.alias( 'template' )}.oncreate, context: this }); + options._root._renderHooks.push( ${generator.alias( 'template' )}.oncreate.bind( this ) ); } else { ${generator.alias( 'template' )}.oncreate.call( this ); } diff --git a/src/generators/dom/preprocess.js b/src/generators/dom/preprocess.js index 6e6c33eafffc..1c60a72cdb38 100644 --- a/src/generators/dom/preprocess.js +++ b/src/generators/dom/preprocess.js @@ -200,6 +200,14 @@ const preprocessors = { const dependencies = block.findDependencies( attribute.value ); block.addDependencies( dependencies ); } + + else if ( attribute.type === 'Transition' ) { + if ( attribute.intro ) generator.hasIntroTransitions = block.hasIntroTransitions = true; + if ( attribute.outro ) { + generator.hasOutroTransitions = block.hasOutroTransitions = true; + block.outros += 1; + } + } }); if ( node.children.length ) { diff --git a/src/generators/dom/visitors/Element/Element.js b/src/generators/dom/visitors/Element/Element.js index 064321164545..11b3db978f13 100644 --- a/src/generators/dom/visitors/Element/Element.js +++ b/src/generators/dom/visitors/Element/Element.js @@ -6,7 +6,7 @@ import visitAttribute from './Attribute.js'; import visitEventHandler from './EventHandler.js'; import visitBinding from './Binding.js'; import visitRef from './Ref.js'; -import visitTransition from './Transition.js'; +import addTransitions from './addTransitions.js'; const meta = { ':Window': visitWindow @@ -16,16 +16,14 @@ const order = { Attribute: 1, Binding: 2, EventHandler: 3, - Ref: 4, - Transition: 5 + Ref: 4 }; const visitors = { Attribute: visitAttribute, EventHandler: visitEventHandler, Binding: visitBinding, - Ref: visitRef, - Transition: visitTransition + Ref: visitRef }; export default function visitElement ( generator, block, state, node ) { @@ -43,21 +41,35 @@ export default function visitElement ( generator, block, state, node ) { block.builders.create.addLine( `var ${name} = ${getRenderStatement( generator, childState.namespace, node.name )};` ); block.mount( name, state.parentNode ); - if ( !state.parentNode ) { - block.builders.detach.addLine( `${generator.helper( 'detachNode' )}( ${name} );` ); - } - // add CSS encapsulation attribute if ( generator.cssId && state.isTopLevel ) { block.builders.create.addLine( `${generator.helper( 'setAttribute' )}( ${name}, '${generator.cssId}', '' );` ); } function visitAttributes () { + let intro; + let outro; + node.attributes .sort( ( a, b ) => order[ a.type ] - order[ b.type ] ) .forEach( attribute => { + if ( attribute.type === 'Transition' ) { + if ( attribute.intro ) intro = attribute; + if ( attribute.outro ) outro = attribute; + return; + } + visitors[ attribute.type ]( generator, block, childState, node, attribute ); }); + + addTransitions( generator, block, childState, node, intro, outro ); + + if ( !outro && !state.parentNode ) { + // TODO this probably doesn't belong here. We eventually need to consider + // what happens to elements that belong to the same outgroup as an + // outroing element... + block.builders.detach.addLine( `${generator.helper( 'detachNode' )}( ${name} );` ); + } } if ( node.name !== 'select' ) { diff --git a/src/generators/dom/visitors/Element/Transition.js b/src/generators/dom/visitors/Element/Transition.js deleted file mode 100644 index 50f75349791f..000000000000 --- a/src/generators/dom/visitors/Element/Transition.js +++ /dev/null @@ -1,30 +0,0 @@ -import deindent from '../../../../utils/deindent.js'; - -export default function visitTransition ( generator, block, state, node, attribute ) { - const name = block.getUniqueName( `${state.name}_${attribute.intro ? 'intro' : 'outro'}` ); - - block.addVariable( name ); - - const snippet = attribute.expression ? block.contextualise( attribute.expression ).snippet : '{}'; - const fn = `${generator.alias( 'template' )}.transitions.${attribute.name}`; // TODO add built-in transitions? - - if ( attribute.intro ) { - generator.hasIntroTransitions = true; - - block.builders.create.addBlock( deindent` - ${block.component}._renderHooks.push({ - fn: function () { - ${name} = ${generator.helper( 'wrapTransition' )}( ${state.name}, ${fn}, ${snippet}, true ); - ${generator.helper( 'transitionManager' )}.add( ${name} ); - }, - context: ${block.component} - }); - ` ); - } - - if ( attribute.outro ) { - generator.hasOutroTransitions = true; - - throw new Error( 'TODO' ); - } -} \ No newline at end of file diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js new file mode 100644 index 000000000000..b3e1a7e51071 --- /dev/null +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -0,0 +1,48 @@ +import deindent from '../../../../utils/deindent.js'; + +export default function addTransitions ( generator, block, state, node, intro, outro ) { + const introName = intro && block.getUniqueName( `${state.name}_intro` ); + const outroName = outro && block.getUniqueName( `${state.name}_outro` ); + + const introSnippet = intro && intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; + + const outroSnippet = outro === intro ? + introSnippet : + outro && outro.expression ? block.contextualise( outro.expression ).snippet : '{}'; + + const wrapTransition = generator.helper( 'wrapTransition' ); + + if ( intro ) { + block.addVariable( introName ); + + const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? + + block.builders.create.addBlock( deindent` + ${block.component}._renderHooks.push( function () { + ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${introSnippet}, true, null, function () { + ${block.component}.fire( 'intro.end', { node: ${state.name} }); + }); + ${generator.helper( 'transitionManager' )}.add( ${introName} ); + }); + ` ); + } + + if ( outro ) { + block.addVariable( outroName ); + + const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; + + if ( intro ) { + block.builders.outro.addBlock( `${introName}.abort();` ); + } + + block.builders.outro.addBlock( deindent` + ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${outroSnippet}, false, null, function () { + detachNode( div ); + ${block.component}.fire( 'outro.end', { node: ${state.name} }); + if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); + }); + transitionManager.add( ${outroName} ); + ` ); + } +} \ No newline at end of file diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index e6c3d9952a7e..6ce7897344df 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -9,7 +9,8 @@ function getBranches ( generator, block, state, node ) { const branches = [{ condition: block.contextualise( node.expression ).snippet, block: node._block.name, - dynamic: node._block.dependencies.size > 0 + dynamic: node._block.dependencies.size > 0, + hasOutroTransitions: node._block.hasOutroTransitions }]; visitChildren( generator, block, state, node ); @@ -22,7 +23,8 @@ function getBranches ( generator, block, state, node ) { branches.push({ condition: null, block: node.else ? node.else._block.name : null, - dynamic: node.else ? node.else._block.dependencies.size > 0 : false + dynamic: node.else ? node.else._block.dependencies.size > 0 : false, + hasOutroTransitions: node.else ? node.else._block.hasOutroTransitions : false }); if ( node.else ) { @@ -81,6 +83,17 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor const parentNode = state.parentNode || `${anchor}.parentNode`; + const remove = branch.hasOutroTransitions ? + deindent` + ${name}.outro( function () { + ${name} = null; + }); + ` : + deindent` + ${name}.destroy( true ); + ${name} = null; + `; + if ( dynamic ) { block.builders.update.addBlock( deindent` if ( ${branch.condition} ) { @@ -91,8 +104,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ${name}.mount( ${parentNode}, ${anchor} ); } } else if ( ${name} ) { - ${name}.destroy( true ); - ${name} = null; + ${remove} } ` ); } else { @@ -103,8 +115,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ${name}.mount( ${parentNode}, ${anchor} ); } } else if ( ${name} ) { - ${name}.destroy( true ); - ${name} = null; + ${remove} } ` ); } @@ -135,6 +146,10 @@ function compound ( generator, block, state, node, branches, dynamic, { name, an const parentNode = state.parentNode || `${anchor}.parentNode`; + if ( block.hasOutroTransitions ) { + throw new Error( 'TODO compound if-blocks with outro transitions are not yet supported' ); + } + if ( dynamic ) { block.builders.update.addBlock( deindent` if ( ${current_block} === ( ${current_block} = ${getBlock}( ${params} ) ) && ${name} ) { diff --git a/src/shared/index.js b/src/shared/index.js index 476f343fa5cc..d31bbffc1784 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -106,8 +106,7 @@ export function _flush () { if ( !this._renderHooks ) return; while ( this._renderHooks.length ) { - var hook = this._renderHooks.pop(); - hook.fn.call( hook.context ); + this._renderHooks.pop()(); } } diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 2dc2444cb0a2..1b4cb1b90dfd 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -4,8 +4,8 @@ export function linear ( t ) { return t; } -export function wrapTransition ( node, fn, params, isIntro ) { - var obj = fn( node, params, isIntro ); +export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { + var obj = fn( node, params, intro ); var start = window.performance.now() + ( obj.delay || 0 ); var duration = obj.duration || 300; @@ -14,16 +14,18 @@ export function wrapTransition ( node, fn, params, isIntro ) { if ( obj.tick ) { // JS transition - if ( isIntro ) obj.tick( 0 ); + if ( intro ) obj.tick( 0 ); return { start: start, end: end, update: function ( now ) { - obj.tick( ease( ( now - start ) / duration ) ); + const p = intro ? now - start : end - now; + obj.tick( ease( p / duration ) ); }, done: function () { - obj.tick( isIntro ? 1 : 0 ); + obj.tick( intro ? 1 : 0 ); + callback(); }, abort: noop }; @@ -39,7 +41,7 @@ export function wrapTransition ( node, fn, params, isIntro ) { init: function () { for ( var key in obj.styles ) { inlineStyles[ key ] = node.style[ key ]; - node.style[ key ] = isIntro ? obj.styles[ key ] : computedStyles[ key ]; + node.style[ key ] = intro ? obj.styles[ key ] : computedStyles[ key ]; } }, update: function ( now ) { @@ -52,7 +54,7 @@ export function wrapTransition ( node, fn, params, isIntro ) { // TODO use a keyframe animation for custom easing functions for ( var key in obj.styles ) { - node.style[ key ] = isIntro ? computedStyles[ key ] : obj.styles[ key ]; + node.style[ key ] = intro ? computedStyles[ key ] : obj.styles[ key ]; } started = true; @@ -60,11 +62,12 @@ export function wrapTransition ( node, fn, params, isIntro ) { }, done: function () { // TODO what if one of these styles was dynamic? - if ( isIntro ) { + if ( intro ) { for ( var key in obj.styles ) { node.style[ key ] = inlineStyles[ key ]; } } + callback(); }, abort: function () { node.style.cssText = getComputedStyle( node ).cssText; From aa67f8b8c404fd4aa288999aa5781fbffcb2dda3 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 11:18:58 -0400 Subject: [PATCH 08/31] abort transitions --- src/generators/dom/Block.js | 26 ++++++++++++++++ .../dom/visitors/Element/addTransitions.js | 6 +++- src/generators/dom/visitors/IfBlock.js | 30 ++++++++++++++----- src/shared/transitions.js | 15 ++++++---- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index d375676fb301..f2d507c035b0 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -24,6 +24,7 @@ export default class Block { create: new CodeBuilder(), mount: new CodeBuilder(), update: new CodeBuilder(), + intro: new CodeBuilder(), outro: new CodeBuilder(), detach: new CodeBuilder(), detachRaw: new CodeBuilder(), @@ -105,6 +106,12 @@ export default class Block { } render () { + let introing; + if ( this.hasIntroTransitions ) { + introing = this.getUniqueName( 'introing' ); + this.addVariable( introing ); + } + let outroing; if ( this.hasOutroTransitions ) { outroing = this.getUniqueName( 'outroing' ); @@ -168,6 +175,24 @@ export default class Block { } } + if ( this.hasIntroTransitions ) { + if ( this.builders.outro.isEmpty() ) { + properties.addBlock( `intro: ${this.generator.helper( 'noop' )},` ); + } else { + properties.addBlock( deindent` + intro: function ( ${this.target}, anchor ) { + if ( ${introing} ) return; + ${introing} = true; + ${this.hasOutroTransitions && `${outroing} = false;`} + + ${this.builders.intro} + + this.mount( ${this.target}, anchor ); + }, + ` ); + } + } + if ( this.hasOutroTransitions ) { if ( this.builders.outro.isEmpty() ) { properties.addBlock( `outro: ${this.generator.helper( 'noop' )},` ); @@ -176,6 +201,7 @@ export default class Block { outro: function ( ${this.alias( 'outrocallback' )} ) { if ( ${outroing} ) return; ${outroing} = true; + ${this.hasIntroTransitions && `${introing} = false;`} var ${this.alias( 'outros' )} = ${this.outros}; diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index b3e1a7e51071..2483b4f12bff 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -17,7 +17,11 @@ export default function addTransitions ( generator, block, state, node, intro, o const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? - block.builders.create.addBlock( deindent` + if ( outro ) { + block.builders.intro.addBlock( `if ( ${outroName} ) ${outroName}.abort();` ); + } + + block.builders.intro.addBlock( deindent` ${block.component}._renderHooks.push( function () { ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${introSnippet}, true, null, function () { ${block.component}.fire( 'intro.end', { node: ${state.name} }); diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index 8c6a8b2a7e95..c4f1a435f884 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -10,6 +10,7 @@ function getBranches ( generator, block, state, node ) { condition: block.contextualise( node.expression ).snippet, block: node._block.name, dynamic: node._block.dependencies.size > 0, + hasIntroTransitions: node._block.hasIntroTransitions, hasOutroTransitions: node._block.hasOutroTransitions }]; @@ -24,6 +25,7 @@ function getBranches ( generator, block, state, node ) { condition: null, block: node.else ? node.else._block.name : null, dynamic: node.else ? node.else._block.dependencies.size > 0 : false, + hasIntroTransitions: node.else ? node.else._block.hasIntroTransitions : false, hasOutroTransitions: node.else ? node.else._block.hasOutroTransitions : false }); @@ -74,16 +76,17 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ` ); const isToplevel = !state.parentNode; + const mountOrIntro = branch.hasIntroTransitions ? 'intro' : 'mount'; if ( isToplevel ) { - block.builders.mount.addLine( `if ( ${name} ) ${name}.mount( ${block.target}, null );` ); + block.builders.mount.addLine( `if ( ${name} ) ${name}.${mountOrIntro}( ${block.target}, null );` ); } else { - block.builders.create.addLine( `if ( ${name} ) ${name}.mount( ${state.parentNode}, null );` ); + block.builders.create.addLine( `if ( ${name} ) ${name}.${mountOrIntro}( ${state.parentNode}, null );` ); } const parentNode = state.parentNode || `${anchor}.parentNode`; - const remove = branch.hasOutroTransitions ? + const exit = branch.hasOutroTransitions ? deindent` ${name}.outro( function () { ${name} = null; @@ -95,6 +98,10 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor `; if ( dynamic ) { + if ( branch.hasIntroTransitions ) { + throw new Error( 'TODO simple dynamic if-block with intro transitions' ); + } + block.builders.update.addBlock( deindent` if ( ${branch.condition} ) { if ( ${name} ) { @@ -104,18 +111,27 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ${name}.mount( ${parentNode}, ${anchor} ); } } else if ( ${name} ) { - ${remove} + ${exit} } ` ); } else { - block.builders.update.addBlock( deindent` - if ( ${branch.condition} ) { + const enter = branch.hasIntroTransitions ? + deindent` + if ( !${name} ) ${name} = ${branch.block}( ${params}, ${block.component} ); + ${name}.intro( ${parentNode}, ${anchor} ); + ` : + deindent` if ( !${name} ) { ${name} = ${branch.block}( ${params}, ${block.component} ); ${name}.mount( ${parentNode}, ${anchor} ); } + `; + + block.builders.update.addBlock( deindent` + if ( ${branch.condition} ) { + ${enter} } else if ( ${name} ) { - ${remove} + ${exit} } ` ); } diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 1b4cb1b90dfd..58406864f7a9 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -27,7 +27,10 @@ export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { obj.tick( intro ? 1 : 0 ); callback(); }, - abort: noop + abort: function () { + if ( !intro ) obj.tick( 1 ); // reset styles for intro + this.aborted = true; + } }; } else { // CSS transition @@ -71,6 +74,7 @@ export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { }, abort: function () { node.style.cssText = getComputedStyle( node ).cssText; + this.aborted = true; } }; } @@ -105,12 +109,13 @@ export var transitionManager = { while ( i-- ) { var transition = transitionManager.transitions[i]; - if ( now >= transition.end ) { - transition.done(); - transitionManager.transitions.splice( i, 1 ); - } else { + + if ( now < transition.end && !transition.aborted ) { if ( now > transition.start ) transition.update( now ); transitionManager.running = true; + } else { + if ( !transition.aborted ) transition.done(); + transitionManager.transitions.splice( i, 1 ); } } From 45a9ce056d0cae09ebdace1602933473cdee9f8e Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 13:45:10 -0400 Subject: [PATCH 09/31] handle bidirectional transitions differently --- package.json | 1 + src/generators/dom/index.js | 2 +- .../dom/visitors/Element/Element.js | 2 +- .../dom/visitors/Element/addTransitions.js | 85 ++++++++++++------- src/shared/transitions.js | 52 +++++++++--- 5 files changed, 98 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 31c7eacb7ae3..1a80a18c7827 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build:shared": "rollup -c rollup/rollup.config.shared.js", "build:ssr": "rollup -c rollup/rollup.config.ssr.js", "dev": "rollup -c rollup/rollup.config.main.js -w", + "dev:shared": "rollup -c rollup/rollup.config.shared.js -w", "pretest": "npm run build", "prepublish": "npm run lint && npm run build" }, diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index 8cf7226a228e..fcd36fcba2a7 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -159,7 +159,7 @@ export default function dom ( parsed, source, options ) { ` ); } - if ( generator.hasComponents ) { + if ( generator.hasComponents || generator.hasIntroTransitions ) { const statement = `this._flush();`; builders.init.addBlock( statement ); diff --git a/src/generators/dom/visitors/Element/Element.js b/src/generators/dom/visitors/Element/Element.js index 11b3db978f13..c42e79c9473f 100644 --- a/src/generators/dom/visitors/Element/Element.js +++ b/src/generators/dom/visitors/Element/Element.js @@ -62,7 +62,7 @@ export default function visitElement ( generator, block, state, node ) { visitors[ attribute.type ]( generator, block, childState, node, attribute ); }); - addTransitions( generator, block, childState, node, intro, outro ); + if ( intro || outro ) addTransitions( generator, block, childState, node, intro, outro ); if ( !outro && !state.parentNode ) { // TODO this probably doesn't belong here. We eventually need to consider diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index 2483b4f12bff..3671321275b1 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -1,52 +1,77 @@ import deindent from '../../../../utils/deindent.js'; export default function addTransitions ( generator, block, state, node, intro, outro ) { - const introName = intro && block.getUniqueName( `${state.name}_intro` ); - const outroName = outro && block.getUniqueName( `${state.name}_outro` ); - - const introSnippet = intro && intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; - - const outroSnippet = outro === intro ? - introSnippet : - outro && outro.expression ? block.contextualise( outro.expression ).snippet : '{}'; - const wrapTransition = generator.helper( 'wrapTransition' ); - if ( intro ) { - block.addVariable( introName ); + if ( intro === outro ) { + const name = block.getUniqueName( `${state.name}_transition` ); + const snippet = intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; - const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? + block.addVariable( name ); - if ( outro ) { - block.builders.intro.addBlock( `if ( ${outroName} ) ${outroName}.abort();` ); - } + const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; block.builders.intro.addBlock( deindent` ${block.component}._renderHooks.push( function () { - ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${introSnippet}, true, null, function () { + if ( !${name} ) ${name} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); + ${name}.run( ${name}.t, 1, function () { ${block.component}.fire( 'intro.end', { node: ${state.name} }); }); - ${generator.helper( 'transitionManager' )}.add( ${introName} ); }); ` ); - } - - if ( outro ) { - block.addVariable( outroName ); - - const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; - - if ( intro ) { - block.builders.outro.addBlock( `${introName}.abort();` ); - } block.builders.outro.addBlock( deindent` - ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${outroSnippet}, false, null, function () { - detachNode( div ); + ${name}.run( ${name}.t, 0, function () { + detachNode( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); + ${name} = null; }); - transitionManager.add( ${outroName} ); ` ); } + + else { + const introName = intro && block.getUniqueName( `${state.name}_intro` ); + const outroName = outro && block.getUniqueName( `${state.name}_outro` ); + + if ( intro ) { + block.addVariable( introName ); + const snippet = intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; + + const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? + + if ( outro ) { + block.builders.intro.addBlock( `if ( ${outroName} ) ${outroName}.abort();` ); + } + + block.builders.intro.addBlock( deindent` + ${block.component}._renderHooks.push( function () { + ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); + ${introName}.run( 0, 1, function () { + ${block.component}.fire( 'intro.end', { node: ${state.name} }); + }); + }); + ` ); + } + + if ( outro ) { + block.addVariable( outroName ); + const snippet = outro.expression ? block.contextualise( outro.expression ).snippet : '{}'; + + const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; + + if ( intro ) { + block.builders.outro.addBlock( `${introName}.abort();` ); + } + + block.builders.outro.addBlock( deindent` + ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); + ${outroName}.run( 1, 0, function () { + detachNode( ${state.name} ); + ${block.component}.fire( 'outro.end', { node: ${state.name} }); + if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); + }); + ` ); + } + } } \ No newline at end of file diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 58406864f7a9..e106a6a837ff 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -4,12 +4,10 @@ export function linear ( t ) { return t; } -export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { +export function wrapTransition ( node, fn, params, intro, outgroup ) { var obj = fn( node, params, intro ); - var start = window.performance.now() + ( obj.delay || 0 ); var duration = obj.duration || 300; - var end = start + duration; var ease = obj.easing || linear; if ( obj.tick ) { @@ -17,19 +15,40 @@ export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { if ( intro ) obj.tick( 0 ); return { - start: start, - end: end, + start: null, + end: null, + a: null, + d: null, + running: false, + t: intro ? 0 : 1, + callback: null, update: function ( now ) { - const p = intro ? now - start : end - now; - obj.tick( ease( p / duration ) ); + const p = now - this.start; + this.t = this.a + this.d * ease( p / this.duration ); + obj.tick( this.t ); }, done: function () { obj.tick( intro ? 1 : 0 ); - callback(); + this.callback(); + this.running = false; }, abort: function () { if ( !intro ) obj.tick( 1 ); // reset styles for intro - this.aborted = true; + this.running = false; + }, + run: function ( a, b, callback ) { + this.a = a; + this.d = b - a; + this.start = window.performance.now() + ( obj.delay || 0 ); + this.duration = duration * Math.abs( b - a ); + this.end = this.start + this.duration; + + this.callback = callback; + + if ( !this.running ) { + this.running = true; + transitionManager.add( this ); + } } }; } else { @@ -75,6 +94,9 @@ export function wrapTransition ( node, fn, params, intro, outgroup, callback ) { abort: function () { node.style.cssText = getComputedStyle( node ).cssText; this.aborted = true; + }, + run: function ( a, b, callback ) { + // TODO... } }; } @@ -110,11 +132,17 @@ export var transitionManager = { while ( i-- ) { var transition = transitionManager.transitions[i]; - if ( now < transition.end && !transition.aborted ) { - if ( now > transition.start ) transition.update( now ); + if ( transition.running ) { + if ( now >= transition.end ) { + transition.done(); + } else if ( now > transition.start ) { + transition.update( now ); + } + } + + if ( transition.running ) { transitionManager.running = true; } else { - if ( !transition.aborted ) transition.done(); transitionManager.transitions.splice( i, 1 ); } } From 806b09840a2601fbbc4735f8fbbc3644edcac152 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 16:06:36 -0400 Subject: [PATCH 10/31] CSS transitions --- src/shared/transitions.js | 150 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 74 deletions(-) diff --git a/src/shared/transitions.js b/src/shared/transitions.js index e106a6a837ff..8f92cef27290 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -1,4 +1,4 @@ -import { noop } from './utils.js'; +import { assign, noop } from './utils.js'; export function linear ( t ) { return t; @@ -10,18 +10,39 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { var duration = obj.duration || 300; var ease = obj.easing || linear; + var transition = { + start: null, + end: null, + a: null, + b: null, + d: null, + running: false, + t: intro ? 0 : 1, + callback: null, + run: function ( a, b, callback ) { + this.a = a; + this.b = b; + this.d = b - a; + this.start = window.performance.now() + ( obj.delay || 0 ); + this.duration = duration * Math.abs( b - a ); + this.end = this.start + this.duration; + + this.callback = callback; + + if ( !obj.tick ) this.generateKeyframes(); + + if ( !this.running ) { + this.running = true; + transitionManager.add( this ); + } + } + } + if ( obj.tick ) { // JS transition if ( intro ) obj.tick( 0 ); - return { - start: null, - end: null, - a: null, - d: null, - running: false, - t: intro ? 0 : 1, - callback: null, + return assign( transition, { update: function ( now ) { const p = now - this.start; this.t = this.a + this.d * ease( p / this.duration ); @@ -30,76 +51,58 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { done: function () { obj.tick( intro ? 1 : 0 ); this.callback(); - this.running = false; }, abort: function () { if ( !intro ) obj.tick( 1 ); // reset styles for intro this.running = false; - }, - run: function ( a, b, callback ) { - this.a = a; - this.d = b - a; - this.start = window.performance.now() + ( obj.delay || 0 ); - this.duration = duration * Math.abs( b - a ); - this.end = this.start + this.duration; - - this.callback = callback; - - if ( !this.running ) { - this.running = true; - transitionManager.add( this ); - } } - }; - } else { - // CSS transition - var started = false; - var inlineStyles = {}; - var computedStyles = getComputedStyle( node ); - - return { - start: start, - end: end, - init: function () { - for ( var key in obj.styles ) { - inlineStyles[ key ] = node.style[ key ]; - node.style[ key ] = intro ? obj.styles[ key ] : computedStyles[ key ]; - } - }, - update: function ( now ) { - if ( !started ) { - var keys = Object.keys( obj.styles ); - div.style.transition = keys.map( function ( key ) { - return key + ' ' + d; - }).join( ', ' ); - - // TODO use a keyframe animation for custom easing functions - - for ( var key in obj.styles ) { - node.style[ key ] = intro ? computedStyles[ key ] : obj.styles[ key ]; - } + }); + } - started = true; - } - }, - done: function () { - // TODO what if one of these styles was dynamic? - if ( intro ) { - for ( var key in obj.styles ) { - node.style[ key ] = inlineStyles[ key ]; - } - } - callback(); - }, - abort: function () { - node.style.cssText = getComputedStyle( node ).cssText; - this.aborted = true; - }, - run: function ( a, b, callback ) { - // TODO... + // CSS transition + var started = false; + var id = null; + var style = document.createElement( 'style' ); + + var cleanup = function () { + document.head.removeChild( style ); + transition.running = started = false; + }; + + return assign( transition, { + generateKeyframes: function () { + id = 'svelte_' + ~~( Math.random() * 1e9 ); // TODO make this more robust + var keyframes = '@keyframes ' + id + '{\n'; + + for ( var p = 0; p <= 1; p += 166.666 / this.duration ) { + var t = this.a + this.d * ease( p ); + var styles = obj.styles( ease( t ) ); + keyframes += ( p * 100 ) + '%{' + styles + '}\n'; } - }; - } + + keyframes += '100% {' + obj.styles( this.b ) + '}\n}'; + + style.textContent = keyframes; + document.head.appendChild( style ); + + node.style.animationName = id; + node.style.animationDuration = ( this.duration / 1e3 ) + 's'; + node.style.animationTimingFunction = 'linear'; + node.style.animationIterationCount = 1; + node.style.animationFillMode = 'forwards'; + }, + update: function ( now ) { + const p = now - this.start; + this.t = this.a + this.d * ease( p / this.duration ); + }, + done: function () { + this.callback(); + cleanup(); + }, + abort: function () { + cleanup(); + } + }); } export var transitionManager = { @@ -134,13 +137,12 @@ export var transitionManager = { if ( transition.running ) { if ( now >= transition.end ) { + transition.running = false; transition.done(); } else if ( now > transition.start ) { transition.update( now ); } - } - if ( transition.running ) { transitionManager.running = true; } else { transitionManager.transitions.splice( i, 1 ); From d63f80fc4807419c6815b028585d26c86260a239 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 16:27:54 -0400 Subject: [PATCH 11/31] never abort transitions, they are either bidi or non-abortable --- .../dom/visitors/Element/addTransitions.js | 27 +++++++------------ src/shared/transitions.js | 12 +++------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index 3671321275b1..d053d89edbf9 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -31,23 +31,18 @@ export default function addTransitions ( generator, block, state, node, intro, o } else { - const introName = intro && block.getUniqueName( `${state.name}_intro` ); - const outroName = outro && block.getUniqueName( `${state.name}_outro` ); - if ( intro ) { - block.addVariable( introName ); + const name = block.getUniqueName( `${state.name}_intro` ); const snippet = intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; - const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? + block.addVariable( name ); - if ( outro ) { - block.builders.intro.addBlock( `if ( ${outroName} ) ${outroName}.abort();` ); - } + const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? block.builders.intro.addBlock( deindent` ${block.component}._renderHooks.push( function () { - ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); - ${introName}.run( 0, 1, function () { + ${name} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); + ${name}.run( 0, 1, function () { ${block.component}.fire( 'intro.end', { node: ${state.name} }); }); }); @@ -55,18 +50,16 @@ export default function addTransitions ( generator, block, state, node, intro, o } if ( outro ) { - block.addVariable( outroName ); + const name = block.getUniqueName( `${state.name}_intro` ); const snippet = outro.expression ? block.contextualise( outro.expression ).snippet : '{}'; - const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; + block.addVariable( name ); - if ( intro ) { - block.builders.outro.addBlock( `${introName}.abort();` ); - } + const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; block.builders.outro.addBlock( deindent` - ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); - ${outroName}.run( 1, 0, function () { + ${name} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); + ${name}.run( 1, 0, function () { detachNode( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 8f92cef27290..65a3b23ff327 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -60,13 +60,13 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { } // CSS transition - var started = false; var id = null; var style = document.createElement( 'style' ); var cleanup = function () { + if ( !transition.running ) return; document.head.removeChild( style ); - transition.running = started = false; + transition.running = false; }; return assign( transition, { @@ -82,14 +82,10 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { keyframes += '100% {' + obj.styles( this.b ) + '}\n}'; - style.textContent = keyframes; + style.textContent += keyframes; document.head.appendChild( style ); - node.style.animationName = id; - node.style.animationDuration = ( this.duration / 1e3 ) + 's'; - node.style.animationTimingFunction = 'linear'; - node.style.animationIterationCount = 1; - node.style.animationFillMode = 'forwards'; + node.style.animation += ( node.style.animation ? ', ' : '' ) + id + ' ' + this.duration + 'ms linear 1 forwards'; }, update: function ( now ) { const p = now - this.start; From 5638a7631bad074d624409e39b3222624ae13134 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 17:10:48 -0400 Subject: [PATCH 12/31] restart animations on secondary intro, various bits of cleanup --- .../dom/visitors/Element/addTransitions.js | 23 +++++++++++-------- src/generators/dom/visitors/IfBlock.js | 1 + src/shared/transitions.js | 14 +++++++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index d053d89edbf9..526a9df6ccb4 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -31,18 +31,23 @@ export default function addTransitions ( generator, block, state, node, intro, o } else { + const introName = intro && block.getUniqueName( `${state.name}_intro` ); + const outroName = outro && block.getUniqueName( `${state.name}_outro` ); + if ( intro ) { - const name = block.getUniqueName( `${state.name}_intro` ); + block.addVariable( introName ); const snippet = intro.expression ? block.contextualise( intro.expression ).snippet : '{}'; - block.addVariable( name ); - const fn = `${generator.alias( 'template' )}.transitions.${intro.name}`; // TODO add built-in transitions? + if ( outro ) { + block.builders.intro.addBlock( `if ( ${outroName} ) ${outroName}.abort();` ); + } + block.builders.intro.addBlock( deindent` ${block.component}._renderHooks.push( function () { - ${name} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); - ${name}.run( 0, 1, function () { + ${introName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, true, null ); + ${introName}.run( 0, 1, function () { ${block.component}.fire( 'intro.end', { node: ${state.name} }); }); }); @@ -50,16 +55,14 @@ export default function addTransitions ( generator, block, state, node, intro, o } if ( outro ) { - const name = block.getUniqueName( `${state.name}_intro` ); + block.addVariable( outroName ); const snippet = outro.expression ? block.contextualise( outro.expression ).snippet : '{}'; - block.addVariable( name ); - const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; block.builders.outro.addBlock( deindent` - ${name} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); - ${name}.run( 1, 0, function () { + ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); + ${outroName}.run( 1, 0, function () { detachNode( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index c4f1a435f884..00ddd049e32c 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -89,6 +89,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor const exit = branch.hasOutroTransitions ? deindent` ${name}.outro( function () { + ${name}.destroy( true ); ${name} = null; }); ` : diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 65a3b23ff327..ddf3c55b3bd4 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -64,17 +64,16 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { var style = document.createElement( 'style' ); var cleanup = function () { - if ( !transition.running ) return; document.head.removeChild( style ); transition.running = false; }; return assign( transition, { generateKeyframes: function () { - id = 'svelte_' + ~~( Math.random() * 1e9 ); // TODO make this more robust + id = '__svelte' + ~~( Math.random() * 1e9 ); // TODO make this more robust var keyframes = '@keyframes ' + id + '{\n'; - for ( var p = 0; p <= 1; p += 166.666 / this.duration ) { + for ( var p = 0; p <= 1; p += 16.666 / this.duration ) { var t = this.a + this.d * ease( p ); var styles = obj.styles( ease( t ) ); keyframes += ( p * 100 ) + '%{' + styles + '}\n'; @@ -85,7 +84,14 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { style.textContent += keyframes; document.head.appendChild( style ); - node.style.animation += ( node.style.animation ? ', ' : '' ) + id + ' ' + this.duration + 'ms linear 1 forwards'; + var d = this.d; + node.style.animation = node.style.animation.split( ',' ) + .filter( function ( anim ) { + // when introing, discard old animations if there are any + return anim && ( d < 0 || !/__svelte/.test( anim ) ); + }) + .concat( id + ' ' + this.duration + 'ms linear 1 forwards' ) + .join( ', ' ); }, update: function ( now ) { const p = now - this.start; From 5bee31fde63562cf007315cd7cff939a2fa79931 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 22:44:23 -0400 Subject: [PATCH 13/31] get basic intro transition test passing --- src/generators/dom/Block.js | 2 +- src/generators/dom/index.js | 17 +++++++---------- src/shared/transitions.js | 4 ++-- test/runtime/index.js | 16 +++++++++------- .../_config.js | 2 +- .../samples/transition-intro-js/main.html | 18 ++++++++++++++++++ .../runtime/samples/transition-intro/main.html | 3 --- 7 files changed, 38 insertions(+), 24 deletions(-) rename test/runtime/samples/{transition-intro => transition-intro-js}/_config.js (90%) create mode 100644 test/runtime/samples/transition-intro-js/main.html delete mode 100644 test/runtime/samples/transition-intro/main.html diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index f2d507c035b0..c8327e0b5d66 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -176,7 +176,7 @@ export default class Block { } if ( this.hasIntroTransitions ) { - if ( this.builders.outro.isEmpty() ) { + if ( this.builders.intro.isEmpty() ) { properties.addBlock( `intro: ${this.generator.helper( 'noop' )},` ); } else { properties.addBlock( deindent` diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index fcd36fcba2a7..ea2bc706b81c 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -303,22 +303,19 @@ export default function dom ( parsed, source, options ) { } }); - if ( typeof value === 'function' ) { // exclude transitionManager — special case + if ( key === 'transitionManager' ) { // special case + const global = `_svelteTransitionManager`; + + builders.main.addBlock( + `var ${generator.alias( 'transitionManager' )} = window.${global} || ( window.${global} = ${code});` + ); + } else { const alias = generator.alias( fn.id.name ); if ( alias !== fn.id.name ) code.overwrite( fn.id.start, fn.id.end, alias ); builders.main.addBlock( code.toString() ); } }); - - if ( generator.hasIntroTransitions || generator.hasOutroTransitions ) { - const global = `_svelteTransitionManager`; - const transitionManager = toSource( shared.transitionManager ); - - builders.main.addBlock( - `var ${generator.alias( 'transitionManager' )} = window.${global} || ( window.${global} = ${transitionManager});` - ); - } } return generator.generate( builders.main.toString(), options, { name, format } ); diff --git a/src/shared/transitions.js b/src/shared/transitions.js index ddf3c55b3bd4..01a13b77ec43 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -44,7 +44,7 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { return assign( transition, { update: function ( now ) { - const p = now - this.start; + var p = now - this.start; this.t = this.a + this.d * ease( p / this.duration ); obj.tick( this.t ); }, @@ -94,7 +94,7 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { .join( ', ' ); }, update: function ( now ) { - const p = now - this.start; + var p = now - this.start; this.t = this.a + this.d * ease( p / this.duration ); }, done: function () { diff --git a/test/runtime/index.js b/test/runtime/index.js index e67192cbc66c..153d8100f348 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -90,17 +90,19 @@ describe( 'runtime', () => { let SvelteComponent; - try { - SvelteComponent = require( `./samples/${dir}/main.html` ).default; - } catch ( err ) { - if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console - throw err; - } - let unintendedError = null; return env() .then( window => { + global.window = window; + + try { + SvelteComponent = require( `./samples/${dir}/main.html` ).default; + } catch ( err ) { + if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console + throw err; + } + Object.assign = () => { throw new Error( 'cannot use Object.assign in generated code, as it is not supported everywhere' ); }; diff --git a/test/runtime/samples/transition-intro/_config.js b/test/runtime/samples/transition-intro-js/_config.js similarity index 90% rename from test/runtime/samples/transition-intro/_config.js rename to test/runtime/samples/transition-intro-js/_config.js index bb60ad0e809d..18bd5526635c 100644 --- a/test/runtime/samples/transition-intro/_config.js +++ b/test/runtime/samples/transition-intro-js/_config.js @@ -4,7 +4,7 @@ export default { let callback; window.performance = { now: () => now }; - window.requestAnimationFrame = cb => callback = cb; + global.requestAnimationFrame = cb => callback = cb; component.set({ visible: true }); const div = target.querySelector( 'div' ); diff --git a/test/runtime/samples/transition-intro-js/main.html b/test/runtime/samples/transition-intro-js/main.html new file mode 100644 index 000000000000..9a3b4f34b831 --- /dev/null +++ b/test/runtime/samples/transition-intro-js/main.html @@ -0,0 +1,18 @@ +{{#if visible}} +
fades in
+{{/if}} + + \ No newline at end of file diff --git a/test/runtime/samples/transition-intro/main.html b/test/runtime/samples/transition-intro/main.html deleted file mode 100644 index 80cd4aca4993..000000000000 --- a/test/runtime/samples/transition-intro/main.html +++ /dev/null @@ -1,3 +0,0 @@ -{{#if visible}} -
fades in
-{{/if}} \ No newline at end of file From 26ed67267c8a446a7ca97f582858431247ca90ee Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 23:14:47 -0400 Subject: [PATCH 14/31] some more transition tests, albeit somewhat ugly --- .../dom/visitors/Element/addTransitions.js | 4 +- .../transition-js-if-block-bidi/_config.js | 40 ++++++++++++ .../transition-js-if-block-bidi/main.html | 19 ++++++ .../_config.js | 62 +++++++++++++++++++ .../main.html | 27 ++++++++ .../_config.js | 3 + .../main.html | 0 7 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/transition-js-if-block-bidi/_config.js create mode 100644 test/runtime/samples/transition-js-if-block-bidi/main.html create mode 100644 test/runtime/samples/transition-js-if-block-intro-outro/_config.js create mode 100644 test/runtime/samples/transition-js-if-block-intro-outro/main.html rename test/runtime/samples/{transition-intro-js => transition-js-if-block-intro}/_config.js (95%) rename test/runtime/samples/{transition-intro-js => transition-js-if-block-intro}/main.html (100%) diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index 526a9df6ccb4..42e46e36b6e8 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -22,7 +22,7 @@ export default function addTransitions ( generator, block, state, node, intro, o block.builders.outro.addBlock( deindent` ${name}.run( ${name}.t, 0, function () { - detachNode( ${state.name} ); + ${generator.helper( 'detachNode' )}( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); ${name} = null; @@ -63,7 +63,7 @@ export default function addTransitions ( generator, block, state, node, intro, o block.builders.outro.addBlock( deindent` ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); ${outroName}.run( 1, 0, function () { - detachNode( ${state.name} ); + ${generator.helper( 'detachNode' )}( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); }); diff --git a/test/runtime/samples/transition-js-if-block-bidi/_config.js b/test/runtime/samples/transition-js-if-block-bidi/_config.js new file mode 100644 index 000000000000..d4cd3982f0a3 --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-bidi/_config.js @@ -0,0 +1,40 @@ +export default { + test ( assert, component, target, window ) { + global.count = 0; + let now = 0; + let callback; + + window.performance = { now: () => now }; + global.requestAnimationFrame = cb => callback = cb; + + component.set({ visible: true }); + assert.equal( global.count, 1 ); + const div = target.querySelector( 'div' ); + assert.equal( div.foo, 0 ); + + now = 300; + callback(); + assert.equal( div.foo, 0.75 ); + + component.set({ visible: false }); + assert.equal( global.count, 1 ); + + now = 500; + callback(); + assert.equal( div.foo, 0.25 ); + + component.set({ visible: true }); + now = 700; + callback(); + assert.equal( div.foo, 0.75 ); + + now = 800; + callback(); + assert.equal( div.foo, 1 ); + + now = 900; + callback(); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-if-block-bidi/main.html b/test/runtime/samples/transition-js-if-block-bidi/main.html new file mode 100644 index 000000000000..31ffd90bc103 --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-bidi/main.html @@ -0,0 +1,19 @@ +{{#if visible}} +
foo bidi
+{{/if}} + + \ No newline at end of file diff --git a/test/runtime/samples/transition-js-if-block-intro-outro/_config.js b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js new file mode 100644 index 000000000000..f267ce2ad2ad --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js @@ -0,0 +1,62 @@ +export default { + test ( assert, component, target, window ) { + let now = 0; + let callback; + + window.performance = { now: () => now }; + global.requestAnimationFrame = cb => callback = cb; + + component.set({ visible: true }); + let div = target.querySelector( 'div' ); + assert.equal( div.foo, 0 ); + + now = 200; + callback(); + assert.equal( div.foo, 0.5 ); + + now = 400; + callback(); + assert.equal( div.foo, 1 ); + + now = 500; + callback(); + assert.equal( div.foo, 1 ); + + component.set({ visible: false }); + now = 600; + callback(); + assert.equal( div.foo, 1 ); + assert.equal( div.bar, 0.75 ); + + now = 900; + callback(); + assert.equal( div.foo, 1 ); + assert.equal( div.bar, 0 ); + + // test outro before intro complete + now = 1000; + component.set({ visible: true }); + div = target.querySelector( 'div' ); + callback(); + + now = 1200; + callback(); + assert.equal( div.foo, 0.5 ); + + component.set({ visible: false }); + now = 1300; + callback(); + assert.equal( div.foo, 0.75 ); + assert.equal( div.bar, 0.75 ); + + now = 1400; + callback(); + assert.equal( div.foo, 1 ); + assert.equal( div.bar, 0.5 ); + + now = 2000; + callback(); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-if-block-intro-outro/main.html b/test/runtime/samples/transition-js-if-block-intro-outro/main.html new file mode 100644 index 000000000000..d752e6372284 --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-intro-outro/main.html @@ -0,0 +1,27 @@ +{{#if visible}} +
foo then bar
+{{/if}} + + \ No newline at end of file diff --git a/test/runtime/samples/transition-intro-js/_config.js b/test/runtime/samples/transition-js-if-block-intro/_config.js similarity index 95% rename from test/runtime/samples/transition-intro-js/_config.js rename to test/runtime/samples/transition-js-if-block-intro/_config.js index 18bd5526635c..50a427062f6e 100644 --- a/test/runtime/samples/transition-intro-js/_config.js +++ b/test/runtime/samples/transition-js-if-block-intro/_config.js @@ -18,6 +18,9 @@ export default { callback(); assert.equal( window.getComputedStyle( div ).opacity, 1 ); + now = 500; + callback(); + component.destroy(); } }; \ No newline at end of file diff --git a/test/runtime/samples/transition-intro-js/main.html b/test/runtime/samples/transition-js-if-block-intro/main.html similarity index 100% rename from test/runtime/samples/transition-intro-js/main.html rename to test/runtime/samples/transition-js-if-block-intro/main.html From dfe00d86275dcd39db091e58760579c87e47bcea Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 08:48:42 -0400 Subject: [PATCH 15/31] support dynamic simple if-blocks --- .../dom/visitors/Element/Element.js | 11 ++- .../dom/visitors/Element/addTransitions.js | 4 +- src/generators/dom/visitors/IfBlock.js | 68 ++++++++++--------- .../_config.js | 47 +++++++++++++ .../main.html | 19 ++++++ 5 files changed, 108 insertions(+), 41 deletions(-) create mode 100644 test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js create mode 100644 test/runtime/samples/transition-js-dynamic-if-block-bidi/main.html diff --git a/src/generators/dom/visitors/Element/Element.js b/src/generators/dom/visitors/Element/Element.js index c42e79c9473f..bdf408732f6a 100644 --- a/src/generators/dom/visitors/Element/Element.js +++ b/src/generators/dom/visitors/Element/Element.js @@ -63,13 +63,12 @@ export default function visitElement ( generator, block, state, node ) { }); if ( intro || outro ) addTransitions( generator, block, childState, node, intro, outro ); + } - if ( !outro && !state.parentNode ) { - // TODO this probably doesn't belong here. We eventually need to consider - // what happens to elements that belong to the same outgroup as an - // outroing element... - block.builders.detach.addLine( `${generator.helper( 'detachNode' )}( ${name} );` ); - } + if ( !state.parentNode ) { + // TODO we eventually need to consider what happens to elements + // that belong to the same outgroup as an outroing element... + block.builders.detach.addLine( `${generator.helper( 'detachNode' )}( ${name} );` ); } if ( node.name !== 'select' ) { diff --git a/src/generators/dom/visitors/Element/addTransitions.js b/src/generators/dom/visitors/Element/addTransitions.js index 42e46e36b6e8..5e19c3d283a6 100644 --- a/src/generators/dom/visitors/Element/addTransitions.js +++ b/src/generators/dom/visitors/Element/addTransitions.js @@ -22,7 +22,6 @@ export default function addTransitions ( generator, block, state, node, intro, o block.builders.outro.addBlock( deindent` ${name}.run( ${name}.t, 0, function () { - ${generator.helper( 'detachNode' )}( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); ${name} = null; @@ -60,10 +59,11 @@ export default function addTransitions ( generator, block, state, node, intro, o const fn = `${generator.alias( 'template' )}.transitions.${outro.name}`; + // TODO hide elements that have outro'd (unless they belong to a still-outroing + // group) prior to their removal from the DOM block.builders.outro.addBlock( deindent` ${outroName} = ${wrapTransition}( ${state.name}, ${fn}, ${snippet}, false, null ); ${outroName}.run( 1, 0, function () { - ${generator.helper( 'detachNode' )}( ${state.name} ); ${block.component}.fire( 'outro.end', { node: ${state.name} }); if ( --${block.alias( 'outros' )} === 0 ) ${block.alias( 'outrocallback' )}(); }); diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index 00ddd049e32c..28b74fa5ffcb 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -86,37 +86,26 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor const parentNode = state.parentNode || `${anchor}.parentNode`; - const exit = branch.hasOutroTransitions ? - deindent` - ${name}.outro( function () { - ${name}.destroy( true ); - ${name} = null; - }); - ` : - deindent` - ${name}.destroy( true ); - ${name} = null; - `; - - if ( dynamic ) { - if ( branch.hasIntroTransitions ) { - throw new Error( 'TODO simple dynamic if-block with intro transitions' ); - } + const enter = dynamic ? + ( branch.hasIntroTransitions ? + deindent` + if ( ${name} ) { + ${name}.update( changed, ${params} ); + } else { + ${name} = ${branch.block}( ${params}, ${block.component} ); + } - block.builders.update.addBlock( deindent` - if ( ${branch.condition} ) { + ${name}.intro( ${parentNode}, ${anchor} ); + ` : + deindent` if ( ${name} ) { ${name}.update( changed, ${params} ); } else { ${name} = ${branch.block}( ${params}, ${block.component} ); ${name}.mount( ${parentNode}, ${anchor} ); } - } else if ( ${name} ) { - ${exit} - } - ` ); - } else { - const enter = branch.hasIntroTransitions ? + ` ) : + ( branch.hasIntroTransitions ? deindent` if ( !${name} ) ${name} = ${branch.block}( ${params}, ${block.component} ); ${name}.intro( ${parentNode}, ${anchor} ); @@ -126,16 +115,29 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ${name} = ${branch.block}( ${params}, ${block.component} ); ${name}.mount( ${parentNode}, ${anchor} ); } - `; + ` ); - block.builders.update.addBlock( deindent` - if ( ${branch.condition} ) { - ${enter} - } else if ( ${name} ) { - ${exit} - } - ` ); - } + // no `update()` here — we don't want to update outroing nodes, + // as that will typically result in glitching + const exit = branch.hasOutroTransitions ? + deindent` + ${name}.outro( function () { + ${name}.destroy( true ); + ${name} = null; + }); + ` : + deindent` + ${name}.destroy( true ); + ${name} = null; + `; + + block.builders.update.addBlock( deindent` + if ( ${branch.condition} ) { + ${enter} + } else if ( ${name} ) { + ${exit} + } + ` ); } function compound ( generator, block, state, node, branches, dynamic, { name, anchor, params } ) { diff --git a/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js new file mode 100644 index 000000000000..9177411dd6ea --- /dev/null +++ b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js @@ -0,0 +1,47 @@ +export default { + data: { + name: 'world' + }, + + test ( assert, component, target, window ) { + global.count = 0; + let now = 0; + let callback; + + window.performance = { now: () => now }; + global.requestAnimationFrame = cb => callback = cb; + + component.set({ visible: true }); + assert.equal( global.count, 1 ); + const div = target.querySelector( 'div' ); + assert.equal( div.foo, 0 ); + + now = 300; + callback(); + component.set({ name: 'everybody' }); + assert.equal( div.foo, 0.75 ); + assert.htmlEqual( div.innerHTML, 'hello everybody!' ); + + component.set({ visible: false, name: 'again' }); + assert.htmlEqual( div.innerHTML, 'hello everybody!' ); + + now = 500; + callback(); + assert.equal( div.foo, 0.25 ); + + component.set({ visible: true }); + now = 700; + callback(); + assert.equal( div.foo, 0.75 ); + assert.htmlEqual( div.innerHTML, 'hello again!' ); + + now = 800; + callback(); + assert.equal( div.foo, 1 ); + + now = 900; + callback(); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-dynamic-if-block-bidi/main.html b/test/runtime/samples/transition-js-dynamic-if-block-bidi/main.html new file mode 100644 index 000000000000..bc0dace68b5d --- /dev/null +++ b/test/runtime/samples/transition-js-dynamic-if-block-bidi/main.html @@ -0,0 +1,19 @@ +{{#if visible}} +
hello {{name}}!
+{{/if}} + + \ No newline at end of file From ec0e4a62cfe981a0d4df137adaa6d36234baecb4 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 10:53:56 -0400 Subject: [PATCH 16/31] support transitions in compound if-blocks --- src/generators/dom/Block.js | 18 +++- src/generators/dom/preprocess.js | 7 ++ src/generators/dom/visitors/IfBlock.js | 139 ++++++++++++++++++++----- 3 files changed, 132 insertions(+), 32 deletions(-) diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index c8327e0b5d66..922306d8f3f2 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -31,6 +31,8 @@ export default class Block { destroy: new CodeBuilder() }; + this.hasIntroMethod = false; // a block could have an intro method but not intro transitions, e.g. if a sibling block has intros + this.hasOutroMethod = false; this.hasIntroTransitions = false; this.hasOutroTransitions = false; this.outros = 0; @@ -175,9 +177,13 @@ export default class Block { } } - if ( this.hasIntroTransitions ) { + if ( this.hasIntroMethod ) { if ( this.builders.intro.isEmpty() ) { - properties.addBlock( `intro: ${this.generator.helper( 'noop' )},` ); + properties.addBlock( deindent` + intro: function ( ${this.target}, anchor ) { + this.mount( ${this.target}, anchor ); + }, + ` ); } else { properties.addBlock( deindent` intro: function ( ${this.target}, anchor ) { @@ -193,9 +199,13 @@ export default class Block { } } - if ( this.hasOutroTransitions ) { + if ( this.hasOutroMethod ) { if ( this.builders.outro.isEmpty() ) { - properties.addBlock( `outro: ${this.generator.helper( 'noop' )},` ); + properties.addBlock( deindent` + outro: function ( outrocallback ) { + outrocallback(); + }, + ` ); } else { properties.addBlock( deindent` outro: function ( ${this.alias( 'outrocallback' )} ) { diff --git a/src/generators/dom/preprocess.js b/src/generators/dom/preprocess.js index 1c60a72cdb38..6b43f93460e3 100644 --- a/src/generators/dom/preprocess.js +++ b/src/generators/dom/preprocess.js @@ -59,6 +59,8 @@ const preprocessors = { IfBlock: ( generator, block, state, node ) => { const blocks = []; let dynamic = false; + let hasIntros = false; + let hasOutros = false; function attachBlocks ( node ) { const dependencies = block.findDependencies( node.expression ); @@ -78,6 +80,9 @@ const preprocessors = { block.addDependencies( node._block.dependencies ); } + if ( node._block.hasIntroTransitions ) hasIntros = true; + if ( node._block.hasOutroTransitions ) hasOutros = true; + if ( isElseIf( node.else ) ) { attachBlocks( node.else.children[0] ); } else if ( node.else ) { @@ -101,6 +106,8 @@ const preprocessors = { blocks.forEach( block => { block.hasUpdateMethod = dynamic; + block.hasIntroMethod = hasIntros; + block.hasOutroMethod = hasOutros; }); generator.blocks.push( ...blocks ); diff --git a/src/generators/dom/visitors/IfBlock.js b/src/generators/dom/visitors/IfBlock.js index 28b74fa5ffcb..11b267717c66 100644 --- a/src/generators/dom/visitors/IfBlock.js +++ b/src/generators/dom/visitors/IfBlock.js @@ -9,9 +9,9 @@ function getBranches ( generator, block, state, node ) { const branches = [{ condition: block.contextualise( node.expression ).snippet, block: node._block.name, - dynamic: node._block.dependencies.size > 0, - hasIntroTransitions: node._block.hasIntroTransitions, - hasOutroTransitions: node._block.hasOutroTransitions + hasUpdateMethod: node._block.hasUpdateMethod, + hasIntroMethod: node._block.hasIntroMethod, + hasOutroMethod: node._block.hasOutroMethod }]; visitChildren( generator, block, state, node ); @@ -24,9 +24,9 @@ function getBranches ( generator, block, state, node ) { branches.push({ condition: null, block: node.else ? node.else._block.name : null, - dynamic: node.else ? node.else._block.dependencies.size > 0 : false, - hasIntroTransitions: node.else ? node.else._block.hasIntroTransitions : false, - hasOutroTransitions: node.else ? node.else._block.hasOutroTransitions : false + hasUpdateMethod: node.else ? node.else._block.hasUpdateMethod : false, + hasIntroMethod: node.else ? node.else._block.hasIntroMethod : false, + hasOutroMethod: node.else ? node.else._block.hasOutroMethod : false }); if ( node.else ) { @@ -57,10 +57,15 @@ export default function visitIfBlock ( generator, block, state, node ) { } const branches = getBranches( generator, block, state, node, generator.getUniqueName( `create_if_block` ) ); - const dynamic = branches.some( branch => branch.dynamic ); + const dynamic = branches[0].hasUpdateMethod; // can use [0] as proxy for all, since they necessarily have the same value + const hasOutros = branches[0].hasOutroMethod; if ( node.else ) { - compound( generator, block, state, node, branches, dynamic, vars ); + if ( hasOutros ) { + compoundWithOutros( generator, block, state, node, branches, dynamic, vars ); + } else { + compound( generator, block, state, node, branches, dynamic, vars ); + } } else { simple( generator, block, state, node, branches[0], dynamic, vars ); } @@ -76,7 +81,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ` ); const isToplevel = !state.parentNode; - const mountOrIntro = branch.hasIntroTransitions ? 'intro' : 'mount'; + const mountOrIntro = branch.hasIntroMethod ? 'intro' : 'mount'; if ( isToplevel ) { block.builders.mount.addLine( `if ( ${name} ) ${name}.${mountOrIntro}( ${block.target}, null );` ); @@ -87,7 +92,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor const parentNode = state.parentNode || `${anchor}.parentNode`; const enter = dynamic ? - ( branch.hasIntroTransitions ? + ( branch.hasIntroMethod ? deindent` if ( ${name} ) { ${name}.update( changed, ${params} ); @@ -105,7 +110,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor ${name}.mount( ${parentNode}, ${anchor} ); } ` ) : - ( branch.hasIntroTransitions ? + ( branch.hasIntroMethod ? deindent` if ( !${name} ) ${name} = ${branch.block}( ${params}, ${block.component} ); ${name}.intro( ${parentNode}, ${anchor} ); @@ -119,7 +124,7 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor // no `update()` here — we don't want to update outroing nodes, // as that will typically result in glitching - const exit = branch.hasOutroTransitions ? + const exit = branch.hasOutroMethod ? deindent` ${name}.outro( function () { ${name}.destroy( true ); @@ -141,50 +146,128 @@ function simple ( generator, block, state, node, branch, dynamic, { name, anchor } function compound ( generator, block, state, node, branches, dynamic, { name, anchor, params } ) { - const getBlock = block.getUniqueName( `get_block` ); + const get_block = block.getUniqueName( `get_block` ); const current_block = block.getUniqueName( `current_block` ); block.builders.create.addBlock( deindent` - function ${getBlock} ( ${params} ) { + function ${get_block} ( ${params} ) { ${branches.map( ({ condition, block }) => { return `${condition ? `if ( ${condition} ) ` : ''}return ${block};`; } ).join( '\n' )} } - var ${current_block} = ${getBlock}( ${params} ); + var ${current_block} = ${get_block}( ${params} ); var ${name} = ${current_block} && ${current_block}( ${params}, ${block.component} ); ` ); const isToplevel = !state.parentNode; + const mountOrIntro = branches[0].hasIntroMethod ? 'intro' : 'mount'; if ( isToplevel ) { - block.builders.mount.addLine( `if ( ${name} ) ${name}.mount( ${block.target}, null );` ); + block.builders.mount.addLine( `if ( ${name} ) ${name}.${mountOrIntro}( ${block.target}, null );` ); } else { - block.builders.create.addLine( `if ( ${name} ) ${name}.mount( ${state.parentNode}, null );` ); + block.builders.create.addLine( `if ( ${name} ) ${name}.${mountOrIntro}( ${state.parentNode}, null );` ); } const parentNode = state.parentNode || `${anchor}.parentNode`; - if ( block.hasOutroTransitions ) { - throw new Error( 'TODO compound if-blocks with outro transitions are not yet supported' ); - } + const changeBlock = deindent` + if ( ${name} ) ${name}.destroy( true ); + ${name} = ${current_block} && ${current_block}( ${params}, ${block.component} ); + if ( ${name} ) ${name}.${mountOrIntro}( ${parentNode}, ${anchor} ); + `; if ( dynamic ) { block.builders.update.addBlock( deindent` - if ( ${current_block} === ( ${current_block} = ${getBlock}( ${params} ) ) && ${name} ) { + if ( ${current_block} === ( ${current_block} = ${get_block}( ${params} ) ) && ${name} ) { ${name}.update( changed, ${params} ); } else { - if ( ${name} ) ${name}.destroy( true ); - ${name} = ${current_block} && ${current_block}( ${params}, ${block.component} ); - if ( ${name} ) ${name}.mount( ${parentNode}, ${anchor} ); + ${changeBlock} + } + ` ); + } else { + block.builders.update.addBlock( deindent` + if ( ${current_block} !== ( ${current_block} = ${get_block}( ${params} ) ) ) { + ${changeBlock} + } + ` ); + } +} + +// if any of the siblings have outros, we need to keep references to the blocks +// (TODO does this only apply to bidi transitions?) +function compoundWithOutros ( generator, block, state, node, branches, dynamic, { name, anchor, params } ) { + const get_block = block.getUniqueName( `get_block` ); + const current_block_index = block.getUniqueName( `current_block_index` ); + const previous_block_index = block.getUniqueName( `previous_block_index` ); + const if_block_creators = block.getUniqueName( `if_block_creators` ); + const if_blocks = block.getUniqueName( `if_blocks` ); + + block.addVariable( current_block_index ); + + block.builders.create.addBlock( deindent` + var ${if_block_creators} = [ + ${branches.map( branch => branch.block ).join( ',\n' )} + ]; + + var ${if_blocks} = []; + + function ${get_block} ( ${params} ) { + ${branches.map( ({ condition, block }, i ) => { + return `${condition ? `if ( ${condition} ) ` : ''}return ${block ? i : -1};`; + } ).join( '\n' )} + } + + if ( ~( ${current_block_index} = ${get_block}( ${params} ) ) ) { + ${if_blocks}[ ${current_block_index} ] = ${if_block_creators}[ ${current_block_index} ]( ${params}, ${block.component} ); + } + ` ); + + const isToplevel = !state.parentNode; + const mountOrIntro = branches[0].hasIntroMethod ? 'intro' : 'mount'; + const initialTarget = isToplevel ? block.target : state.parentNode; + + ( isToplevel ? block.builders.mount : block.builders.create ).addBlock( + `if ( ~${current_block_index} ) ${if_blocks}[ ${current_block_index} ].${mountOrIntro}( ${initialTarget}, null );` + ); + + const parentNode = state.parentNode || `${anchor}.parentNode`; + + const changeBlock = deindent` + var ${name} = ${if_blocks}[ ${previous_block_index} ]; + if ( ${name} ) { + ${name}.outro( function () { + ${if_blocks}[ ${previous_block_index} ].destroy( true ); + ${if_blocks}[ ${previous_block_index} ] = null; + }); + } + + if ( ~${current_block_index} ) { + ${name} = ${if_blocks}[ ${current_block_index} ]; + if ( !${name} ) { + ${name} = ${if_blocks}[ ${current_block_index} ] = ${if_block_creators}[ ${current_block_index} ]( ${params}, ${block.component} ); + } + + ${name}.${mountOrIntro}( ${parentNode}, ${anchor} ); + } + `; + + if ( dynamic ) { + block.builders.update.addBlock( deindent` + var ${previous_block_index} = ${current_block_index}; + ${current_block_index} = ${get_block}( state ); + if ( ${current_block_index} === ${previous_block_index} ) { + if ( ~${current_block_index} ) ${if_blocks}[ ${current_block_index} ].update( changed, ${params} ); + } else { + ${changeBlock} } ` ); } else { block.builders.update.addBlock( deindent` - if ( ${current_block} !== ( ${current_block} = ${getBlock}( ${params} ) ) ) { - if ( ${name} ) ${name}.destroy( true ); - ${name} = ${current_block} && ${current_block}( ${params}, ${block.component} ); - if ( ${name} ) ${name}.mount( ${parentNode}, ${anchor} ); + var ${previous_block_index} = ${current_block_index}; + ${current_block_index} = ${get_block}( state ); + if ( ${current_block_index} !== ${previous_block_index} ) { + ${changeBlock} } ` ); } From 07f6ec50edf90488dfb57b373d7c25765fac4ebd Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 11:23:07 -0400 Subject: [PATCH 17/31] only apply easing function once! --- src/shared/transitions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 01a13b77ec43..90fdd0d1701d 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -75,7 +75,7 @@ export function wrapTransition ( node, fn, params, intro, outgroup ) { for ( var p = 0; p <= 1; p += 16.666 / this.duration ) { var t = this.a + this.d * ease( p ); - var styles = obj.styles( ease( t ) ); + var styles = obj.styles( t ); keyframes += ( p * 100 ) + '%{' + styles + '}\n'; } From f5bc3e3c84da6387feebde49ff5328f8a52fcc9f Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 13:58:54 -0400 Subject: [PATCH 18/31] remove method is unused --- src/shared/transitions.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 90fdd0d1701d..a74e09711db1 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -120,14 +120,6 @@ export var transitionManager = { } }, - remove: function ( transitions ) { - var i = transitions.length; - while ( i-- ) { - var index = this.transitions.indexOf( transitions[i] ); - if ( ~index ) this.transitions.splice( index, 1 ); - } - }, - next: function () { transitionManager.running = false; From f76fac2973d9354ea17959292aae52a6baafd3a5 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 13:59:20 -0400 Subject: [PATCH 19/31] tighten up transition tests --- test/runtime/index.js | 29 +++++++++++++- .../_config.js | 22 +++-------- .../transition-js-if-block-bidi/_config.js | 22 +++-------- .../_config.js | 38 ++++++------------- .../transition-js-if-block-intro/_config.js | 17 ++------- .../_config.js | 21 ++++++++++ .../main.html | 20 ++++++++++ 7 files changed, 95 insertions(+), 74 deletions(-) create mode 100644 test/runtime/samples/transition-js-if-else-block-intro/_config.js create mode 100644 test/runtime/samples/transition-js-if-else-block-intro/main.html diff --git a/test/runtime/index.js b/test/runtime/index.js index 153d8100f348..604042d0a41b 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -4,6 +4,7 @@ import * as path from 'path'; import * as fs from 'fs'; import * as acorn from 'acorn'; import * as babel from 'babel-core'; +import { transitionManager } from '../../shared.js'; import { addLineNumbers, loadConfig, loadSvelte, env, setupHtmlEqual } from '../helpers.js'; @@ -94,6 +95,29 @@ describe( 'runtime', () => { return env() .then( window => { + // set of hacks to support transition tests + transitionManager.running = false; + transitionManager.transitions = []; + + const raf = { + time: 0, + callback: null, + tick: now => { + raf.time = now; + if ( raf.callback ) raf.callback(); + } + }; + window.performance = { now: () => raf.time }; + global.requestAnimationFrame = cb => { + let called = false; + raf.callback = () => { + if ( !called ) { + called = true; + cb(); + } + }; + }; + global.window = window; try { @@ -148,7 +172,7 @@ describe( 'runtime', () => { Object.assign = Object_assign; if ( config.test ) { - config.test( assert, component, target, window ); + config.test( assert, component, target, window, raf ); } else { component.destroy(); assert.equal( target.innerHTML, '' ); @@ -175,9 +199,10 @@ describe( 'runtime', () => { }); }); + const shared = path.resolve( 'shared.js' ); describe( 'shared helpers', () => { fs.readdirSync( 'test/runtime/samples' ).forEach( dir => { - runTest( dir, path.resolve( 'shared.js' ) ); + runTest( dir, shared ); }); }); diff --git a/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js index 9177411dd6ea..fcf391ac60c3 100644 --- a/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js @@ -3,21 +3,15 @@ export default { name: 'world' }, - test ( assert, component, target, window ) { + test ( assert, component, target, window, raf ) { global.count = 0; - let now = 0; - let callback; - - window.performance = { now: () => now }; - global.requestAnimationFrame = cb => callback = cb; component.set({ visible: true }); assert.equal( global.count, 1 ); const div = target.querySelector( 'div' ); assert.equal( div.foo, 0 ); - now = 300; - callback(); + raf.tick( 300 ); component.set({ name: 'everybody' }); assert.equal( div.foo, 0.75 ); assert.htmlEqual( div.innerHTML, 'hello everybody!' ); @@ -25,22 +19,18 @@ export default { component.set({ visible: false, name: 'again' }); assert.htmlEqual( div.innerHTML, 'hello everybody!' ); - now = 500; - callback(); + raf.tick( 500 ); assert.equal( div.foo, 0.25 ); component.set({ visible: true }); - now = 700; - callback(); + raf.tick( 700 ); assert.equal( div.foo, 0.75 ); assert.htmlEqual( div.innerHTML, 'hello again!' ); - now = 800; - callback(); + raf.tick( 800 ); assert.equal( div.foo, 1 ); - now = 900; - callback(); + raf.tick( 900 ); component.destroy(); } diff --git a/test/runtime/samples/transition-js-if-block-bidi/_config.js b/test/runtime/samples/transition-js-if-block-bidi/_config.js index d4cd3982f0a3..8a6db10074e2 100644 --- a/test/runtime/samples/transition-js-if-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-if-block-bidi/_config.js @@ -1,39 +1,29 @@ export default { - test ( assert, component, target, window ) { + test ( assert, component, target, window, raf ) { global.count = 0; - let now = 0; - let callback; - - window.performance = { now: () => now }; - global.requestAnimationFrame = cb => callback = cb; component.set({ visible: true }); assert.equal( global.count, 1 ); const div = target.querySelector( 'div' ); assert.equal( div.foo, 0 ); - now = 300; - callback(); + raf.tick( 300 ); assert.equal( div.foo, 0.75 ); component.set({ visible: false }); assert.equal( global.count, 1 ); - now = 500; - callback(); + raf.tick( 500 ); assert.equal( div.foo, 0.25 ); component.set({ visible: true }); - now = 700; - callback(); + raf.tick( 700 ); assert.equal( div.foo, 0.75 ); - now = 800; - callback(); + raf.tick( 800 ); assert.equal( div.foo, 1 ); - now = 900; - callback(); + raf.tick( 900 ); component.destroy(); } diff --git a/test/runtime/samples/transition-js-if-block-intro-outro/_config.js b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js index f267ce2ad2ad..146ac082d55c 100644 --- a/test/runtime/samples/transition-js-if-block-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js @@ -1,61 +1,45 @@ export default { - test ( assert, component, target, window ) { - let now = 0; - let callback; - - window.performance = { now: () => now }; - global.requestAnimationFrame = cb => callback = cb; - + test ( assert, component, target, window, raf ) { component.set({ visible: true }); let div = target.querySelector( 'div' ); assert.equal( div.foo, 0 ); - now = 200; - callback(); + raf.tick( 200 ); assert.equal( div.foo, 0.5 ); - now = 400; - callback(); + raf.tick( 400 ); assert.equal( div.foo, 1 ); - now = 500; - callback(); + raf.tick( 500 ); assert.equal( div.foo, 1 ); component.set({ visible: false }); - now = 600; - callback(); + raf.tick( 600 ); assert.equal( div.foo, 1 ); assert.equal( div.bar, 0.75 ); - now = 900; - callback(); + raf.tick( 900 ); assert.equal( div.foo, 1 ); assert.equal( div.bar, 0 ); // test outro before intro complete - now = 1000; + raf.tick( 1000 ); component.set({ visible: true }); div = target.querySelector( 'div' ); - callback(); - now = 1200; - callback(); + raf.tick( 1200 ); assert.equal( div.foo, 0.5 ); component.set({ visible: false }); - now = 1300; - callback(); + raf.tick( 1300 ); assert.equal( div.foo, 0.75 ); assert.equal( div.bar, 0.75 ); - now = 1400; - callback(); + raf.tick( 1400 ); assert.equal( div.foo, 1 ); assert.equal( div.bar, 0.5 ); - now = 2000; - callback(); + raf.tick( 2000 ); component.destroy(); } diff --git a/test/runtime/samples/transition-js-if-block-intro/_config.js b/test/runtime/samples/transition-js-if-block-intro/_config.js index 50a427062f6e..04d3c6245e4f 100644 --- a/test/runtime/samples/transition-js-if-block-intro/_config.js +++ b/test/runtime/samples/transition-js-if-block-intro/_config.js @@ -1,25 +1,16 @@ export default { - test ( assert, component, target, window ) { - let now = 0; - let callback; - - window.performance = { now: () => now }; - global.requestAnimationFrame = cb => callback = cb; - + test ( assert, component, target, window, raf ) { component.set({ visible: true }); const div = target.querySelector( 'div' ); assert.equal( window.getComputedStyle( div ).opacity, 0 ); - now = 200; - callback(); + raf.tick( 200 ); assert.equal( window.getComputedStyle( div ).opacity, 0.5 ); - now = 400; - callback(); + raf.tick( 400 ); assert.equal( window.getComputedStyle( div ).opacity, 1 ); - now = 500; - callback(); + raf.tick( 500 ); component.destroy(); } diff --git a/test/runtime/samples/transition-js-if-else-block-intro/_config.js b/test/runtime/samples/transition-js-if-else-block-intro/_config.js new file mode 100644 index 000000000000..768b16567cc8 --- /dev/null +++ b/test/runtime/samples/transition-js-if-else-block-intro/_config.js @@ -0,0 +1,21 @@ +export default { + test ( assert, component, target, window, raf ) { + assert.equal( target.querySelector( 'div' ), component.refs.no ); + assert.equal( component.refs.no.foo, 0 ); + + raf.tick( 200 ); + assert.equal( component.refs.no.foo, 0.5 ); + + raf.tick( 500 ); + component.set({ x: true }); + assert.equal( component.refs.no, undefined ); + assert.equal( component.refs.yes.foo, 0 ); + + raf.tick( 700 ); + assert.equal( component.refs.yes.foo, 0.5 ); + + raf.tick( 1000 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-if-else-block-intro/main.html b/test/runtime/samples/transition-js-if-else-block-intro/main.html new file mode 100644 index 000000000000..1b30160b026a --- /dev/null +++ b/test/runtime/samples/transition-js-if-else-block-intro/main.html @@ -0,0 +1,20 @@ +{{#if x}} +
yes
+{{else}} +
no
+{{/if}} + + \ No newline at end of file From 65064cb70c441956aa0065a08a0be94c8524db3b Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 14:34:18 -0400 Subject: [PATCH 20/31] =?UTF-8?q?improve=20deindent=20slightly=20=E2=80=94?= =?UTF-8?q?=20allow=20inline=20false=20expressions=20(which=20get=20remove?= =?UTF-8?q?d),=20and=20trim=20trailing=20tabs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/deindent.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/utils/deindent.js b/src/utils/deindent.js index 63730254b3da..f618dd5277f5 100644 --- a/src/utils/deindent.js +++ b/src/utils/deindent.js @@ -9,13 +9,24 @@ export default function deindent ( strings, ...values ) { let trailingIndentation = getTrailingIndentation( result ); for ( let i = 1; i < strings.length; i += 1 ) { - const value = String( values[ i - 1 ] ).replace( /\n/g, `\n${trailingIndentation}` ); - result += value + strings[i].replace( pattern, '' ); + const expression = values[ i - 1 ]; + const string = strings[i].replace( pattern, '' ); + + if ( expression || expression === '' ) { + const value = String( expression ).replace( /\n/g, `\n${trailingIndentation}` ); + result += value + string; + } + + else { + let c = result.length; + while ( /\s/.test( result[ c - 1 ] ) ) c -= 1; + result = result.slice( 0, c ) + string; + } trailingIndentation = getTrailingIndentation( result ); } - return result.trim(); + return result.trim().replace( /\t+$/gm, '' ); } function getTrailingIndentation ( str ) { From a2cd983e99136a78f71143063b23ce7d0fe8c9a3 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 14:41:11 -0400 Subject: [PATCH 21/31] intro transitions in each-blocks --- src/generators/dom/Block.js | 38 +++++++++---------- src/generators/dom/preprocess.js | 8 ++-- src/generators/dom/visitors/EachBlock.js | 27 ++++++------- .../transition-js-each-block-intro/_config.js | 32 ++++++++++++++++ .../transition-js-each-block-intro/main.html | 18 +++++++++ .../samples/comment/_actual.html | 2 +- 6 files changed, 88 insertions(+), 37 deletions(-) create mode 100644 test/runtime/samples/transition-js-each-block-intro/_config.js create mode 100644 test/runtime/samples/transition-js-each-block-intro/main.html diff --git a/src/generators/dom/Block.js b/src/generators/dom/Block.js index 922306d8f3f2..f90575481505 100644 --- a/src/generators/dom/Block.js +++ b/src/generators/dom/Block.js @@ -33,8 +33,6 @@ export default class Block { this.hasIntroMethod = false; // a block could have an intro method but not intro transitions, e.g. if a sibling block has intros this.hasOutroMethod = false; - this.hasIntroTransitions = false; - this.hasOutroTransitions = false; this.outros = 0; this.aliases = new Map(); @@ -109,13 +107,15 @@ export default class Block { render () { let introing; - if ( this.hasIntroTransitions ) { + const hasIntros = !this.builders.intro.isEmpty(); + if ( hasIntros ) { introing = this.getUniqueName( 'introing' ); this.addVariable( introing ); } let outroing; - if ( this.hasOutroTransitions ) { + const hasOutros = !this.builders.outro.isEmpty(); + if ( hasOutros ) { outroing = this.getUniqueName( 'outroing' ); this.addVariable( outroing ); } @@ -178,21 +178,21 @@ export default class Block { } if ( this.hasIntroMethod ) { - if ( this.builders.intro.isEmpty() ) { + if ( hasIntros ) { properties.addBlock( deindent` intro: function ( ${this.target}, anchor ) { + if ( ${introing} ) return; + ${introing} = true; + ${hasOutros && `${outroing} = false;`} + + ${this.builders.intro} + this.mount( ${this.target}, anchor ); }, ` ); } else { properties.addBlock( deindent` intro: function ( ${this.target}, anchor ) { - if ( ${introing} ) return; - ${introing} = true; - ${this.hasOutroTransitions && `${outroing} = false;`} - - ${this.builders.intro} - this.mount( ${this.target}, anchor ); }, ` ); @@ -200,24 +200,24 @@ export default class Block { } if ( this.hasOutroMethod ) { - if ( this.builders.outro.isEmpty() ) { - properties.addBlock( deindent` - outro: function ( outrocallback ) { - outrocallback(); - }, - ` ); - } else { + if ( hasOutros ) { properties.addBlock( deindent` outro: function ( ${this.alias( 'outrocallback' )} ) { if ( ${outroing} ) return; ${outroing} = true; - ${this.hasIntroTransitions && `${introing} = false;`} + ${hasIntros && `${introing} = false;`} var ${this.alias( 'outros' )} = ${this.outros}; ${this.builders.outro} }, ` ); + } else { + properties.addBlock( deindent` + outro: function ( outrocallback ) { + outrocallback(); + }, + ` ); } } diff --git a/src/generators/dom/preprocess.js b/src/generators/dom/preprocess.js index 6b43f93460e3..522a68207483 100644 --- a/src/generators/dom/preprocess.js +++ b/src/generators/dom/preprocess.js @@ -80,8 +80,8 @@ const preprocessors = { block.addDependencies( node._block.dependencies ); } - if ( node._block.hasIntroTransitions ) hasIntros = true; - if ( node._block.hasOutroTransitions ) hasOutros = true; + if ( node._block.hasIntroMethod ) hasIntros = true; + if ( node._block.hasOutroMethod ) hasOutros = true; if ( isElseIf( node.else ) ) { attachBlocks( node.else.children[0] ); @@ -209,9 +209,9 @@ const preprocessors = { } else if ( attribute.type === 'Transition' ) { - if ( attribute.intro ) generator.hasIntroTransitions = block.hasIntroTransitions = true; + if ( attribute.intro ) generator.hasIntroTransitions = block.hasIntroMethod = true; if ( attribute.outro ) { - generator.hasOutroTransitions = block.hasOutroTransitions = true; + generator.hasOutroTransitions = block.hasOutroMethod = true; block.outros += 1; } } diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index e4df8c575da6..641ad9b8b5f2 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -11,7 +11,8 @@ export default function visitEachBlock ( generator, block, state, node ) { const params = block.params.join( ', ' ); const anchor = node.needsAnchor ? block.getUniqueName( `${each_block}_anchor` ) : ( node.next && node.next._state.name ) || 'null'; - const vars = { each_block, create_each_block, each_block_value, iterations, i, params, anchor }; + const mountOrIntro = node._block.hasIntroMethod ? 'intro' : 'mount'; + const vars = { each_block, create_each_block, each_block_value, iterations, i, params, anchor, mountOrIntro }; const { snippet } = block.contextualise( node.expression ); @@ -29,7 +30,7 @@ export default function visitEachBlock ( generator, block, state, node ) { if ( isToplevel ) { block.builders.mount.addBlock( deindent` for ( var ${i} = 0; ${i} < ${iterations}.length; ${i} += 1 ) { - ${iterations}[${i}].mount( ${block.target}, null ); + ${iterations}[${i}].${mountOrIntro}( ${block.target}, null ); } ` ); } @@ -52,13 +53,13 @@ export default function visitEachBlock ( generator, block, state, node ) { block.builders.create.addBlock( deindent` if ( !${each_block_value}.length ) { ${each_block_else} = ${node.else._block.name}( ${params}, ${block.component} ); - ${!isToplevel ? `${each_block_else}.mount( ${state.parentNode}, null );` : ''} + ${!isToplevel ? `${each_block_else}.${mountOrIntro}( ${state.parentNode}, null );` : ''} } ` ); block.builders.mount.addBlock( deindent` if ( ${each_block_else} ) { - ${each_block_else}.mount( ${state.parentNode || block.target}, null ); + ${each_block_else}.${mountOrIntro}( ${state.parentNode || block.target}, null ); } ` ); @@ -70,7 +71,7 @@ export default function visitEachBlock ( generator, block, state, node ) { ${each_block_else}.update( changed, ${params} ); } else if ( !${each_block_value}.length ) { ${each_block_else} = ${node.else._block.name}( ${params}, ${block.component} ); - ${each_block_else}.mount( ${parentNode}, ${anchor} ); + ${each_block_else}.${mountOrIntro}( ${parentNode}, ${anchor} ); } else if ( ${each_block_else} ) { ${each_block_else}.destroy( true ); ${each_block_else} = null; @@ -85,7 +86,7 @@ export default function visitEachBlock ( generator, block, state, node ) { } } else if ( !${each_block_else} ) { ${each_block_else} = ${node.else._block.name}( ${params}, ${block.component} ); - ${each_block_else}.mount( ${parentNode}, ${anchor} ); + ${each_block_else}.${mountOrIntro}( ${parentNode}, ${anchor} ); } ` ); } @@ -109,7 +110,7 @@ export default function visitEachBlock ( generator, block, state, node ) { } } -function keyed ( generator, block, state, node, snippet, { each_block, create_each_block, each_block_value, iterations, i, params, anchor } ) { +function keyed ( generator, block, state, node, snippet, { each_block, create_each_block, each_block_value, iterations, i, params, anchor, mountOrIntro } ) { const fragment = block.getUniqueName( 'fragment' ); const value = block.getUniqueName( 'value' ); const key = block.getUniqueName( 'key' ); @@ -129,7 +130,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea if ( state.parentNode ) { create.addLine( - `${iterations}[${i}].mount( ${state.parentNode}, null );` + `${iterations}[${i}].${mountOrIntro}( ${state.parentNode}, null );` ); } @@ -166,7 +167,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}${node.key ? `, ${key}` : `` } ); } - ${_iterations}[${i}].mount( ${fragment}, null ); + ${_iterations}[${i}].${mountOrIntro}( ${fragment}, null ); } // remove old iterations @@ -184,7 +185,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea ` ); } -function unkeyed ( generator, block, state, node, snippet, { create_each_block, each_block_value, iterations, i, params, anchor } ) { +function unkeyed ( generator, block, state, node, snippet, { create_each_block, each_block_value, iterations, i, params, anchor, mountOrIntro } ) { const create = new CodeBuilder(); create.addLine( @@ -193,7 +194,7 @@ function unkeyed ( generator, block, state, node, snippet, { create_each_block, if ( state.parentNode ) { create.addLine( - `${iterations}[${i}].mount( ${state.parentNode}, null );` + `${iterations}[${i}].${mountOrIntro}( ${state.parentNode}, null );` ); } @@ -222,12 +223,12 @@ function unkeyed ( generator, block, state, node, snippet, { create_each_block, ${iterations}[${i}].update( changed, ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i} ); } else { ${iterations}[${i}] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component} ); - ${iterations}[${i}].mount( ${parentNode}, ${anchor} ); + ${iterations}[${i}].${mountOrIntro}( ${parentNode}, ${anchor} ); } ` : deindent` ${iterations}[${i}] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component} ); - ${iterations}[${i}].mount( ${parentNode}, ${anchor} ); + ${iterations}[${i}].${mountOrIntro}( ${parentNode}, ${anchor} ); `; const start = node._block.hasUpdateMethod ? '0' : `${iterations}.length`; diff --git a/test/runtime/samples/transition-js-each-block-intro/_config.js b/test/runtime/samples/transition-js-each-block-intro/_config.js new file mode 100644 index 000000000000..7deb8c97a934 --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-intro/_config.js @@ -0,0 +1,32 @@ +export default { + data: { + things: [ 'a', 'b', 'c' ] + }, + + test ( assert, component, target, window, raf ) { + let divs = target.querySelectorAll( 'div' ); + assert.equal( divs[0].foo, 0 ); + assert.equal( divs[1].foo, 0 ); + assert.equal( divs[2].foo, 0 ); + + raf.tick( 50 ); + assert.equal( divs[0].foo, 0.5 ); + assert.equal( divs[1].foo, 0.5 ); + assert.equal( divs[2].foo, 0.5 ); + + component.set({ things: [ 'a', 'b', 'c', 'd' ] }); + divs = target.querySelectorAll( 'div' ); + assert.equal( divs[0].foo, 0.5 ); + assert.equal( divs[1].foo, 0.5 ); + assert.equal( divs[2].foo, 0.5 ); + assert.equal( divs[3].foo, 0 ); + + raf.tick( 75 ); + assert.equal( divs[0].foo, 0.75 ); + assert.equal( divs[1].foo, 0.75 ); + assert.equal( divs[2].foo, 0.75 ); + assert.equal( divs[3].foo, 0.25 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-block-intro/main.html b/test/runtime/samples/transition-js-each-block-intro/main.html new file mode 100644 index 000000000000..7f12ef1d8f82 --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-intro/main.html @@ -0,0 +1,18 @@ +{{#each things as thing}} +
{{thing}}
+{{/each}} + + \ No newline at end of file diff --git a/test/server-side-rendering/samples/comment/_actual.html b/test/server-side-rendering/samples/comment/_actual.html index e2adc073dcbc..e5c61a4b0ec2 100644 --- a/test/server-side-rendering/samples/comment/_actual.html +++ b/test/server-side-rendering/samples/comment/_actual.html @@ -1,3 +1,3 @@

before

- +

after

\ No newline at end of file From 2d533f99deef7dbd3d8134688b19b3f6bc89cf13 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 14:50:12 -0400 Subject: [PATCH 22/31] remove redundant ternary --- src/generators/dom/visitors/EachBlock.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index 641ad9b8b5f2..1657a6b9ac76 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -125,7 +125,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea create.addBlock( deindent` var ${key} = ${each_block_value}[${i}].${node.key}; - ${iterations}[${i}] = ${lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}${node.key ? `, ${key}` : `` } ); + ${iterations}[${i}] = ${lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} ); ` ); if ( state.parentNode ) { @@ -164,7 +164,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea if ( ${lookup}[ ${key} ] ) { ${consequent} } else { - ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}${node.key ? `, ${key}` : `` } ); + ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} ); } ${_iterations}[${i}].${mountOrIntro}( ${fragment}, null ); From 42af2bb32b59887d9a5cdc7c29c4ee52fbd7a58b Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 15:01:19 -0400 Subject: [PATCH 23/31] fix mount order of keyed each-block with intros --- src/generators/dom/visitors/EachBlock.js | 6 ++- .../_config.js | 49 +++++++++++++++++++ .../main.html | 18 +++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/transition-js-each-block-keyed-intro/_config.js create mode 100644 test/runtime/samples/transition-js-each-block-keyed-intro/main.html diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index 1657a6b9ac76..3d637bc5d925 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -149,6 +149,8 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea const parentNode = state.parentNode || `${anchor}.parentNode`; + const hasIntros = node._block.hasIntroMethod; + block.builders.update.addBlock( deindent` var ${each_block_value} = ${snippet}; var ${_iterations} = []; @@ -163,11 +165,13 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea if ( ${lookup}[ ${key} ] ) { ${consequent} + ${hasIntros && `${_iterations}[${i}].mount( ${fragment}, null );`} } else { ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} ); + ${hasIntros && `${_iterations}[${i}].intro( ${fragment}, null );`} } - ${_iterations}[${i}].${mountOrIntro}( ${fragment}, null ); + ${!hasIntros && `${_iterations}[${i}].mount( ${fragment}, null );`} } // remove old iterations diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js new file mode 100644 index 000000000000..dc61ac5ea430 --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js @@ -0,0 +1,49 @@ +export default { + data: { + things: [ + { name: 'a' }, + { name: 'b' }, + { name: 'c' } + ] + }, + + test ( assert, component, target, window, raf ) { + let divs = target.querySelectorAll( 'div' ); + assert.equal( divs[0].foo, 0 ); + assert.equal( divs[1].foo, 0 ); + assert.equal( divs[2].foo, 0 ); + + raf.tick( 50 ); + assert.equal( divs[0].foo, 0.5 ); + assert.equal( divs[1].foo, 0.5 ); + assert.equal( divs[2].foo, 0.5 ); + + component.set({ + things: [ + { name: 'a' }, + { name: 'woo!' }, + { name: 'b' }, + { name: 'c' } + ] + }); + assert.htmlEqual( target.innerHTML, ` +
a
+
woo!
+
b
+
c
+ ` ); + divs = target.querySelectorAll( 'div' ); + assert.equal( divs[0].foo, 0.5 ); + assert.equal( divs[1].foo, 0 ); + assert.equal( divs[2].foo, 0.5 ); + assert.equal( divs[3].foo, 0.5 ); + + raf.tick( 75 ); + assert.equal( divs[0].foo, 0.75 ); + assert.equal( divs[1].foo, 0.25 ); + assert.equal( divs[2].foo, 0.75 ); + assert.equal( divs[3].foo, 0.75 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro/main.html b/test/runtime/samples/transition-js-each-block-keyed-intro/main.html new file mode 100644 index 000000000000..d9442d0d6f1c --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-keyed-intro/main.html @@ -0,0 +1,18 @@ +{{#each things as thing @name}} +
{{thing.name}}
+{{/each}} + + \ No newline at end of file From f06eced938f2d2cc76fe0c688fcf0cfa6e4a0801 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 15:33:00 -0400 Subject: [PATCH 24/31] unkeyed each-blocks with outros --- src/generators/dom/visitors/EachBlock.js | 22 ++++++++++++++++--- .../transition-js-each-block-outro/_config.js | 16 ++++++++++++++ .../transition-js-each-block-outro/main.html | 18 +++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 test/runtime/samples/transition-js-each-block-outro/_config.js create mode 100644 test/runtime/samples/transition-js-each-block-outro/main.html diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index 3d637bc5d925..da3353f577ac 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -237,6 +237,24 @@ function unkeyed ( generator, block, state, node, snippet, { create_each_block, const start = node._block.hasUpdateMethod ? '0' : `${iterations}.length`; + const destroy = node._block.hasOutroMethod ? + deindent` + function outro ( i ) { + if ( ${iterations}[i] ) { + ${iterations}[i].outro( function () { + ${iterations}[i].destroy( true ); + ${iterations}[i] = null; + }); + } + } + + for ( ; ${i} < ${iterations}.length; ${i} += 1 ) outro( ${i} ); + ` : + deindent` + ${generator.helper( 'destroyEach' )}( ${iterations}, true, ${each_block_value}.length ); + ${iterations}.length = ${each_block_value}.length; + `; + block.builders.update.addBlock( deindent` var ${each_block_value} = ${snippet}; @@ -245,9 +263,7 @@ function unkeyed ( generator, block, state, node, snippet, { create_each_block, ${forLoopBody} } - ${generator.helper( 'destroyEach' )}( ${iterations}, true, ${each_block_value}.length ); - - ${iterations}.length = ${each_block_value}.length; + ${destroy} } ` ); } diff --git a/test/runtime/samples/transition-js-each-block-outro/_config.js b/test/runtime/samples/transition-js-each-block-outro/_config.js new file mode 100644 index 000000000000..5e8b99d88d56 --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-outro/_config.js @@ -0,0 +1,16 @@ +export default { + data: { + things: [ 'a', 'b', 'c' ] + }, + + test ( assert, component, target, window, raf ) { + const divs = target.querySelectorAll( 'div' ); + + component.set({ things: [ 'a' ] }); + + raf.tick( 50 ); + assert.equal( divs[0].foo, undefined ); + assert.equal( divs[1].foo, 0.5 ); + assert.equal( divs[2].foo, 0.5 ); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-block-outro/main.html b/test/runtime/samples/transition-js-each-block-outro/main.html new file mode 100644 index 000000000000..494132c9bedb --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-outro/main.html @@ -0,0 +1,18 @@ +{{#each things as thing}} +
{{thing}}
+{{/each}} + + \ No newline at end of file From 22ac50abb647d709219c96b9466b754572b3426f Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 15:52:41 -0400 Subject: [PATCH 25/31] outros on keyed each-blocks --- src/generators/dom/visitors/EachBlock.js | 42 +++++++++++++------ .../each-block-changed-check/expected.js | 1 - .../_config.js | 25 +++++++++++ .../main.html | 18 ++++++++ 4 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 test/runtime/samples/transition-js-each-block-keyed-outro/_config.js create mode 100644 test/runtime/samples/transition-js-each-block-keyed-outro/main.html diff --git a/src/generators/dom/visitors/EachBlock.js b/src/generators/dom/visitors/EachBlock.js index da3353f577ac..5a427c94c699 100644 --- a/src/generators/dom/visitors/EachBlock.js +++ b/src/generators/dom/visitors/EachBlock.js @@ -115,7 +115,7 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea const value = block.getUniqueName( 'value' ); const key = block.getUniqueName( 'key' ); const lookup = block.getUniqueName( `${each_block}_lookup` ); - const _lookup = block.getUniqueName( `_${each_block}_lookup` ); + const keys = block.getUniqueName( `${each_block}_keys` ); const iteration = block.getUniqueName( `${each_block}_iteration` ); const _iterations = block.getUniqueName( `_${each_block}_iterations` ); @@ -142,19 +142,40 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea const consequent = node._block.hasUpdateMethod ? deindent` - ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${lookup}[ ${key} ]; - ${_lookup}[ ${key} ].update( changed, ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i} ); + ${_iterations}[${i}] = ${lookup}[ ${key} ] = ${lookup}[ ${key} ]; + ${lookup}[ ${key} ].update( changed, ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i} ); ` : - `${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${lookup}[ ${key} ];`; + `${_iterations}[${i}] = ${lookup}[ ${key} ] = ${lookup}[ ${key} ];`; const parentNode = state.parentNode || `${anchor}.parentNode`; const hasIntros = node._block.hasIntroMethod; + const destroy = node._block.hasOutroMethod ? + deindent` + function outro ( key ) { + ${lookup}[ key ].outro( function () { + ${lookup}[ key ].destroy( true ); + ${lookup}[ key ] = null; + }); + } + + for ( var ${i} = 0; ${i} < ${iterations}.length; ${i} += 1 ) { + ${key} = ${iterations}[${i}].key; + if ( !${keys}[ ${key} ] ) outro( ${key} ); + } + ` : + deindent` + for ( var ${i} = 0; ${i} < ${iterations}.length; ${i} += 1 ) { + var ${iteration} = ${iterations}[${i}]; + if ( !${keys}[ ${iteration}.key ] ) ${iteration}.destroy( true ); + } + `; + block.builders.update.addBlock( deindent` var ${each_block_value} = ${snippet}; var ${_iterations} = []; - var ${_lookup} = Object.create( null ); + var ${keys} = Object.create( null ); var ${fragment} = document.createDocumentFragment(); @@ -162,12 +183,13 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea for ( var ${i} = 0; ${i} < ${each_block_value}.length; ${i} += 1 ) { var ${value} = ${each_block_value}[${i}]; var ${key} = ${value}.${node.key}; + ${keys}[ ${key} ] = true; if ( ${lookup}[ ${key} ] ) { ${consequent} ${hasIntros && `${_iterations}[${i}].mount( ${fragment}, null );`} } else { - ${_iterations}[${i}] = ${_lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} ); + ${_iterations}[${i}] = ${lookup}[ ${key} ] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} ); ${hasIntros && `${_iterations}[${i}].intro( ${fragment}, null );`} } @@ -175,17 +197,11 @@ function keyed ( generator, block, state, node, snippet, { each_block, create_ea } // remove old iterations - for ( var ${i} = 0; ${i} < ${iterations}.length; ${i} += 1 ) { - var ${iteration} = ${iterations}[${i}]; - if ( !${_lookup}[ ${iteration}.key ] ) { - ${iteration}.destroy( true ); - } - } + ${destroy} ${parentNode}.insertBefore( ${fragment}, ${anchor} ); ${iterations} = ${_iterations}; - ${lookup} = ${_lookup}; ` ); } diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 17b22c9a5093..c0a809272713 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -39,7 +39,6 @@ function create_main_fragment ( state, component ) { } destroyEach( each_block_iterations, true, each_block_value.length ); - each_block_iterations.length = each_block_value.length; } diff --git a/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js new file mode 100644 index 000000000000..d40e9a3a068f --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js @@ -0,0 +1,25 @@ +export default { + data: { + things: [ + { name: 'a' }, + { name: 'b' }, + { name: 'c' } + ] + }, + + test ( assert, component, target, window, raf ) { + const divs = target.querySelectorAll( 'div' ); + + component.set({ + things: [ + { name: 'a' }, + { name: 'c' } + ] + }); + + raf.tick( 50 ); + assert.equal( divs[0].foo, undefined ); + assert.equal( divs[1].foo, 0.5 ); + assert.equal( divs[2].foo, undefined ); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-block-keyed-outro/main.html b/test/runtime/samples/transition-js-each-block-keyed-outro/main.html new file mode 100644 index 000000000000..2e735125299e --- /dev/null +++ b/test/runtime/samples/transition-js-each-block-keyed-outro/main.html @@ -0,0 +1,18 @@ +{{#each things as thing @name}} +
{{thing.name}}
+{{/each}} + + \ No newline at end of file From b8affd42e90d150cdf42924d122324f82dba65f5 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 1 May 2017 16:29:23 -0400 Subject: [PATCH 26/31] simplify/unify transitions --- src/shared/.eslintrc.json | 38 +++++++++++++ src/shared/transitions.js | 109 +++++++++++++++----------------------- 2 files changed, 82 insertions(+), 65 deletions(-) create mode 100644 src/shared/.eslintrc.json diff --git a/src/shared/.eslintrc.json b/src/shared/.eslintrc.json new file mode 100644 index 000000000000..46f19570776a --- /dev/null +++ b/src/shared/.eslintrc.json @@ -0,0 +1,38 @@ +{ + "root": true, + "rules": { + "indent": [ 2, "tab", { "SwitchCase": 1 } ], + "semi": [ 2, "always" ], + "keyword-spacing": [ 2, { "before": true, "after": true } ], + "space-before-blocks": [ 2, "always" ], + "no-mixed-spaces-and-tabs": [ 2, "smart-tabs" ], + "no-cond-assign": 0, + "no-unused-vars": 2, + "no-const-assign": 2, + "no-class-assign": 2, + "no-this-before-super": 2, + "no-unreachable": 2, + "valid-typeof": 2, + "quote-props": [ 2, "as-needed" ], + "arrow-spacing": 2, + "no-inner-declarations": 0 + }, + "env": { + "es6": true, + "browser": true, + "node": true, + "mocha": true + }, + "extends": [ + "eslint:recommended", + "plugin:import/errors", + "plugin:import/warnings" + ], + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "settings": { + "import/core-modules": [ "svelte" ] + } +} diff --git a/src/shared/transitions.js b/src/shared/transitions.js index a74e09711db1..349c1b375c2c 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -4,13 +4,42 @@ export function linear ( t ) { return t; } +function generateKeyframes ( a, b, delta, duration, ease, fn, node, style ) { + var id = '__svelte' + ~~( Math.random() * 1e9 ); // TODO make this more robust + var keyframes = '@keyframes ' + id + '{\n'; + + for ( var p = 0; p <= 1; p += 16.666 / duration ) { + var t = a + delta * ease( p ); + keyframes += ( p * 100 ) + '%{' + fn( t ) + '}\n'; + } + + keyframes += '100% {' + fn( b ) + '}\n}'; + style.textContent += keyframes; + + document.head.appendChild( style ); + + node.style.animation = node.style.animation.split( ',' ) + .filter( function ( anim ) { + // when introing, discard old animations if there are any + return anim && ( delta < 0 || !/__svelte/.test( anim ) ); + }) + .concat( id + ' ' + duration + 'ms linear 1 forwards' ) + .join( ', ' ); +} + export function wrapTransition ( node, fn, params, intro, outgroup ) { var obj = fn( node, params, intro ); - var duration = obj.duration || 300; var ease = obj.easing || linear; - var transition = { + // TODO share