made with requirebin
Last active
December 1, 2015 01:28
-
-
Save mikkoh/acd623a56bcbfe2133b1 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f1DOM = require('f1-dom'); | |
var elButton; | |
var button; | |
// data-f1 defines an association with states | |
// which are later defined when creating an f1 instance | |
document.body.innerHTML = | |
'<div data-f1="elButton">' + | |
'<div data-f1="text">Im a button</div>' + | |
'</div>'; | |
button = f1DOM({ | |
// define the container where your button lives | |
el: document.body, | |
// define what your button will look like in each state: out, idle | |
states: { | |
idle: { | |
elButton: { | |
style: { | |
padding: 10, // padding: 10px | |
margin: 10, // margin: 10px | |
backgroundColor: [ 255, 0, 255 ], // rgb(255, 0, 255) | |
cursor: 'pointer', // we can change this so why not | |
display: 'inline-block' | |
} | |
}, | |
text: { | |
style: { | |
color: [ 33, 33, 33 ], // rgb(33, 33, 33) | |
rotate: [ 0, 0, 0 ] // transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) | |
} | |
} | |
}, | |
over: { | |
elButton: { | |
style: { | |
padding: 20, // padding: 20px | |
margin: 0, // margin: 0px | |
backgroundColor: [ 255, 0, 0 ], // change the rgb values | |
cursor: 'progress', // we can change this so why not | |
display: 'inline-block' | |
} | |
}, | |
text: { | |
style: { | |
color: [ 255, 255, 255 ], // rgb(255, 255, 255) | |
rotate: [ 0, 0, 15 ] // transform: rotateX(0deg) rotateY(0deg) rotateZ(15deg) | |
} | |
} | |
} | |
}, | |
// define transitions between states (for info on how to write | |
// fancier animations check out f1's documentation) | |
transitions: [ | |
{ from: 'idle', to: 'over', bi: true } | |
] | |
}) | |
.init('idle'); // initialize the button in the out state defined in states | |
elButton = document.querySelector('[data-f1]'); | |
// `go` will tell the button to go to the state defined | |
elButton.onmouseover = function() { button.go('over'); }; | |
elButton.onmouseout = function() { button.go('idle'); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":2,ieee754:3,"is-array":4}],2:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],3:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],4:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],5:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){ | |
position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],6:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],7:[function(require,module,exports){module.exports=function(propertyStyle,target,state){if(state.style&&Array.isArray(state.style[propertyStyle])){var style;var rounded=state.style[propertyStyle].map(Math.round);if(state.style[propertyStyle].length==3){style="rgb("+rounded.join(",")+")"}else if(state.style[propertyStyle].length==4){rounded[3]=state.style[propertyStyle][3];style="rgba("+rounded.join(",")+")"}else{throw new Error("unsupported "+propertyStyle+" of type",state.style[propertyStyle])}target.style[propertyStyle]=style}}},{}],8:[function(require,module,exports){var arrayUnion=require("array-union");module.exports=function(el,targets,states){var targetNames=[];var state;var nodes;var elTargetName;for(var stateName in states){state=states[stateName];targetNames=arrayUnion(targetNames,Object.keys(state))}nodes=el.querySelectorAll("[data-f1]");for(var i=0;i<nodes.length;i++){elTargetName=nodes[i].getAttribute("data-f1");if(targetNames.indexOf(elTargetName)!==-1){targets[elTargetName]=nodes[i]}}}},{"array-union":10}],9:[function(require,module,exports){var matCreate=require("gl-mat4/create");var matTranslate=require("gl-mat4/translate");var matScale=require("gl-mat4/scale");var matRotateX=require("gl-mat4/rotateX");var matRotateY=require("gl-mat4/rotateY");var matRotateZ=require("gl-mat4/rotateZ");module.exports=function getTransformMatrix(data){if(data.style&&(data.style.translate||data.style.scale||data.style.rotate||data.style.perspective!==undefined)){var translation=data.style.translate||[0,0,0];var scale=data.style.scale||[1,1,1];var rotate=data.style.rotate||[0,0,0];var perspective=data.style.perspective||1e3;var transform=matCreate();while(translation.length<3){translation.push(0)}while(rotate.length<3){rotate.push(0)}while(scale.length<3){scale.push(1)}rotate=rotate.map(function(value){return Math.PI/180*value});matTranslate(transform,transform,translation);matScale(transform,transform,scale);matRotateX(transform,transform,rotate[0]);matRotateY(transform,transform,rotate[1]);matRotateZ(transform,transform,rotate[2]);transform[11]=-1/perspective;return transform}else{return null}}},{"gl-mat4/create":39,"gl-mat4/rotateX":40,"gl-mat4/rotateY":41,"gl-mat4/rotateZ":42,"gl-mat4/scale":43,"gl-mat4/translate":44}],10:[function(require,module,exports){"use strict";var arrayUniq=require("array-uniq");module.exports=function(){return arrayUniq([].concat.apply([],arguments))}},{"array-uniq":11}],11:[function(require,module,exports){(function(global){"use strict";function uniqNoSet(arr){var ret=[];for(var i=0;i<arr.length;i++){if(ret.indexOf(arr[i])===-1){ret.push(arr[i])}}return ret}function uniqSet(arr){var seen=new Set;return arr.filter(function(el){if(!seen.has(el)){seen.add(el);return true}})}function uniqSetWithForEach(arr){var ret=[];new Set(arr).forEach(function(el){ret.push(el)});return ret}function doesForEachActuallyWork(){var ret=false;new Set([true]).forEach(function(el){ret=el});return ret===true}if("Set"in global){if(typeof Set.prototype.forEach==="function"&&doesForEachActuallyWork()){module.exports=uniqSetWithForEach}else{module.exports=uniqSet}}else{module.exports=uniqNoSet}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],12:[function(require,module,exports){var prefix=require("prefix-style");var toCamelCase=require("to-camel-case");var cache={"float":"cssFloat"};var addPxToStyle=require("add-px-to-style");function style(element,property,value){var camel=cache[property];if(typeof camel==="undefined"){camel=detect(property)}if(camel){if(value===undefined){return element.style[camel]}element.style[camel]=addPxToStyle(camel,value)}}function each(element,properties){for(var k in properties){if(properties.hasOwnProperty(k)){style(element,k,properties[k])}}}function detect(cssProp){var camel=toCamelCase(cssProp);var result=prefix(camel);cache[camel]=cache[cssProp]=cache[result]=result;return result}function set(){if(arguments.length===2){each(arguments[0],arguments[1])}else{style(arguments[0],arguments[1],arguments[2])}}module.exports=set;module.exports.set=set;module.exports.get=function(element,properties){if(Array.isArray(properties)){return properties.reduce(function(obj,prop){obj[prop]=style(element,prop||"");return obj},{})}else{return style(element,properties||"")}}},{"add-px-to-style":13,"prefix-style":14,"to-camel-case":15}],13:[function(require,module,exports){var IS_UNITLESS={animationIterationCount:true,boxFlex:true,boxFlexGroup:true,boxOrdinalGroup:true,columnCount:true,flex:true,flexGrow:true,flexPositive:true,flexShrink:true,flexNegative:true,flexOrder:true,gridRow:true,gridColumn:true,fontWeight:true,lineClamp:true,lineHeight:true,opacity:true,order:true,orphans:true,tabSize:true,widows:true,zIndex:true,zoom:true,fillOpacity:true,stopOpacity:true,strokeDashoffset:true,strokeOpacity:true,strokeWidth:true};module.exports=function(name,value){if(typeof value==="number"&&!IS_UNITLESS[name]){return value+"px"}else{return value}}},{}],14:[function(require,module,exports){var div=null;var prefixes=["Webkit","Moz","O","ms"];module.exports=function prefixStyle(prop){if(!div){div=document.createElement("div")}var style=div.style;if(prop in style){return prop}var titleCase=prop.charAt(0).toUpperCase()+prop.slice(1);for(var i=prefixes.length;i>=0;i--){var name=prefixes[i]+titleCase;if(name in style){return name}}return false}},{}],15:[function(require,module,exports){var toSpace=require("to-space-case");module.exports=toCamelCase;function toCamelCase(string){return toSpace(string).replace(/\s(\w)/g,function(matches,letter){return letter.toUpperCase()})}},{"to-space-case":16}],16:[function(require,module,exports){var clean=require("to-no-case");module.exports=toSpaceCase;function toSpaceCase(string){return clean(string).replace(/[\W_]+(.|$)/g,function(matches,match){return match?" "+match:""})}},{"to-no-case":17}],17:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasCamel=/[a-z][A-Z]/;var hasSeparator=/[\W_]/;function toNoCase(string){if(hasSpace.test(string))return string.toLowerCase();if(hasSeparator.test(string))string=unseparate(string);if(hasCamel.test(string))string=uncamelize(string);return string.toLowerCase()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],18:[function(require,module,exports){(function(global){var kimi=require("kimi");var getTween=require("tween-function");var noop=require("no-op");var extend=require("deep-extend");var Emitter=require("events").EventEmitter;var getParser=require("./lib/parsers/getParser");var parseStates=require("./lib/states/parseStates");var parseTransitions=require("./lib/transitions/parseTransitions");var parseTargets=require("./lib/targets/parseTargets");var numInstances=0;module.exports=f1;function f1(settings){if(!(this instanceof f1)){return new f1(settings)}settings=settings||{};var emitter=this;var onUpdate=settings.onUpdate||noop;var onState=settings.onState||noop;numInstances++;this.onState=function(){emitter.emit.apply(emitter,getEventArgs("state",arguments));if(onState){onState.apply(undefined,arguments)}};this.onUpdate=function(){emitter.emit.apply(emitter,getEventArgs("update",arguments));if(onUpdate){onUpdate.apply(undefined,arguments)}};this.name=settings.name||"ui_"+numInstances;this.isInitialized=false;this.data=null;this.defTargets=null;this.defStates=null;this.defTransitions=null;this.parser=null;if(settings.transitions){this.transitions(settings.transitions)}if(settings.states){this.states(settings.states)}if(settings.targets){this.targets(settings.targets)}if(settings.parsers){this.parsers(settings.parsers)}this.driver=kimi({manualStep:settings.autoUpdate===undefined?false:!settings.autoUpdate,onState:_onState.bind(this),onUpdate:_onUpdate.bind(this)})}f1.prototype=extend(Emitter.prototype,{targets:function(targets){this.defTargets=targets;this.parsedTargets=parseTargets(targets);return this},states:function(states){this.defStates=states;return this},transitions:function(transitions){this.defTransitions=Array.isArray(transitions)?transitions:Array.prototype.slice.apply(arguments);return this},parsers:function(parsersDefinitions){if(typeof parsersDefinitions!=="object"||Array.isArray(parsersDefinitions)){throw new Error("parsers should be an Object that contains arrays of functions under init and update")}this.parser=this.parser||getParser();this.parser.add(parsersDefinitions);return this},init:function(initState){if(!this.isInitialized){this.isInitialized=true;var driver=this.driver;if(!this.defStates){throw new Error("You must define states before attempting to call init")}else if(!this.defTransitions){throw new Error("You must define transitions before attempting to call init")}else if(!this.parser){throw new Error("You must define parsers before attempting to call init")}else if(!this.defTargets){throw new Error("You must define targets before attempting to call init")}else{parseStates(driver,this.defStates);parseTransitions(driver,this.defStates,this.defTransitions);this.parser.init(this.defStates,this.defTargets,this.defTransitions);driver.init(initState)}if(global.__f1__){global.__f1__.init(this)}}return this},destroy:function(){if(global.__f1__){global.__f1__.destroy(this)}this.driver.destroy()},go:function(state,cb){this.driver.go(state,cb);return this},set:function(state){this.driver.set(state);return this},step:function(deltaTime){this.driver.step(deltaTime);return this},update:function(){_onUpdate.call(this,this.data,this.state,this.time);return this},apply:function(pathToTarget,target,parserDefinition){var data=this.data;var parser=this.parser;var animationData;if(parserDefinition){parser=new getParser(parserDefinition)}if(parser){if(typeof pathToTarget==="string"){pathToTarget=pathToTarget.split(".")}animationData=data[pathToTarget[0]];for(var i=1,len=pathToTarget.length;i<len;i++){animationData=animationData[pathToTarget[i]]}parser.update(target,animationData)}}});function getEventArgs(name,args){args=Array.prototype.slice.apply(args);args.unshift(name);return args}function _onUpdate(data,state,time){var pathToTarget;var target;if(data!==undefined&&state!==undefined&&time!==undefined){this.data=data;this.state=state;this.time=time;if(this.parsedTargets){for(var i=0,len=this.parsedTargets.length;i<len;i+=2){pathToTarget=this.parsedTargets[i];target=this.parsedTargets[i+1];this.apply(pathToTarget,target)}}this.onUpdate(data,state,time)}}function _onState(data,state){this.data=data;this.state=state;this.time=0;this.onState(data,state)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./lib/parsers/getParser":19,"./lib/states/parseStates":20,"./lib/targets/parseTargets":21,"./lib/transitions/parseTransitions":24,"deep-extend":25,events:5,kimi:27,"no-op":37,"tween-function":38}],19:[function(require,module,exports){module.exports=function getParser(parserDefinition){var initMethods=[];var parserMethods=[];var parser={add:function(parserDefinition){if(parserDefinition.init){parserDefinition.init.forEach(function(initFunc){parser.addInit(initFunc)})}if(parserDefinition.update){parserDefinition.update.forEach(function(parserFunc){parser.addUpdate(parserFunc)})}},addInit:function(init){initMethods.push(init)},addUpdate:function(parser){parserMethods.push(parser)},init:function(states,targets,transitions){initMethods.forEach(function(method){method(states,targets,transitions)})},update:function(item,calculatedState){parserMethods.forEach(function(method){method(item,calculatedState)})}};if(parserDefinition){parser.add(parserDefinition)}return parser}},{}],20:[function(require,module,exports){module.exports=function(driver,states){var state,stateName;for(var stateName in states){state=states[stateName];if(typeof state=="function"){state=states[stateName]=state(stateName)}driver.state(stateName,state)}}},{}],21:[function(require,module,exports){module.exports=function(animatables){var returnValue=[];if(Array.isArray(animatables)){for(var i=0,len=animatables.length;i<len;i+=2){returnValue.push(animatables[i].split("."));returnValue.push(animatables[i+1])}}else{for(var i in animatables){returnValue.push(i.split("."),animatables[i])}}return returnValue}},{}],22:[function(require,module,exports){var tweenFunction=require("tween-function");var defaultTransition=require("./defaultTransition");module.exports=function createTransitions(animation,stateFrom,stateTo){var paths=[];var pathAnimations;getPathsToProperties(stateFrom,stateTo,paths);pathAnimations=paths.map(getAnimationDefinitions.bind(undefined,animation));return buildTransitionDefinition(paths,pathAnimations,stateFrom)};function thisOrThat(value1,value2){return value1!==undefined?value1:value2}function getPathsToProperties(stateFrom,stateTo,paths,keys){var newKeys;keys=keys||[];for(var i in stateFrom){if(stateTo[i]!==undefined){newKeys=keys.slice();newKeys.push(i);if(typeof stateFrom[i]==="object"){getPathsToProperties(stateFrom[i],stateTo[i],paths,newKeys)}else{paths.push(newKeys)}}}}function getAnimationDefinitions(animation,path){var animationDefinition=animation;var reducedDefinition=path.reduce(function(curDef,pathPart){animationDefinition=animationDefinition[pathPart]||{};return{duration:thisOrThat(animationDefinition.duration,curDef.duration),delay:thisOrThat(animationDefinition.delay,curDef.delay),ease:thisOrThat(animationDefinition.ease,curDef.ease)}},{duration:animation.duration,delay:animation.delay,ease:animation.ease});reducedDefinition.duration=thisOrThat(reducedDefinition.duration,defaultTransition.duration);reducedDefinition.delay=thisOrThat(reducedDefinition.delay,defaultTransition.delay);reducedDefinition.ease=thisOrThat(reducedDefinition.ease,defaultTransition.ease);return reducedDefinition}function buildTransitionDefinition(paths,pathAnimations,state){var transitions={};var overallDuration=pathAnimations.reduce(function(longestDuration,animationDef){var curDuration=animationDef.duration+animationDef.delay;return curDuration>longestDuration?curDuration:longestDuration},0);var transitionsDef;var stateDef;var aniDef;paths.forEach(function(path,i){var duration;var delay;var ease;transitionsDef=transitions;stateDef=state;aniDef=pathAnimations[i];duration=aniDef.duration;delay=aniDef.delay;ease=aniDef.ease;path.forEach(function(pathPart,j){if(j===path.length-1){if(typeof stateDef[pathPart]==="number"){transitionsDef[pathPart]=tweenFunction({duration:duration/overallDuration,delay:delay/overallDuration,ease:ease,cap:true})}else if(typeof stateDef[pathPart]==="string"||typeof stateDef[pathPart]==="boolean"){transitionsDef[pathPart]=function(time,start,end){if(time*overallDuration<duration+delay){return start}else{return end}}}}else{if(transitionsDef[pathPart]===undefined){transitionsDef[pathPart]={}}stateDef=stateDef[pathPart];transitionsDef=transitionsDef[pathPart]}})});return{duration:overallDuration,transitions:transitions}}},{"./defaultTransition":23,"tween-function":38}],23:[function(require,module,exports){module.exports={duration:.5,delay:0}},{}],24:[function(require,module,exports){var getInterpolation=require("interpolation-builder");var createTransitions=require("./createTransitions");module.exports=function(driver,states,transitions){transitions.forEach(function(transition,i){var from=transition.from||throwError("from",i,transition);var to=transition.to||throwError("to",i,transition);var animation=transition.animation;var duration;var animationDefinition;if(typeof animation=="object"||animation===undefined){animation=animation||{};animationDefinition=createTransitions(animation,states[from],states[to]);animation=getInterpolation(animationDefinition.transitions);duration=animationDefinition.duration}else{duration=animation.duration}driver.fromTo(from,to,duration,animation);if(transition.bi){driver.fromTo(to,from,duration,animation)}})};function throwError(type,idx,transition){throw new Error("For the transition at "+idx+":\n"+JSON.stringify(transition,undefined," ")+"\n"+"you did not define "+type+"\n\n")}},{"./createTransitions":22,"interpolation-builder":26}],25:[function(require,module,exports){(function(Buffer){"use strict";function isSpecificValue(val){return val instanceof Buffer||val instanceof Date||val instanceof RegExp?true:false}function cloneSpecificValue(val){if(val instanceof Buffer){var x=new Buffer(val.length);val.copy(x);return x}else if(val instanceof Date){return new Date(val.getTime())}else if(val instanceof RegExp){return new RegExp(val)}else{throw new Error("Unexpected situation")}}function deepCloneArray(arr){var clone=[];arr.forEach(function(item,index){if(typeof item==="object"&&item!==null){if(Array.isArray(item)){clone[index]=deepCloneArray(item)}else if(isSpecificValue(item)){clone[index]=cloneSpecificValue(item)}else{clone[index]=deepExtend({},item)}}else{clone[index]=item}});return clone}var deepExtend=module.exports=function(){if(arguments.length<1||typeof arguments[0]!=="object"){return false}if(arguments.length<2){return arguments[0]}var target=arguments[0];var args=Array.prototype.slice.call(arguments,1);var val,src,clone;args.forEach(function(obj){if(typeof obj!=="object"||Array.isArray(obj)){return}Object.keys(obj).forEach(function(key){src=target[key];val=obj[key];if(val===target){return}else if(typeof val!=="object"||val===null){target[key]=val;return}else if(Array.isArray(val)){target[key]=deepCloneArray(val);return}else if(isSpecificValue(val)){target[key]=cloneSpecificValue(val);return}else if(typeof src!=="object"||src===null||Array.isArray(src)){target[key]=deepExtend({},val);return}else{target[key]=deepExtend(src,val);return}})});return target}}).call(this,require("buffer").Buffer)},{buffer:1}],26:[function(require,module,exports){module.exports=function builder(definition){var interpolationFunctions={};function interpolator(time,start,end){var rVal=Array.isArray(start)?[]:{};for(var i in interpolationFunctions){rVal[i]=interpolationFunctions[i](time,start[i],end[i])}return rVal}interpolator.sub=function(property){var nBuilder=builder();interpolationFunctions[property]=nBuilder;return nBuilder},interpolator.map=function(property,interpolationFunction){if(Array.isArray(property)){property.forEach(function(property){interpolationFunctions[property]=interpolationFunction||lerp})}else{interpolationFunctions[property]=interpolationFunction||lerp}return interpolator};if(definition){parse(interpolator,definition)}return interpolator};function parse(interpolator,definition){for(var i in definition){if(typeof definition[i]=="function"||!definition[i]){interpolator.map(i,definition[i])}else if(typeof definition[i]=="object"){parse(interpolator.sub(i),definition[i])}}}function lerp(time,start,end){return(end-start)*time+start}},{}],27:[function(require,module,exports){var pathfinder=require("./pathfinder");var rafLoop=require("raf-loop");var noop=require("no-op");module.exports=kimi;function kimi(settings){if(!(this instanceof kimi)){return new kimi(settings)}settings=settings||{};this.onUpdate=settings.onUpdate||noop;this.onState=settings.onState||noop;this.allowReverse=settings.allowReverse||true;this.directions=pathfinder();this.animator={};this.states={};this.currentTime=0;this.currentState=null;this.targetState=null;this.currentPath=[];this.onComplete=null;if(!settings.manualStep){this.engine=rafLoop(this.step.bind(this))}}kimi.prototype={state:function(name,value){this.states[name]=value},fromTo:function(from,to,duration,animator){if(arguments.length<4){throw new Error("incorrect amount of arguments sent when defining fromTo")}this.directions.fromTo(from,to,duration);setAnimator.call(this,from,to,animator)},init:function(state){this.currentState=state;sendUpdate.call(this)},set:function(state){var setToTarget;if(this.currentPath.length>0){setToTarget=this.currentPath[this.currentPath.length-1]===state}else{setToTarget=this.targetState===state}this.currentState=state;this.currentTime=0;this.targetState=null;this.currentPath=[];if(this.engine){this.engine.stop()}sendUpdate.call(this);if(setToTarget&&this.onComplete){this.onComplete(this.states[state],state)}this.onComplete=null},go:function(to,onComplete){if(this.currentState){this.onComplete=onComplete||noop;if(this.currentPath.length===0||this.currentPath[this.currentPath.length-1]!==to){if(to===this.currentState){if(!this.allowReverse){this.currentPath=this.directions.getPath(this.currentState,this.targetState,to).path;this.currentPath.shift()}else{this.currentPath=[to]}}else{if(this.targetState&&this.currentState!==this.targetState){this.currentPath=this.directions.getPath({from:this.currentState,to:this.targetState,location:this.currentTime/1e3},to)}else{this.currentPath=this.directions.getPath(this.currentState,to)}}if(this.currentPath===null){throw new Error("It is not possible to go from "+this.currentState+" to "+to)}else if(!this.targetState){if(this.currentTime===0){this.currentPath.shift()}this.targetState=this.currentPath[0]}if(this.engine){this.engine.start()}}}else{throw new Error("call init with your initial state before calling go")}},destroy:function(){if(this.engine){this.engine.stop()}this.engine=null;this.step=function(){}},step:function(delta){if(this.currentPath.length||this.targetState){var to=this.currentPath[0];var isReversing=this.allowReverse&&(this.currentState===to||this.targetState&&to&&to!==this.targetState);var duration=this.directions.fromTo(this.currentState,this.targetState)*1e3;var animator=this.animator[this.currentState][this.targetState];if(isReversing){this.currentTime=Math.max(this.currentTime-delta,0);if(this.currentTime===0){sendUpdate.call(this,duration);if(this.currentState===to){this.targetState=this.currentPath.shift()}else if(to!=this.targetState){this.targetState=to}}else{sendUpdate.call(this,duration,animator)}}else{this.currentTime=Math.min(this.currentTime+delta,duration);if(this.currentTime===duration){this.currentTime=0;this.currentState=this.currentPath.shift();this.targetState=this.currentPath[0];sendUpdate.call(this,duration)}else{sendUpdate.call(this,duration,animator)}}if(this.currentPath.length===0){if(this.engine){this.engine.stop()}this.onComplete(this.states[this.currentState],this.currentState)}}}};function sendUpdate(duration,animator){if(animator){this.onUpdate(animator(this.currentTime/duration,this.states[this.currentState],this.states[this.targetState]),this.currentState,this.currentTime)}else{this.onUpdate(this.states[this.currentState],this.currentState,this.currentTime);this.onState(this.states[this.currentState],this.currentState,this.currentTime)}}function setAnimator(from,to,animator){var animators=this.animator[from]||(this.animator[from]={});animators[to]=animator}},{"./pathfinder":36,"no-op":37,"raf-loop":31}],28:[function(require,module,exports){var assign=require("101/assign");var PriorityQueue=require("./libs/queue");var Graph=function(vertices){this.vertices=vertices||{}};assign(Graph.prototype,{addVertex:function(name,edges){this.vertices[name]=edges;return this},shortestPath:function(start,finish,options){options=options||{};this.nodes=new PriorityQueue;this.distances={};this.previous={};this.start=start;this.finish=finish;this.setBaseline.call(this);var smallest;var path=[];var alt;while(!this.nodes.isEmpty()){smallest=this.nodes.dequeue();if(smallest===finish){while(this.previous[smallest]){path.push(smallest);smallest=this.previous[smallest]}break}if(!smallest||this.distances[smallest]===Infinity){continue}for(var neighbor in this.vertices[smallest]){alt=this.distances[smallest]+this.vertices[smallest][neighbor];if(alt<this.distances[neighbor]){this.distances[neighbor]=alt;this.previous[neighbor]=smallest;this.nodes.enqueue(alt,neighbor)}}}if(path.length<1){return null}if(options.trim){path.shift();if(options.reverse){return path}return path.reverse()}path=path.concat([start]);if(options.reverse){return path}return path.reverse()},setBaseline:function(){var vertex;for(vertex in this.vertices){if(vertex===this.start){this.distances[vertex]=0;this.nodes.enqueue(0,vertex)}else{this.distances[vertex]=Infinity;this.nodes.enqueue(Infinity,vertex)}this.previous[vertex]=null}}});module.exports=Graph},{"./libs/queue":29,"101/assign":30}],29:[function(require,module,exports){var assign=require("101/assign");var PriorityQueue=function(){this.nodes=[]};assign(PriorityQueue.prototype,{enqueue:function(priority,key){this.nodes.push({key:key,priority:priority});this.sort.call(this)},dequeue:function(){return this.nodes.shift().key},sort:function(){this.nodes.sort(function(a,b){return a.priority-b.priority})},isEmpty:function(){return!this.nodes.length}});module.exports=PriorityQueue},{"101/assign":30}],30:[function(require,module,exports){module.exports=assign;function assign(target,firstSource){if(arguments.length===1){firstSource=arguments[0];return function(target){return assign(target,firstSource)}}if(target===undefined||target===null)throw new TypeError("Cannot convert first argument to object");var to=Object(target);for(var i=1;i<arguments.length;i++){var nextSource=arguments[i];if(nextSource===undefined||nextSource===null)continue;var keysArray=Object.keys(Object(nextSource));for(var nextIndex=0,len=keysArray.length;nextIndex<len;nextIndex++){var nextKey=keysArray[nextIndex];Object.getOwnPropertyDescriptor(nextSource,nextKey);to[nextKey]=nextSource[nextKey]}}return to}},{}],31:[function(require,module,exports){var inherits=require("inherits");var EventEmitter=require("events").EventEmitter;var now=require("right-now");var raf=require("raf");module.exports=Engine;function Engine(fn){if(!(this instanceof Engine))return new Engine(fn);this.running=false;this.last=now();this._frame=0;this._tick=this.tick.bind(this);if(fn)this.on("tick",fn)}inherits(Engine,EventEmitter);Engine.prototype.start=function(){if(this.running)return;this.running=true;this.last=now();this._frame=raf(this._tick);return this};Engine.prototype.stop=function(){this.running=false;if(this._frame!==0)raf.cancel(this._frame);this._frame=0;return this};Engine.prototype.tick=function(){this._frame=raf(this._tick);var time=now();var dt=time-this.last;this.emit("tick",dt);this.last=time}},{events:5,inherits:32,raf:33,"right-now":35}],32:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],33:[function(require,module,exports){var now=require("performance-now"),global=typeof window==="undefined"?{}:window,vendors=["moz","webkit"],suffix="AnimationFrame",raf=global["request"+suffix],caf=global["cancel"+suffix]||global["cancelRequest"+suffix];for(var i=0;i<vendors.length&&!raf;i++){raf=global[vendors[i]+"Request"+suffix];caf=global[vendors[i]+"Cancel"+suffix]||global[vendors[i]+"CancelRequest"+suffix]}if(!raf||!caf){var last=0,id=0,queue=[],frameDuration=1e3/60;raf=function(callback){if(queue.length===0){var _now=now(),next=Math.max(0,frameDuration-(_now-last));last=next+_now;setTimeout(function(){var cp=queue.slice(0);queue.length=0;for(var i=0;i<cp.length;i++){if(!cp[i].cancelled){try{cp[i].callback(last)}catch(e){setTimeout(function(){throw e},0)}}}},Math.round(next))}queue.push({handle:++id,callback:callback,cancelled:false});return id};caf=function(handle){for(var i=0;i<queue.length;i++){if(queue[i].handle===handle){queue[i].cancelled=true}}}}module.exports=function(fn){return raf.call(global,fn)};module.exports.cancel=function(){caf.apply(global,arguments)}},{"performance-now":34}],34:[function(require,module,exports){(function(process){(function(){var getNanoSeconds,hrtime,loadTime;if(typeof performance!=="undefined"&&performance!==null&&performance.now){module.exports=function(){return performance.now()}}else if(typeof process!=="undefined"&&process!==null&&process.hrtime){module.exports=function(){return(getNanoSeconds()-loadTime)/1e6};hrtime=process.hrtime;getNanoSeconds=function(){var hr;hr=hrtime();return hr[0]*1e9+hr[1]};loadTime=getNanoSeconds()}else if(Date.now){module.exports=function(){return Date.now()-loadTime};loadTime=Date.now()}else{module.exports=function(){return(new Date).getTime()-loadTime};loadTime=(new Date).getTime()}}).call(this)}).call(this,require("_process"))},{_process:6}],35:[function(require,module,exports){(function(global){module.exports=global.performance&&global.performance.now?function now(){ | |
return performance.now()}:Date.now||function now(){return+new Date}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],36:[function(require,module,exports){var Graph=require("node-dijkstra");module.exports=function(){var costs={};return{getPath:function(startState){var args=arguments;var tempnode=typeof startState==="object"&&startState.from+"_"+startState.to;var path;var graph;var pathPart;var i;if(tempnode){costs[tempnode]={};costs[tempnode][startState.from]=startState.location;costs[tempnode][startState.to]=costs[startState.from][startState.to]-startState.location;graph=new Graph(costs);path=graph.shortestPath(tempnode,args[1]);path.shift();for(i=2;i<args.length;i++){pathPart=graph.shortestPath(args[i-1],args[i]);pathPart.shift();path=path.concat(pathPart)}delete costs[tempnode]}else{graph=new Graph(costs);path=[];path=graph.shortestPath(startState,args[1]);for(i=2;i<args.length;i++){pathPart=graph.shortestPath(args[i-1],args[i]);pathPart.shift();path=path.concat(pathPart)}}return path},fromTo:function(from,to,duration){if(duration===undefined){return costs[from][to]}else{if(!costs[from]){costs[from]={}}if(!costs[to]){costs[to]={}}costs[from][to]=duration}}}}},{"node-dijkstra":28}],37:[function(require,module,exports){module.exports=function noop(){}},{}],38:[function(require,module,exports){module.exports=function(settings){var ease,delay,duration;settings=settings||{};cap=settings.cap||false;ease=settings.ease||linear;delay=settings.delay||0;duration=settings.duration||1;function tween(time,start,end){if(time>delay){time=(time-delay)/duration;if(cap)time=Math.min(Math.max(time,0),1);return(end-start)*ease(time)+start}else{return start}}return tween};function linear(time){return time}},{}],39:[function(require,module,exports){module.exports=create;function create(){var out=new Float32Array(16);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}},{}],40:[function(require,module,exports){module.exports=rotateX;function rotateX(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[4]=a10*c+a20*s;out[5]=a11*c+a21*s;out[6]=a12*c+a22*s;out[7]=a13*c+a23*s;out[8]=a20*c-a10*s;out[9]=a21*c-a11*s;out[10]=a22*c-a12*s;out[11]=a23*c-a13*s;return out}},{}],41:[function(require,module,exports){module.exports=rotateY;function rotateY(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c-a20*s;out[1]=a01*c-a21*s;out[2]=a02*c-a22*s;out[3]=a03*c-a23*s;out[8]=a00*s+a20*c;out[9]=a01*s+a21*c;out[10]=a02*s+a22*c;out[11]=a03*s+a23*c;return out}},{}],42:[function(require,module,exports){module.exports=rotateZ;function rotateZ(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7];if(a!==out){out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c+a10*s;out[1]=a01*c+a11*s;out[2]=a02*c+a12*s;out[3]=a03*c+a13*s;out[4]=a10*c-a00*s;out[5]=a11*c-a01*s;out[6]=a12*c-a02*s;out[7]=a13*c-a03*s;return out}},{}],43:[function(require,module,exports){module.exports=scale;function scale(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}},{}],44:[function(require,module,exports){module.exports=translate;function translate(out,a,v){var x=v[0],y=v[1],z=v[2],a00,a01,a02,a03,a10,a11,a12,a13,a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]=a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out}},{}],45:[function(require,module,exports){module.exports=require("../lib/applyColor").bind(undefined,"backgroundColor")},{"../lib/applyColor":7}],46:[function(require,module,exports){var style=require("dom-css");module.exports=function(target,state){style(target,state.style)}},{"dom-css":12}],47:[function(require,module,exports){module.exports=require("../lib/applyColor").bind(undefined,"color")},{"../lib/applyColor":7}],48:[function(require,module,exports){module.exports=function(target,state){for(var i in state){if(i!=="style"){target[i]=state[i]}}}},{}],49:[function(require,module,exports){module.exports={init:[],update:[require("./copy"),require("./baseCSS"),require("./backgroundColor"),require("./color"),require("./transform"),require("./transformOrigin")]}},{"./backgroundColor":45,"./baseCSS":46,"./color":47,"./copy":48,"./transform":50,"./transformOrigin":51}],50:[function(require,module,exports){var getTransformMatrix=require("../lib/getTransformMatrix");module.exports=function(target,state){var transform=getTransformMatrix(state);var cssValue;var perspective;if(transform){perspective=-1/transform[11];cssValue="perspective("+perspective+"px) matrix3d("+Array.prototype.join.call(transform,",")+")";target.style.transform=cssValue;target.style.webkitTransform=cssValue;target.style.msTransform=cssValue;target.style.mozTransform=cssValue;target.style.ieTransform=cssValue}}},{"../lib/getTransformMatrix":9}],51:[function(require,module,exports){module.exports=function(target,state){if(state.style&&Array.isArray(state.style.transformOrigin)){var anchor=state.style.transformOrigin;var cssValue=anchor.map(function(value){return value*100+"%"}).join(" ");target.style["transform-origin"]=cssValue;target.style["--webkit-transform-origin"]=cssValue;target.style["--ms-transform-origin"]=cssValue;target.style["--moz-transform-origin"]=cssValue}}},{}],"f1-dom":[function(require,module,exports){var f1=require("f1");var parsers=require("./parsers");var getTargetsFromStates=require("./lib/getTargetsFromStates");module.exports=function(settings){if(!settings.states){throw new Error("You must define states before using f1-dom")}settings.el=settings.el||document.body;settings.parsers=settings.parsers||{init:parsers.init.slice(),update:parsers.update.slice()};settings.targets={};getTargetsFromStates(settings.el,settings.targets,settings.states);return f1(settings)}},{"./lib/getTargetsFromStates":8,"./parsers":49,f1:18}]},{},[]);var f1DOM=require("f1-dom");var elButton;var button;document.body.innerHTML='<div data-f1="elButton">'+'<div data-f1="text">Im a button</div>'+"</div>";button=f1DOM({el:document.body,states:{idle:{elButton:{style:{padding:10,margin:10,backgroundColor:[255,0,255],cursor:"pointer",display:"inline-block"}},text:{style:{color:[33,33,33],rotate:[0,0,0]}}},over:{elButton:{style:{padding:20,margin:0,backgroundColor:[255,0,0],cursor:"progress",display:"inline-block"}},text:{style:{color:[255,255,255],rotate:[0,0,15]}}}},transitions:[{from:"idle",to:"over",bi:true}]}).init("idle");elButton=document.querySelector("[data-f1]");elButton.onmouseover=function(){button.go("over")};elButton.onmouseout=function(){button.go("idle")}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"f1-dom": "6.0.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment