diff --git a/.gitignore b/.gitignore deleted file mode 100755 index 333dd9b..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/dist -examples/dist/* -!examples/dist/index.html -node_modules/ -.idea/**/* -!.idea/codeStyleSettings.xml -yarn-error.log -Caddyfile \ No newline at end of file diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100755 index b6628c1..0000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100755 index a211ada..0000000 --- a/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -tsconfig.json -.travis.yml -.idea -.vscode \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 8cd398a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: node_js -node_js: 8 - -install: - - yarn - -script: - - yarn test - - yarn ghpages - -deploy: - - provider: npm - email: $NPM_EMAIL - api_key: $NPM_AUTH - skip_cleanup: true - on: - tags: true - - provider: pages - github-token: $GITHUB_TOKEN - keep-history: true - local-dir: examples/dist - skip-cleanup: true - on: - tags: true - -cache: - yarn: true - -env: - secure: "u0T1YAecgMpwEQruQAHfjiCiARYo7z/su1vpCTQvFOg3rPmsM/R/7ai0KYysL1whjTMvmFxg2pJx3jq2tejuD7kyK2JUDc1B9pSDg/LBwCPyw9ity5uElXh6GHtMTIyHLleKZRAh4pyrQY3Bs2QsdFHga1jSDr5w3PrRBJ+cYY78eYLGZwHgU8zbjZ6i65nqrA5oNUM9RtIZrM8ZWSz3WmW6zPkAQQaEJ/JqT+zJ1j29XLoBqXwML24ydUM/MHujj98tSCGbAGgjkGqx2t+fwtpbxEUSmc4rMC8PDAL7dCQ9kF6Q5D1ztbj+W8/IhLWhrAjjCzaogbPaYKpxAnnUPsoTuiZbe6wCDAT4S71Nf22SgA3QTT3+9G+L0EOhie/URyTzDwEXHhVUTDA+V0ayVe0XvcWqHeL92lLMMHSCUsx2zhqx5nw998XrmrUDt/rSq59b+4EJ+t1JVSDr5Eawnlvaqp1Yy1BPuA9l3vGnFQImWcUffz4Uu21Qc7uG+rQtZp7+wZ7zRYLuO4pwfftkVL6B0r8ixO4K7ksIIVMkxFoVOKOw4EDoN1qLzje7FHeCxHOPvSdK34KLnqTZ82y1Z/VcP+xcSxeA+n5lY27LIIJa869V0n4mBN+juOlwI1TzGb7pwkiIKdIrnSvEhN4WqIWUwkEaSOpkp8B+rhRy/aE=" \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100755 index 3e8e557..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "editor.tabSize": 2, - "editor.insertSpaces": false, - "editor.detectIndentation": false, - "prettier.tabWidth": 2, - "prettier.useTabs": true, - "prettier.semi": false, - "prettier.bracketSpacing": false, - "prettier.singleQuote": true -} \ No newline at end of file diff --git a/1.bundle.css b/1.bundle.css new file mode 100644 index 0000000..2a0afdf --- /dev/null +++ b/1.bundle.css @@ -0,0 +1,2 @@ +.slider{height:100%}.slider .carousel-content{display:block;height:100%;white-space:nowrap}.slider .carousel-content>*{white-space:normal} +.carousel{height:100%;width:100%}.carousel .carousel-content{height:100%;display:flex} diff --git a/1.bundle.js b/1.bundle.js new file mode 100644 index 0000000..55f3cb6 --- /dev/null +++ b/1.bundle.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{244:function(t,e){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},245:function(t,e,n){var r=n(34),o="["+n(244)+"]",i=RegExp("^"+o+o+"*"),u=RegExp(o+o+"*$");t.exports=function(t,e){return t=String(r(t)),1&e&&(t=t.replace(i,"")),2&e&&(t=t.replace(u,"")),t}},246:function(t,e,n){var r=n(247);n(15)({global:!0,forced:parseFloat!=r},{parseFloat:r})},247:function(t,e,n){var r=n(6).parseFloat,o=n(245),i=n(244),u=1/r(i+"-0")!=-1/0;t.exports=u?function(t){var e=o(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},250:function(t,e,n){"use strict";n(152),n(97),n(153);var r=n(0),o=(n(268),n(165),n(269),n(271),n(283)),i=n.n(o),u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n4?(e=t.substr(1,2),n=t.substr(3,2),r=t.substr(5,2)):(e=t.substr(1,1),n=t.substr(2,1),r=t.substr(3,1),e+=e,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:1}}}),S={test:function(t){return"string"==typeof t&&y.test(t)||M.test(t)||k.test(t)||A.test(t)},parse:function(t){return M.test(t)?M.parse(t):k.test(t)?k.parse(t):A.test(t)?A.parse(t):t},transform:function(t){return b(t)?M.transform(t):w(t)?k.transform(t):t}},C=/(-)?(\d[\d\.]*)/g,T=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,D=function(t){if("string"!=typeof t||!isNaN(t))return!1;var e=0,n=t.match(C),r=t.match(T);return n&&(e+=n.length),r&&(e+=r.length),e>0},R=function(t){var e=t,n=[],r=e.match(T);r&&(e=e.replace(T,"${c}"),n.push.apply(n,r.map(S.parse)));var o=e.match(C);return o&&n.push.apply(n,o.map(f.parse)),n},L=function(t){var e=t,n=0,r=t.match(T),o=r?r.length:0;if(r)for(var i=0;i4?(e=t.substr(1,2),n=t.substr(3,2),r=t.substr(5,2)):(e=t.substr(1,1),n=t.substr(2,1),r=t.substr(3,1),e+=e,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:1}}}),Jt={test:function(t){return"string"==typeof t&&zt.test(t)||$t.test(t)||Zt.test(t)||Gt.test(t)},parse:function(t){return $t.test(t)?$t.parse(t):Zt.test(t)?Zt.parse(t):Gt.test(t)?Gt.parse(t):t},transform:function(t){return Ut(t)?$t.transform(t):Bt(t)?Zt.transform(t):t}},Kt=function(){return(Kt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n1;if(a){var c=ln[0],f=ln[1];r=pt(c,f),i=rt(c,f)}var p=function(){if(a){var t=ln[0],o=ln[1],c=pt(t,o),f=rt(t,o);n.scale=u*(c/r),n.rotate=s+(f-i)}e(n)},l=cn(document,"touchmove",{passive:!o}).start(function(t){(o||t.touches.length>1)&&t.preventDefault(),_.update(p)});return hn&&_.update(p),{stop:function(){Z.update(p),l.stop()}}})).pipe(function(t){return t.touches},gn):function(t){var e=(void 0===t?{}:t).preventDefault,n=void 0===e||e;return Ee(function(t){var e=t.update,r=function(){return e(dn)},o=cn(document,"mousemove").start(function(t){n&&t.preventDefault(),_.update(r)});return vn&&_.update(r),{stop:function(){Z.update(r),o.stop()}}})}(t);var e,n,r,o,i,u,a,s};function yn(t,e,n,r){var o,i=!1,u=0;function a(){o&&clearTimeout(o)}function s(){var s=this,c=Date.now()-u,f=arguments;function p(){u=Date.now(),n.apply(s,f)}i||(r&&!o&&p(),a(),void 0===r&&c>t?p():!0!==e&&(o=setTimeout(r?function(){o=void 0}:p,void 0===r?t-c:t)))}return"boolean"!=typeof e&&(r=n,n=e,e=void 0),s.cancel=function(){a(),i=!0},s}var bn=n(1),wn=(n(166),function(){function t(t,e,n,r){void 0===t&&(t=8),void 0===e&&(e=100),void 0===n&&(n=1.1),void 0===r&&(r=150),this.stability=t,this.sensitivity=e,this.tolerance=n,this.delay=r,this.lastUpDeltas=Array.from(Array(2*this.stability)),this.lastDownDeltas=Array.from(Array(2*this.stability)),this.deltasTimestamp=Array.from(Array(2*this.stability))}return t.prototype.check=function(t){return this.deltasTimestamp.push(Date.now()),this.deltasTimestamp.shift(),0!==t&&(t>0?(this.lastUpDeltas.push(t),this.lastUpDeltas.shift(),this.isInertia(1)):(this.lastDownDeltas.push(t),this.lastDownDeltas.shift(),this.isInertia(-1)))},t.prototype.isInertia=function(t){var e=-1==t?this.lastDownDeltas:this.lastUpDeltas;if(null==e[0])return t;if(this.deltasTimestamp[2*this.stability-2]+this.delay>Date.now()&&e[0]==e[2*this.stability-1])return!1;var n=e.slice(0,this.stability),r=e.slice(this.stability,2*this.stability),o=n.reduce(function(t,e){return t+e}),i=r.reduce(function(t,e){return t+e}),u=o/n.length,a=i/r.length;return Math.abs(u)=-135||t<=135&&t>=45},jn=function(t){function e(){var e,n,o,i=null!==t&&t.apply(this,arguments)||this;return i.offset=$e(0),i.snaps={pages:[0],elements:[0]},i.activePage=0,i.preventClick=!1,i.destination=0,i.lethargy=new wn,i.wheelStart=null,i.wheelPanning=!1,i.onWheel=function(t){null===i.wheelStart&&(i.wheelStart=i.x);var e=Be.angle({x:t.deltaX,y:t.deltaY}),n=i.lethargy.check(t.deltaX);Mn(e)||(t.stopPropagation(),t.preventDefault(),!1!==n&&(i.wheelPanning||(i.goTo(i.activePage+n),i.wheelPanning=!0,setTimeout(function(){return i.wheelPanning=!1},500))))},i.onResize=(e=250,n=function(){return i.onUpdate()},void 0===o?yn(e,n,!1):yn(e,o,!1!==n)),i.overDrag=function(t){var e=i.attrs.tug,n=void 0===e?.4:e,r=-i.max;return t0?xn(0,t,n):t},i.snapToAnimation=function(t){sn(r.a({},t,{velocity:i.offset.getVelocity(),stiffness:100,damping:20})).start(i.offset),i.redraw()},i.goTo=function(t){var e=i.snaps.pages;t<0||t>e.length-1||i.spring(e[t])},i.goToElement=function(t){var e=i.snaps.elements;i.spring(e[t])},i.isActive=function(t){var e=i.dom.offsetWidth,n=i.destination,r=i.snaps.elements[t],o=i.snaps.elements[t+1];return r>=n&&o-5<=n+e},i}return r.b(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this.dom.firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this.content.scrollWidth-this.dom.offsetWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x",{get:function(){return this.offset.get()},enumerable:!0,configurable:!0}),e.prototype.redraw=function(){bn.a.redraw()},e.prototype.onCreate=function(){var t=this,e=this.attrs,n=e.draggable,o=void 0===n||n,i=e.touchpadSupport,u=void 0===i||i;this.onUpdate();var a=Ve(this.content),s=this.offset.subscribe(function(t){a.set("x",t)}).unsubscribe,c=s;if(o){var f=function(){},p=cn(this.dom,"mousedown touchstart").start(function(e){var n=t.x;e instanceof MouseEvent&&1!==e.which||(t.preventClick=!1,f=function(t){void 0===t&&(t={});var e=t.x,n=t.y,o=Object(r.c)(t,["x","y"]);if(void 0!==e||void 0!==n){var i=ot(e||0),u=ot(n||0),a={x:0,y:0};return mn(o).pipe(function(t){return a.x=i(t.x),a.y=u(t.y),a})}return mn(o)}({x:n,preventDefault:!1}).pipe(function(t){return t.x},t.overDrag).start(t.offset).stop,cn(document,"mouseup touchend",{once:!0}).start(function(){return function(e){var n=t.attrs,r=n.snapTo,o=void 0===r?"pages":r,i=n.power,u=void 0===i?.25:i,a=t.snaps[o],s=t.x,c=s-e,f=u*t.offset.getVelocity(),p=Math.round(s+f),l=Pn(a,-p);t.preventClick=Math.abs(c)>1,t.spring(l)}(n)}))}).stop,l=function(e){if(!t.preventClick)return f();e.stopPropagation(),e.preventDefault()};this.dom.addEventListener("click",l,!0);c=function(){s(),p(),f(),t.dom.removeEventListener("click",l,!0)}}var h=function(){};u&&(this.dom.addEventListener("wheel",this.onWheel),h=function(){return t.dom.removeEventListener("wheel",t.onWheel)}),window.addEventListener("resize",this.onResize);this.onRemove=function(){c(),h(),window.removeEventListener("resize",t.onResize)},this.redraw()},e.prototype.onUpdate=function(){var t=r.a({},this.snaps);this.snaps=this.calcSnaps();var e=this.attrs.connect;e&&e(this),i()(t,this.snaps)||this.spring(this.snaps.pages[this.activePage])},e.prototype.calcSnaps=function(){var t=this.dom.offsetWidth;return Array.from(this.content.children).reduce(function(e,n,r){var o=e.pages,i=e.elements,u=o[o.length-1],a=i[i.length-1],s=a+n.offsetWidth;return i.push(s),a>0&&s-u>t&&o.push(a),{pages:o,elements:i}},{pages:[0],elements:[0]})},e.prototype.spring=function(t,e){void 0===e&&(e=this.snapToAnimation);var n=this.x;this.destination=Math.min(t,this.max);var r=-this.destination;this.setActivePage(t),n!==r&&e({from:n,to:r})},e.prototype.setActivePage=function(t){var e=this.snaps.pages;this.activePage=e.indexOf(Pn(e,t))},e.prototype.preselectPage=function(t){var e=this,n=this.snaps.pages[t];n>0&&this.spring(n,function(t){var n=t.to;e.offset.update(n)})},e.prototype.render=function(){var t=this.attrs,e=t.draggable,n=void 0===e||e,r=t.overflow,o=t.unstyled,i=t.className;return Object(bn.a)(".carousel",{style:o?{}:{overflow:r?null:"hidden",userSelect:n?"none":null,touchAction:n?"pan-y pinch-zoom":null},className:i},Object(bn.a)(".carousel-content",n?{ondragstart:function(t){return t.preventDefault()}}:{},this.children))},e}(On.a)},266:function(t,e,n){},267:function(t,e,n){"use strict";n.d(e,"a",function(){return r});n(43);var r=function(){function t(t){var e=this;this.initialPage=0,this.connect=function(t){e.carousel||0===e.initialPage||t.preselectPage(e.initialPage),e.carousel=t},Object.assign(this,t)}return Object.defineProperty(t.prototype,"activePage",{get:function(){return this.carousel?this.carousel.activePage:this.initialPage},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.carousel?this.carousel.snaps.pages.length:0},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return t>=0&&t0?arguments[0]:void 0)}},n(274),!1,!0)},274:function(t,e,n){"use strict";var r=n(103),o=n(106).getWeakData,i=n(9),u=n(10),a=n(62),s=n(58),c=n(61),f=n(17),p=n(36),l=p.set,h=p.getterFor,d=c(5),v=c(6),g=0,m=function(t){return t.frozen||(t.frozen=new y)},y=function(){this.entries=[]},b=function(t,e){return d(t.entries,function(t){return t[0]===e})};y.prototype={get:function(t){var e=b(this,t);if(e)return e[1]},has:function(t){return!!b(this,t)},set:function(t,e){var n=b(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=v(this.entries,function(e){return e[0]===t});return~e&&this.entries.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,c){var p=t(function(t,r){a(t,p,e),l(t,{type:e,id:g++,frozen:void 0}),null!=r&&s(r,t[c],t,n)}),d=h(e),v=function(t,e,n){var r=d(t),u=o(i(e),!0);return!0===u?m(r).set(e,n):u[r.id]=n,t};return r(p.prototype,{delete:function(t){var e=d(this);if(!u(t))return!1;var n=o(t);return!0===n?m(e).delete(t):n&&f(n,e.id)&&delete n[e.id]},has:function(t){var e=d(this);if(!u(t))return!1;var n=o(t);return!0===n?m(e).has(t):n&&f(n,e.id)}}),r(p.prototype,n?{get:function(t){var e=d(this);if(u(t)){var n=o(t);return!0===n?m(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return v(this,t,e)}}:{add:function(t){return v(this,t,!0)}}),p}}},275:function(t,e,n){"use strict";var r=n(276),o=n(41);n(11)({target:"WeakSet",proto:!0,real:!0,forced:o},{addAll:function(){return r.apply(this,arguments)}})},276:function(t,e,n){"use strict";var r=n(9),o=n(40);t.exports=function(){for(var t=r(this),e=o(t.add),n=0,i=arguments.length;n=0;c--)if(p[c]!=l[c])return!1;for(c=p.length-1;c>=0;c--)if(f=p[c],!u(t[f],e[f],n))return!1;return typeof t==typeof e}(t,e,n))};function a(t){return null==t}function s(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}},284:function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}(t.exports="function"==typeof Object.keys?Object.keys:n).shim=n},285:function(t,e){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function o(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}(e=t.exports=n?r:o).supported=r,e.unsupported=o},287:function(t,e,n){"use strict";n.d(e,"a",function(){return o});n(156);var r=n(0),o=(n(266),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.className="slider",e}return r.b(e,t),e.prototype.index=function(){return this.carousel?this.activePage:this.initialPage},e.prototype.total=function(){return this.totalPages},e.prototype.actives=function(){var t=this;return this.carousel?this.carousel.snaps.elements.map(function(e,n){return function(){return t.isActive(n)}}):[]},e}(n(267).a))}}]); \ No newline at end of file diff --git a/2.bundle.css b/2.bundle.css new file mode 100644 index 0000000..517b6bb --- /dev/null +++ b/2.bundle.css @@ -0,0 +1,2 @@ +.map-maps{height:500px} +.maps{height:100%} diff --git a/2.bundle.js b/2.bundle.js new file mode 100644 index 0000000..98433d6 --- /dev/null +++ b/2.bundle.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{244:function(t,e){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},245:function(t,e,n){var r=n(34),o="["+n(244)+"]",a=RegExp("^"+o+o+"*"),i=RegExp(o+o+"*$");t.exports=function(t,e){return t=String(r(t)),1&e&&(t=t.replace(a,"")),2&e&&(t=t.replace(i,"")),t}},246:function(t,e,n){var r=n(247);n(15)({global:!0,forced:parseFloat!=r},{parseFloat:r})},247:function(t,e,n){var r=n(6).parseFloat,o=n(245),a=n(244),i=1/r(a+"-0")!=-1/0;t.exports=i?function(t){var e=o(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},248:function(t,e,n){"use strict";var r,o,a,i=n(249),c=n(28),s=n(29),u=n(91),p=n(7)("iterator"),l=!1;[].keys&&("next"in(a=[].keys())?(o=i(i(a)))!==Object.prototype&&(r=o):l=!0),null==r&&(r={}),u||s(r,p)||c(r,p,function(){return this}),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:l}},249:function(t,e,n){var r=n(29),o=n(92),a=n(99)("IE_PROTO"),i=n(258),c=Object.prototype;t.exports=i?Object.getPrototypeOf:function(t){return t=o(t),r(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},251:function(t,e,n){var r=!n(163)(function(t){Array.from(t)});n(15)({target:"Array",stat:!0,forced:r},{from:n(252)})},252:function(t,e,n){"use strict";var r=n(60),o=n(92),a=n(162),i=n(160),c=n(35),s=n(159),u=n(161);t.exports=function(t){var e,n,p,l,f=o(t),h="function"==typeof this?this:Array,v=arguments.length,d=v>1?arguments[1]:void 0,g=void 0!==d,y=0,m=u(f);if(g&&(d=r(d,v>2?arguments[2]:void 0,2)),null==m||h==Array&&i(m))for(n=new h(e=c(f.length));e>y;y++)s(n,y,g?d(f[y],y):f[y]);else for(l=m.call(f),n=new h;!(p=l.next()).done;y++)s(n,y,g?a(l,d,[p.value,y],!0):p.value);return n.length=y,n}},253:function(t,e,n){var r=n(254);n(15)({global:!0,forced:parseInt!=r},{parseInt:r})},254:function(t,e,n){var r=n(6).parseInt,o=n(245),a=n(244),i=/^[-+]?0[xX]/,c=8!==r(a+"08")||22!==r(a+"0x16");t.exports=c?function(t,e){var n=o(String(t),3);return r(n,e>>>0||(i.test(n)?16:10))}:r},255:function(t,e,n){"use strict";var r=n(164),o=n(98),a=n(256),i=o.set,c=o.getterFor("String Iterator");a(String,"String",function(t){i(this,{type:"String Iterator",string:String(t),index:0})},function(){var t,e=c(this),n=e.string,o=e.index;return o>=n.length?{value:void 0,done:!0}:(t=r(n,o,!0),e.index+=t.length,{value:t,done:!1})})},256:function(t,e,n){"use strict";var r=n(15),o=n(257),a=n(249),i=n(259),c=n(155),s=n(28),u=n(42),p=n(91),l=n(7)("iterator"),f=n(95),h=n(248),v=h.IteratorPrototype,d=h.BUGGY_SAFARI_ITERATORS,g=function(){return this};t.exports=function(t,e,n,h,y,m,b){o(n,e,h);var O,w,j,x=function(t){if(t===y&&P)return P;if(!d&&t in A)return A[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},k=e+" Iterator",_=!1,A=t.prototype,I=A[l]||A["@@iterator"]||y&&A[y],P=!d&&I||x(y),S="Array"==e&&A.entries||I;if(S&&(O=a(S.call(new t)),v!==Object.prototype&&O.next&&(p||a(O)===v||(i?i(O,v):"function"!=typeof O[l]&&s(O,l,g)),c(O,k,!0,!0),p&&(f[k]=g))),"values"==y&&I&&"values"!==I.name&&(_=!0,P=function(){return I.call(this)}),p&&!b||A[l]===P||s(A,l,P),f[e]=P,y)if(w={values:x("values"),keys:m?P:x("keys"),entries:x("entries")},b)for(j in w)!d&&!_&&j in A||u(A,j,w[j]);else r({target:e,proto:!0,forced:d||_},w);return w}},257:function(t,e,n){"use strict";var r=n(248).IteratorPrototype,o=n(167),a=n(59),i=n(155),c=n(95),s=function(){return this};t.exports=function(t,e,n){var u=e+" Iterator";return t.prototype=o(r,{next:a(1,n)}),i(t,u,!1,!0),c[u]=s,t}},258:function(t,e,n){t.exports=!n(12)(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},259:function(t,e,n){var r=n(260);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,o){return r(n,o),e?t.call(n,o):n.__proto__=o,n}}():void 0)},260:function(t,e,n){var r=n(16),o=n(13);t.exports=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}},261:function(t,e,n){"use strict";n(15)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},262:function(t,e,n){},263:function(t,e,n){},264:function(t,e){var n="__googleMapsApiOnLoadCallback",r=["channel","client","key","language","region","v"],o=null;t.exports=function(t){return t=t||{},o||(o=new Promise(function(e,o){var a=setTimeout(function(){window[n]=function(){},o(new Error("Could not load the Google Maps API"))},t.timeout||1e4);window[n]=function(){null!==a&&clearTimeout(a),e(window.google.maps),delete window[n]};var i=document.createElement("script"),c=["callback="+n];r.forEach(function(e){t[e]&&c.push(e+"="+t[e])}),t.libraries&&t.libraries.length&&c.push("libraries="+t.libraries.join(",")),i.src="https://maps.googleapis.com/maps/api/js?"+c.join("&"),document.body.appendChild(i)})),o}},288:function(t,e,n){"use strict";n.r(e);n(251),n(157),n(93),n(94),n(246),n(253),n(255),n(261),n(262);var r=n(1),o=(n(156),n(0)),a=(n(263),n(264)),i=n.n(a),c=n(33),s=n(2),u=(n(102),n(101),n(152),n(97),n(105),n(168),n(96),n(153),n(104),n(158),function(){function t(t){this.object=t,this.attached=new Map}return t.prototype.attach=function(t){var e=this;t.forEach(function(t){e.attached.has(t)||e.attached.set(t,e.object.add(t,function(n){void 0===n&&(n={redraw:!0}),n.redraw=!0,e.object.hit(t,n),n.redraw&&r.a.redraw()}))}),this.remove(Array.from(this.attached.keys()).filter(function(e){return-1===t.indexOf(e)}))},t.prototype.remove=function(t){var e=this;Array.from(this.attached.keys()).filter(function(e){return!t||t.indexOf(e)>-1}).forEach(function(t){e.attached.get(t)(),e.attached.delete(t)})},t}()),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onInit=e.createCache,e.onBeforeUpdate=e.attachEvents,e}return o.b(e,t),e.prototype.createCache=function(){var t=this,e=this.attrs.object;this.events=new u({add:function(t,n){var r=e.addListener(t,n);return function(){return google.maps.event.removeListener(r)}},hit:function(n,r){var o=t.attrs.on,a=void 0===o?{}:o;r.target=e,a&&n in a&&a[n](r)}}),this.attachEvents()},e.prototype.attachEvents=function(){var t=this.attrs.on,e=void 0===t?{}:t;this.events.attach(Object.keys(e))},e.prototype.onRemove=function(){this.events.remove()},e.prototype.render=function(){return this.children},e}(s.a),l=function(){function t(){this.pool=[]}return t.prototype.create=function(t){var e;return this.pool.length?this.pool.pop():t(((e=document.createElement("div")).style.height="100%",e))},t.prototype.release=function(t){var e=t.getDiv();e.parentNode&&e.parentNode.removeChild(e),this.pool.push(t)},t}(),f=Object(c.a)(),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.b(e,t),e.prototype.onCreate=function(){var t=this,n=this.attrs,a=(n.children,n.on,n.apiKey),c=n.region,s=n.language,u=(n.class,n.initial),p=void 0===u?{}:u,l=o.c(n,["children","on","apiKey","region","language","class","initial"]);i()({key:a,region:c,language:s}).then(function(n){var r=e.pool.create(function(t){return new n.Map(t)}),a=p.zoom,i=void 0===a?7:a,c=p.center,s=void 0===c?{lat:51.0030477,lng:4.5000955}:c;r.setOptions(o.a({zoom:i,center:s},l)),t.dom&&t.dom.appendChild(r.getDiv()),t.onRemove=function(){e.pool.release(r)},t.map=r}).then(r.a.redraw).catch(console.error)},e.prototype.render=function(){var t=this.attrs,e=t.class,n=t.on,a=o.c(t,["class","on"]);return this.map&&a&&this.map.setOptions(a),Object(r.a)(".maps",{className:e},this.map&&Object(r.a)(f.Provider,{value:this.map},Object(r.a)(p,{on:n,object:this.map},this.children)))},e.pool=new l,e}(s.a),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.b(e,t),e.prototype.onRemove=function(){this.marker&&this.marker.setMap(null)},e.prototype.render=function(){var t=this,e=this.attrs,n=(e.children,e.on),a=o.c(e,["children","on"]);return Object(r.a)(f.Consumer,function(e){if(!e)throw"No Maps parent detected";return t.marker?t.marker.setOptions(a):t.marker=new google.maps.Marker(o.a({map:e},a)),Object(r.a)(p,{on:n,object:t.marker},t.children)})},e}(s.a);function d(t,e,n,r){var o,a=!1,i=0;function c(){o&&clearTimeout(o)}function s(){var s=this,u=Date.now()-i,p=arguments;function l(){i=Date.now(),n.apply(s,p)}a||(r&&!o&&l(),c(),void 0===r&&u>t?l():!0!==e&&(o=setTimeout(r?function(){o=void 0}:l,void 0===r?t-u:t)))}return"boolean"!=typeof e&&(r=n,n=e,e=void 0),s.cancel=function(){c(),a=!0},s}function g(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,function(t,e){for(var n=Object.getOwnPropertyNames(e),r=0;r>"),Object(i.a)("a.sliderpage-slide-link",{href:"https://codeurs.be",target:"_blank"},"external")])})),Object(i.a)(s.a,[1,2,3,4,5,6,7].map(function(t,a){return Object(i.a)(".sliderpage-slide",{className:"is-active",style:{"min-width":"33.33333%"}},[t,Object(i.a)("a.sliderpage-slide-link",{onclick:function(){e.carousel.goNext()}},"next >>"),Object(i.a)("a.sliderpage-slide-link",{href:"https://codeurs.be",target:"_blank"},"external")])})))])},t}(a(2).a)}}]); \ No newline at end of file diff --git a/examples/src/assets/Inter-Bold.woff b/assets/fonts/Inter-Bold.woff old mode 100755 new mode 100644 similarity index 100% rename from examples/src/assets/Inter-Bold.woff rename to assets/fonts/Inter-Bold.woff diff --git a/examples/src/assets/Inter-Light.woff b/assets/fonts/Inter-Light.woff old mode 100755 new mode 100644 similarity index 100% rename from examples/src/assets/Inter-Light.woff rename to assets/fonts/Inter-Light.woff diff --git a/examples/src/assets/Inter-Regular.woff b/assets/fonts/Inter-Regular.woff old mode 100755 new mode 100644 similarity index 100% rename from examples/src/assets/Inter-Regular.woff rename to assets/fonts/Inter-Regular.woff diff --git a/examples/src/assets/test.jpg b/assets/images/test.jpg old mode 100755 new mode 100644 similarity index 100% rename from examples/src/assets/test.jpg rename to assets/images/test.jpg diff --git a/examples/src/assets/test.svg b/assets/images/test.svg old mode 100755 new mode 100644 similarity index 100% rename from examples/src/assets/test.svg rename to assets/images/test.svg diff --git a/bundle.css b/bundle.css new file mode 100644 index 0000000..30f7ec8 --- /dev/null +++ b/bundle.css @@ -0,0 +1,4 @@ +@font-face{font-family:Inter;font-weight:300;src:url(/assets/fonts/Inter-Light.woff) format("woff")}@font-face{font-family:Inter;font-weight:400;src:url(/assets/fonts/Inter-Regular.woff) format("woff")}@font-face{font-family:Inter;font-weight:700;src:url(/assets/fonts/Inter-Bold.woff) format("woff")}body{font-family:Inter,sans-serif}a{display:inline-block;margin-right:10px}.modalexample{background:#fff;border-radius:10px;margin:50px;padding:200px}.images-bg{width:200px!important;height:200px!important}.images-portrait{outline:1px solid red;width:150px;height:250px}.images-landscape{outline:1px solid red;width:200px;height:100px}.images-fixedheight{height:200px;display:flex} +.modal{position:fixed;top:0;left:0;width:100%;height:100%;opacity:0;transition:opacity .35s ease-out;overflow:auto}.modal.is-open{opacity:1}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);z-index:-1;pointer-events:none}.modal-container{display:flex;align-items:center;justify-content:center;min-height:100%;z-index:1}.modal-container,.modal-container-content{position:relative}.modal.mod-full .modal-container-content{position:absolute;top:0;left:0;height:100%;width:100%;overflow:auto} +.image{display:block;width:auto;height:auto;max-width:100%;max-height:100%}.image.mod-crop{width:100%;height:100%} +.autocomplete{display:inline-block;position:relative}.autocomplete-item.is-active{background:red}.autocomplete-menu{max-height:300px;overflow:auto;position:absolute;top:100%;left:0;right:0;background:#fff;box-shadow:0 3px 30px rgba(0,0,0,.2)}.autocomplete-menu:empty{display:none}.dropdown-menu-item{padding:10px}.dropdown-menu-item.is-active{background:red} diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..481d7a6 --- /dev/null +++ b/bundle.js @@ -0,0 +1,27 @@ +!function(e){function t(t){for(var n,r,i=t[0],a=t[1],c=0,u=[];c0&&(o.className=r.join(" ")),a[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)}s.trust=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)},s.fragment=function(){var e=o.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e};var l=function(){return s.apply(this,arguments)};if(l.m=s,l.trust=s.trust,l.fragment=s.fragment,(f=function(t){if(!(this instanceof f))throw new Error("Promise must be called with `new`");if("function"!=typeof t)throw new TypeError("executor must be a function");var n=this,r=[],o=[],i=s(r,!0),a=s(o,!1),c=n._instance={resolvers:r,rejectors:o},u="function"==typeof e?e:setTimeout;function s(e,t){return function i(s){var f;try{if(!t||null==s||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof(f=s.then))u(function(){t||0!==e.length||console.error("Possible unhandled promise rejection:",s);for(var n=0;n0||e(n)}}var r=n(a);try{e(n(i),r)}catch(e){r(e)}}l(t)}).prototype.then=function(e,t){var n,r,o=this._instance;function i(e,t,i,a){t.push(function(t){if("function"!=typeof e)i(t);else try{n(e(t))}catch(e){r&&r(e)}}),"function"==typeof o.retry&&a===o.state&&o.retry()}var a=new f(function(e,t){n=e,r=t});return i(e,o.resolvers,n,!0),i(t,o.rejectors,r,!1),a},f.prototype.catch=function(e){return this.then(null,e)},f.prototype.finally=function(e){return this.then(function(t){return f.resolve(e()).then(function(){return t})},function(t){return f.resolve(e()).then(function(){return f.reject(t)})})},f.resolve=function(e){return e instanceof f?e:new f(function(t){t(e)})},f.reject=function(e){return new f(function(t,n){n(e)})},f.all=function(e){return new f(function(t,n){var r=e.length,o=0,i=[];if(0===e.length)t([]);else for(var a=0;a=200&&f.status<300||304===f.status||/^file:\/\//i.test(t),i=f.responseText;if("function"==typeof n.extract)i=n.extract(f,n),e=!0;else if("function"==typeof n.deserialize)i=n.deserialize(i);else try{i=i?JSON.parse(i):null}catch(e){throw new Error("Invalid JSON: "+i)}if(e)r(i);else{var a=new Error(f.responseText);a.code=f.status,a.response=i,o(a)}}catch(e){o(e)}},u&&null!=s?f.send(s):f.send()}),jsonp:o(function(t,n,o,i){var c=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+r++,u=e.document.createElement("script");e[c]=function(t){u.parentNode.removeChild(u),o(t),delete e[c]},u.onerror=function(){u.parentNode.removeChild(u),i(new Error("JSONP request failed")),delete e[c]},t=a(t,n.data,!0),u.src=t+(t.indexOf("?")<0?"?":"&")+encodeURIComponent(n.callbackKey||"callback")+"="+encodeURIComponent(c),e.document.documentElement.appendChild(u)}),setCompletionCallback:function(e){n=e}}}(window,f),h=function(e){var t,n=e.document,o={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function i(e){return e.attrs&&e.attrs.xmlns||o[e.tag]}function a(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function c(e){var t=e.state;try{return this.apply(t,arguments)}finally{a(e,t)}}function u(){try{return n.activeElement}catch(e){return null}}function s(e,t,n,r,o,i,a){for(var c=n;c'+t.children+"",a=a.firstChild):a.innerHTML=t.children,t.dom=a.firstChild,t.domSize=a.childNodes.length;for(var c,u=n.createDocumentFragment();c=a.firstChild;)u.appendChild(c);y(e,u,o)}function p(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)s(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)w(t,0,t.length);else{for(var a=0,c=0,u=null,f=null;c=c&&S>=a;)if(b=t[j],O=n[S],null==b)j--;else if(null==O)S--;else{if(b.key!==O.key)break;b!==O&&h(e,b,O,r,o,i),null!=O.dom&&(o=O.dom),j--,S--}for(;j>=c&&S>=a;)if(d=t[c],p=n[a],null==d)c++;else if(null==p)a++;else{if(d.key!==p.key)break;c++,a++,d!==p&&h(e,d,p,r,g(t,c,o),i)}for(;j>=c&&S>=a;){if(null==d)c++;else if(null==p)a++;else if(null==b)j--;else if(null==O)S--;else{if(a===S)break;if(d.key!==O.key||b.key!==p.key)break;k=g(t,c,o),y(e,m(b),k),b!==p&&h(e,b,p,r,k,i),++a<=--S&&y(e,m(d),o),d!==O&&h(e,d,O,r,o,i),null!=O.dom&&(o=O.dom),c++,j--}b=t[j],O=n[S],d=t[c],p=n[a]}for(;j>=c&&S>=a;){if(null==b)j--;else if(null==O)S--;else{if(b.key!==O.key)break;b!==O&&h(e,b,O,r,o,i),null!=O.dom&&(o=O.dom),j--,S--}b=t[j],O=n[S]}if(a>S)w(t,c,j+1);else if(c>j)s(e,n,a,S+1,r,o,i);else{var A,C,E=o,I=S-a+1,T=new Array(I),P=0,M=0,R=2147483647,L=0;for(M=0;M=a;M--)if(null==A&&(A=v(t,c,j+1)),null!=(O=n[M])){var N=A[O.key];null!=N&&(R=N0&&(r[i]=o[t-1]),o[t]=i)}}t=o.length,n=o[t-1];for(;t-- >0;)o[t]=n,n=r[n];return o}(T)).length-1,M=S;M>=a;M--)p=n[M],-1===T[M-a]?l(e,p,r,i,o):C[P]===M-a?P--:y(e,m(p),o),null!=p.dom&&(o=n[M].dom);else for(M=S;M>=a;M--)p=n[M],-1===T[M-a]&&l(e,p,r,i,o),null!=p.dom&&(o=n[M].dom)}}else{var _=t.length_&&w(t,a,t.length),n.length>_&&s(e,n,a,n.length,r,o,i)}}}function h(e,t,n,o,a,u){var s=t.tag;if(s===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate){var n=c.call(e.attrs.onbeforeupdate,e,t);if(void 0!==n&&!n)break}if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate){var n=c.call(e.state.onbeforeupdate,e,t);if(void 0!==n&&!n)break}return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,!0}(n,t))return;if("string"==typeof s)switch(null!=n.attrs&&R(n.attrs,n,o),s){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(m(t),d(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,u,a);break;case"[":!function(e,t,n,r,o,i){p(e,t.children,n.children,r,o,i);var a=0,c=n.children;if(n.dom=null,null!=c){for(var u=0;u0){for(var o=e.dom;--t;)r.appendChild(o.nextSibling);r.insertBefore(o,r.firstChild)}return r}return e.dom}function g(e,t,n){for(;t-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var A=/[A-Z]/g;function C(e){return"-"+e.toLowerCase()}function E(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(A,C)}function I(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var r in e.style.cssText="",n){null!=(o=n[r])&&e.style.setProperty(E(r),String(o))}else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(E(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(E(r))}}function T(){}function P(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new T,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function M(e,t,n){"function"==typeof e.oninit&&c.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(c.bind(e.oncreate,t))}function R(e,t,n){"function"==typeof e.onupdate&&n.push(c.bind(e.onupdate,t))}return T.prototype=Object.create(null),T.prototype.handleEvent=function(e){var n,r=this["on"+e.type];"function"==typeof r?n=r.call(e.currentTarget,e):"function"==typeof r.handleEvent&&r.handleEvent(e),!1===e.redraw?e.redraw=void 0:"function"==typeof t&&t(),!1===n&&(e.preventDefault(),e.stopPropagation())},{render:function(e,t){if(!e)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var n=[],o=u(),i=e.namespaceURI;null==e.vnodes&&(e.textContent=""),t=r.normalizeChildren(Array.isArray(t)?t:[t]),p(e,e.vnodes,t,n,null,"http://www.w3.org/1999/xhtml"===i?void 0:i),e.vnodes=t,null!=o&&u()!==o&&"function"==typeof o.focus&&o.focus();for(var a=0;a-1&&r.splice(t,2)}function a(){if(o)throw new Error("Nested m.redraw.sync() call");o=!0;for(var e=1;e-1&&u.pop();for(var l=0;l-1?r:o>-1?o:e.length;if(r>-1){var a=o>-1?o:e.length,c=y(e.slice(r+1,a));for(var u in c)t[u]=c[u]}if(o>-1){var s=y(e.slice(o+1));for(var u in s)n[u]=s[u]}return e.slice(0,i)}var c={prefix:"#!",getPath:function(){switch(c.prefix.charAt(0)){case"#":return i("hash").slice(c.prefix.length);case"?":return i("search").slice(c.prefix.length)+i("hash");default:return i("pathname").slice(c.prefix.length)+i("search")+i("hash")}},setPath:function(e,n,o){var i={},u={};if(e=a(e,i,u),null!=n){for(var s in n)i[s]=n[s];e=e.replace(/:([^\/]+)/g,function(e,t){return delete i[t],n[t]})}var l=d(i);l&&(e+="?"+l);var f=d(u);if(f&&(e+="#"+f),r){var p=o?o.state:null,h=o?o.title:null;t.onpopstate(),o&&o.replace?t.history.replaceState(p,h,c.prefix+e):t.history.pushState(p,h,c.prefix+e)}else t.location.href=c.prefix+e}};return c.defineRoutes=function(e,i,u){function s(){var n=c.getPath(),r={},o=a(n,r,r),s=t.history.state;if(null!=s)for(var l in s)r[l]=s[l];for(var f in e){var d=new RegExp("^"+f.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(d.test(o))return void o.replace(d,function(){for(var t=f.match(/:[^\/]+/g)||[],o=[].slice.call(arguments,1,-2),a=0;a0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(23),o=n(126),i=n(9),a=n(73),c=Object.defineProperty;t.f=r?c:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){e.exports=!n(12)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){e.exports=!n(8)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";n.d(t,"a",function(){return r});n(38);var r=function(e){var t;return Array.isArray(e)?e[0]&&"function"==typeof e[0]?e[0]:(t=[]).concat.apply(t,e):e}},function(e,t,n){var r=n(21),o=n(109),i=n(13),a=n(65),c=Object.defineProperty;t.f=r?c:function(e,t,n){if(i(e),t=a(t,!0),i(n),o)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(27);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(25),o=n(59);e.exports=n(21)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(64),o=n(34);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(51),o=n(27);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(3),o=n(14),i=n(17),a=n(75),c=n(129),u=n(36),s=u.get,l=u.enforce,f=String(c).split("toString");n(49)("inspectSource",function(e){return c.call(e)}),(e.exports=function(e,t,n,c){var u=!!c&&!!c.unsafe,s=!!c&&!!c.enumerable,d=!!c&&!!c.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),l(n).source=f.join("string"==typeof t?t:"")),e!==r?(u?!d&&e[t]&&(s=!0):delete e[t],s?e[t]=n:o(e,t,n)):s?e[t]=n:a(t,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&s(this).source||c.call(this)})},function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(0),o=n(5),i=n(2),a=function(e){return{Provider:function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r.b(n,t),n.prototype.render=function(){var t=e,n=this.attrs,r=n.value,i=n.children;return e=r,[i,Object(o.a)({view:function(){e=t}})]},n}(i.a),Consumer:function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r.b(n,t),n.prototype.render=function(){return(0,this.attrs.children)(e)},n}(i.a),__get:function(){return e}}}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(63),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r,o,i,a=n(197),c=n(10),u=n(14),s=n(17),l=n(78),f=n(52),d=n(3).WeakMap;if(a){var p=new d,h=p.get,v=p.has,m=p.set;r=function(e,t){return m.call(p,e,t),t},o=function(e){return h.call(p,e)||{}},i=function(e){return v.call(p,e)}}else{var g=l("state");f[g]=!0,r=function(e,t){return u(e,g,t),t},o=function(e){return s(e,g)?e[g]:{}},i=function(e){return s(e,g)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},function(e,t,n){var r=n(40);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(71),o=n(10),i=n(26),a=n(18),c=n(72),u=n(127),s=n(4)("isConcatSpreadable"),l=!n(8)(function(){var e=[];return e[s]=!1,e.concat()[0]!==e}),f=n(50)("concat"),d=function(e){if(!o(e))return!1;var t=e[s];return void 0!==t?!!t:r(e)},p=!l||!f;n(11)({target:"Array",proto:!0,forced:p},{concat:function(e){var t,n,r,o,s,l=i(this),f=u(l,0),p=0;for(t=-1,r=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n=9007199254740991)throw TypeError("Maximum allowed index exceeded");c(f,p++,s)}return f.length=p,f}})},function(e,t){e.exports={}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t){e.exports=!1},function(e,t,n){var r=n(6),o=n(28),i=n(29),a=n(67),c=n(112),u=n(98),s=u.get,l=u.enforce,f=String(c).split("toString");n(44)("inspectSource",function(e){return c.call(e)}),(e.exports=function(e,t,n,c){var u=!!c&&!!c.unsafe,s=!!c&&!!c.enumerable,d=!!c&&!!c.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),l(n).source=f.join("string"==typeof t?t:"")),e!==r?(u?!d&&e[t]&&(s=!0):delete e[t],s?e[t]=n:o(e,t,n)):s?e[t]=n:a(t,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&s(this).source||c.call(this)})},function(e,t,n){var r=n(201);n(11)({target:"Object",stat:!0,forced:Object.assign!==r},{assign:r})},function(e,t,n){var r=n(6),o=n(67),i=r["__core-js_shared__"]||o("__core-js_shared__",{});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.0.1",mode:n(91)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(21),o=n(111),i=n(59),a=n(30),c=n(65),u=n(29),s=n(109),l=Object.getOwnPropertyDescriptor;t.f=r?l:function(e,t){if(e=a(e),t=c(t,!0),s)try{return l(e,t)}catch(e){}if(u(e,t))return i(!o.f.call(e,t),e[t])}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(3),o=n(75),i=r["__core-js_shared__"]||o("__core-js_shared__",{});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.0.1",mode:n(41)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){var r=n(8),o=n(4)("species");e.exports=function(e){return!r(function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},function(e,t,n){var r=n(8),o=n(22),i="".split;e.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==o(e)?i.call(e,""):Object(e)}:Object},function(e,t){e.exports={}},function(e,t,n){var r=n(22),o=n(84);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";var r=n(14),o=n(32),i=n(8),a=n(4),c=n(84),u=a("species"),s=!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}),l=!i(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]});e.exports=function(e,t,n,f){var d=a(e),p=!i(function(){var t={};return t[d]=function(){return 7},7!=""[e](t)}),h=p&&!i(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===e&&(n.constructor={},n.constructor[u]=function(){return n}),n[d](""),!t});if(!p||!h||"replace"===e&&!s||"split"===e&&!l){var v=/./[d],m=n(d,""[e],function(e,t,n,r,o){return t.exec===c?p&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),g=m[0],y=m[1];o(String.prototype,e,g),o(RegExp.prototype,d,2==t?function(e,t){return y.call(e,this,t)}:function(e){return y.call(e,this)}),f&&r(RegExp.prototype[d],"sham",!0)}}},function(e,t,n){var r=n(19).f,o=n(17),i=n(4)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r; +/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;th;h++)if((l?g(r(m=e[h])[0],m[1]):g(e[h]))===s)return s;return}d=p.call(e)}for(;!(m=d.next()).done;)if(u(d,g,m.value,l)===s)return s}).BREAK=s},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(46);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(37),o=n(51),i=n(26),a=n(18),c=n(127);e.exports=function(e,t){var n=1==e,u=2==e,s=3==e,l=4==e,f=6==e,d=5==e||f,p=t||c;return function(t,c,h){for(var v,m,g=i(t),y=o(g),b=r(c,h,3),w=a(y.length),x=0,O=n?p(t,w):u?p(t,0):void 0;w>x;x++)if((d||x in y)&&(m=b(v=y[x],x,g),e))if(n)O[x]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return x;case 2:O.push(v)}else if(l)return!1;return f?-1:s||l?l:O}}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(12),o=n(20),i="".split;e.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==o(e)?i.call(e,""):Object(e)}:Object},function(e,t,n){var r=n(16);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(16),o=n(6).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(6),o=n(28);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t,n){var r=n(12),o=n(7)("species");e.exports=function(e){return!r(function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},function(e,t){e.exports={}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,n){var r=n(22);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(73),o=n(19),i=n(48);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(10);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(10),o=n(3).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(3),o=n(14);e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(23),o=n(128),i=n(48),a=n(31),c=n(73),u=n(17),s=n(126),l=Object.getOwnPropertyDescriptor;t.f=r?l:function(e,t){if(e=a(e),t=c(t,!0),s)try{return l(e,t)}catch(e){}if(u(e,t))return i(!o.f.call(e,t),e[t])}},function(e,t,n){var r=n(49)("keys"),o=n(76);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,n){var r=n(8),o=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n==s||n!=u&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",s=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(130),o=n(79);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r=n(136);e.exports=function(e,t,n){return t+(n?r(e,t,!0).length:1)}},function(e,t,n){"use strict";var r,o,i=n(207),a=RegExp.prototype.exec,c=String.prototype.replace,u=a,s=(r=/a/,o=/b*/g,a.call(r,"a"),a.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),l=void 0!==/()??/.exec("")[1];(s||l)&&(u=function(e){var t,n,r,o,u=this;return l&&(n=new RegExp("^"+u.source+"$(?!\\s)",i.call(u))),s&&(t=u.lastIndex),r=a.call(u,e),s&&r&&(u.lastIndex=u.global?r.index+r[0].length:t),l&&r&&r.length>1&&c.call(r[0],n,function(){for(o=1;odocument.F=Object<\/script>"),e.close(),l=e.F;n--;)delete l.prototype[i[n]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[u]=e):n=l(),void 0===t?n:o(n,t)},n(52)[u]=!0},function(e,t,n){"use strict";var r=n(11),o=n(237),i=n(149),a=n(150),c=n(55),u=n(14),s=n(32),l=n(41),f=n(4)("iterator"),d=n(39),p=n(148),h=p.IteratorPrototype,v=p.BUGGY_SAFARI_ITERATORS,m=function(){return this};e.exports=function(e,t,n,p,g,y,b){o(n,t,p);var w,x,O,k=function(e){if(e===g&&E)return E;if(!v&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},j=t+" Iterator",S=!1,A=e.prototype,C=A[f]||A["@@iterator"]||g&&A[g],E=!v&&C||k(g),I="Array"==t&&A.entries||C;if(I&&(w=i(I.call(new e)),h!==Object.prototype&&w.next&&(l||i(w)===h||(a?a(w,h):"function"!=typeof w[f]&&u(w,f,m)),c(w,j,!0,!0),l&&(d[j]=m))),"values"==g&&C&&"values"!==C.name&&(S=!0,E=function(){return C.call(this)}),l&&!b||A[f]===E||u(A,f,E),d[t]=E,g)if(x={values:k("values"),keys:y?E:k("keys"),entries:k("entries")},b)for(O in x)!v&&!S&&O in A||s(A,O,x[O]);else r({target:t,proto:!0,forced:v||S},x);return x}},function(e,t,n){e.exports=n.p+"assets/images/test.svg";var r=""+e.exports;e.exports={src:r,width:50,height:50,type:"svg",bytes:812,toString:function(){return r}}},function(e,t){e.exports=!1},function(e,t,n){var r=n(34);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(30),o=n(45).f,i=n(21),a=n(12)(function(){o(1)}),c=!i||a;n(15)({target:"Object",stat:!0,forced:c,sham:!i},{getOwnPropertyDescriptor:function(e,t){return o(r(e),t)}})},function(e,t,n){var r=n(176).f,o=n(12)(function(){Object.getOwnPropertyNames(1)});n(15)({target:"Object",stat:!0,forced:o},{getOwnPropertyNames:r})},function(e,t){e.exports={}},function(e,t,n){var r=n(210),o=Object.prototype;r!==o.toString&&n(32)(o,"toString",r,{unsafe:!0})},function(e,t,n){"use strict";var r=n(131)(!1),o=[].indexOf,i=!!o&&1/[1].indexOf(1,-0)<0,a=n(87)("indexOf");n(11)({target:"Array",proto:!0,forced:i||a},{indexOf:function(e){return i?o.apply(this,arguments)||0:r(this,e,arguments[1])}})},function(e,t,n){var r,o,i,a=n(172),c=n(16),u=n(28),s=n(29),l=n(99),f=n(69),d=n(6).WeakMap;if(a){var p=new d,h=p.get,v=p.has,m=p.set;r=function(e,t){return m.call(p,e,t),t},o=function(e){return h.call(p,e)||{}},i=function(e){return v.call(p,e)}}else{var g=l("state");f[g]=!0,r=function(e,t){return u(e,g,t),t},o=function(e){return s(e,g)?e[g]:{}},i=function(e){return s(e,g)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},function(e,t,n){var r=n(44)("keys"),o=n(110);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(175);n(15)({target:"Object",stat:!0,forced:Object.assign!==r},{assign:r})},function(e,t,n){"use strict";var r=n(61)(2),o=n(50)("filter");n(11)({target:"Array",proto:!0,forced:!o},{filter:function(e){return r(this,e,arguments[1])}})},function(e,t,n){var r=n(26),o=n(81),i=n(8)(function(){o(1)});n(11)({target:"Object",stat:!0,forced:i},{keys:function(e){return o(r(e))}})},function(e,t,n){var r=n(32);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){var r=n(147),o=n(232),i=n(14),a=n(3);for(var c in r){var u=a[c],s=u&&u.prototype;if(s&&s.forEach!==o)try{i(s,"forEach",o)}catch(e){s.forEach=o}}},function(e,t,n){"use strict";var r=n(31),o=n(235),i=n(39),a=n(36),c=n(89),u=a.set,s=a.getterFor("Array Iterator");e.exports=c(Array,"Array",function(e,t){u(this,{type:"Array Iterator",target:r(e),index:0,kind:t})},function(){var e=s(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}},"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,n){var r=n(76)("meta"),o=n(240),i=n(10),a=n(17),c=n(19).f,u=0,s=Object.isExtensible||function(){return!0},l=function(e){c(e,r,{value:{objectID:"O"+ ++u,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,r)){if(!s(e))return"F";if(!t)return"E";l(e)}return e[r].objectID},getWeakData:function(e,t){if(!a(e,r)){if(!s(e))return!0;if(!t)return!1;l(e)}return e[r].weakData},onFreeze:function(e){return o&&f.REQUIRED&&s(e)&&!a(e,r)&&l(e),e}};n(52)[r]=!0},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(63),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t,n){e.exports=!n(21)&&!n(12)(function(){return 7!=Object.defineProperty(n(66)("div"),"a",{get:function(){return 7}}).a})},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:r},function(e,t,n){e.exports=n(44)("native-function-to-string",Function.toString)},function(e,t,n){var r=n(114),o=n(70).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(29),o=n(30),i=n(115)(!1),a=n(69);e.exports=function(e,t){var n,c=o(e),u=0,s=[];for(n in c)!r(a,n)&&r(c,n)&&s.push(n);for(;t.length>u;)r(c,n=t[u++])&&(~i(s,n)||s.push(n));return s}},function(e,t,n){var r=n(30),o=n(35),i=n(108);e.exports=function(e){return function(t,n,a){var c,u=r(t),s=o(u.length),l=i(a,s);if(e&&n!=n){for(;s>l;)if((c=u[l++])!=c)return!0}else for(;s>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(12),o=/#|\.prototype\./,i=function(e,t){var n=c[a(e)];return n==s||n!=u&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",s=i.POLYFILL="P";e.exports=i},function(e,t,n){var r=n(114),o=n(70);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(20),o=n(7)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,n){var r,o,i,a=n(6),c=n(20),u=n(60),s=n(121),l=n(66),f=a.setImmediate,d=a.clearImmediate,p=a.process,h=a.MessageChannel,v=a.Dispatch,m=0,g={},y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};f&&d||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++m]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(m),m},d=function(e){delete g[e]},"process"==c(p)?r=function(e){p.nextTick(u(y,e,1))}:v&&v.now?r=function(e){v.now(u(y,e,1))}:h?(i=(o=new h).port2,o.port1.onmessage=b,r=u(i.postMessage,i,1)):a.addEventListener&&"function"==typeof postMessage&&!a.importScripts?(r=function(e){a.postMessage(e+"","*")},a.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){s.appendChild(l("script")).onreadystatechange=function(){s.removeChild(this),y.call(e)}}:function(e){setTimeout(u(y,e,1),0)}),e.exports={set:f,clear:d}},function(e,t,n){var r=n(6).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(6).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){"use strict";var r=n(46),o=function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";var r,o,i=n(193),a=RegExp.prototype.exec,c=String.prototype.replace,u=a,s=(r=/a/,o=/b*/g,a.call(r,"a"),a.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),l=void 0!==/()??/.exec("")[1];(s||l)&&(u=function(e){var t,n,r,o,u=this;return l&&(n=new RegExp("^"+u.source+"$(?!\\s)",i.call(u))),s&&(t=u.lastIndex),r=a.call(u,e),s&&r&&(u.lastIndex=u.global?r.index+r[0].length:t),l&&r&&r.length>1&&c.call(r[0],n,function(){for(o=1;ou;)r(c,n=t[u++])&&(~i(s,n)||s.push(n));return s}},function(e,t,n){var r=n(31),o=n(18),i=n(132);e.exports=function(e){return function(t,n,a){var c,u=r(t),s=o(u.length),l=i(a,s);if(e&&n!=n){for(;s>l;)if((c=u[l++])!=c)return!0}else for(;s>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(47),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){"use strict";var r=n(206),o=n(9),i=n(27),a=n(135),c=n(83),u=n(18),s=n(53),l=n(84),f=n(8),d=[].push,p=Math.min,h=!f(function(){return!RegExp(4294967295,"y")});n(54)("split",2,function(e,t,n){var f;return f="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var o=String(i(this)),a=void 0===n?4294967295:n>>>0;if(0===a)return[];if(void 0===e)return[o];if(!r(e))return t.call(o,e,a);for(var c,u,s,f=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),h=0,v=new RegExp(e.source,p+"g");(c=l.call(v,o))&&!((u=v.lastIndex)>h&&(f.push(o.slice(h,c.index)),c.length>1&&c.index=a));)v.lastIndex===c.index&&v.lastIndex++;return h===o.length?!s&&v.test("")||f.push(""):f.push(o.slice(h)),f.length>a?f.slice(0,a):f}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var r=i(this),o=null==t?void 0:t[e];return void 0!==o?o.call(t,r,n):f.call(String(r),t,n)},function(e,r){var i=n(f,e,this,r,f!==t);if(i.done)return i.value;var l=o(e),d=String(this),v=a(l,RegExp),m=l.unicode,g=(l.ignoreCase?"i":"")+(l.multiline?"m":"")+(l.unicode?"u":"")+(h?"y":"g"),y=new v(h?l:"^(?:"+l.source+")",g),b=void 0===r?4294967295:r>>>0;if(0===b)return[];if(0===d.length)return null===s(y,d)?[d]:[];for(var w=0,x=0,O=[];x=s?n?"":void 0:(i=c.charCodeAt(u))<55296||i>56319||u+1===s||(a=c.charCodeAt(u+1))<56320||a>57343?n?c.charAt(u):i:n?c.slice(u,u+2):a-56320+(i-55296<<10)+65536}},function(e,t,n){var r=n(22),o=n(4)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,n){var r=n(39),o=n(4)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(137),o=n(4)("iterator"),i=n(39);e.exports=function(e){if(null!=e)return e[o]||e["@@iterator"]||i[r(e)]}},function(e,t,n){var r=n(9);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r,o,i,a=n(3),c=n(22),u=n(37),s=n(142),l=n(74),f=a.setImmediate,d=a.clearImmediate,p=a.process,h=a.MessageChannel,v=a.Dispatch,m=0,g={},y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};f&&d||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++m]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(m),m},d=function(e){delete g[e]},"process"==c(p)?r=function(e){p.nextTick(u(y,e,1))}:v&&v.now?r=function(e){v.now(u(y,e,1))}:h?(i=(o=new h).port2,o.port1.onmessage=b,r=u(i.postMessage,i,1)):a.addEventListener&&"function"==typeof postMessage&&!a.importScripts?(r=function(e){a.postMessage(e+"","*")},a.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){s.appendChild(l("script")).onreadystatechange=function(){s.removeChild(this),y.call(e)}}:function(e){setTimeout(u(y,e,1),0)}),e.exports={set:f,clear:d}},function(e,t,n){var r=n(3).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(3).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){"use strict";var r=n(40),o=function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},function(e,t,n){"use strict";var r=n(216),o=n(19),i=n(23),a=n(4)("species");e.exports=function(e){var t=r(e),n=o.f;i&&t&&!t[a]&&n(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(60),o=n(64),i=n(92),a=n(35),c=n(222);e.exports=function(e,t){var n=1==e,u=2==e,s=3==e,l=4==e,f=6==e,d=5==e||f,p=t||c;return function(t,c,h){for(var v,m,g=i(t),y=o(g),b=r(c,h,3),w=a(y.length),x=0,O=n?p(t,w):u?p(t,0):void 0;w>x;x++)if((d||x in y)&&(m=b(v=y[x],x,g),e))if(n)O[x]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return x;case 2:O.push(v)}else if(l)return!1;return f?-1:s||l?l:O}}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,n){"use strict";var r,o,i,a=n(149),c=n(14),u=n(17),s=n(41),l=n(4)("iterator"),f=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):f=!0),null==r&&(r={}),s||u(r,l)||c(r,l,function(){return this}),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:f}},function(e,t,n){var r=n(17),o=n(26),i=n(78)("IE_PROTO"),a=n(238),c=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?c:null}},function(e,t,n){var r=n(239);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,o){return r(n,o),t?e.call(n,o):n.__proto__=o,n}}():void 0)},function(e,t,n){e.exports=n.p+"assets/images/test.jpg";var r=""+e.exports;e.exports={src:r,width:200,height:600,type:"jpg",bytes:11208,toString:function(){return r}}},function(e,t,n){var r=!n(86)(function(e){Array.from(e)});n(11)({target:"Array",stat:!0,forced:r},{from:n(234)})},function(e,t,n){"use strict";var r=n(136),o=n(36),i=n(89),a=o.set,c=o.getterFor("String Iterator");i(String,"String",function(e){a(this,{type:"String Iterator",string:String(e),index:0})},function(){var e,t=c(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=r(n,o,!0),t.index+=e.length,{value:e,done:!1})})},,function(e,t,n){var r=n(25).f,o=n(29),i=n(7)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(61)(1),o=n(50)("map");n(11)({target:"Array",proto:!0,forced:!o},{map:function(e){return r(this,e,arguments[1])}})},function(e,t,n){"use strict";var r=n(146)(1),o=n(68)("map");n(15)({target:"Array",proto:!0,forced:!o},{map:function(e){return r(this,e,arguments[1])}})},function(e,t,n){var r=n(147),o=n(105),i=n(3),a=n(14),c=n(4),u=c("iterator"),s=c("toStringTag"),l=o.values;for(var f in r){var d=i[f],p=d&&d.prototype;if(p){if(p[u]!==l)try{a(p,u,l)}catch(e){p[u]=l}if(p[s]||a(p,s,f),r[f])for(var h in o)if(p[h]!==o[h])try{a(p,h,o[h])}catch(e){p[h]=o[h]}}}},function(e,t,n){"use strict";var r=n(65),o=n(25),i=n(59);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},function(e,t,n){var r=n(95),o=n(7)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(119),o=n(7)("iterator"),i=n(95);e.exports=function(e){if(null!=e)return e[o]||e["@@iterator"]||i[r(e)]}},function(e,t,n){var r=n(13);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(7)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},function(e,t,n){var r=n(63),o=n(34);e.exports=function(e,t,n){var i,a,c=String(o(e)),u=r(t),s=c.length;return u<0||u>=s?n?"":void 0:(i=c.charCodeAt(u))<55296||i>56319||u+1===s||(a=c.charCodeAt(u+1))<56320||a>57343?n?c.charAt(u):i:n?c.slice(u,u+2):a-56320+(i-55296<<10)+65536}},function(e,t,n){e.exports=n(202)},function(e,t,n){"use strict";var r=n(10),o=n(71),i=n(132),a=n(18),c=n(31),u=n(72),s=n(4)("species"),l=[].slice,f=Math.max,d=n(50)("slice");n(11)({target:"Array",proto:!0,forced:!d},{slice:function(e,t){var n,d,p,h=c(this),v=a(h.length),m=i(e,v),g=i(void 0===t?v:t,v);if(o(h)&&("function"!=typeof(n=h.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[s])&&(n=void 0):n=void 0,n===Array||void 0===n))return l.call(h,m,g);for(d=new(void 0===n?Array:n)(f(g-m,0)),p=0;mdocument.F=Object<\/script>"),e.close(),l=e.F;n--;)delete l.prototype[i[n]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[u]=e):n=l(),void 0===t?n:o(n,t)},n(69)[u]=!0},function(e,t,n){"use strict";e.exports=n(169)("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},n(242),!0)},function(e,t,n){"use strict";var r=n(3),o=n(80),i=n(11),a=n(32),c=n(106),u=n(58),s=n(62),l=n(10),f=n(8),d=n(86),p=n(55),h=n(241);e.exports=function(e,t,n,v,m){var g=r[e],y=g&&g.prototype,b=g,w=v?"set":"add",x={},O=function(e){var t=y[e];a(y,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(m&&!l(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return m&&!l(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(m&&!l(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(o(e,"function"!=typeof g||!(m||y.forEach&&!f(function(){(new g).entries().next()}))))b=n.getConstructor(t,e,v,w),c.REQUIRED=!0;else if(o(e,!0)){var k=new b,j=k[w](m?{}:-0,1)!=k,S=f(function(){k.has(1)}),A=d(function(e){new g(e)}),C=!m&&f(function(){for(var e=new g,t=5;t--;)e[w](t,t);return!e.has(-0)});A||((b=t(function(t,n){s(t,b,e);var r=h(new g,t,b);return null!=n&&u(n,r[w],r,v),r})).prototype=y,y.constructor=b),(S||C)&&(O("delete"),O("has"),v&&O("get")),(C||j)&&O(w),m&&y.clear&&delete y.clear}return x[e]=b,i({global:!0,forced:b!=g},x),p(b,e),m||n.setStrong(b,e,v),b}},function(e,t,n){"use strict";var r=n(16),o=n(107),i=n(108),a=n(35),c=n(30),u=n(159),s=n(7)("species"),l=[].slice,f=Math.max,d=n(68)("slice");n(15)({target:"Array",proto:!0,forced:!d},{slice:function(e,t){var n,d,p,h=c(this),v=a(h.length),m=i(e,v),g=i(void 0===t?v:t,v);if(o(h)&&("function"!=typeof(n=h.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[s])&&(n=void 0):n=void 0,n===Array||void 0===n))return l.call(h,m,g);for(d=new(void 0===n?Array:n)(f(g-m,0)),p=0;ms;)for(var d,p=c(arguments[s++]),h=l?r(p).concat(l(p)):r(p),v=h.length,m=0;v>m;)f.call(p,d=h[m++])&&(n[d]=p[d]);return n}:u},function(e,t,n){var r=n(30),o=n(113).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(r(e))}},function(e,t,n){var r=n(178),o=Object.prototype;r!==o.toString&&n(42)(o,"toString",r,{unsafe:!0})},function(e,t,n){"use strict";var r=n(119),o={};o[n(7)("toStringTag")]="z",e.exports="[object z]"!==String(o)?function(){return"[object "+r(this)+"]"}:o.toString},function(e,t,n){"use strict";var r,o,i,a="Promise",c=n(91),u=n(6),s=n(15),l=n(16),f=n(46),d=n(180),p=n(20),h=n(181),v=n(163),m=n(182),g=n(120).set,y=n(183),b=n(184),w=n(185),x=n(123),O=n(186),k=n(122),j=n(7)("species"),S=n(98),A=n(117),C=S.get,E=S.set,I=S.getterFor(a),T=u.Promise,P=u.TypeError,M=u.document,R=u.process,L=u.fetch,N=R&&R.versions,_=N&&N.v8||"",B=x.f,z=B,D="process"==p(R),F=!!(M&&M.createEvent&&u.dispatchEvent),K=A(a,function(){var e=T.resolve(1),t=function(){},n=(e.constructor={})[j]=function(e){e(t,t)};return!((D||"function"==typeof PromiseRejectionEvent)&&(!c||e.finally)&&e.then(t)instanceof n&&0!==_.indexOf("6.6")&&-1===k.indexOf("Chrome/66"))}),G=K||!v(function(e){T.all(e).catch(function(){})}),U=function(e){var t;return!(!l(e)||"function"!=typeof(t=e.then))&&t},H=function(e,t,n){if(!t.notified){t.notified=!0;var r=t.reactions;y(function(){for(var o=t.value,i=1==t.state,a=0,c=function(n){var r,a,c,u=i?n.ok:n.fail,s=n.resolve,l=n.reject,f=n.domain;try{u?(i||(2===t.rejection&&q(e,t),t.rejection=1),!0===u?r=o:(f&&f.enter(),r=u(o),f&&(f.exit(),c=!0)),r===n.promise?l(P("Promise-chain cycle")):(a=U(r))?a.call(r,s,l):s(r)):l(o)}catch(e){f&&!c&&f.exit(),l(e)}};r.length>a;)c(r[a++]);t.reactions=[],t.notified=!1,n&&!t.rejection&&W(e,t)})}},$=function(e,t,n){var r,o;F?((r=M.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),u.dispatchEvent(r)):r={promise:t,reason:n},(o=u["on"+e])?o(r):"unhandledrejection"===e&&w("Unhandled promise rejection",n)},W=function(e,t){g.call(u,function(){var n,r=t.value;if(V(t)&&(n=O(function(){D?R.emit("unhandledRejection",r,e):$("unhandledrejection",e,r)}),t.rejection=D||V(t)?2:1,n.error))throw n.value})},V=function(e){return 1!==e.rejection&&!e.parent},q=function(e,t){g.call(u,function(){D?R.emit("rejectionHandled",e):$("rejectionhandled",e,t.value)})},Y=function(e,t,n,r){return function(o){e(t,n,o,r)}},J=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,H(e,t,!0))},Z=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw P("Promise can't be resolved itself");var o=U(n);o?y(function(){var r={done:!1};try{o.call(n,Y(Z,e,r,t),Y(J,e,r,t))}catch(n){J(e,r,n,t)}}):(t.value=n,t.state=1,H(e,t,!1))}catch(n){J(e,{done:!1},n,t)}}};K&&(T=function(e){d(this,T,a),f(e),r.call(this);var t=C(this);try{e(Y(Z,this,t),Y(J,this,t))}catch(e){J(this,t,e)}},(r=function(e){E(this,{type:a,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=n(187)(T.prototype,{then:function(e,t){var n=I(this),r=B(m(this,T));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=D?R.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&H(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r,t=C(e);this.promise=e,this.resolve=Y(Z,e,t),this.reject=Y(J,e,t)},x.f=B=function(e){return e===T||e===i?new o(e):z(e)},c||"function"!=typeof L||s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return b(T,L.apply(u,arguments))}})),s({global:!0,wrap:!0,forced:K},{Promise:T}),n(155)(T,a,!1,!0),n(188)(a),i=n(124).Promise,s({target:a,stat:!0,forced:K},{reject:function(e){var t=B(this);return t.reject.call(void 0,e),t.promise}}),s({target:a,stat:!0,forced:c||K},{resolve:function(e){return b(c&&this===i?T:this,e)}}),s({target:a,stat:!0,forced:G},{all:function(e){var t=this,n=B(t),r=n.resolve,o=n.reject,i=O(function(){var n=[],i=0,a=1;h(e,function(e){var c=i++,u=!1;n.push(void 0),a++,t.resolve(e).then(function(e){u||(u=!0,n[c]=e,--a||r(n))},o)}),--a||r(n)});return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=B(t),r=n.reject,o=O(function(){h(e,function(e){t.resolve(e).then(n.resolve,r)})});return o.error&&r(o.value),n.promise}})},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},function(e,t,n){var r=n(13),o=n(160),i=n(35),a=n(60),c=n(161),u=n(162),s={};(e.exports=function(e,t,n,l,f){var d,p,h,v,m,g=a(t,n,l?2:1);if(f)d=e;else{if("function"!=typeof(p=c(e)))throw TypeError("Target is not iterable");if(o(p)){for(h=0,v=i(e.length);v>h;h++)if((l?g(r(m=e[h])[0],m[1]):g(e[h]))===s)return s;return}d=p.call(e)}for(;!(m=d.next()).done;)if(u(d,g,m.value,l)===s)return s}).BREAK=s},function(e,t,n){var r=n(13),o=n(46),i=n(7)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||null==(n=r(a)[i])?t:o(n)}},function(e,t,n){var r,o,i,a,c,u,s,l=n(6),f=n(45).f,d=n(20),p=n(120).set,h=n(122),v=l.MutationObserver||l.WebKitMutationObserver,m=l.process,g=l.Promise,y="process"==d(m),b=f(l,"queueMicrotask"),w=b&&b.value;w||(r=function(){var e,t;for(y&&(e=m.domain)&&e.exit();o;){t=o.fn,o=o.next;try{t()}catch(e){throw o?a():i=void 0,e}}i=void 0,e&&e.enter()},y?a=function(){m.nextTick(r)}:v&&!/(iPhone|iPod|iPad).*AppleWebKit/i.test(h)?(c=!0,u=document.createTextNode(""),new v(r).observe(u,{characterData:!0}),a=function(){u.data=c=!c}):g&&g.resolve?(s=g.resolve(void 0),a=function(){s.then(r)}):a=function(){p.call(l,r)}),e.exports=w||function(e){var t={fn:e,next:void 0};i&&(i.next=t),o||(o=t,a()),i=t}},function(e,t,n){var r=n(13),o=n(16),i=n(123);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){var r=n(6);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},function(e,t){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},function(e,t,n){var r=n(42);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},function(e,t,n){"use strict";var r=n(189),o=n(25),i=n(21),a=n(7)("species");e.exports=function(e){var t=r(e),n=o.f;i&&t&&!t[a]&&n(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(124),o=n(6),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},function(e,t,n){"use strict";var r=n(13),o=n(35),i=n(34),a=n(191),c=n(192);n(194)("match",1,function(e,t,n){return[function(t){var n=i(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var i=n(t,e,this);if(i.done)return i.value;var u=r(e),s=String(this);if(!u.global)return c(u,s);var l=u.unicode;u.lastIndex=0;for(var f,d=[],p=0;null!==(f=c(u,s));){var h=String(f[0]);d[p]=h,""===h&&(u.lastIndex=a(s,o(u.lastIndex),l)),p++}return 0===p?null:d}]})},function(e,t,n){"use strict";var r=n(164);e.exports=function(e,t,n){return t+(n?r(e,t,!0).length:1)}},function(e,t,n){var r=n(20),o=n(125);e.exports=function(e,t){var n=e.exec;if("function"==typeof n){var i=n.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){"use strict";var r=n(28),o=n(42),i=n(12),a=n(7),c=n(125),u=a("species"),s=!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}),l=!i(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]});e.exports=function(e,t,n,f){var d=a(e),p=!i(function(){var t={};return t[d]=function(){return 7},7!=""[e](t)}),h=p&&!i(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===e&&(n.constructor={},n.constructor[u]=function(){return n}),n[d](""),!t});if(!p||!h||"replace"===e&&!s||"split"===e&&!l){var v=/./[d],m=n(d,""[e],function(e,t,n,r,o){return t.exec===c?p&&!o?{done:!0,value:v.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),g=m[0],y=m[1];o(String.prototype,e,g),o(RegExp.prototype,d,2==t?function(e,t){return y.call(e,this,t)}:function(e){return y.call(e,this)}),f&&r(RegExp.prototype[d],"sham",!0)}}},function(e,t,n){},function(e,t,n){e.exports=!n(8)(function(){return!String(Symbol())})},function(e,t,n){var r=n(129),o=n(3).WeakMap;e.exports="function"==typeof o&&/native code/.test(r.call(o))},function(e,t,n){var r=n(17),o=n(199),i=n(77),a=n(19);e.exports=function(e,t){for(var n=o(t),c=a.f,u=i.f,s=0;ss;)for(var d,p=c(arguments[s++]),h=l?r(p).concat(l(p)):r(p),v=h.length,m=0;v>m;)f.call(p,d=h[m++])&&(n[d]=p[d]);return n}:u},function(e,t,n){n(43),e.exports=n(57).Object.assign},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(204),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(82))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,c,u=1,s={},l=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(h,0,e)}:(a="setImmediate$"+Math.random()+"$",c=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&h(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",c,!1):e.attachEvent("onmessage",c),r=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;na;)c(r[a++]);t.reactions=[],t.notified=!1,n&&!t.rejection&&W(e,t)})}},$=function(e,t,n){var r,o;F?((r=M.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),u.dispatchEvent(r)):r={promise:t,reason:n},(o=u["on"+e])?o(r):"unhandledrejection"===e&&w("Unhandled promise rejection",n)},W=function(e,t){g.call(u,function(){var n,r=t.value;if(V(t)&&(n=O(function(){D?R.emit("unhandledRejection",r,e):$("unhandledrejection",e,r)}),t.rejection=D||V(t)?2:1,n.error))throw n.value})},V=function(e){return 1!==e.rejection&&!e.parent},q=function(e,t){g.call(u,function(){D?R.emit("rejectionHandled",e):$("rejectionhandled",e,t.value)})},Y=function(e,t,n,r){return function(o){e(t,n,o,r)}},J=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,H(e,t,!0))},Z=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw P("Promise can't be resolved itself");var o=U(n);o?y(function(){var r={done:!1};try{o.call(n,Y(Z,e,r,t),Y(J,e,r,t))}catch(n){J(e,r,n,t)}}):(t.value=n,t.state=1,H(e,t,!1))}catch(n){J(e,{done:!1},n,t)}}};K&&(T=function(e){d(this,T,a),f(e),r.call(this);var t=C(this);try{e(Y(Z,this,t),Y(J,this,t))}catch(e){J(this,t,e)}},(r=function(e){E(this,{type:a,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=n(103)(T.prototype,{then:function(e,t){var n=I(this),r=B(m(this,T));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=D?R.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&H(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r,t=C(e);this.promise=e,this.resolve=Y(Z,e,t),this.reject=Y(J,e,t)},x.f=B=function(e){return e===T||e===i?new o(e):z(e)},c||"function"!=typeof L||s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return b(T,L.apply(u,arguments))}})),s({global:!0,wrap:!0,forced:K},{Promise:T}),n(55)(T,a,!1,!0),n(145)(a),i=n(57).Promise,s({target:a,stat:!0,forced:K},{reject:function(e){var t=B(this);return t.reject.call(void 0,e),t.promise}}),s({target:a,stat:!0,forced:c||K},{resolve:function(e){return b(c&&this===i?T:this,e)}}),s({target:a,stat:!0,forced:G},{all:function(e){var t=this,n=B(t),r=n.resolve,o=n.reject,i=O(function(){var n=[],i=0,a=1;h(e,function(e){var c=i++,u=!1;n.push(void 0),a++,t.resolve(e).then(function(e){u||(u=!0,n[c]=e,--a||r(n))},o)}),--a||r(n)});return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=B(t),r=n.reject,o=O(function(){h(e,function(e){t.resolve(e).then(n.resolve,r)})});return o.error&&r(o.value),n.promise}})},function(e,t,n){var r,o,i,a,c,u,s,l=n(3),f=n(77).f,d=n(22),p=n(141).set,h=n(143),v=l.MutationObserver||l.WebKitMutationObserver,m=l.process,g=l.Promise,y="process"==d(m),b=f(l,"queueMicrotask"),w=b&&b.value;w||(r=function(){var e,t;for(y&&(e=m.domain)&&e.exit();o;){t=o.fn,o=o.next;try{t()}catch(e){throw o?a():i=void 0,e}}i=void 0,e&&e.enter()},y?a=function(){m.nextTick(r)}:v&&!/(iPhone|iPod|iPad).*AppleWebKit/i.test(h)?(c=!0,u=document.createTextNode(""),new v(r).observe(u,{characterData:!0}),a=function(){u.data=c=!c}):g&&g.resolve?(s=g.resolve(void 0),a=function(){s.then(r)}):a=function(){p.call(l,r)}),e.exports=w||function(e){var t={fn:e,next:void 0};i&&(i.next=t),o||(o=t,a()),i=t}},function(e,t,n){var r=n(9),o=n(10),i=n(144);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){var r=n(3);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},function(e,t){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},function(e,t,n){var r=n(57),o=n(3),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=n(31),o=[].join,i=n(51)!=Object,a=n(87)("join",",");n(11)({target:"Array",proto:!0,forced:i||a},{join:function(e){return o.call(r(this),void 0===e?",":e)}})},function(e,t,n){var r=n(23),o=n(19).f,i=Function.prototype,a=i.toString,c=/^\s*function ([^ (]*)/;!r||"name"in i||o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(c)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(146)(2),o=n(68)("filter");n(15)({target:"Array",proto:!0,forced:!o},{filter:function(e){return r(this,e,arguments[1])}})},function(e,t,n){var r=n(16),o=n(107),i=n(7)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},function(e,t,n){"use strict";var r=n(115)(!0);n(15)({target:"Array",proto:!0},{includes:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),n(224)("includes")},function(e,t,n){var r=n(7)("unscopables"),o=n(167),i=n(28),a=Array.prototype;null==a[r]&&i(a,r,o(null)),e.exports=function(e){a[r][e]=!0}},function(e,t,n){var r=n(21),o=n(25),i=n(13),a=n(118);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),c=r.length,u=0;c>u;)o.f(e,n=r[u++],t[n]);return e}},function(e,t,n){var r=n(21),o=n(25).f,i=Function.prototype,a=i.toString,c=/^\s*function ([^ (]*)/;!r||"name"in i||o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(c)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(228),o=n(230)("includes");n(15)({target:"String",proto:!0,forced:!o},{includes:function(e){return!!~r(this,e,"includes").indexOf(e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,n){var r=n(229),o=n(34);e.exports=function(e,t,n){if(r(t))throw TypeError("String.prototype."+n+" doesn't accept regex");return String(o(e))}},function(e,t,n){var r=n(16),o=n(20),i=n(7)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(7)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,n){},function(e,t,n){"use strict";var r=[].forEach,o=n(61)(0),i=n(87)("forEach");e.exports=i?function(e){return o(this,e,arguments[1])}:r},function(e,t,n){"use strict";var r=n(9),o=n(26),i=n(18),a=n(47),c=n(27),u=n(83),s=n(53),l=Math.max,f=Math.min,d=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(54)("replace",2,function(e,t,n){return[function(n,r){var o=c(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,o){var c=n(t,e,this,o);if(c.done)return c.value;var d=r(e),p=String(this),h="function"==typeof o;h||(o=String(o));var m=d.global;if(m){var g=d.unicode;d.lastIndex=0}for(var y=[];;){var b=s(d,p);if(null===b)break;if(y.push(b),!m)break;""===String(b[0])&&(d.lastIndex=u(p,i(d.lastIndex),g))}for(var w,x="",O=0,k=0;k=O&&(x+=p.slice(O,S)+T,O=S+j.length)}return x+p.slice(O)}];function v(e,n,r,i,a,c){var u=r+e.length,s=i.length,l=h;return void 0!==a&&(a=o(a),l=p),t.call(c,l,function(t,o){var c;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(u);case"<":c=a[o.slice(1,-1)];break;default:var l=+o;if(0===l)return t;if(l>s){var f=d(l/10);return 0===f?t:f<=s?void 0===i[f-1]?o.charAt(1):i[f-1]+o.charAt(1):t}c=i[l-1]}return void 0===c?"":c})}})},function(e,t,n){"use strict";var r=n(37),o=n(26),i=n(140),a=n(138),c=n(18),u=n(72),s=n(139);e.exports=function(e){var t,n,l,f,d=o(e),p="function"==typeof this?this:Array,h=arguments.length,v=h>1?arguments[1]:void 0,m=void 0!==v,g=0,y=s(d);if(m&&(v=r(v,h>2?arguments[2]:void 0,2)),null==y||p==Array&&a(y))for(n=new p(t=c(d.length));t>g;g++)u(n,g,m?v(d[g],g):d[g]);else for(f=y.call(d),n=new p;!(l=f.next()).done;g++)u(n,g,m?i(f,v,[l.value,g],!0):l.value);return n.length=g,n}},function(e,t,n){var r=n(4)("unscopables"),o=n(88),i=n(14),a=Array.prototype;null==a[r]&&i(a,r,o(null)),e.exports=function(e){a[r][e]=!0}},function(e,t,n){var r=n(23),o=n(19),i=n(9),a=n(81);e.exports=r?Object.defineProperties:function(e,t){i(e);for(var n,r=a(t),c=r.length,u=0;c>u;)o.f(e,n=r[u++],t[n]);return e}},function(e,t,n){"use strict";var r=n(148).IteratorPrototype,o=n(88),i=n(48),a=n(55),c=n(39),u=function(){return this};e.exports=function(e,t,n){var s=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,s,!1,!0),c[s]=u,e}},function(e,t,n){e.exports=!n(8)(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},function(e,t,n){var r=n(10),o=n(9);e.exports=function(e,t){if(o(e),!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}},function(e,t,n){e.exports=!n(8)(function(){return Object.isExtensible(Object.preventExtensions({}))})},function(e,t,n){var r=n(10),o=n(150);e.exports=function(e,t,n){var i,a=t.constructor;return a!==n&&"function"==typeof a&&(i=a.prototype)!==n.prototype&&r(i)&&o&&o(e,i),e}},function(e,t,n){"use strict";var r=n(19).f,o=n(88),i=n(103),a=n(37),c=n(62),u=n(58),s=n(89),l=n(145),f=n(23),d=n(106).fastKey,p=n(36),h=p.set,v=p.getterFor;e.exports={getConstructor:function(e,t,n,s){var l=e(function(e,r){c(e,l,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),f||(e.size=0),null!=r&&u(r,e[s],e,n)}),p=v(t),m=function(e,t,n){var r,o,i=p(e),a=g(e,t);return a?a.value=n:(i.last=a={index:o=d(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),f?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},g=function(e,t){var n,r=p(e),o=d(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(l.prototype,{clear:function(){for(var e=p(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,f?e.size=0:this.size=0},delete:function(e){var t=p(this),n=g(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),f?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=p(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!g(this,e)}}),i(l.prototype,n?{get:function(e){var t=g(this,e);return t&&t.value},set:function(e,t){return m(this,0===e?0:e,t)}}:{add:function(e){return m(this,e=0===e?0:e,e)}}),f&&r(l.prototype,"size",{get:function(){return p(this).size}}),l},setStrong:function(e,t,n){var r=t+" Iterator",o=v(t),i=v(r);s(e,t,function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})},function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})},n?"entries":"values",!n,!0),l(t)}}},function(e,t,n){"use strict";n.r(t);n(170),n(100),n(93),n(94),n(177),n(179),n(190),n(195);var r=n(0),o=n(1),i=n(2),a=function(e){var t=null;return function(n){function i(){return null!==n&&n.apply(this,arguments)||this}return r.b(i,n),i.prototype.onInit=function(){e().then(function(e){return t=e.default}).then(o.a.redraw).catch(console.error)},i.prototype.render=function(){var e=this.attrs,n=e.children,i=r.c(e,["children"]);return t&&Object(o.a)(t,i,n)},i}(i.a)},c=n(33);n(166),n(134);function u(e,t,n,r){return{isExact:e,path:t||"",url:n,params:r}}function s(e){for(var t=e.length;"/"===e[--t];);return e.slice(0,t+1)}function l(e){try{return decodeURIComponent(e)}catch(t){return e}}var f=function(e,t){var n=t.path,r=t.exact,o=void 0!==r&&r;if(n===e||!n)return u(n===e,n,e);var i=s(n).split("/"),a=s(e).split("/");if(!(i.length>a.length||o&&i.lengtha:ir&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(v,"$1"+e.trim());case 58:return e.trim()+t.replace(v,"$1"+e.trim());default:if(0<1*n&&0u.charCodeAt(8))break;case 115:a=a.replace(u,"-webkit-"+u)+";"+a;break;case 207:case 102:a=a.replace(u,"-webkit-"+(102c.charCodeAt(0)&&(c=c.trim()),c=[c],0p)&&(D=(G=G.replace(" ",":")).length),0=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),((r^=r>>>15)>>>0).toString(36)},ne={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},re=/[A-Z]|^ms/g,oe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ie=X(function(e){return e.replace(re,"-$&").toLowerCase()}),ae=function(e,t){if(null==t||"boolean"==typeof t)return"";switch(e){case"animation":case"animationName":"string"==typeof t&&(t=t.replace(oe,function(e,t,n){return ue={name:t,styles:n,next:ue},t}))}return 1!==ne[e]&&45!==e.charCodeAt(1)&&"number"==typeof t&&0!==t?t+"px":t};function ce(e,t,n,r){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return ue={name:n.name,styles:n.styles,next:ue},n.name;if(void 0!==n.styles){var o=n.next;if(void 0!==o)for(;void 0!==o;)ue={name:o.name,styles:o.styles,next:ue},o=o.next;return n.styles}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o-1||(n.removeListener(E.a.redraw),t.matchers.delete(r))})},t.prototype.render=function(){var e=this.attrs,t=e.children,n=r.c(e,["children"]),o=Object.keys(n),i=Array.from(this.matchers).reduce(function(e,t){var n=t[0];return t[1].matches?e?o.indexOf(n)>o.indexOf(e)?n:e:n:e},null);return i&&t&&t(this.attrs[i])},t}(i.a)),ye=n(151),be=n.n(ye),we=n(90),xe=n.n(we);n(221),n(223),n(157),n(226),n(227),n(231),n(43);!function(e){e.MouseUp="MouseUp",e.KeyArrowUp="KeyArrowUp",e.KeyArrowDown="KeyArrowDown",e.KeyEscape="KeyEscape",e.KeyHome="KeyHome",e.KeyEnd="KeyEnd",e.KeySpace="KeySpace",e.KeyEnter="KeyEnter",e.ItemMouseEnter="ItemMouseEnter",e.ItemClick="ItemClick",e.InputBlur="InputBlur",e.InputChange="InputChange",e.ButtonClick="ButtonClick",e.ButtonBlur="ButtonBlur"}(le||(le={}));var Oe=function(e,t,n){var o=e.highlightedIndex,i={selectedItem:null};switch(t.type){case le.ButtonClick:return e.isOpen?r.a({},e,i,{isOpen:!1}):r.a({},e,i,{highlightedIndex:null,isOpen:!0});case le.KeyEscape:case le.ButtonBlur:case le.InputBlur:case le.MouseUp:return r.a({},e,i,{isOpen:!1});case le.ItemClick:case le.KeyEnter:return r.a({},e,{isOpen:!1,inputValue:n.itemToString(t.item),selectedItem:t.item});case le.KeyArrowDown:case le.KeyArrowUp:var a=(null===o?-1:o)+t.amount;return a<0||a>=t.total?e:r.a({},e,{highlightedIndex:a});case le.ItemMouseEnter:return r.a({},e,{highlightedIndex:t.index});case le.InputChange:return r.a({},e,i,{highlightedIndex:null,isOpen:!0,inputValue:t.value})}},ke=function(){return function(e){var t=this;void 0===e&&(e=Oe),this.highlightedIndex=null,this.inputValue=null,this.isOpen=!1,this.selectedItem=null,this.dispatch=function(e,n){return Object.assign(t,t.reducer(t,e,n))},this.reducer=e}}();function je(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function Se(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function Ae(e,t){if(e.clientHeightt||i>e&&a=t&&c>=n?i-e-r:a>t&&cn?a-t+o:0}var Ee=function(e,t){var n=t.scrollMode,r=t.block,o=t.inline,i=t.boundary,a=t.skipOverflowHiddenElements,c="function"==typeof i?i:function(e){return e!==i};if(!je(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,s=[],l=e;je(l)&&c(l);){if((l=l.parentNode)===u){s.push(l);break}l===document.body&&Ae(l)&&!Ae(document.documentElement)||Ae(l,a)&&s.push(l)}for(var f=window.visualViewport?visualViewport.width:innerWidth,d=window.visualViewport?visualViewport.height:innerHeight,p=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),m=v.height,g=v.width,y=v.top,b=v.right,w=v.bottom,x=v.left,O="start"===r||"nearest"===r?y:"end"===r?w:y+m/2,k="center"===o?x+g/2:"end"===o?b:x,j=[],S=0;S=0&&x>=0&&w<=d&&b<=f&&y>=T&&w<=M&&x>=R&&b<=P)return j;var L=getComputedStyle(A),N=parseInt(L.borderLeftWidth,10),_=parseInt(L.borderTopWidth,10),B=parseInt(L.borderRightWidth,10),z=parseInt(L.borderBottomWidth,10),D=0,F=0,K="offsetWidth"in A?A.offsetWidth-A.clientWidth-N-B:0,G="offsetHeight"in A?A.offsetHeight-A.clientHeight-_-z:0;if(u===A)D="start"===r?O:"end"===r?O-d:"nearest"===r?Ce(h,h+d,d,_,z,h+O,h+O+m,m):O-d/2,F="start"===o?k:"center"===o?k-f/2:"end"===o?k-f:Ce(p,p+f,f,N,B,p+k,p+k+g,g),D=Math.max(0,D+h),F=Math.max(0,F+p);else{D="start"===r?O-T-_:"end"===r?O-M+z+G:"nearest"===r?Ce(T,M,E,_,z+G,O,O+m,m):O-(T+E/2)+G/2,F="start"===o?k-R-N:"center"===o?k-(R+I/2)+K/2:"end"===o?k-P+B+K:Ce(R,P,I,N,B+K,k,k+g,g);var U=A.scrollLeft,H=A.scrollTop;O+=H-(D=Math.max(0,Math.min(H+D,A.scrollHeight-E+G))),k+=U-(F=Math.max(0,Math.min(U+F,A.scrollWidth-I+K)))}j.push({el:A,top:D,left:F})}return j};function Ie(e){return e===Object(e)&&0!==Object.keys(e).length}var Te=function(e,t){var n=!e.ownerDocument.documentElement.contains(e);if(Ie(t)&&"function"==typeof t.behavior)return t.behavior(n?[]:Ee(e,t));if(!n){var r=function(e){return!1===e?{block:"end",inline:"nearest"}:Ie(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(e){var r=e.el,o=e.top,i=e.left;r.scroll&&n?r.scroll({top:o,left:i,behavior:t}):(r.scrollTop=o,r.scrollLeft=i)})}(Ee(e,r),r.behavior)}},Pe=function(){for(var e=[],t=0;t=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t},Re=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.defaultStore=new ke,n.items=[],n.id="autocomplete-"+t.instanceCount++,n.menuId=n.id+"-menu",n.labelId=n.id+"-label",n.inputId=n.id+"-input",n.buttonId=n.id+"-button",n.getItemId=function(e){return n.id+"-item-"+e},n.clearCallbacks=[],n.avoidScrolling=!1,n.interacting=!1,n.inputAttrs=function(e){void 0===e&&(e={});e.onkeydown,e.onblur;var t=e.oninput,o=r.c(e,["onkeydown","onblur","oninput"]),i=n.store,a=i.inputValue,c=i.isOpen,u=i.highlightedIndex,s={oninput:Pe(t,n.inputChange),onblur:Pe(t,n.inputBlur),onkeydown:Pe(t,n.keyDown)};return r.a({"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof u&&u>=0?n.getItemId(u):null,"aria-controls":c?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:a,id:n.inputId},s,o)},n.inputChange=function(e){var t=e.target;n.dispatch({type:le.InputChange,value:t.value})},n.inputBlur=function(e){var t=document&&!!document.activeElement&&!!document.activeElement.id&&document.activeElement.id==n.buttonId;n.interacting||t||n.dispatch({type:le.InputBlur})},n.itemAttrs=function(e){var t=e.item,o=e.onclick,i=e.onmousemove,a=(e.onmousedown,e.onkeydown),c=r.c(e,["item","onclick","onmousemove","onmousedown","onkeydown"]),u=n.store.highlightedIndex,s=n.items.length;n.items.push(t);var l={onclick:Pe(o,function(){return n.itemClick(s)}),onmousemove:Pe(i,function(){return n.itemMouseMove(s)}),onkeydown:Pe(a,n.keyDown)},f=u===s,d=f&&{onupdate:function(e){!n.avoidScrolling&&n.store.isOpen&&Te(e.dom,{behavior:"smooth",scrollMode:"if-needed"})}};return r.a({id:n.getItemId(s),role:"option","aria-selected":f},l,d,c)},n.labelAttrs=function(e){return void 0===e&&(e={}),r.a({for:n.inputId,id:n.labelId},e)},n.menuAttrs=function(e){return void 0===e&&(e={}),r.a({role:"listbox","aria-labelledby":n.labelId,id:n.menuId},e)},n.buttonAttrs=function(e){void 0===e&&(e={});var t=e.onclick,o=e.onkeydown,i=e.onblur,a=r.c(e,["onclick","onkeydown","onblur"]),c=n.store.isOpen,u={onclick:Pe(t,n.buttonClick),onkeydown:Pe(o,n.keyDown),onblur:Pe(i,n.buttonBlur)};return r.a({id:n.buttonId,type:"button",role:"button","aria-label":c?"close menu":"open menu","aria-haspopup":!0},u,a)},n.buttonClick=function(e){var t=e.target;e.preventDefault(),document.activeElement===document.body&&t.focus(),n.dispatch({type:le.ButtonClick},{async:!0})},n.buttonBlur=function(e){var t=e.target;n.schedule(function(){n.interacting||null!=document.activeElement&&document.activeElement.id===n.inputId||document.activeElement===t||n.dispatch({type:le.ButtonBlur})})},n.keyDown=function(e){switch(Me(e)){case"ArrowUp":return n.keyArrowup(e);case"ArrowDown":return n.keyArrowdown(e);case"Escape":return n.keyEscape(e);case"Enter":return n.keyEnter(e)}},n}return r.b(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this.attrs.store||this.defaultStore},enumerable:!0,configurable:!0}),t.prototype.onCreate=function(e){var t=this,n=function(){return t.interacting=!0},r=function(n){var r=n.target,o=t.store.isOpen;t.schedule(function(){var n,i;t.interacting=!1,!o||((n=e)===(i=r)||n.contains&&n.contains(i))||t.dispatch({type:le.MouseUp})})};e.addEventListener("mousedown",n),window.addEventListener("mouseup",r),e.addEventListener("touchstart",n,{passive:!0}),window.addEventListener("touchend",r),this.onRemove=function(){e.removeEventListener("mousedown",n),window.removeEventListener("mouseup",r),e.removeEventListener("touchstart",n),window.removeEventListener("touchend",r),t.clearCallbacks.forEach(function(e){return e()})}},t.prototype.schedule=function(e,t){var n=setTimeout(e,t);this.clearCallbacks.push(function(){return clearTimeout(n)})},t.prototype.dispatch=function(e,t){void 0===t&&(t={});var n=this.attrs,r=n.itemToString,i=void 0===r?function(e){return""+e}:r,a=n.onselect,c=t.async,u=this.store.selectedItem;this.store.dispatch(e,{items:this.items,itemToString:i});var s=this.store.selectedItem;u!=s&&a&&a(s),c?o.a.redraw():o.a.redraw.sync()},t.prototype.itemMouseMove=function(e){var t=this;e!==this.store.highlightedIndex&&(this.avoidScrolling=!0,this.dispatch({type:le.ItemMouseEnter,index:e}),this.schedule(function(){return t.avoidScrolling=!1},250))},t.prototype.itemClick=function(e){var t=this.items[e];this.dispatch({type:le.ItemClick,item:t})},t.prototype.keyArrowdown=function(e){e.preventDefault();var t=e.shiftKey?5:1;this.dispatch({type:le.KeyArrowDown,amount:t,total:this.items.length})},t.prototype.keyArrowup=function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.dispatch({type:le.KeyArrowUp,amount:t,total:this.items.length})},t.prototype.keyEnter=function(e){var t=this.store,n=t.isOpen,r=t.highlightedIndex;if(n&&null!==r){e.preventDefault();var o=this.items[r];this.dispatch({type:le.KeyEnter,item:o})}},t.prototype.keyEscape=function(e){e.preventDefault(),this.dispatch({type:le.KeyEscape})},t.prototype.render=function(){return this.items=[],this.children(r.a({},this.store,{inputAttrs:this.inputAttrs,menuAttrs:this.menuAttrs,buttonAttrs:this.buttonAttrs,labelAttrs:this.labelAttrs,itemAttrs:this.itemAttrs}))},t.instanceCount=0,t}(i.a),Le=[{name:"Afghanistan",code:"AF"},{name:"Åland Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D'Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:"Korea, Democratic People'S Republic of",code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:"Lao People'S Democratic Republic",code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia and Montenegro",code:"CS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}];function Ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r.5?"200":"300"),onload:function(e){return console.log(e)}}),Object(o.a)("h3","Server resize"),Object(o.a)(".images-landscape",{style:{width:"400px",height:"auto"}},Object(o.a)(H,{resize:function(e,t){return Object.assign({},e)}},Object(o.a)($,xe.a))),Object(o.a)("h3","No crop"),Object(o.a)(".images-landscape",{style:{width:"400px",height:"auto"}},Object(o.a)($,xe.a)),Object(o.a)(".images-portrait",Object(o.a)($,be.a)),Object(o.a)("h3","Cover"),Object(o.a)(".images-landscape",Object(o.a)($,{alt:"ok",fit:"cover",src:"https://picsum.photos/600/200"})),Object(o.a)(".images-portrait",Object(o.a)($,{fit:"cover",width:200,height:100,src:"https://picsum.photos/200/100"})),Object(o.a)(".images-portrait",Object(o.a)($,{fit:"cover",position:{x:.8,y:.8},src:"https://picsum.photos/800/400"})),Object(o.a)("h3","Contain"),Object(o.a)(".images-landscape",Object(o.a)($,{fit:"contain",src:"https://picsum.photos/600/200"})),Object(o.a)(".images-portrait",Object(o.a)($,{fit:"contain",src:"https://picsum.photos/600/200"})),Object(o.a)("h3","Fixed height"),Object(o.a)(".images-fixedheight",[Object(o.a)($,{fit:"portrait",src:"https://picsum.photos/600/200"}),Object(o.a)($,{fit:"portrait",src:"https://picsum.photos/300/300"}),Object(o.a)($,{fit:"portrait",src:"https://picsum.photos/100/200"})]))},Xe=pe("nav")(Ke()),Qe=pe(Xe)(Fe()),et=pe(Qe)(De()),tt=pe(k)(ze()),nt=a(function(){return Promise.all([n.e(1),n.e(3)]).then(n.bind(null,286))}),rt=function(e){function t(){return e.apply(this,arguments)||this}return Ue(t,e),t.prototype.render=function(){return Object(o.a)(Ve,Object(o.a)(ve,[Object(o.a)(he,{path:"/:language"},function(e){var t=e.match.params.language;return Object(o.a)("",[Object(o.a)(g,{matcher:function(e,n){return $e(e,Object.assign({},n,{path:n.path&&"/"+t+n.path}))},formatPath:function(e){return We("/"+t+e)}},[Object(o.a)("",Object(o.a)(Ye)),"Language: "+t,Object(o.a)(et,{as:"div"},[Object(o.a)(tt,{class:"home",to:"/",exact:!0},"Home"),Object(o.a)(tt,{to:"/slider"},"Slider"),Object(o.a)(tt,{to:"/autocomplete"},"Autocomplete"),Object(o.a)(tt,{to:"/modal"},"Modal"),Object(o.a)(tt,{to:"/images"},"Images"),Object(o.a)(tt,{to:"/maps"},"Maps"),Object(o.a)(tt,{to:"/back"},"Back home")]),Object(o.a)(ve,[Object(o.a)(he,{path:"/slider"},nt),Object(o.a)(he,{path:"/autocomplete"},Be),Object(o.a)(he,{path:"/images"},Ze),Object(o.a)(he,{path:"/back"},function(){return Object(o.a)("",["Back home",Object(o.a)(me,{to:"/"})])}),Object(o.a)(he,{path:"/modal"},Je),Object(o.a)(he,{path:"/maps"},He),Object(o.a)(he,function(){return[Object(o.a)(ge,{"(max-width: 800px)":{cols:3},"(min-width: 800px)":{cols:5},"(min-width: 1000px)":{cols:10}},function(e){var t=e.cols;return Object(o.a)("","cols: "+t)})]})])])])}),Object(o.a)(he,function(){return Object(o.a)("","Choose a language:",Object(o.a)(Ye))})]))},t}(i.a);o.a.mount(document.getElementById("root"),rt)}]); \ No newline at end of file diff --git a/examples/src/custom.d.ts b/examples/src/custom.d.ts deleted file mode 100755 index 5ddd866..0000000 --- a/examples/src/custom.d.ts +++ /dev/null @@ -1,5 +0,0 @@ - -declare module '*.png' -declare module '*.jpg' -declare module '*.gif' -declare module '*.svg' \ No newline at end of file diff --git a/examples/src/index.less b/examples/src/index.less deleted file mode 100755 index 5899edf..0000000 --- a/examples/src/index.less +++ /dev/null @@ -1,57 +0,0 @@ -@font-face { - font-family: 'Inter'; - font-weight: 300; - src: url("./assets/Inter-Light.woff") format("woff"); -} - -@font-face { - font-family: 'Inter'; - font-weight: 400; - src: url("./assets/Inter-Regular.woff") format("woff"); -} - -@font-face { - font-family: 'Inter'; - font-weight: 700; - src: url("./assets/Inter-Bold.woff") format("woff"); -} - -body { - font-family: 'Inter', sans-serif; -} - -a { - display: inline-block; - margin-right: 10px; -} - -.modalexample { - background: white; - border-radius: 10px; - margin: 50px; - padding: 200px; -} - -.images { - &-bg { - width: 200px !important; - height: 200px !important; - } - - &-portrait { - outline: 1px solid red; - width: 150px; - height: 250px; - } - - &-landscape { - outline: 1px solid red; - width: 200px; - height: 100px; - } - - &-fixedheight { - height: 200px; - display: flex; - } -} \ No newline at end of file diff --git a/examples/src/index.ts b/examples/src/index.ts deleted file mode 100755 index fa1b4f8..0000000 --- a/examples/src/index.ts +++ /dev/null @@ -1,219 +0,0 @@ -import './index.less' - -import { - Breakpoint, createContext, HistoryRouter, Image, ImageResizer, lazy, Link, m, Modal, - ModalOverlay, ModalStore, parseRoute, Portal, Redirect, Route, styled, Switch, View -} from '@codeurs/front' -import testImage from 'assets/test.jpg' -import svgImage from 'assets/test.svg' -import Autocomplete from 'views/autocomplete' - -const Map = lazy(() => import('./views/map')) - -const Theme = createContext('green') - -const hashMatcher = (location, route) => - parseRoute(location.hash.substr(1), route) - -const hashFormatter = path => path && `/#${path}` - -const HashRouter = ({children}) => - m(HistoryRouter, {matcher: hashMatcher, formatPath: hashFormatter}, children) - -const LanguageLink = ({lang, children}) => - m(Link, {to: `/${lang}`}, children) - -const LanguagesNav = () => - m(HashRouter, [ - m(LanguageLink, {lang: 'nl'}, 'Nederlands'), - m(LanguageLink, {lang: 'en'}, 'English'), - m(LanguageLink, {lang: 'fr'}, 'Français'), - ]) - -class ModalExample extends View { - modal = new ModalStore() - render() { - return [ - m('button', {onclick: this.modal.open}, 'Open modal'), - m(Portal, [ - m(Modal, this.modal, [ - m(ModalOverlay), - m('.modalexample', [ - 'Popup content', - m('button', {onclick: () => this.modal.close()}, 'Close popup') - ]) - ]) - ]) - ] - } -} - -const Images = ({children}) => - m('.images', - m('h3', 'Onload'), - m(Image, { - class: 'images-bg', - background: true, - onclick: () => {}, - src: `https://picsum.photos/200/${Math.random() > .5 ? '200' : '300'}`, - onload: e => console.log(e) - }), - m('h3', 'Server resize'), - m('.images-landscape', {style: {width: '400px', height: 'auto'}}, - m(ImageResizer, { - resize: (attrs, container) => { - return {...attrs} - } - }, - m(Image, svgImage) - ) - ), - m('h3', 'No crop'), - m('.images-landscape', {style: {width: '400px', height: 'auto'}}, - m(Image, svgImage) - ), - m('.images-portrait', - m(Image, testImage) - ), - m('h3', 'Cover'), - m('.images-landscape', - m(Image, { - alt: 'ok', - fit: 'cover', - src: 'https://picsum.photos/600/200' - }) - ), - m('.images-portrait', - m(Image, { - fit: 'cover', - width: 200, - height: 100, - src: 'https://picsum.photos/200/100' - }) - ), - m('.images-portrait', - m(Image, { - fit: 'cover', - position: {x: .8, y: .8}, - src: 'https://picsum.photos/800/400' - }) - ), - m('h3', 'Contain'), - m('.images-landscape', - m(Image, { - fit: 'contain', - src: 'https://picsum.photos/600/200' - }) - ), - m('.images-portrait', - m(Image, { - fit: 'contain', - src: 'https://picsum.photos/600/200' - }) - ), - m('h3', 'Fixed height'), - m('.images-fixedheight', [ - m(Image, { - fit: 'portrait', - src: 'https://picsum.photos/600/200' - }), - m(Image, { - fit: 'portrait', - src: 'https://picsum.photos/300/300' - }), - m(Image, { - fit: 'portrait', - src: 'https://picsum.photos/100/200' - }) - ]) - ) - -const Nav = styled('nav')` - background: red; -` - -const Nav2 = styled(Nav)` - color: white; -` - -const Nav3 = styled(Nav2)` - color: blue; -` - -const A = styled(Link)` - color: inherit; - &:hover { - color: yellow; - } - &.is-active { - color: gold; - } -` -const breakpoints = { - ipadPort: '(min-width: 800px)' -} - -const Slider = lazy(() => import('./views/sliderpage')) - -class Examples extends View { - render() { - return m(HashRouter, - m(Switch, [ - m(Route, { - path: '/:language', - }, ({match}) => { - const {params: {language}} = match - return m('', [ - m(HistoryRouter, { - matcher: (location, route) => - hashMatcher(location, { - ...route, - path: route.path && `/${language}${route.path}` - }), - formatPath: path => hashFormatter(`/${language}${path}`) - }, [ - m('', m(LanguagesNav)), - `Language: ${language}`, - m(Nav3, {as: 'div'}, [ - m(A, {class: 'home', to: '/', exact: true}, 'Home'), - m(A, {to: '/slider'}, 'Slider'), - m(A, {to: '/autocomplete'}, 'Autocomplete'), - m(A, {to: '/modal'}, 'Modal'), - m(A, {to: '/images'}, 'Images'), - m(A, {to: '/maps'}, 'Maps'), - m(A, {to: '/back'}, 'Back home') - ]), - m(Switch, [ - m(Route, {path: '/slider'}, Slider), - m(Route, {path: '/autocomplete'}, Autocomplete), - m(Route, {path: '/images'}, Images), - m(Route, {path: '/back'}, - () => m('', [ - 'Back home', - m(Redirect, {to: '/'}) - ]) - ), - m(Route, {path: '/modal'}, ModalExample), - m(Route, {path: '/maps'}, Map), - m(Route, () => [ - m(Breakpoint, { - '(max-width: 800px)': {cols: 3}, - '(min-width: 800px)': {cols: 5}, - '(min-width: 1000px)': {cols: 10} - }, ({cols}) => m('', 'cols: '+cols)) - ]) - ]) - ]) - ]) - } - ), - m(Route, () => m('', - 'Choose a language:', - m(LanguagesNav) - )) - ]) - ) - } -} - -m.mount(document.getElementById('root'), Examples) \ No newline at end of file diff --git a/examples/src/views/autocomplete.less b/examples/src/views/autocomplete.less deleted file mode 100755 index b2352c1..0000000 --- a/examples/src/views/autocomplete.less +++ /dev/null @@ -1,36 +0,0 @@ -.autocomplete { - display: inline-block; - position: relative; - - &-item { - &.is-active { - background: red; - } - } - - &-menu { - max-height: 300px; - overflow: auto; - position: absolute; - top: 100%; - left: 0; - right: 0; - background: white; - box-shadow: 0 3px 30px rgba(0, 0, 0, .2); - - &:empty { - display: none; - } - } -} - -.dropdown { - &-menu { - &-item { - padding: 10px; - &.is-active { - background: red; - } - } - } -} \ No newline at end of file diff --git a/examples/src/views/autocomplete.ts b/examples/src/views/autocomplete.ts deleted file mode 100755 index 687a1ed..0000000 --- a/examples/src/views/autocomplete.ts +++ /dev/null @@ -1,74 +0,0 @@ -import './autocomplete.less' - -import {Autocomplete, AutocompleteStore, classes, m, View} from '@codeurs/front' -import countries from './countries' - -const dropdownOptions = [ - 'a', 'b', 'c' -] - -export default class extends View { - autocomplete = new AutocompleteStore() - selectedDropdownItem: string - render() { - return m('div', [ - m('h2', 'dropdown'), - m('', - m(Autocomplete, { - onselect: (item?: string) => { - if (item) this.selectedDropdownItem = item - } - }, - ({isOpen, selectedItem, itemAttrs, menuAttrs, buttonAttrs, highlightedIndex}) => - m('.dropdown', - m('button.dropdown-label', buttonAttrs(), this.selectedDropdownItem || 'Select something'), - isOpen && m('.dropdown-menu', menuAttrs(), - dropdownOptions.map((option, index) => - m('.dropdown-menu-item', itemAttrs({ - item: option, - ...classes({is: {active: highlightedIndex === index}}) - }), option) - ) - ) - ) - ) - ), - m('h2', 'autocomplete'), - m('button', { - onclick: e => { - this.autocomplete.inputValue = 'Belgium' - } - }, 'Select Belgium'), - m(Autocomplete, { - store: this.autocomplete, - onselect: country => console.log(country), - itemToString: country => country.name - }, ({ - isOpen, - highlightedIndex, - inputValue, - inputAttrs, - menuAttrs, - itemAttrs, - buttonAttrs - }) => m('.autocomplete', [ - m('input', inputAttrs({ - placeholder: 'Search', - })), - m('button', buttonAttrs(), 'Toggle menu'), - isOpen && m('ul', menuAttrs(), - m('.autocomplete-menu', - countries - .filter(country => country.name.toLowerCase().includes(inputValue.toLowerCase())) - .map((country, i) => - m('li.autocomplete-item', itemAttrs({ - key: country.code, - item: country, - ...classes({is: {active: highlightedIndex == i}}) - }), country.name) - )) - ) - ])) - ]) - } -} \ No newline at end of file diff --git a/examples/src/views/countries.ts b/examples/src/views/countries.ts deleted file mode 100755 index ddf3086..0000000 --- a/examples/src/views/countries.ts +++ /dev/null @@ -1,245 +0,0 @@ -export default [ - {name: 'Afghanistan', code: 'AF'}, - {name: 'Åland Islands', code: 'AX'}, - {name: 'Albania', code: 'AL'}, - {name: 'Algeria', code: 'DZ'}, - {name: 'American Samoa', code: 'AS'}, - {name: 'AndorrA', code: 'AD'}, - {name: 'Angola', code: 'AO'}, - {name: 'Anguilla', code: 'AI'}, - {name: 'Antarctica', code: 'AQ'}, - {name: 'Antigua and Barbuda', code: 'AG'}, - {name: 'Argentina', code: 'AR'}, - {name: 'Armenia', code: 'AM'}, - {name: 'Aruba', code: 'AW'}, - {name: 'Australia', code: 'AU'}, - {name: 'Austria', code: 'AT'}, - {name: 'Azerbaijan', code: 'AZ'}, - {name: 'Bahamas', code: 'BS'}, - {name: 'Bahrain', code: 'BH'}, - {name: 'Bangladesh', code: 'BD'}, - {name: 'Barbados', code: 'BB'}, - {name: 'Belarus', code: 'BY'}, - {name: 'Belgium', code: 'BE'}, - {name: 'Belize', code: 'BZ'}, - {name: 'Benin', code: 'BJ'}, - {name: 'Bermuda', code: 'BM'}, - {name: 'Bhutan', code: 'BT'}, - {name: 'Bolivia', code: 'BO'}, - {name: 'Bosnia and Herzegovina', code: 'BA'}, - {name: 'Botswana', code: 'BW'}, - {name: 'Bouvet Island', code: 'BV'}, - {name: 'Brazil', code: 'BR'}, - {name: 'British Indian Ocean Territory', code: 'IO'}, - {name: 'Brunei Darussalam', code: 'BN'}, - {name: 'Bulgaria', code: 'BG'}, - {name: 'Burkina Faso', code: 'BF'}, - {name: 'Burundi', code: 'BI'}, - {name: 'Cambodia', code: 'KH'}, - {name: 'Cameroon', code: 'CM'}, - {name: 'Canada', code: 'CA'}, - {name: 'Cape Verde', code: 'CV'}, - {name: 'Cayman Islands', code: 'KY'}, - {name: 'Central African Republic', code: 'CF'}, - {name: 'Chad', code: 'TD'}, - {name: 'Chile', code: 'CL'}, - {name: 'China', code: 'CN'}, - {name: 'Christmas Island', code: 'CX'}, - {name: 'Cocos (Keeling) Islands', code: 'CC'}, - {name: 'Colombia', code: 'CO'}, - {name: 'Comoros', code: 'KM'}, - {name: 'Congo', code: 'CG'}, - {name: 'Congo, The Democratic Republic of the', code: 'CD'}, - {name: 'Cook Islands', code: 'CK'}, - {name: 'Costa Rica', code: 'CR'}, - {name: 'Cote D\'Ivoire', code: 'CI'}, - {name: 'Croatia', code: 'HR'}, - {name: 'Cuba', code: 'CU'}, - {name: 'Cyprus', code: 'CY'}, - {name: 'Czech Republic', code: 'CZ'}, - {name: 'Denmark', code: 'DK'}, - {name: 'Djibouti', code: 'DJ'}, - {name: 'Dominica', code: 'DM'}, - {name: 'Dominican Republic', code: 'DO'}, - {name: 'Ecuador', code: 'EC'}, - {name: 'Egypt', code: 'EG'}, - {name: 'El Salvador', code: 'SV'}, - {name: 'Equatorial Guinea', code: 'GQ'}, - {name: 'Eritrea', code: 'ER'}, - {name: 'Estonia', code: 'EE'}, - {name: 'Ethiopia', code: 'ET'}, - {name: 'Falkland Islands (Malvinas)', code: 'FK'}, - {name: 'Faroe Islands', code: 'FO'}, - {name: 'Fiji', code: 'FJ'}, - {name: 'Finland', code: 'FI'}, - {name: 'France', code: 'FR'}, - {name: 'French Guiana', code: 'GF'}, - {name: 'French Polynesia', code: 'PF'}, - {name: 'French Southern Territories', code: 'TF'}, - {name: 'Gabon', code: 'GA'}, - {name: 'Gambia', code: 'GM'}, - {name: 'Georgia', code: 'GE'}, - {name: 'Germany', code: 'DE'}, - {name: 'Ghana', code: 'GH'}, - {name: 'Gibraltar', code: 'GI'}, - {name: 'Greece', code: 'GR'}, - {name: 'Greenland', code: 'GL'}, - {name: 'Grenada', code: 'GD'}, - {name: 'Guadeloupe', code: 'GP'}, - {name: 'Guam', code: 'GU'}, - {name: 'Guatemala', code: 'GT'}, - {name: 'Guernsey', code: 'GG'}, - {name: 'Guinea', code: 'GN'}, - {name: 'Guinea-Bissau', code: 'GW'}, - {name: 'Guyana', code: 'GY'}, - {name: 'Haiti', code: 'HT'}, - {name: 'Heard Island and Mcdonald Islands', code: 'HM'}, - {name: 'Holy See (Vatican City State)', code: 'VA'}, - {name: 'Honduras', code: 'HN'}, - {name: 'Hong Kong', code: 'HK'}, - {name: 'Hungary', code: 'HU'}, - {name: 'Iceland', code: 'IS'}, - {name: 'India', code: 'IN'}, - {name: 'Indonesia', code: 'ID'}, - {name: 'Iran, Islamic Republic Of', code: 'IR'}, - {name: 'Iraq', code: 'IQ'}, - {name: 'Ireland', code: 'IE'}, - {name: 'Isle of Man', code: 'IM'}, - {name: 'Israel', code: 'IL'}, - {name: 'Italy', code: 'IT'}, - {name: 'Jamaica', code: 'JM'}, - {name: 'Japan', code: 'JP'}, - {name: 'Jersey', code: 'JE'}, - {name: 'Jordan', code: 'JO'}, - {name: 'Kazakhstan', code: 'KZ'}, - {name: 'Kenya', code: 'KE'}, - {name: 'Kiribati', code: 'KI'}, - {name: 'Korea, Democratic People\'S Republic of', code: 'KP'}, - {name: 'Korea, Republic of', code: 'KR'}, - {name: 'Kuwait', code: 'KW'}, - {name: 'Kyrgyzstan', code: 'KG'}, - {name: 'Lao People\'S Democratic Republic', code: 'LA'}, - {name: 'Latvia', code: 'LV'}, - {name: 'Lebanon', code: 'LB'}, - {name: 'Lesotho', code: 'LS'}, - {name: 'Liberia', code: 'LR'}, - {name: 'Libyan Arab Jamahiriya', code: 'LY'}, - {name: 'Liechtenstein', code: 'LI'}, - {name: 'Lithuania', code: 'LT'}, - {name: 'Luxembourg', code: 'LU'}, - {name: 'Macao', code: 'MO'}, - {name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK'}, - {name: 'Madagascar', code: 'MG'}, - {name: 'Malawi', code: 'MW'}, - {name: 'Malaysia', code: 'MY'}, - {name: 'Maldives', code: 'MV'}, - {name: 'Mali', code: 'ML'}, - {name: 'Malta', code: 'MT'}, - {name: 'Marshall Islands', code: 'MH'}, - {name: 'Martinique', code: 'MQ'}, - {name: 'Mauritania', code: 'MR'}, - {name: 'Mauritius', code: 'MU'}, - {name: 'Mayotte', code: 'YT'}, - {name: 'Mexico', code: 'MX'}, - {name: 'Micronesia, Federated States of', code: 'FM'}, - {name: 'Moldova, Republic of', code: 'MD'}, - {name: 'Monaco', code: 'MC'}, - {name: 'Mongolia', code: 'MN'}, - {name: 'Montserrat', code: 'MS'}, - {name: 'Morocco', code: 'MA'}, - {name: 'Mozambique', code: 'MZ'}, - {name: 'Myanmar', code: 'MM'}, - {name: 'Namibia', code: 'NA'}, - {name: 'Nauru', code: 'NR'}, - {name: 'Nepal', code: 'NP'}, - {name: 'Netherlands', code: 'NL'}, - {name: 'Netherlands Antilles', code: 'AN'}, - {name: 'New Caledonia', code: 'NC'}, - {name: 'New Zealand', code: 'NZ'}, - {name: 'Nicaragua', code: 'NI'}, - {name: 'Niger', code: 'NE'}, - {name: 'Nigeria', code: 'NG'}, - {name: 'Niue', code: 'NU'}, - {name: 'Norfolk Island', code: 'NF'}, - {name: 'Northern Mariana Islands', code: 'MP'}, - {name: 'Norway', code: 'NO'}, - {name: 'Oman', code: 'OM'}, - {name: 'Pakistan', code: 'PK'}, - {name: 'Palau', code: 'PW'}, - {name: 'Palestinian Territory, Occupied', code: 'PS'}, - {name: 'Panama', code: 'PA'}, - {name: 'Papua New Guinea', code: 'PG'}, - {name: 'Paraguay', code: 'PY'}, - {name: 'Peru', code: 'PE'}, - {name: 'Philippines', code: 'PH'}, - {name: 'Pitcairn', code: 'PN'}, - {name: 'Poland', code: 'PL'}, - {name: 'Portugal', code: 'PT'}, - {name: 'Puerto Rico', code: 'PR'}, - {name: 'Qatar', code: 'QA'}, - {name: 'Reunion', code: 'RE'}, - {name: 'Romania', code: 'RO'}, - {name: 'Russian Federation', code: 'RU'}, - {name: 'RWANDA', code: 'RW'}, - {name: 'Saint Helena', code: 'SH'}, - {name: 'Saint Kitts and Nevis', code: 'KN'}, - {name: 'Saint Lucia', code: 'LC'}, - {name: 'Saint Pierre and Miquelon', code: 'PM'}, - {name: 'Saint Vincent and the Grenadines', code: 'VC'}, - {name: 'Samoa', code: 'WS'}, - {name: 'San Marino', code: 'SM'}, - {name: 'Sao Tome and Principe', code: 'ST'}, - {name: 'Saudi Arabia', code: 'SA'}, - {name: 'Senegal', code: 'SN'}, - {name: 'Serbia and Montenegro', code: 'CS'}, - {name: 'Seychelles', code: 'SC'}, - {name: 'Sierra Leone', code: 'SL'}, - {name: 'Singapore', code: 'SG'}, - {name: 'Slovakia', code: 'SK'}, - {name: 'Slovenia', code: 'SI'}, - {name: 'Solomon Islands', code: 'SB'}, - {name: 'Somalia', code: 'SO'}, - {name: 'South Africa', code: 'ZA'}, - {name: 'South Georgia and the South Sandwich Islands', code: 'GS'}, - {name: 'Spain', code: 'ES'}, - {name: 'Sri Lanka', code: 'LK'}, - {name: 'Sudan', code: 'SD'}, - {name: 'Suriname', code: 'SR'}, - {name: 'Svalbard and Jan Mayen', code: 'SJ'}, - {name: 'Swaziland', code: 'SZ'}, - {name: 'Sweden', code: 'SE'}, - {name: 'Switzerland', code: 'CH'}, - {name: 'Syrian Arab Republic', code: 'SY'}, - {name: 'Taiwan, Province of China', code: 'TW'}, - {name: 'Tajikistan', code: 'TJ'}, - {name: 'Tanzania, United Republic of', code: 'TZ'}, - {name: 'Thailand', code: 'TH'}, - {name: 'Timor-Leste', code: 'TL'}, - {name: 'Togo', code: 'TG'}, - {name: 'Tokelau', code: 'TK'}, - {name: 'Tonga', code: 'TO'}, - {name: 'Trinidad and Tobago', code: 'TT'}, - {name: 'Tunisia', code: 'TN'}, - {name: 'Turkey', code: 'TR'}, - {name: 'Turkmenistan', code: 'TM'}, - {name: 'Turks and Caicos Islands', code: 'TC'}, - {name: 'Tuvalu', code: 'TV'}, - {name: 'Uganda', code: 'UG'}, - {name: 'Ukraine', code: 'UA'}, - {name: 'United Arab Emirates', code: 'AE'}, - {name: 'United Kingdom', code: 'GB'}, - {name: 'United States', code: 'US'}, - {name: 'United States Minor Outlying Islands', code: 'UM'}, - {name: 'Uruguay', code: 'UY'}, - {name: 'Uzbekistan', code: 'UZ'}, - {name: 'Vanuatu', code: 'VU'}, - {name: 'Venezuela', code: 'VE'}, - {name: 'Viet Nam', code: 'VN'}, - {name: 'Virgin Islands, British', code: 'VG'}, - {name: 'Virgin Islands, U.S.', code: 'VI'}, - {name: 'Wallis and Futuna', code: 'WF'}, - {name: 'Western Sahara', code: 'EH'}, - {name: 'Yemen', code: 'YE'}, - {name: 'Zambia', code: 'ZM'}, - {name: 'Zimbabwe', code: 'ZW'} -] \ No newline at end of file diff --git a/examples/src/views/index.ts b/examples/src/views/index.ts deleted file mode 100755 index 883be09..0000000 --- a/examples/src/views/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as autocomplete } from './autocomplete'; -export { default as map } from './map'; -export { default as sliderpage } from './sliderpage'; -export { default as countries } from './countries'; diff --git a/examples/src/views/map.less b/examples/src/views/map.less deleted file mode 100755 index 7fb4827..0000000 --- a/examples/src/views/map.less +++ /dev/null @@ -1,5 +0,0 @@ -.map { - &-maps { - height: 500px; - } -} \ No newline at end of file diff --git a/examples/src/views/map.ts b/examples/src/views/map.ts deleted file mode 100755 index 1f99058..0000000 --- a/examples/src/views/map.ts +++ /dev/null @@ -1,82 +0,0 @@ -import './map.less' - -import {m, Maps, Marker, View} from '@codeurs/front' -import {debounce} from 'throttle-debounce' - -export default class Map extends View { - markers = 1 - zoom = 4.5 - center = {lat: 50.3115184, lng: 6.3301855} - - setMapProperties = debounce(300, e => { - let redraw = false - const map = e.target - const zoomLevel = map.getZoom() - if (zoomLevel !== this.zoom) { - redraw = true - this.zoom = zoomLevel - } - const center = map.getCenter() - if (!center.equals(new google.maps.LatLng( - this.center.lat, this.center.lng - ))) { - redraw = true - this.center = center.toJSON() - } - if (redraw) m.redraw() - }) - - changeMapProperty = e => { - e.redraw = false - this.setMapProperties(e) - } - - render() { - return m('.map', - m('label', - 'Add markers: ', - m('input[type=range]', { - value: this.markers, - min: 1, max: 50, - step: 1, - oninput: e => this.markers = parseInt(e.target.value, 10) - }) - ), - m('label', - 'Zoom: ', - m('input[type=range]', { - value: this.zoom, - min: 1, max: 15, - step: 1, - oninput: e => this.zoom = parseFloat(e.target.value) - }) - ), - m('.map-maps', - m(Maps, - { - apiKey: 'AIzaSyDSOLxTZy_56sksxVCD970SpqJPFxXe5Ok', - center: this.center, - zoom: this.zoom, - disableDefaultUI: true, - on: { - center_changed: this.changeMapProperty, - zoom_changed: this.changeMapProperty - } - }, - Array.from(Array(this.markers)) - .map((_, i) => - m(Marker, { - position: { - lat: this.center.lat, - lng: this.center.lng + i * 1.5 - }, - on: { - click: () => console.log(i) - } - }) - ) - ) - ) - ) - } -} \ No newline at end of file diff --git a/examples/src/views/sliderpage.less b/examples/src/views/sliderpage.less deleted file mode 100644 index aa465a1..0000000 --- a/examples/src/views/sliderpage.less +++ /dev/null @@ -1,33 +0,0 @@ - -.sliderpage { - height: 400px; - margin-top: 50px; - - &.is-animating { - background: red; - } - - &-slide { - opacity: .5; - display: inline-flex; - min-width: 100%; - height: 100%; - justify-content: center; - align-items: center; - font-size: 50px; - transition: opacity .25s ease-out; - box-shadow: inset 0 0 30px red; - - &-link { - font-size: 15px; - display: block; - text-decoration: underline; - color: blue; - cursor: pointer; - } - - &.is-active { - opacity: 1; - } - } -} \ No newline at end of file diff --git a/examples/src/views/sliderpage.ts b/examples/src/views/sliderpage.ts deleted file mode 100755 index ad530d4..0000000 --- a/examples/src/views/sliderpage.ts +++ /dev/null @@ -1,73 +0,0 @@ -import './sliderpage.less' - -import { - Carousel, CarouselStore, m, Slider, SliderStore, View -} from '@codeurs/front' - -export default class SliderPage extends View { - slider = new SliderStore() - carousel = new CarouselStore() - - state = { - snap: 'pages' as const, - width: 1 - } - - render() { - const {snap, width} = this.state - return m('div', [ - m('h1', '@codeurs/front'), - m('input[type=range]', { - value: width, - oninput: e => this.setState({width: parseFloat(e.target.value)}), - min: 0, - max: 1, - step: .01 - }), - m('button', { - onclick: () => this.setState({snap: snap == 'pages' ? 'elements': 'pages'}) - }, `Snap to ${snap == 'pages' ? 'elements': 'pages'}`), - m('.sliderpage', - m(Carousel, {...this.carousel, touchpadSupport: false, snapTo: snap}, - [1, 2, 3, 4, 5, 6, 7].map((slide, i) => - m('.sliderpage-slide', { - //onclick: () => alert('ok'), - className: this.carousel.isActive(i) && 'is-active', - style: {'min-width': width * 100 + '%'} - }, [ - slide, - m('a.sliderpage-slide-link', { - onclick: () => { - this.carousel.goNext() - } - }, 'next >>'), - m('a.sliderpage-slide-link', { - href: 'https://codeurs.be', - target: '_blank' - }, 'external') - ]) - ) - ), - m(Carousel, - [1, 2, 3, 4, 5, 6, 7].map((slide, i) => - m('.sliderpage-slide', { - className: 'is-active', - style: {'min-width': '33.33333%'} - }, [ - slide, - m('a.sliderpage-slide-link', { - onclick: () => { - this.carousel.goNext() - } - }, 'next >>'), - m('a.sliderpage-slide-link', { - href: 'https://codeurs.be', - target: '_blank' - }, 'external') - ]) - ) - ) - ) - ]) - } -} \ No newline at end of file diff --git a/examples/tsconfig.json b/examples/tsconfig.json deleted file mode 100755 index 30da950..0000000 --- a/examples/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "sourceMap": true, - "importHelpers": true, - "allowJs": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "target": "es6", - "module": "esnext", - "moduleResolution": "node", - "noUnusedParameters": false, - "removeComments": false, - "preserveConstEnums": true, - "skipLibCheck": true, - "baseUrl": "./src/", - "outDir": "./dist/", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "resolveJsonModule": true, - "downlevelIteration": true, - "jsx": "react", - "jsxFactory": "m", - "lib": ["es2017", "dom"] - }, - "include": ["./src/**/*"] -} diff --git a/examples/webpack.config.js b/examples/webpack.config.js deleted file mode 100755 index 1d689ae..0000000 --- a/examples/webpack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -const path = require('path') - -module.exports = require('@codeurs/packer')( - 'src/index.ts', 'dist/bundle.js', { - include: [path.resolve('../node_modules/@codeurs/front/dist')] - } -) \ No newline at end of file diff --git a/examples/dist/index.html b/index.html similarity index 100% rename from examples/dist/index.html rename to index.html diff --git a/package.json b/package.json deleted file mode 100755 index d313e33..0000000 --- a/package.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "name": "@codeurs/front", - "version": "0.16.0", - "description": "Collection of mithril utilities and components", - "sideEffects": [ - "*.css", - "*.less" - ], - "module": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist", - "src" - ], - "publishConfig": { - "access": "public" - }, - "repository": "https://github.com/codeurs/front", - "author": "Ben Merckx ", - "license": "MIT", - "scripts": { - "dev": "run-s build less && run-p less watch examples:watch", - "build": "tsc", - "watch": "tsc --pretty --preserveWatchOutput -w", - "examples:watch": "cd examples && webpack --mode development -w", - "examples:build": "cd examples && webpack --mode production --optimize-minimize", - "ghpages": "run-s prepublishOnly examples:build", - "less": "copyfiles -u 1 \"./src/**/*.less\" dist", - "prepublishOnly": "rimraf dist && run-p build less", - "pretty:format": "prettier --print-width 80 --single-quote --write --no-semi --no-bracket-spacing --parser typescript --tab-width 2 --use-tabs", - "pretty:hyperscript": "perl -i -0777pe 's/\\bm\\(\\s+/m(/gs'", - "prepare": "symlink-dir . node_modules/@codeurs/front", - "test": "jest" - }, - "husky": { - "hooks": { - "pre-commit": "node -e \"process.exit(require('os').platform() != 'win32')\" || lint-staged" - } - }, - "lint-staged": { - "src/**/*.ts": [ - "npm run -s pretty:format", - "npm run -s pretty:hyperscript", - "git add" - ], - "src/**/*.less": [ - "prettier --write --tab-width 2 --use-tabs --parser postcss", - "git add" - ] - }, - "jest": { - "transform": { - "^.+\\.ts?$": "ts-jest" - }, - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.ts$", - "moduleDirectories": [ - "node_modules", - "src" - ], - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx" - ] - }, - "dependencies": { - "@emotion/cache": "^10.0.7", - "@emotion/is-prop-valid": "^0.7.3", - "@emotion/serialize": "^0.11.4", - "@emotion/utils": "^0.11.1", - "@types/classnames": "^2.2.6", - "@types/deep-equal": "^1.0.1", - "@types/googlemaps": "^3.30.16", - "@types/jump.js": "^1.0.2", - "@types/load-google-maps-api": "^1.3.0", - "@types/mithril": "https://codeload.github.com/codeurs/mithril.d.ts/tar.gz/911e3bb343b77dc6839debc911e9829de2cefbcf", - "@types/throttle-debounce": "^1.1.1", - "classnames": "^2.2.5", - "core-js": "^3.0.1", - "deep-equal": "^1.0.1", - "jump.js": "codeurs/jump.js", - "load-google-maps-api": "^1.3.2", - "mithril": "2.0.0-rc.4", - "object-to-formdata": "codeurs/object-to-formdata", - "popmotion": "^8.6.4", - "scroll-into-view-if-needed": "^2.2.20", - "throttle-debounce": "^2.1.0", - "tslib": "^1.9.3" - }, - "devDependencies": { - "@codeurs/packer": "=0.14.1", - "@types/jest": "^24.0.9", - "copyfiles": "^2.0.0", - "cross-env": "^5.2.0", - "husky": "^1.2.0", - "jest": "^24.1.0", - "lint-staged": "^8.1.0", - "npm-run-all": "^4.1.3", - "prettier": "^1.15.3", - "rimraf": "^2.6.3", - "serve": "^10.1.2", - "style-loader": "^0.23.1", - "symlink-dir": "^2.0.2", - "ts-jest": "^24.0.0" - } -} diff --git a/readme.md b/readme.md deleted file mode 100755 index f90fdca..0000000 --- a/readme.md +++ /dev/null @@ -1,145 +0,0 @@ -# Components -A collection of (currently) unfinished and undocumented mithril utilities and components. - -## Table of Contents -- [Action](#action) -- [Classes](#classes) -- [MediaQuery](#mediaquery) -- [Modal](#modal) -- [Portal](#portal) -- [Slider](#slider) - -## Action - -Use an action component when you have an internal or external link. - -```javascript -import {action} from '@codeurs/front' - -view() { - return m('a', action('/url')) -} -``` - -If you have multiple attributes you must write it a little bit different. - -```javascript -import {action} from '@codeurs/front' - -view() { - return m('a', { - class: 'link', - ...action('/url') - }) -} -``` - -## Classes - -Conditionally join classNames together. Uses [classNames](https://github.com/JedWatson/classnames) in its implementation but allows you to easily prefix them. - -```javascript -import {classes} from '@codeurs/front' - -view() { - const {mod} = this.attrs - const open = true - - return [ - //class will be 'mod-small' - m('a', classes({mod: 'small'}), 'Size'), - - //class will be 'mod-small.mod-black' - m('a', classes({mod: ['small', 'black']}), 'Size and color'), - - //class will not be set if mod is falsy (false/null/undefined/0/NaN/'') - m('a', classes({mod}), 'Modification'), - - //class will be 'is-open' if open evaluates to true - m('a', classes({is: {open}}), 'Is open'), - - //class will be 'is-active' if url is '/home' - m('a', classes({is: {active: action.isActive('/home')}}), 'Is active') - ] -} -``` - -## MediaQuery - -Media queries are useful when you want to modify your site depending on the browser's width. The big advantage over css media queries is that elements are not shown but also not drawn. - -```javascript -import {MediaQuery} from '@codeurs/front' - -view() { - return [ - m(MediaQuery, { - maxWidth: 767, - view: () => m('p', 'Content that can only be seen up to 768 pixels.') - }), - m(MediaQuery, { - minWidth: 768, - view: () => m('p', 'Content that can only be seen from 768 pixels.') - }) - ] -} -``` - -## Modal - -A temporary UI overlay. - -````javascript -import {Component, ModalStore, Modal, ModalOverlay} from '@codeurs/front' - -class ModalExample extends Component { - modal = new ModalStore() - view() { - return [ - m('a', {onclick: this.modal.open}, 'Open modal'), - m(Modal, this.modal, [ - m(ModalOverlay), - m('.modalexample', 'Popup content') - ]) - ] - } -} -```` - -## Portal - -Creates a top-level node in the body and mounts its children. Useful to escape z-index stacking for modals. - -````javascript -import {Component, Portal} from '@codeurs/front' - -class PortalExample extends Component { - view() { - return m(Portal, [ - m('.portalexample', 'This is placed at the end of document.body') - ]) - } -} -```` - -## Slider - -Horizontal touch enabled slider. Slides can be of variable width. - -````javascript -import {Component, Slider, SliderStore} from '@codeurs/front' - -export default class SliderExample extends Component { - slider = new SliderStore() - view() { - return m('.sliderexample', [ - m(Slider, this.slider, [ - m('.sliderexample-slide'), // display: inline-block - m('.sliderexample-slide') // etc ... - ]), - m('a', {onclick: e => this.slider.goPrevious()}, 'Previous'), - m('a', {onclick: e => this.slider.goNext()}, 'Next') - ]) - } -} -```` diff --git a/src/container/autocomplete.ts b/src/container/autocomplete.ts deleted file mode 100755 index e47599c..0000000 --- a/src/container/autocomplete.ts +++ /dev/null @@ -1,338 +0,0 @@ -import {Children, VnodeDOM} from 'mithril' -import scrollIntoView from 'scroll-into-view-if-needed' -import {DOMAttrs, m} from '../hyperscript' -import { - AutocompleteAction, AutocompleteChange, AutocompleteState, AutocompleteStore -} from '../store/autocompletestore' -import {View} from '../ui/view' - -export type AutocompleteApi = AutocompleteState & { - inputAttrs: (attrs?: DOMAttrs) => DOMAttrs - menuAttrs: (attrs?: DOMAttrs) => DOMAttrs - buttonAttrs: (attrs?: DOMAttrs) => DOMAttrs - labelAttrs: (attrs?: DOMAttrs) => DOMAttrs - itemAttrs: (attrs: ItemAttrs) => DOMAttrs -} - -export type AutocompleteRenderApi = ( - api: AutocompleteApi -) => Children - -type ItemAttrs = { - item: Item -} & DOMAttrs - -const callFunctions = (...fns: Array) => (...args: Array) => - fns.forEach(fn => fn && fn(...args)) - -const callHandlers = (...fns: Array) => ( - event: Event & {redraw: boolean} -) => { - event.redraw = false - return callFunctions(...fns)(event) -} - -const normalizeArrowKey = (event: KeyboardEvent) => { - const {key, keyCode} = event - if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) - return `Arrow${key}` - return key -} - -const isOrContainsNode = (parent: HTMLElement, child: HTMLElement) => - parent === child || (parent.contains && parent.contains(child)) - -export class Autocomplete extends View< - { - store?: AutocompleteStore - onselect?: (item: null | Item) => void - itemToString?: (item: Item) => string - children: AutocompleteRenderApi - }, - {}, - HTMLElement -> { - static instanceCount = 0 - - defaultStore: AutocompleteStore = new AutocompleteStore() - - private items: Array = [] - private id = `autocomplete-${Autocomplete.instanceCount++}` - private menuId = `${this.id}-menu` - private labelId = `${this.id}-label` - private inputId = `${this.id}-input` - private buttonId = `${this.id}-button` - private getItemId = (index: number) => `${this.id}-item-${index}` - private clearCallbacks: Array = [] - private avoidScrolling = false - private interacting = false - - get store() { - return this.attrs.store || this.defaultStore - } - - onCreate(dom: HTMLElement) { - const onMouseDown = () => (this.interacting = true) - const onMouseUp = (event: Event) => { - const target = event.target as HTMLElement - const {isOpen} = this.store - this.schedule(() => { - this.interacting = false - if (isOpen && !isOrContainsNode(dom, target)) - this.dispatch({type: AutocompleteChange.MouseUp}) - }) - } - dom.addEventListener('mousedown', onMouseDown) - window.addEventListener('mouseup', onMouseUp) - dom.addEventListener('touchstart', onMouseDown, {passive: true}) - window.addEventListener('touchend', onMouseUp) - this.onRemove = () => { - dom.removeEventListener('mousedown', onMouseDown) - window.removeEventListener('mouseup', onMouseUp) - dom.removeEventListener('touchstart', onMouseDown) - window.removeEventListener('touchend', onMouseUp) - this.clearCallbacks.forEach(fn => fn()) - } - } - - schedule(work: () => void, time?: number) { - const id = setTimeout(work, time) - this.clearCallbacks.push(() => clearTimeout(id)) - } - - dispatch(action: AutocompleteAction, options: {async?: boolean} = {}) { - const {itemToString = (item: Item) => `${item}`, onselect} = this.attrs - const {async} = options - const {selectedItem: wasSelected} = this.store - this.store.dispatch(action, { - items: this.items, - itemToString - }) - const {selectedItem} = this.store - if (wasSelected != selectedItem) if (onselect) onselect(selectedItem) - if (async) m.redraw() - else (m.redraw as any).sync() - } - - // -- Input ------------------- - - inputAttrs = (attrs: DOMAttrs = {}) => { - const {onkeydown, onblur, oninput, ...rest} = attrs - const {inputValue, isOpen, highlightedIndex} = this.store - const events = { - oninput: callHandlers(oninput, this.inputChange), - onblur: callHandlers(oninput, this.inputBlur), - onkeydown: callHandlers(oninput, this.keyDown) - } - return { - 'aria-autocomplete': 'list', - 'aria-activedescendant': - isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 - ? this.getItemId(highlightedIndex) - : null, - 'aria-controls': isOpen ? this.menuId : null, - 'aria-labelledby': this.labelId, - autoComplete: 'off', - value: inputValue, - id: this.inputId, - ...events, - ...rest - } - } - - inputChange = (event: KeyboardEvent) => { - const element = event.target as HTMLInputElement - this.dispatch({ - type: AutocompleteChange.InputChange, - value: element.value - }) - } - - inputBlur = (event: Event) => { - const buttonIsActive = - document && - !!document.activeElement && - !!document.activeElement.id && - document.activeElement.id == this.buttonId - if (!this.interacting && !buttonIsActive) - this.dispatch({type: AutocompleteChange.InputBlur}) - } - - // -- Item ------------------- - - itemAttrs = (attrs: {item: Item} & DOMAttrs) => { - const {item, onclick, onmousemove, onmousedown, onkeydown, ...rest} = attrs - const {highlightedIndex} = this.store - const index = this.items.length - this.items.push(item) - const events = { - onclick: callHandlers(onclick, () => this.itemClick(index)), - onmousemove: callHandlers(onmousemove, () => this.itemMouseMove(index)), - onkeydown: callHandlers(onkeydown, this.keyDown) - } - const selected = highlightedIndex === index - const scrollTo = selected && { - onupdate: (vnode: VnodeDOM) => { - if (this.avoidScrolling || !this.store.isOpen) return - scrollIntoView(vnode.dom, {behavior: 'smooth', scrollMode: 'if-needed'}) - } - } - return { - id: this.getItemId(index), - role: 'option', - 'aria-selected': selected, - ...events, - ...scrollTo, - ...rest - } - } - - itemMouseMove(index: number) { - const {highlightedIndex} = this.store - if (index === highlightedIndex) return - this.avoidScrolling = true - this.dispatch({ - type: AutocompleteChange.ItemMouseEnter, - index - }) - this.schedule(() => (this.avoidScrolling = false), 250) - } - - itemClick(index: number) { - const item = this.items[index] - this.dispatch({ - type: AutocompleteChange.ItemClick, - item - }) - } - - // -- Label ------------------- - - labelAttrs = (attrs: DOMAttrs = {}) => { - return { - for: this.inputId, - id: this.labelId, - ...attrs - } - } - - // -- Menu ------------------- - - menuAttrs = (attrs: DOMAttrs = {}) => { - return { - role: 'listbox', - 'aria-labelledby': this.labelId, - id: this.menuId, - ...attrs - } - } - - // -- Button ------------------- - - buttonAttrs = (attrs: DOMAttrs = {}) => { - const {onclick, onkeydown, onblur, ...rest} = attrs - const {isOpen} = this.store - const events = { - onclick: callHandlers(onclick, this.buttonClick), - onkeydown: callHandlers(onkeydown, this.keyDown), - onblur: callHandlers(onblur, this.buttonBlur) - } - return { - id: this.buttonId, - type: 'button', - role: 'button', - 'aria-label': isOpen ? 'close menu' : 'open menu', - 'aria-haspopup': true, - ...events, - ...rest - } - } - - buttonClick = (event: MouseEvent) => { - const button = event.target as HTMLElement - event.preventDefault() - if (document.activeElement === document.body) button.focus() - this.dispatch({type: AutocompleteChange.ButtonClick}, {async: true}) - } - - buttonBlur = (event: Event) => { - const blurTarget = event.target - this.schedule(() => { - if ( - !this.interacting && - (document.activeElement == null || - document.activeElement.id !== this.inputId) && - document.activeElement !== blurTarget - ) - this.dispatch({type: AutocompleteChange.ButtonBlur}) - }) - } - - // -- Key down handlers ------------------- - - keyDown = (event: KeyboardEvent) => { - switch (normalizeArrowKey(event)) { - case 'ArrowUp': - return this.keyArrowup(event) - case 'ArrowDown': - return this.keyArrowdown(event) - case 'Escape': - return this.keyEscape(event) - case 'Enter': - return this.keyEnter(event) - } - } - - keyArrowdown(event: KeyboardEvent) { - event.preventDefault() - const amount = event.shiftKey ? 5 : 1 - this.dispatch({ - type: AutocompleteChange.KeyArrowDown, - amount, - total: this.items.length - }) - } - - keyArrowup(event: KeyboardEvent) { - event.preventDefault() - const amount = event.shiftKey ? -5 : -1 - this.dispatch({ - type: AutocompleteChange.KeyArrowUp, - amount, - total: this.items.length - }) - } - - keyEnter(event: KeyboardEvent) { - const {isOpen, highlightedIndex} = this.store - if (!isOpen || highlightedIndex === null) return - event.preventDefault() - const item = this.items[highlightedIndex] - // Todo: don't trigger for disabled items - this.dispatch({ - type: AutocompleteChange.KeyEnter, - item - }) - } - - keyEscape(event: KeyboardEvent) { - event.preventDefault() - this.dispatch({ - type: AutocompleteChange.KeyEscape - }) - } - - // -- View ------------------- - - render() { - this.items = [] - return this.children({ - ...this.store, - inputAttrs: this.inputAttrs, - menuAttrs: this.menuAttrs, - buttonAttrs: this.buttonAttrs, - labelAttrs: this.labelAttrs, - itemAttrs: this.itemAttrs - }) - } -} diff --git a/src/container/fetcher.ts b/src/container/fetcher.ts deleted file mode 100755 index 2ca22ff..0000000 --- a/src/container/fetcher.ts +++ /dev/null @@ -1,70 +0,0 @@ -import deepEqual from 'deep-equal' -import m, {Children, RequestOptions} from 'mithril' -import {View} from '../ui/view' - -export type FetcherState = { - isLoading: boolean - data?: T - error?: Error -} - -export type FetcherRender = (state: FetcherState) => Children - -type RequestData = { - url: string - hydrate?: T - cache?: any - setCache?: (cache: any) => void -} & RequestOptions - -export class Fetcher extends View< - RequestData & {children: FetcherRender} -> { - isLoading = false - error?: Error - data?: T - transport?: XMLHttpRequest - cache?: RequestData - hydrated = false - - onInit = this.load - onBeforeUpdate = this.load - - load() { - const { - cache = this.cache, - setCache = (cache: any) => (this.cache = cache), - children, - hydrate, - ...request - } = this.attrs - if (hydrate && !this.hydrated) { - this.data = hydrate - this.hydrated = true - setCache(request) - } - if (deepEqual(cache, request)) return - setCache(request) - this.isLoading = true - this.onRemove() - m.request({ - ...request, - config: xhr => (this.transport = xhr) - }) - .then(data => (this.data = data)) - .catch(e => console.error((this.error = e))) - .then(() => (this.isLoading = false)) - } - - onRemove() { - if (this.transport) this.transport = void this.transport.abort() - } - - render() { - return this.children({ - isLoading: this.isLoading, - data: this.data, - error: this.error - }) - } -} diff --git a/src/container/index.ts b/src/container/index.ts deleted file mode 100755 index ca07256..0000000 --- a/src/container/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './autocomplete' -export * from './toggle' -export * from './fetcher' diff --git a/src/container/toggle.ts b/src/container/toggle.ts deleted file mode 100755 index 80e9866..0000000 --- a/src/container/toggle.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {Children} from 'mithril' -import {View} from '../ui/view' - -export class Toggle extends View<{ - defaultValue?: boolean - children: (options: { - value: boolean - toggle: () => boolean - set: (value: boolean) => boolean - }) => Children -}> { - value = !!this.attrs.defaultValue - render() { - const {children} = this.attrs - return children({ - value: this.value, - toggle: () => (this.value = !this.value), - set: v => (this.value = v) - }) - } -} diff --git a/src/deprecated/action.ts b/src/deprecated/action.ts deleted file mode 100755 index 4b5ab76..0000000 --- a/src/deprecated/action.ts +++ /dev/null @@ -1,60 +0,0 @@ -function trimSlashes(str: string) { - return str.replace(/^\/|\/$/g, '') -} - -function startsWith(a: string, b: string) { - return a.substr(0, b.length) == b -} - -export const action = Object.assign( - ( - data: string | {url: string; target?: string}, - cb: null | Function = null, - replace: boolean = false - ): any => { - if (typeof data == 'string') return action({url: data}, cb, replace) - if (!data || !data.url) return {} - const {url, target} = data - if (url.indexOf('mailto:') === 0) return {href: url} - if (url.indexOf('@') > -1) return {href: 'mailto:' + url} - if (url.indexOf('.') > -1 || url.indexOf('://') > -1) - return { - href: url, - target: target || '_blank', - rel: 'external noopener', - onclick: cb - } - else - return { - href: url, - target, - onclick: (e: MouseEvent) => { - if (cb) cb() - action.anchorClick(e, url, replace) - } - } - }, - { - isActive(data: any, exact = false): boolean { - if (typeof data == 'string') return action.isActive({url: data}, exact) - const {pathname} = window.location - const path = trimSlashes(pathname) - const url = trimSlashes(data.url) - if (exact) return path == url - return startsWith(path, url) - }, - anchorClick(e: MouseEvent, href: string, replace = false) { - if (e.which == 2) return - e.preventDefault() - action.navigate(href, replace) - }, - navigate(url: string | {url: string}, replace = false): void { - if (!url) return - if (typeof url != 'string' && 'url' in url) - return action.navigate(url.url, replace) - if (replace) history.replaceState(null, '', url) - else history.pushState(null, '', url) - window.onpopstate && window.onpopstate({state: null} as any) - } - } -) diff --git a/src/deprecated/background.ts b/src/deprecated/background.ts deleted file mode 100755 index d67eb35..0000000 --- a/src/deprecated/background.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {DOMAttrs} from '../hyperscript' -import m from 'mithril' -import {Image, ImageResizer} from '../ui/image' -import {View} from '../ui/view' -import {classes} from '../util/classes' -import {getResizedUrl} from './picture' - -export type Img = { - src: string - empty?: boolean - focus?: {x: number; y: number} -} - -export class Background extends View< - { - img: string | Img - class?: string - } & DOMAttrs, - HTMLDivElement -> { - render() { - const {children, img, class: className, ...rest} = this.attrs - if (img && typeof img == 'object' && img.empty) return - const src = typeof img === 'string' ? img : img.src - const position = (typeof img == 'object' && img.focus) || 'center center' - return m(ImageResizer, - { - resize: ( - attrs: {src: string} & DOMAttrs, - container: {width: number; height: number} - ) => { - const {src} = attrs - if (src.indexOf('://') > -1) return attrs - const url = getResizedUrl(src, container.width, container.height) - return {...attrs, src: url} - } - }, - m(Image, - { - src, - background: true, - fit: 'cover', - position, - upScale: true, - ...classes('background', className), - ...rest - }, - children - ) - ) - } -} diff --git a/src/deprecated/form.ts b/src/deprecated/form.ts deleted file mode 100755 index 7d66857..0000000 --- a/src/deprecated/form.ts +++ /dev/null @@ -1,128 +0,0 @@ -import m, {RequestOptions} from 'mithril' -import objectToFormData from 'object-to-formdata' -import {FormStatus, FormStore} from '../store/formstore' -import { - Boxes, - Checkbox, - Fields, - Input, - Radios, - Select, - Textarea -} from '../ui/form/fields' - -export class FormBase { - constructor(protected store: FormStore, protected fields: Fields) {} - - status() { - return this.store.status.type - } - - isCompleted() { - return this.status() == FormStatus.Success - } - - formSubmit(e: Event, options = {}) { - e.preventDefault() - const form = e.target as HTMLFormElement - const {action: url, method} = form - const type = form.getAttribute('enctype') || 'application/json' - return this.submit(type, {url, method, ...options}) - } - - submit(type: string, options: {url: string} & RequestOptions) { - const {url, method, headers = {}, ...rest} = options - switch (this.store.status.type) { - case 'sending': - case 'success': - return Promise.resolve() - default: - return this.transfer({ - url, - method, - data: this.formatData(type), - headers: - type.indexOf('multipart') === 0 - ? headers - : {'Content-Type': type, ...headers}, - serialize: v => v, - ...rest - }).then( - response => Promise.resolve(this.store.success(response)), - errors => Promise.reject(this.store.fail(errors)) - ) - } - } - - formatData(type: string) { - switch (type) { - case 'application/x-www-form-urlencoded': - return m.buildQueryString(this.store.data) - case 'multipart/form-data': - return objectToFormData(this.store.data) - case 'application/json': - return JSON.stringify(this.store.data) - } - } - - transfer(request: RequestOptions & {url: string}) { - return m.request({ - ...request, - config: (xhr: XMLHttpRequest) => { - this.store.send(xhr) - } - }) - } - - text = (config: any) => this.fields.asField(Input, {...config}) - email = (config: any) => this.text({...config, type: 'email'}) - password = (config: any) => this.text({...config, type: 'password'}) - textarea = (config: any) => this.fields.asField(Textarea, {...config}) - select = (config: any) => this.fields.asField(Select, config) - radio = (config: any) => this.fields.asField(Radios, config) - checkbox = (config: any) => this.fields.asField(Checkbox, config) - boxes = (config: any) => this.fields.asField(Boxes, config) -} - -/** - * Als instance klasse van de view waar je de form wilt gebruiken maak je een nieuw Form aan. - * Het onsubmit event van je html formulier koppel je door aan de submit methode van dit form object. - * Velden toevoegen aan je html formulier is gemakkelijk via de shortcurts die je vind op dit form object. - * Wanneer het onsucces event wordt aangeroepen weet je dat het formulier succesvol verwerkt is door de server. - * - * Eigen custom velden maken en toevoegen kan door de attrs methode te gebruiken (zie implementatie shortcuts). - * Een eigen veld moet ten minste de attributes 'value' en 'onchange' ondersteunen om te functioneren. - * - * Langs de serverkant moet je een route voorzien die de data verwerkt. - * Deze stuurt een json bericht terug van volgende type: - * { - * "succes": true | false - * "errors": { ... } // Alleen als succes false is - * "data": { ... } // Alleen als succes true is (wordt meegegeven als argument aan de onsucces) - * } - * - * TODO: - * - Gebruik de setCustomValidity methode om de in-browser validatie toe te passen op elementen met een error - * - Select vervangen door geheel eigen implementatie (die makkelijker te stylen is als de standaard html select) - * - Een flexibel en veilig wysiwyg-editor veld toevoegen (bv. tinymce) - * - Basis styling van bestaande elementen robuuster en flexibeler maken - */ -export class Form extends FormBase { - constructor({data = {}, ...config} = {}) { - const store = new FormStore(data) - const fields = new Fields(store, { - defaultUnstyled: true, - labelInFields: false, - defaultRequired: false, - ...config - }) - super(store, fields) - } - - formSubmit(e: Event, options?: any) { - return super.formSubmit(e, options).catch(errors => { - const [firstKey] = Object.keys(errors) - if (firstKey) this.fields.focusField(firstKey) - }) - } -} diff --git a/src/deprecated/index.ts b/src/deprecated/index.ts deleted file mode 100755 index a0e820d..0000000 --- a/src/deprecated/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './action' -export * from './background' -export * from './form' -export * from './page' -export * from './picture' -export * from './router' -export * from './slider' diff --git a/src/deprecated/page.ts b/src/deprecated/page.ts deleted file mode 100755 index 0d378f3..0000000 --- a/src/deprecated/page.ts +++ /dev/null @@ -1,34 +0,0 @@ -import m, {CVnode} from 'mithril' -import {Component} from '../ui/component' - -type Route = { - href: string - path: string - params: {} -} - -export class Page extends Component<{route: Route} & T> { - currentRoute: Route - - constructor(vnode: CVnode<{route: Route} & T>) { - super(vnode) - this.currentRoute = this.attrs.route - } - - oninit(vnode: CVnode<{route: Route} & T>) { - super.oninit(vnode) - this.onroutechange() - } - - onafterupdate() { - const last = this.currentRoute.href - this.currentRoute = this.attrs.route - if (last !== this.currentRoute.href) this.onroutechange() - } - - onroutechange() {} - - static render(attrs: any) { - return m(this, attrs) - } -} diff --git a/src/deprecated/picture.ts b/src/deprecated/picture.ts deleted file mode 100755 index b5c2886..0000000 --- a/src/deprecated/picture.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {DOMAttrs} from '../hyperscript' -import m from 'mithril' -import {Image, ImageResizer} from '../ui/image' -import {View} from '../ui/view' -import {classes} from '../util/classes' - -const WIDTHS = [100, 200, 400, 600, 800] -const HEIGHTS = [100, 200, 400, 600, 800] - -export function getResizedUrl(url: string, width: number, height: number) { - let w = WIDTHS.find(w => w > width) - let h = HEIGHTS.find(h => h > height) - if (!w) w = WIDTHS[WIDTHS.length - 1] - if (!h) h = HEIGHTS[HEIGHTS.length - 1] - return `/cache/${w}/${h}${url}` -} - -export class Picture extends View< - { - src: string - empty?: boolean - width?: number - height?: number - inline?: boolean - max?: number - [key: string]: any - }, - HTMLDivElement -> { - render() { - const { - children, - inline, - class: className, - max, - empty, - focus: position, - ...rest - } = this.attrs - if (empty) return - return m(ImageResizer, - { - resize: ( - attrs: {src: string} & DOMAttrs, - container: {width: number; height: number} - ) => { - const {src} = attrs - if (src.indexOf('://') > -1) return attrs - const url = getResizedUrl(src, container.width, Infinity) - return {...attrs, src: url} - } - }, - m(Image, { - upScale: true, - position, - style: {display: inline && 'inline'}, - ...classes('picture', className), - ...rest - }) - ) - } -} diff --git a/src/deprecated/router.ts b/src/deprecated/router.ts deleted file mode 100755 index 1813e57..0000000 --- a/src/deprecated/router.ts +++ /dev/null @@ -1,81 +0,0 @@ -import jump from 'jump.js' -import m from 'mithril' - -export class Router { - transport: null | XMLHttpRequest = null - data: any = {} - - constructor(initialState: any) { - this.data = initialState - } - - url() { - return this.data.url - } - - view(vnode: any) { - const {href} = window.location - const params = - href.indexOf('?') > -1 ? m.parseQueryString(href.split('?')[1]) : {} - const route = {href, path: window.location.pathname, params} - return this.resolve(this.data, route) - } - - mount(element: HTMLElement) { - window.onpopstate = e => { - if (e.state) { - this.setData(e.state.data) - m.redraw() - } else { - this.navigate(window.location.pathname) - } - } - m.mount(element, this) - } - - getPageTitle(data: any) { - return data.title - } - - setData(data: any) { - this.data = data - const {hash, href} = window.location - const queryIndex = href.indexOf('?') - const query = queryIndex > -1 ? href.substr(queryIndex) : '' - window.history.replaceState({data}, this.getPageTitle(data)) - document.title = this.getPageTitle(data) - } - - clear() { - if (!this.transport) return - this.transport.abort() - this.transport = null - } - - scroll(hash?: string) { - if (hash) jump(hash) - else window.scrollTo(0, 0) - } - - fetch(path: string) { - return Promise.reject('implement') - } - - resolve(data: any, route: any) { - throw 'implement' - } - - navigate(path: string) { - const {hash} = window.location - if (path == this.url()) { - if (hash) this.scroll(hash) - } else { - this.clear() - return this.fetch(path).then(data => { - this.setData(data) - setTimeout(() => this.scroll(hash)) - return data - }) - } - } -} diff --git a/src/deprecated/slider.less b/src/deprecated/slider.less deleted file mode 100644 index b4a80c3..0000000 --- a/src/deprecated/slider.less +++ /dev/null @@ -1,13 +0,0 @@ -.slider { - height: 100%; - - .carousel-content { - display: block; - height: 100%; - white-space: nowrap; - - > * { - white-space: normal; - } - } -} \ No newline at end of file diff --git a/src/deprecated/slider.ts b/src/deprecated/slider.ts deleted file mode 100644 index bb9dd45..0000000 --- a/src/deprecated/slider.ts +++ /dev/null @@ -1,26 +0,0 @@ -import './slider.less' - -import {CarouselStore} from '../store/carouselstore' - -export {Carousel as Slider} from '../ui/carousel' - -// Backwards compatibility -export class SliderStore extends CarouselStore { - className = 'slider' - - index() { - if (!this.carousel) return this.initialPage - return this.activePage - } - - total() { - return this.totalPages - } - - actives() { - if (!this.carousel) return [] - return this.carousel.snaps.elements.map((_, i) => () => this.isActive(i)) - } - - //animating = stream(false) -} diff --git a/src/hyperscript.ts b/src/hyperscript.ts deleted file mode 100755 index 29c5a43..0000000 --- a/src/hyperscript.ts +++ /dev/null @@ -1,78 +0,0 @@ -import 'core-js/features/object/assign' - -import hyperscript, {Attributes, Child, Children, CVnode} from 'mithril' -import {Component, View} from './ui' -import {extractChildren} from './util/children' - -export type ChildAttr = {children: T} | {children?: T} - -const mithrilStatic = {...hyperscript} - -export type ClassComponents = - | {new (vnode: CVnode): View} - | {new (vnode: CVnode): Component} - -export type ComponentConstructors = - | {(attrs: Attrs): Children} - | ClassComponents - -type Without = Pick> -type AttributesArgument = Without & {key?: any} -type OptionalAttrs = {} extends Attrs - ? {} - : {children: any} extends Attrs - ? {} - : never -export type ChildrenType = ({children?: Children} & Attrs)['children'] - -type ExtendedHyperscript = { - (selector: string, ...children: Children[]): Children - (selector: string, attributes: Attributes, ...children: Children[]): Children - >( - component: ComponentConstructors, - ...args: Array> - ): Children - ( - component: ComponentConstructors, - attributes: AttributesArgument, - ...args: Array> - ): Children -} & typeof mithrilStatic - -const isPlainFunction = (input: Function) => - typeof input === 'function' && typeof input.prototype.view !== 'function' - -export type Attrs = Partial & { - [key: string]: any -} - -export type DOMAttrs = {[key: string]: any} - -export const m: ExtendedHyperscript = Object.assign( - (selector: any, attrs: any, ...children: any) => { - const makeChildren = (children: any) => - !children || children.length === 0 - ? {} - : {children: extractChildren(children)} - if (isPlainFunction(selector)) { - if ( - attrs && - (typeof attrs !== 'object' || attrs.tag != null || Array.isArray(attrs)) - ) - return selector(makeChildren([].concat(attrs).concat(children))) - return selector({...attrs, ...makeChildren(children)}) - } - if ( - typeof selector === 'string' && - attrs && - !Array.isArray(attrs) && - typeof attrs === 'object' && - !attrs.tag - ) { - const {children: childrenAttr, ...rest} = attrs - return hyperscript(selector, rest, childrenAttr, ...children) - } - return hyperscript(selector, attrs, ...children) - }, - hyperscript -) diff --git a/src/index.ts b/src/index.ts deleted file mode 100755 index ba62d7e..0000000 --- a/src/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './container' -export * from './hyperscript' -export * from './router' -export * from './store' -export * from './ui' -export * from './styled' -export * from './util' -export * from './deprecated' diff --git a/src/router/index.ts b/src/router/index.ts deleted file mode 100755 index b857556..0000000 --- a/src/router/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {Router} from './router' - -export * from './link' -export * from './redirect' -export * from './parseroute' -export * from './route' -export * from './switch' -export const HistoryRouter = Router -export {Location, RouterContext, Matcher} from './router' diff --git a/src/router/link.ts b/src/router/link.ts deleted file mode 100755 index 4630c80..0000000 --- a/src/router/link.ts +++ /dev/null @@ -1,63 +0,0 @@ -// See: https://github.com/jorgebucaran/hyperapp-router/blob/19f95f843ae2dc5b4d83f9647edc591a6450c4e3/src/Link.js -import {m} from '../hyperscript' -import {View} from '../ui/view' -import {addClasses} from '../util/classes' -import {Location, RouterContext} from './router' - -export class Link extends View<{ - to: string - target?: string - onclick?: Function - [key: string]: any -}> { - render() { - const {to, target, download, onclick, children, ...attrs} = this.attrs - return m(Location, (location: RouterContext) => { - const href = location.formatPath(to) - const active = !!location.match({path: to, exact: attrs.exact}) - const anchorAttrs = addClasses( - { - ...attrs, - href, - target, - download, - onclick: (e: MouseEvent & {redraw: boolean}) => { - e.redraw = false - if (onclick) onclick(e) - const ignore = - download || - target === '_blank' || - ignoreClick(e) || - isExternal(location, e.currentTarget as HTMLAnchorElement) - if (ignore) return - e.preventDefault() - location.push(href) - } - }, - {is: {active}} - ) - return m('a', anchorAttrs, children) - }) - } -} - -const ignoreClick = (e: MouseEvent) => - e.defaultPrevented || - e.button !== 0 || - e.altKey || - e.metaKey || - e.ctrlKey || - e.shiftKey - -type LocationProperties = {protocol: string; hostname: string; port?: string} - -const isExternal = ( - location: LocationProperties, - anchorElement: HTMLAnchorElement -) => getOrigin(location) !== getOrigin(anchorElement) - -const getOrigin: (location: LocationProperties) => string = ({ - protocol, - hostname, - port = '' -}) => `${protocol}//${hostname}${port && `:${port}`}` diff --git a/src/router/parseroute.ts b/src/router/parseroute.ts deleted file mode 100755 index 74ecb2c..0000000 --- a/src/router/parseroute.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Source: https://github.com/jorgebucaran/hyperapp-router/blob/19f95f843ae2dc5b4d83f9647edc591a6450c4e3/src/parseRoute.js - -export type Match = { - isExact: boolean - path: string - url: string - params?: { - [key: string]: any - } -} - -function createMatch( - isExact: boolean, - path: undefined | string, - url: string, - params?: {} -): Match { - return { - isExact, - path: path || '', - url, - params - } -} - -function trimTrailingSlash(url: string) { - for (var len = url.length; '/' === url[--len]; ); - return url.slice(0, len + 1) -} - -function decodeParam(val: string) { - try { - return decodeURIComponent(val) - } catch (e) { - return val - } -} - -export const parseRoute = ( - url: string, - route: {path?: string; exact?: boolean} -) => { - const {path, exact = false} = route - if (path === url || !path) return createMatch(path === url, path, url) - var paths = trimTrailingSlash(path).split('/') - var urls = trimTrailingSlash(url).split('/') - - if (paths.length > urls.length || (exact && paths.length < urls.length)) - return - - for ( - var i = 0, - params: {[key: string]: string} = {}, - len = paths.length, - url = ''; - i < len; - i++ - ) { - if (':' === paths[i][0]) { - params[paths[i].slice(1)] = urls[i] = decodeParam(urls[i]) - } else if (paths[i] !== urls[i]) { - return - } - url += urls[i] + '/' - } - - return createMatch(false, path, url.slice(0, -1), params) -} diff --git a/src/router/redirect.ts b/src/router/redirect.ts deleted file mode 100755 index e7995d9..0000000 --- a/src/router/redirect.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {m} from '../hyperscript' -import {View} from '../ui/view' -import {Location, RouterContext} from './router' - -export class Redirect extends View<{ - to: string -}> { - render() { - const {to} = this.attrs - return m(Location, (location: RouterContext) => - location.replace(location.formatPath(to)) - ) - } -} diff --git a/src/router/route.ts b/src/router/route.ts deleted file mode 100755 index de9db57..0000000 --- a/src/router/route.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {ComponentConstructors, m} from '../hyperscript' -import {View} from '../ui/view' -import {Match} from './parseroute' -import {Location, RouteInfo, RouterContext} from './router' - -export type RouteAttrs = RouteInfo & { - children: ComponentConstructors<{ - match?: Match - location?: RouterContext - [key: string]: any - }> -} - -export class Route extends View { - render() { - const {children} = this.attrs - return m(Location, (location: RouterContext) => { - const match = location.match(this.attrs) - return match && children && m(children, {match, location}) - }) - } -} diff --git a/src/router/router.ts b/src/router/router.ts deleted file mode 100755 index b090a85..0000000 --- a/src/router/router.ts +++ /dev/null @@ -1,103 +0,0 @@ -import {Children} from 'mithril' -import {m} from '../hyperscript' -import {createContext} from '../ui/context' -import {StatelessView, View} from '../ui/view' -import {Match, parseRoute} from './parseroute' -import {RouteAttrs} from './route' - -export type LocationData = { - protocol: string - hostname: string - port: string - search: string - hash: string - pathname: string -} - -export type History = { - replace: (to: string) => void - push: (href: string) => void -} - -export type RouteInfo = { - path?: string - exact?: boolean -} - -export type Matcher = ( - location: LocationData, - route: RouteInfo -) => undefined | Match - -export type RouterContext = LocationData & - History & - RouterAttrs & { - match: (route: RouteInfo) => Match - formatPath: (path: string) => string - } - -const {Provider, Consumer} = createContext() - -export const Location: StatelessView<{ - children: (location: RouterContext) => Children -}> = ({children}) => - m(Consumer, - (location: undefined | RouterContext) => location && children(location) - ) - -const pathnameMatcher: Matcher = (location, route) => - parseRoute(location.pathname, route) - -type RouterAttrs = { - matcher?: Matcher - formatPath?: (path: string) => string -} - -export class Router extends View { - static instances = 0 - - onCreate() { - if (!Router.instances++) { - window.addEventListener('popstate', m.redraw) - window.addEventListener('hashchange', m.redraw) - } - this.onRemove = () => { - if (!--Router.instances) { - window.removeEventListener('popstate', m.redraw) - window.removeEventListener('hashchange', m.redraw) - } - } - } - - render() { - const { - matcher = pathnameMatcher, - formatPath = (v: string) => v - } = this.attrs - const {location, history} = window - const {protocol, hostname, port, search, hash, pathname} = location - return m(Provider, - { - value: { - protocol, - hostname, - port, - search, - hash, - pathname, - replace: (to: string) => { - history.replaceState(pathname, '', to) - m.redraw() - }, - push: (href: string) => { - history.pushState(href, '', href) - m.redraw() - }, - match: (route: RouteAttrs) => matcher(location, route), - formatPath - } as RouterContext - }, - this.children - ) - } -} diff --git a/src/router/switch.ts b/src/router/switch.ts deleted file mode 100755 index 29eff0a..0000000 --- a/src/router/switch.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Children, Vnode} from 'mithril' -import {ComponentConstructors, m} from '../hyperscript' -import {View} from '../ui/view' -import {extractChildren} from '../util/children' -import {Match} from './parseroute' -import {Route, RouteAttrs} from './route' -import {Location, RouterContext} from './router' - -export class Switch extends View<{ - children: Array> -}> { - render() { - const {children} = this.attrs - return m(Location, (location: RouterContext) => { - for (const child of children) { - if (child.tag !== Route) - throw `Unexpected child type "${child.tag}", expected "Route"` - const render = extractChildren( - child.children - ) as ComponentConstructors<{match?: Match; location?: RouterContext}> - const match = location.match(child.attrs) - if (!match) continue - return render && m(render, {match, location}) - } - }) - } -} diff --git a/src/store/autocompletestore.ts b/src/store/autocompletestore.ts deleted file mode 100755 index 379b62e..0000000 --- a/src/store/autocompletestore.ts +++ /dev/null @@ -1,106 +0,0 @@ -export enum AutocompleteChange { - MouseUp = 'MouseUp', - KeyArrowUp = 'KeyArrowUp', - KeyArrowDown = 'KeyArrowDown', - KeyEscape = 'KeyEscape', - KeyHome = 'KeyHome', - KeyEnd = 'KeyEnd', - KeySpace = 'KeySpace', - KeyEnter = 'KeyEnter', - ItemMouseEnter = 'ItemMouseEnter', - ItemClick = 'ItemClick', - InputBlur = 'InputBlur', - InputChange = 'InputChange', - ButtonClick = 'ButtonClick', - ButtonBlur = 'ButtonBlur' -} - -export type AutocompleteAction = - | {type: AutocompleteChange.KeyEscape} - | {type: AutocompleteChange.ButtonBlur} - | {type: AutocompleteChange.ButtonClick} - | {type: AutocompleteChange.InputBlur} - | {type: AutocompleteChange.MouseUp} - | {type: AutocompleteChange.KeyArrowDown; amount: number; total: number} - | {type: AutocompleteChange.KeyArrowUp; amount: number; total: number} - | {type: AutocompleteChange.KeyEnter; item: Item} - | {type: AutocompleteChange.ItemClick; item: Item} - | {type: AutocompleteChange.ItemMouseEnter; index: number} - | {type: AutocompleteChange.InputChange; value: string} - -export interface AutocompleteState { - highlightedIndex: number | null - inputValue: string | null - isOpen: boolean - selectedItem: Item | null -} - -type AutocompleteProps = { - items: Array - itemToString: (item: Item) => string -} - -type AutocompleteReducer = ( - state: AutocompleteState, - action: AutocompleteAction, - props: AutocompleteProps -) => AutocompleteState - -export const autocompleteReducer = ( - state: AutocompleteState, - action: AutocompleteAction, - props: { - items: Array - itemToString: (item: Item) => string - } -): AutocompleteState => { - const {highlightedIndex} = state - const reset = {selectedItem: null} - switch (action.type) { - case AutocompleteChange.ButtonClick: - if (state.isOpen) return {...state, ...reset, isOpen: false} - return {...state, ...reset, highlightedIndex: null, isOpen: true} - case AutocompleteChange.KeyEscape: - case AutocompleteChange.ButtonBlur: - case AutocompleteChange.InputBlur: - case AutocompleteChange.MouseUp: - return {...state, ...reset, isOpen: false} - case AutocompleteChange.ItemClick: - case AutocompleteChange.KeyEnter: - return { - ...state, - isOpen: false, - inputValue: props.itemToString(action.item), - selectedItem: action.item - } - case AutocompleteChange.KeyArrowDown: - case AutocompleteChange.KeyArrowUp: - const next = - (highlightedIndex === null ? -1 : highlightedIndex) + action.amount - if (next < 0 || next >= action.total) return state - return {...state, highlightedIndex: next} - case AutocompleteChange.ItemMouseEnter: - return {...state, highlightedIndex: action.index} - case AutocompleteChange.InputChange: - return {...state, ...reset, highlightedIndex: null, isOpen: true, inputValue: action.value} - } -} - -export class AutocompleteStore implements AutocompleteState { - highlightedIndex: number | null = null - inputValue: string | null = null - isOpen: boolean = false - selectedItem: Item | null = null - private reducer: AutocompleteReducer - - constructor(reducer: AutocompleteReducer = autocompleteReducer) { - this.reducer = reducer - } - - dispatch = ( - action: AutocompleteAction, - props: AutocompleteProps - ) => { - return Object.assign(this, this.reducer(this, action, props)) - } -} diff --git a/src/store/carouselstore.ts b/src/store/carouselstore.ts deleted file mode 100644 index 3447ff2..0000000 --- a/src/store/carouselstore.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {Carousel, CarouselAttrs} from '../ui/carousel' - -export class CarouselStore implements CarouselAttrs { - carousel?: Carousel - snapTo?: 'elements' | 'pages' - infinite?: boolean - tug?: number - power?: number - overflow?: boolean - protected initialPage: number = 0 - - constructor(options?: CarouselAttrs & {initialPage?: number}) { - Object.assign(this, options) - } - - /** @internal */ - connect = (carousel: Carousel) => { - if (!this.carousel && this.initialPage !== 0) - carousel.preselectPage(this.initialPage) - this.carousel = carousel - } - - get activePage() { - if (!this.carousel) return this.initialPage - return this.carousel.activePage - } - - get totalPages() { - if (!this.carousel) return 0 - return this.carousel.snaps.pages.length - } - - has(index: number) { - return index >= 0 && index < this.totalPages - } - - hasNext() { - return this.has(this.activePage + 1) - } - - hasPrevious() { - return this.has(this.activePage - 1) - } - - goTo(index: number) { - if (!this.carousel) return (this.initialPage = index) - return this.has(index) && this.carousel.goTo(index) - } - - goNext() { - return this.goTo(this.activePage + 1) - } - - goPrevious() { - return this.goTo(this.activePage - 1) - } - - isActive(childIndex: number): boolean { - if (!this.carousel) return false - return this.carousel.isActive(childIndex) - } -} diff --git a/src/store/formstore.ts b/src/store/formstore.ts deleted file mode 100755 index c748082..0000000 --- a/src/store/formstore.ts +++ /dev/null @@ -1,55 +0,0 @@ -import m from 'mithril' - -export const FormStatus = { - Reset: 'reset', - Sending: 'sending', // {xhr} - Failure: 'error', // {errors} - Success: 'success' // {response} -} - -export type FormState = - | {type: 'reset'} - | {type: 'sending'; xhr: XMLHttpRequest} - | {type: 'error'; errors: {[key: string]: any}} - | {type: 'success'; response: {[key: string]: any}} - -export class FormStore { - data: {[key: string]: any} - status: FormState - - constructor(data = {}) { - this.data = data - this.status = {type: 'reset'} - } - - send(xhr: XMLHttpRequest) { - this.status = {type: 'sending', xhr} - } - - success(response: any) { - this.status = {type: 'success', response} - return response - } - - fail(errors: any) { - this.status = {type: 'error', errors} - return errors - } - - reset() { - switch (this.status.type) { - case 'sending': - this.status.xhr.abort() - default: - this.status = {type: 'reset'} - } - } - - setData(key: string, value: any) { - this.data[key] = value - } - - toString() { - return this.status.type - } -} diff --git a/src/store/index.ts b/src/store/index.ts deleted file mode 100755 index 37514f1..0000000 --- a/src/store/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './autocompletestore' -export * from './carouselstore' -export * from './formstore' -export * from './modalstore' diff --git a/src/store/modalstore.ts b/src/store/modalstore.ts deleted file mode 100755 index c74d285..0000000 --- a/src/store/modalstore.ts +++ /dev/null @@ -1,14 +0,0 @@ -import stream from 'mithril/stream' - -export class ModalStore { - isOpen = false - - open = () => - this.isOpen = true - - close = () => - this.isOpen = false - - toggle = () => - this.isOpen = !this.isOpen -} \ No newline at end of file diff --git a/src/styled/index.ts b/src/styled/index.ts deleted file mode 100755 index 9bc65a5..0000000 --- a/src/styled/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './styled' diff --git a/src/styled/styled.ts b/src/styled/styled.ts deleted file mode 100755 index d820aec..0000000 --- a/src/styled/styled.ts +++ /dev/null @@ -1,96 +0,0 @@ -import createCache from '@emotion/cache' -import isPropValid from '@emotion/is-prop-valid' -import {serializeStyles} from '@emotion/serialize' -import {EmotionCache, getRegisteredStyles, insertStyles} from '@emotion/utils' -import {StatelessView} from '../ui' -import {DOMAttrs, m} from '../hyperscript' -import {createContext} from '../ui/context' - -const EmotionCacheContext = createContext(createCache()) - -type Styled = { - (tag: string): (...args: any[]) => StatelessView - (tag: T): (...args: any[]) => T -} - -const concatClasses = (classes: Array) => - classes.filter(v => v).join(' ') - -const addClasses = (attrs: DOMAttrs, ...rest: Array): DOMAttrs => { - const {class: c1, className: c2, ...props} = attrs - return {...props, class: concatClasses([c1, c2, ...rest])} -} - -const filterProps = (props: DOMAttrs) => { - const res: DOMAttrs = {} - for (const key in props) if (isPropValid(key)) res[key] = props[key] - return res -} - -export const styled: Styled = (tag: any): any => { - const isReal = tag.__emotion_real === tag - const baseTag = (isReal && tag.__emotion_base) || tag - - return function(): StatelessView { - const args = arguments - const styles: any = /*isReal && tag.__emotion_styles !== undefined - ? tag.__emotion_styles.slice(0) - :*/ [] - const name = - (typeof tag === 'string' && tag) || - (tag.name !== 'component' && tag.name) || - tag.displayName - if (name) styles.push(`label:${name};`) - if (args[0] == null || args[0].raw === undefined) { - styles.push.apply(styles, args) - } else { - styles.push(args[0][0]) - const len = args.length - for (let i = 1; i < len; i++) { - styles.push(args[i], args[0][i]) - } - } - - const component: StatelessView = ({ - children, - className: extra, - ...attrs - }) => - m(EmotionCacheContext.Consumer, (cache: EmotionCache) => { - let className = '' - const classInterpolations: Array = [] - if (typeof extra === 'string') { - className += getRegisteredStyles( - cache.registered, - classInterpolations, - extra - ) - } - // Todo: typescript typings are wrong, first two arguments are switched - const serialized = (serializeStyles as any)( - styles.concat(classInterpolations), - cache.registered, - attrs - ) - const rules = insertStyles(cache, serialized, typeof tag === 'string') - className += `${cache.key}-${serialized.name}` - if (typeof tag === 'string' && attrs.as) { - tag = attrs.as - delete attrs.as - } - const props = - typeof tag === 'string' - ? filterProps(addClasses(attrs, className)) - : addClasses(attrs, className) - return m(tag, props, children) - }) - - const Styled: any = component - if (name) Styled.displayName = name - Styled.__emotion_real = Styled - Styled.__emotion_base = baseTag - Styled.__emotion_styles = styles - - return Styled - } -} diff --git a/src/ui/breakpoint.ts b/src/ui/breakpoint.ts deleted file mode 100755 index 55ed740..0000000 --- a/src/ui/breakpoint.ts +++ /dev/null @@ -1,51 +0,0 @@ -import m, {Children} from 'mithril' -import {View} from './view' - -export class Breakpoint extends View< - { - children?: (attrs: T) => Children - } & { - [breakpoint: string]: T - } -> { - matchers = new Map() - - onInit = this.createMatchers - onBeforeUpdate = this.createMatchers - onRemove = this.removeMatchers - - createMatchers() { - const {children, ...breakpoints} = this.attrs - const keys = Object.keys(breakpoints) - keys.forEach(query => { - if (this.matchers.has(query)) return - const matcher = matchMedia(query) - matcher.addListener(m.redraw) - this.matchers.set(query, matchMedia(query)) - }) - this.removeMatchers(keys) - } - - removeMatchers(except: Array = []) { - this.matchers.forEach((matcher, query) => { - if (except.indexOf(query) > -1) return - matcher.removeListener(m.redraw) - this.matchers.delete(query) - }) - } - - render() { - const {children, ...breakpoints} = this.attrs - const keys = Object.keys(breakpoints) - const active = Array.from(this.matchers).reduce( - (active: null | string, [key, matcher]) => { - if (!matcher.matches) return active - if (!active) return key - if (keys.indexOf(key) > keys.indexOf(active)) return key - return active - }, - null - ) - return active && children && children(this.attrs[active]) - } -} diff --git a/src/ui/carousel.less b/src/ui/carousel.less deleted file mode 100644 index 086fb40..0000000 --- a/src/ui/carousel.less +++ /dev/null @@ -1,9 +0,0 @@ -.carousel { - height: 100%; - width: 100%; - - .carousel-content { - height: 100%; - display: flex; - } -} diff --git a/src/ui/carousel.ts b/src/ui/carousel.ts deleted file mode 100644 index 6bf4462..0000000 --- a/src/ui/carousel.ts +++ /dev/null @@ -1,291 +0,0 @@ -import './carousel.less' -// We polyfill these as they're used in popmotion. Babel runtime transform -// doesn't pick these up if they're in in an external lib like this one -// (I think). -import 'core-js/features/object/assign' -import 'core-js/features/array/from' -import 'core-js/features/weak-set' - -import deepEqual from 'deep-equal' -import {calc, listen, pointer, spring, styler, value} from 'popmotion' -import {debounce} from 'throttle-debounce' -import {m} from '../hyperscript' -import {Lethargy} from '../util/lethargy' -import {View} from './view' - -// Todo: -// https://www.w3.org/WAI/tutorials/carousels/structure/ -// http://w3c.github.io/aria-practices/examples/carousel/carousel-1/carousel-1.html -// infinite scroll - lazy load - autoplay - -const mix = calc.getValueFromProgress - -type Snaps = {pages: Array; elements: Array} - -const closest = (snaps: Array, value: number) => - snaps.reduce((prev, curr) => - Math.abs(curr - value) < Math.abs(prev - value) ? curr : prev - ) - -const angleIsVertical = (angle: number) => { - const isUp = angle <= -90 + 45 && angle >= -90 - 45 - const isDown = angle <= 90 + 45 && angle >= 90 - 45 - return isUp || isDown -} - -export type CarouselAttrs = { - snapTo?: 'elements' | 'pages' - infinite?: boolean - tug?: number - power?: number - overflow?: boolean - draggable?: boolean - touchpadSupport?: boolean - // Backwards compatibility - unstyled?: boolean - connect?: (instance: Carousel) => void -} - -export class Carousel extends View< - CarouselAttrs & {className?: string}, - HTMLDivElement -> { - dom!: HTMLDivElement - offset = value(0) - snaps: Snaps = {pages: [0], elements: [0]} - activePage = 0 - preventClick = false - destination: number = 0 - - get content(): HTMLDivElement { - return this.dom.firstChild as HTMLDivElement - } - - get max() { - return this.content.scrollWidth - this.dom.offsetWidth - } - - get x() { - return this.offset.get() as number - } - - redraw() { - m.redraw() - } - - onCreate() { - const {draggable = true, touchpadSupport = true} = this.attrs - this.onUpdate() - - const contentStyler = styler(this.content) - const clearSubscription = this.offset.subscribe((offset: number) => { - contentStyler.set('x', offset) - }).unsubscribe - - let clearDraggable = clearSubscription - - if (draggable) { - const snapToPoint = (start: number) => { - const {snapTo = 'pages', power = 0.25} = this.attrs - const snaps = this.snaps[snapTo] - const from = this.x - const velocity = this.offset.getVelocity() - const distance = from - start - const amplitude = power * velocity - const idealTarget = Math.round(from + amplitude) - const snap = closest(snaps, -idealTarget) - this.preventClick = Math.abs(distance) > 1 - this.spring(snap) - } - - let clearTrack = () => {} - - const clearMove = listen(this.dom, 'mousedown touchstart').start( - (event: MouseEvent | TouchEvent) => { - const start = this.x - if (event instanceof MouseEvent && event.which !== 1) return - this.preventClick = false - clearTrack = pointer({ - x: start, - preventDefault: false - }) - .pipe( - (pos: {x: number}) => pos.x, - this.overDrag - ) - .start(this.offset).stop - listen(document, 'mouseup touchend', {once: true}).start(() => - snapToPoint(start) - ) - } - ).stop - - const onClick = (e: MouseEvent) => { - if (!this.preventClick) return clearTrack() - e.stopPropagation() - e.preventDefault() - } - - this.dom.addEventListener('click', onClick, true) - const clearClick = () => - this.dom.removeEventListener('click', onClick, true) - - clearDraggable = () => { - clearSubscription() - clearMove() - clearTrack() - clearClick() - } - } - - let clearTouchpad = () => {} - if (touchpadSupport) { - this.dom.addEventListener('wheel', this.onWheel) - clearTouchpad = () => this.dom.removeEventListener('wheel', this.onWheel) - } - - window.addEventListener('resize', this.onResize) - const clearResize = () => - window.removeEventListener('resize', this.onResize) - - this.onRemove = () => { - clearDraggable() - clearTouchpad() - clearResize() - } - - this.redraw() - } - - lethargy = new Lethargy() - wheelStart: null | number = null - wheelPanning = false - onWheel = (e: MouseWheelEvent) => { - if (this.wheelStart === null) this.wheelStart = this.x - const angle = calc.angle({ - x: e.deltaX, - y: e.deltaY - }) - const direction = this.lethargy.check(e.deltaX) - if (angleIsVertical(angle)) return - e.stopPropagation() - e.preventDefault() - if (direction === false) return - if (this.wheelPanning) return - this.goTo(this.activePage + direction) - this.wheelPanning = true - setTimeout(() => (this.wheelPanning = false), 500) - } - - onResize = debounce(250, () => this.onUpdate()) - - onUpdate() { - const oldSnaps = {...this.snaps} - this.snaps = this.calcSnaps() - const {connect} = this.attrs - if (connect) connect(this) - if (deepEqual(oldSnaps, this.snaps)) return - this.spring(this.snaps.pages[this.activePage]) - } - - overDrag = (v: number) => { - const {tug = 0.4} = this.attrs - const min = -this.max, - max = 0 - if (v < min) return mix(min, v, tug) - if (v > max) return mix(max, v, tug) - return v - } - - calcSnaps() { - const pageWidth = this.dom.offsetWidth - const children = Array.from(this.content.children) as Array - return children.reduce( - ({pages, elements}, child, i) => { - const prevPage = pages[pages.length - 1] - const prevElement = elements[elements.length - 1] - const width = child.offsetWidth - const offset = prevElement + width - elements.push(offset) - if (prevElement > 0 && offset - prevPage > pageWidth) - pages.push(prevElement) - return {pages, elements} - }, - {pages: [0], elements: [0]} - ) - } - - snapToAnimation = (options: {from: number; to: number}) => { - spring({ - ...options, - velocity: this.offset.getVelocity(), - stiffness: 100, - damping: 20 - }).start(this.offset) - this.redraw() - } - - spring(destination: number, animate = this.snapToAnimation) { - const from = this.x - this.destination = Math.min(destination, this.max) - const to = -this.destination - this.setActivePage(destination) - if (from !== to) animate({from, to}) - } - - setActivePage(destination: number) { - const {pages} = this.snaps - this.activePage = pages.indexOf(closest(pages, destination)) - } - - preselectPage(index: number) { - const {pages} = this.snaps - const destination = pages[index] - if (destination > 0) - this.spring(destination, ({to}) => { - this.offset.update(to) - }) - } - - goTo = (pageIndex: number) => { - const {pages} = this.snaps - if (pageIndex < 0) return - if (pageIndex > pages.length - 1) return - this.spring(pages[pageIndex]) - } - - goToElement = (elementIndex: number) => { - const {elements} = this.snaps - this.spring(elements[elementIndex]) - } - - isActive = (elementIndex: number) => { - const width = this.dom.offsetWidth - const x = this.destination - const pos = this.snaps.elements[elementIndex] - const next = this.snaps.elements[elementIndex + 1] - // The 5 here accounts for rounding errors on high dpi screens, - // there's possibly a better way but I don't see it at this time - return pos >= x && next - 5 <= x + width - } - - render() { - const {draggable = true, overflow, unstyled, className} = this.attrs - return m('.carousel', - { - style: unstyled - ? {} - : { - overflow: !overflow ? 'hidden' : null, - userSelect: draggable ? 'none' : null, - touchAction: draggable ? 'pan-y pinch-zoom' : null - }, - className - }, - m('.carousel-content', - draggable ? {ondragstart: (e: Event) => e.preventDefault()} : {}, - this.children - ) - ) - } -} diff --git a/src/ui/component.ts b/src/ui/component.ts deleted file mode 100755 index 33a7215..0000000 --- a/src/ui/component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import {Children, ClassComponent, CVnode, CVnodeDOM} from 'mithril' -import {extractChildren} from '../util/children' - -declare var process: {env: {NODE_ENV: string}} - -export class Component - implements ClassComponent { - // Following are references to properties on mithril's vnode - attrs: Attr - dom!: El - children: Children - - constructor(vnode: CVnode) { - this.attrs = vnode.attrs - } - - oninit(vnode: CVnode) { - this.patch(this.update, 'oncreate', 'onupdate', 'view') - } - - onbeforeupdate(vnode: CVnode, old: CVnodeDOM) { - return true - } - - onafterupdate() {} - onremove() {} - - patch(to: any, ...methods: Array) { - const comp: any = this - methods.forEach(method => { - const original = comp[method] && comp[method].bind(comp) - comp[method] = (...args: Array) => { - return to.apply(comp, args.concat(original)) - } - }) - } - - update(vnode: CVnodeDOM, original?: any) { - this.attrs = vnode.attrs - if (vnode.dom) this.dom = vnode.dom as any - this.children = extractChildren(vnode.children) - this.onafterupdate() - if (original) { - if (process.env.NODE_ENV === 'production') { - try { - return original(vnode) - } catch (e) { - setTimeout(() => { - // Rethrow outside of this context so it can be picked up by Sentry - throw e - }) - return null - } - } else { - return original(vnode) - } - } - } - - view(): Children { - throw 'assert' - } -} diff --git a/src/ui/context.ts b/src/ui/context.ts deleted file mode 100755 index 3c297df..0000000 --- a/src/ui/context.ts +++ /dev/null @@ -1,48 +0,0 @@ -// See https://github.com/MithrilJS/mithril.js/issues/2148#issuecomment-452023800 -import m, {Children, CVnode} from 'mithril' -import {View} from './view' - -export type ProviderAttrs = {value: T} -export type Provider = { - new (vnode: CVnode>): View> -} -export type ConsumerAttrs = {children: (value: T) => Children} -export type Consumer = { - new (vnode: CVnode>): View> -} - -export type Context = { - Provider: Provider - Consumer: Consumer - __get: () => T -} - -type ContextCreator = { - (): Context - (context: T): Context -} - -export const createContext: ContextCreator = (context?: T): Context => ({ - Provider: class Provider extends View> { - render() { - const received = context - const {value, children} = this.attrs - context = value - return [ - children, - m({ - view: () => { - context = received - } - }) - ] - } - }, - Consumer: class Consumer extends View> { - render() { - const {children} = this.attrs - return children(context as T) - } - }, - __get: () => context as T -}) diff --git a/src/ui/form/boxes.less b/src/ui/form/boxes.less deleted file mode 100644 index 41d56e8..0000000 --- a/src/ui/form/boxes.less +++ /dev/null @@ -1,15 +0,0 @@ -.boxes-front { - &-left, &-right { - @media (min-width: 480px) { - display: inline-block; - vertical-align: top; - width: ~"calc(50% - 12.5px)"; - } - } - - &-col + &-col { - @media (min-width: 480px) { - margin-left: 25px; - } - } -} \ No newline at end of file diff --git a/src/ui/form/boxes.ts b/src/ui/form/boxes.ts deleted file mode 100755 index ebebe27..0000000 --- a/src/ui/form/boxes.ts +++ /dev/null @@ -1,64 +0,0 @@ -import './boxes.less' - -import m from 'mithril' -import {cleanupOptions, Options} from '../../util/formutils' -import {Component} from '../component' -import {Checkbox} from './checkbox' - -export class Boxes extends Component<{ - name: string - unstyled?: boolean - className?: string - value: Array - label?: string - modifier?: any - required?: boolean - options: Options - onchange?: (v: Array) => void - onfocus?: (e: Event) => void -}> { - className = - this.attrs.className || (this.attrs.unstyled && 'boxes') || 'boxes-front' - - setValue(key: string, active: boolean) { - const {value = [], onchange = () => {}} = this.attrs - - if (active) { - if (!value.find(v => v == key)) onchange([...value, key]) - else onchange(value) - } else { - onchange(value.filter(v => v != key)) - } - } - - view() { - const {value = [], options, unstyled, required} = this.attrs - const cleanOptions = cleanupOptions(options) - const half = Math.ceil(cleanOptions.length / 2) - - return m(`div.${this.className}`, [ - m(`div.${this.className}-left`, [ - cleanOptions.slice(0, half).map(o => - m(Checkbox, { - unstyled, - required: required && value.length == 0, - value: value.find(v => v == o.key), - onchange: (d: boolean) => this.setValue(o.key, d), - label: o.label - }) - ) - ]), - m(`.${this.className}-right`, [ - cleanOptions.slice(half).map(o => - m(Checkbox, { - unstyled, - required: required && value.length == 0, - value: value.find(v => v == o.key), - onchange: (d: boolean) => this.setValue(o.key, d), - label: o.label - }) - ) - ]) - ]) - } -} diff --git a/src/ui/form/checkbox.less b/src/ui/form/checkbox.less deleted file mode 100644 index cc68861..0000000 --- a/src/ui/form/checkbox.less +++ /dev/null @@ -1,63 +0,0 @@ -.checkbox-front { - transform: translate3d(0, 0, 0); - - &-input { - //Do not use display: none because the object has to be positioned - position: absolute; - opacity: 0; - } - - &-label { - cursor: pointer; - position: relative; - - &-square, - &-text { - display: inline-block; - vertical-align: top; - } - - &-square { - position: relative; - top: 4px; - width: 14px; - height: 14px; - border: 1px solid #dedede; - border-radius: 2px; - margin-right: 15px; - - .has-error & { - border: 1px solid #f44336; - } - - &:after { - color: #000000; - content: "✔"; - font-size: 16px; - line-height: 0.9; - position: absolute; - top: 0; - left: 0; - width: 14px; - height: 14px; - opacity: 0; - transform: scale(0); - transition: all 0.3s ease; - } - } - - &-text { - font-size: 18px; - line-height: 22px; - max-width: ~"calc(100% - 30px)"; - user-select: none; - } - } - - &-input:checked + .checkbox-front-label { - .checkbox-front-label-square:after { - opacity: 1; - transform: scale(1); - } - } -} diff --git a/src/ui/form/checkbox.ts b/src/ui/form/checkbox.ts deleted file mode 100755 index a3532fd..0000000 --- a/src/ui/form/checkbox.ts +++ /dev/null @@ -1,41 +0,0 @@ -import './checkbox.less' - -import m from 'mithril' -import {randomKey} from '../../util/formutils' -import {Component} from '../component' - -export class Checkbox extends Component<{ - name?: string - unstyled?: boolean - className?: string - value?: null | string | boolean - label?: string - required?: boolean - onchange?: (v: boolean) => void -}> { - className = - this.attrs.className || - (this.attrs.unstyled && 'checkbox') || - 'checkbox-front' - id = randomKey('check_') - - view() { - const {value, onchange, label, name = this.id, required} = this.attrs - - return m(`div.${this.className}`, [ - m(`input.${this.className}-input`, { - type: 'checkbox', - name, - id: this.id, - checked: value ? true : false, - onclick: onchange && (() => onchange(!value)), - required - }), - m(`label.${this.className}-label`, - {for: this.id}, - m(`span.${this.className}-label-square`), - m(`span.${this.className}-label-text`, label) - ) - ]) - } -} diff --git a/src/ui/form/field.less b/src/ui/form/field.less deleted file mode 100644 index 927e40a..0000000 --- a/src/ui/form/field.less +++ /dev/null @@ -1,15 +0,0 @@ -.field-front{ - - position: relative; - display: inline-block; - padding: 10px 0; - text-align: left; - vertical-align: top; - - &-errormsg { - padding-top: 5px; - padding-right: 10px; - font-size: 11px; - color: red; - } -} \ No newline at end of file diff --git a/src/ui/form/field.ts b/src/ui/form/field.ts deleted file mode 100755 index 49d9b32..0000000 --- a/src/ui/form/field.ts +++ /dev/null @@ -1,47 +0,0 @@ -import './field.less' - -import m from 'mithril' -import classnames from 'classnames' -import {Component} from '../component' -import {getErrorMessage} from '../../util/formutils' - -export class Field extends Component<{ - unstyled?: boolean - errors?: undefined | string | Array - label?: string - id?: string - required?: boolean - width?: number -}> { - className = this.attrs.unstyled ? 'field' : 'field-front' - - view() { - const {errors, id, required, width = 1.0} = this.attrs - - const style = {width: `${width * 100}%`} - const hasErrors = errors !== undefined - const classes = [hasErrors && 'has-error', required && 'is-required'] - - return m(`div.${this.className}`, {class: classnames(classes), style, id}, [ - this.viewLabel(), - this.children, - this.viewErrors() - ]) - } - - viewLabel() { - const {label} = this.attrs - if (!label) return - - return m(`div.${this.className}-label`, label) - } - - viewErrors() { - const {errors} = this.attrs - const hasErrors = errors !== undefined - - if (!hasErrors) return - - return m(`div.${this.className}-errormsg`, getErrorMessage(errors)) - } -} diff --git a/src/ui/form/fields.ts b/src/ui/form/fields.ts deleted file mode 100755 index 7372417..0000000 --- a/src/ui/form/fields.ts +++ /dev/null @@ -1,90 +0,0 @@ -import jump from 'jump.js' -import m from 'mithril' -import {FormStatus, FormStore} from '../../store/formstore' -import {randomKey} from '../../util/formutils' -import {Field} from './field' - -export {Input} from './input' -export {Select} from './select' -export {Textarea} from './textarea' -export {Radio} from './radio' -export {Radios} from './radios' -export {Checkbox} from './checkbox' -export {Boxes} from './boxes' - -export class Fields { - store: FormStore - key = randomKey() - config = { - fieldClass: Field, - defaultUnstyled: false, - defaultRequired: true, - labelInFields: false - } - - constructor(store: FormStore, config: any) { - this.store = store - this.config = {...this.config, ...config} - } - - status() { - return this.store.status - } - - asField(viewClass: any, config: any, children?: any) { - return m(this.config.fieldClass, - this.fieldAttrs(config), - m(viewClass, this.viewAttrs(config), children) - ) - } - - defaultFieldAttrs(key: string, rest: any) { - return { - required: this.config.defaultRequired, - unstyled: this.config.defaultUnstyled, - name: key, - ...rest, - id: 'field_' + key + '_' + this.key, - value: this.store.data[key], - onchange: (value: any) => this.store.setData(key, value), - label: this.config.labelInFields ? undefined : rest.label - } - } - - /** - * Can be used to initialize custom formfields - also used internally - */ - fieldAttrs(input: any) { - const {key, ...rest} = input - const attrs = this.defaultFieldAttrs(rest.name || key, rest) - const status = this.status() - switch (status.type) { - case 'error': - return { - ...attrs, - errors: status.errors[key], - onfocus: () => { - if (status.type == 'error') delete status.errors[key] - } - } - default: - return attrs - } - } - - /** - * This method can be overridden and used to filter certain attributes from passing on to the child element inside. - * Example: Use this to filter out the label attribute. It can now be drawn in the field view itself. - */ - viewAttrs(attrs: any) { - return { - ...this.fieldAttrs(attrs), - id: undefined, - label: this.config.labelInFields ? attrs.label : undefined - } - } - - focusField(field: string) { - jump(`#field_${field}_${this.key}`) - } -} diff --git a/src/ui/form/index.ts b/src/ui/form/index.ts deleted file mode 100755 index 19e3f26..0000000 --- a/src/ui/form/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './boxes' -export * from './checkbox' -export * from './field' -export * from './fields' -export * from './input' -export * from './radio' -export * from './radios' -export * from './select' -export * from './textarea' diff --git a/src/ui/form/input.less b/src/ui/form/input.less deleted file mode 100644 index 3ca7d0d..0000000 --- a/src/ui/form/input.less +++ /dev/null @@ -1,29 +0,0 @@ -.input-front { - position: relative; - - //INPUT - &-input { - width: 100%; - background-color: #fff; - border: 1px solid #dedede; - padding: 10px; - color: #171717; - font: inherit; - font-size: 14px; - line-height: 14px; - - .has-error & { - border: 1px solid #f44336; - } - } - - //LABEL - &-label { - color: #000000; - pointer-events: none; - user-select: none; - position: absolute; - left: 10px; - top: 10px; - } -} \ No newline at end of file diff --git a/src/ui/form/input.ts b/src/ui/form/input.ts deleted file mode 100755 index 96a7561..0000000 --- a/src/ui/form/input.ts +++ /dev/null @@ -1,60 +0,0 @@ -import './input.less' - -import classnames from 'classnames' -import m from 'mithril' -import {getErrorMessage} from '../../util/formutils' -import {Component} from '../component' - -export class Input extends Component<{ - name: string - type?: string - unstyled?: boolean - className?: string - value: string - label?: string - modifier?: any - required?: boolean - disabled?: boolean - options: Array<{key: string; label: string}> | {[key: string]: string} - onchange?: (v: string) => void - onfocus?: (e: Event) => void - placeholder?: string -}> { - className = - this.attrs.className || (this.attrs.unstyled && 'input') || 'input-front' - inputDom: null | HTMLElement = null - - view() { - const { - value, - onchange, - label, - name, - modifier, - onfocus, - type = 'text', - required, - disabled, - placeholder - } = this.attrs - - return m(`.${this.className}`, - {class: classnames([modifier, value && 'has-value'])}, - [ - m(`input.${this.className}-input`, { - type, - required, - disabled, - name, - value, - placeholder, - onfocus, - oncreate: vnode => (this.inputDom = vnode.dom as HTMLElement), - oninput: onchange && ((e: any) => onchange(e.target.value)), - onchange: onchange && ((e: any) => onchange(e.target.value)) - }), - label && m(`label.${this.className}-label`, label) - ] - ) - } -} diff --git a/src/ui/form/radio.less b/src/ui/form/radio.less deleted file mode 100644 index f44b965..0000000 --- a/src/ui/form/radio.less +++ /dev/null @@ -1,60 +0,0 @@ -.radio-front { - & + .radio-front { - margin-top: 10px; - } - - &-input { - //Do not use display: none because the object has to be positioned - position: absolute; - opacity: 0; - } - - &-label { - cursor: pointer; - position: relative; - - &-bullet, - &-text { - display: inline-block; - vertical-align: top; - } - - &-bullet { - position: relative; - top: 4px; - width: 14px; - height: 14px; - border: 1px solid #dedede; - border-radius: 100%; - margin-right: 15px; - - &:after { - content: ""; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) scale(0); - width: 10px; - height: 10px; - border-radius: 100%; - background-color: #3f98bd; - opacity: 0; - transition: all 0.3s ease; - } - } - - &-text { - font-size: 18px; - line-height: 22px; - max-width: ~"calc(100% - 30px)"; - user-select: none; - } - } - - &-input:checked + .radio-front-label { - .radio-front-label-bullet:after { - opacity: 1; - transform: translate(-50%, -50%) scale(1); - } - } -} diff --git a/src/ui/form/radio.ts b/src/ui/form/radio.ts deleted file mode 100755 index 436a77c..0000000 --- a/src/ui/form/radio.ts +++ /dev/null @@ -1,53 +0,0 @@ -import './radio.less' - -import m from 'mithril' -import {randomKey} from '../../util/formutils' -import {Component} from '../component' -import {classes} from '../../util/classes' -import {DOMAttrs} from '../../hyperscript' - -export class Radio extends Component< - { - name: string - value: boolean - onchange?: (checked: boolean) => void - option: string // Really label? - required?: boolean - unstyled?: boolean - className?: string - disabled?: boolean - } & DOMAttrs -> { - className = - this.attrs.className || (this.attrs.unstyled && 'radio') || 'radio-front' - id = randomKey('radio_') - - view() { - const { - value = false, - onchange, - option, - name = this.id, - required, - disabled, - ...rest - } = this.attrs - - return m(`div.${this.className}`, classes({is: {disabled}}), [ - m(`input.${this.className}-input`, { - type: 'radio', - checked: !!value, - required, - name: name, - onclick: onchange && (() => onchange(!value)), - id: this.id, - disabled, - ...rest - }), - m(`label.${this.className}-label`, {for: this.id}, [ - m(`span.${this.className}-label-bullet`), - m(`span.${this.className}-label-text`, option) - ]) - ]) - } -} diff --git a/src/ui/form/radios.ts b/src/ui/form/radios.ts deleted file mode 100755 index b620e7b..0000000 --- a/src/ui/form/radios.ts +++ /dev/null @@ -1,51 +0,0 @@ -import m from 'mithril' -import {cleanupOptions, randomKey} from '../../util/formutils' -import {Component} from '../component' -import {Radio} from './radio' -import {DOMAttrs} from '../../hyperscript' - -export class Radios extends Component<{ - name: string - unstyled?: boolean - className?: string - value: string - label?: string - modifier?: any - required?: boolean - options: - | Array<{key: string; label: string} & DOMAttrs> - | {[key: string]: string} - onchange?: (v: string) => void - onfocus?: (e: Event) => void -}> { - className = - this.attrs.className || (this.attrs.unstyled && 'radios') || 'radios-front' - defaultKey = randomKey('radios_') - - view() { - const { - value, - onchange, - options, - unstyled, - name = this.defaultKey, - required - } = this.attrs - - const cleanOptions = cleanupOptions(options) - - return m(`div.${this.className}`, - cleanOptions.map(({key, label, ...rest}) => - m(Radio, { - option: label, - name: name, - unstyled, - required, - value: value == key, - onchange: onchange && (() => onchange(key)), - ...rest - }) - ) - ) - } -} diff --git a/src/ui/form/select.less b/src/ui/form/select.less deleted file mode 100644 index 6498f4d..0000000 --- a/src/ui/form/select.less +++ /dev/null @@ -1,20 +0,0 @@ -.select-front { - width: 100%; - background-color: #fff; - border: 1px solid #dedede; - border-radius: 4px; - padding: 18.5px 20px; - color: #000000; - font: inherit; - font-size: 14px; - line-height: 14px; - appearance: none; - - &:focus { - outline: 0; - } - - .has-error & { - border: 1px solid #f44336; - } -} diff --git a/src/ui/form/select.ts b/src/ui/form/select.ts deleted file mode 100755 index b88bdb6..0000000 --- a/src/ui/form/select.ts +++ /dev/null @@ -1,55 +0,0 @@ -import './select.less' - -import classnames from 'classnames' -import m from 'mithril' -import {cleanupOptions} from '../../util/formutils' -import {Component} from '../component' - -export class Select extends Component<{ - name: string - unstyled?: boolean - className?: string - value: string - label?: string - modifier?: any - required?: boolean - options: Array<{key: string; label: string}> | {[key: string]: string} - onchange?: (v: string) => void - onfocus?: (e: Event) => void -}> { - className = - this.attrs.className || (this.attrs.unstyled && 'select') || 'select-front' - - view() { - const { - value, - onchange, - label, - name, - options, - modifier, - onfocus, - required = true - } = this.attrs - - const cleanOptions = cleanupOptions(options) - const fullLabel = required ? label + ' *' : label - - return m(`select.${this.className}`, - { - class: classnames([modifier, value && 'has-value']), - name, - required, - onfocus, - onchange: onchange && ((e: any) => onchange(e.target.value)), - oninput: onchange && ((e: any) => onchange(e.target.value)) - }, - [ - label && m('option[disabled]', {selected: !value}, fullLabel), - cleanOptions.map(o => - m('option', {value: o.key, selected: o.key == value}, o.label) - ) - ] - ) - } -} diff --git a/src/ui/form/textarea.less b/src/ui/form/textarea.less deleted file mode 100644 index 47538db..0000000 --- a/src/ui/form/textarea.less +++ /dev/null @@ -1,34 +0,0 @@ -.textarea-front { - position: relative; - - //TEXTAREA - &-textarea { - width: 100%; - background-color: #fff; - border: 1px solid #dedede; - border-radius: 4px; - padding: 25px 20px 10px 20px; - color: #000000; - font: inherit; - font-size: 14px; - line-height: 14px; - display: inline-block; - resize: vertical; - min-height: 100px; - - .error & { - border: 1px solid #f44336; - } - } - - //LABEL - &-label { - color: #000000; - pointer-events: none; - user-select: none; - position: absolute; - left: 10px; - top: 10px; - backface-visibility: hidden; - } -} diff --git a/src/ui/form/textarea.ts b/src/ui/form/textarea.ts deleted file mode 100755 index 5274d81..0000000 --- a/src/ui/form/textarea.ts +++ /dev/null @@ -1,49 +0,0 @@ -import './textarea.less' - -import classnames from 'classnames' -import m from 'mithril' -import {Component} from '../component' - -export class Textarea extends Component<{ - name: string - unstyled?: boolean - className?: string - value: string - label?: string - modifier?: any - required?: boolean - onchange?: (v: string) => void - onfocus?: (e: Event) => void -}> { - className = - this.attrs.className || - (this.attrs.unstyled && 'textarea') || - 'textarea-front' - - view() { - const { - value, - onchange, - label, - modifier, - name, - required, - onfocus - } = this.attrs - - return m(`div.${this.className}`, - {class: classnames([modifier, value && 'has-value'])}, - [ - m(`textarea.${this.className}-textarea`, { - required, - name, - onfocus, - value, - oninput: onchange && ((e: any) => onchange(e.target.value)), - onchange: onchange && ((e: any) => onchange(e.target.value)) - }), - label && m(`label.${this.className}-label`, label) - ] - ) - } -} diff --git a/src/ui/icon.less b/src/ui/icon.less deleted file mode 100755 index 460fb71..0000000 --- a/src/ui/icon.less +++ /dev/null @@ -1,5 +0,0 @@ -.icon { - font-style: normal; - display: inline-block; - vertical-align: middle; -} diff --git a/src/ui/icon.ts b/src/ui/icon.ts deleted file mode 100755 index fa9e10e..0000000 --- a/src/ui/icon.ts +++ /dev/null @@ -1,12 +0,0 @@ -import './icon.less' - -import {DOMAttrs, m} from '../hyperscript' -import {addClasses} from '../util/classes' -import {View} from './view' - -export class Icon extends View<{icon: string} & DOMAttrs> { - render() { - const {children, icon, ...attrs} = this.attrs - return m('i.icon', addClasses(attrs, {icon})) - } -} diff --git a/src/ui/image.less b/src/ui/image.less deleted file mode 100755 index 0675d6e..0000000 --- a/src/ui/image.less +++ /dev/null @@ -1,12 +0,0 @@ -.image { - display: block; - width: auto; - height: auto; - max-width: 100%; - max-height: 100%; - - &.mod-crop { - width: 100%; - height: 100%; - } -} diff --git a/src/ui/image.ts b/src/ui/image.ts deleted file mode 100755 index d264a39..0000000 --- a/src/ui/image.ts +++ /dev/null @@ -1,211 +0,0 @@ -import './image.less' - -import {DOMAttrs, m} from '../hyperscript' -import {addClasses} from '../util/classes' -import {contain, cover} from '../util/fit' -import {createContext} from './context' -import {View} from './view' - -export type ImageFit = 'portrait' | 'landscape' | 'cover' | 'contain' - -type Size = { - width: number - height: number -} - -const supportsObjectFit = window.navigator.msMaxTouchPoints === undefined - -const canUpscale = (fit: 'cover' | 'contain', container: Size, image: Size) => { - const test = fit === 'cover' ? cover : contain - const {width, height} = test( - container.width, - container.height, - image.width, - image.height - ) - return width < image.width && height < image.height -} - -const BrowserImage = (window as any)['Image'] - -export type ImageAttrs = { - src: string - width?: number - height?: number - fit?: ImageFit - upScale?: boolean - position?: undefined | false | string | {x: number; y: number} - background?: boolean -} & DOMAttrs - -class ImageBase extends View { - loader?: typeof BrowserImage - - onCreate() { - this.load() - if (!this.shouldCheckScale) return - const listener = () => this.scale() - window.addEventListener('resize', listener) - this.onRemove = () => window.removeEventListener('resize', listener) - this.scale() - } - - onUpdate = () => { - this.load() - this.scale() - } - - load() { - const {onload, onerror, src} = this.attrs - if (!onload && !onerror) return - if (this.loader && this.loader.src === src) return - if (!this.loader) { - const img = new BrowserImage() - img.onload = (e: Event) => this.attrs.onload && this.attrs.onload(e) - img.onerror = (e: Error) => this.attrs.onerror && this.attrs.onerror(e) - this.loader = img - } - this.loader.src = src - } - - scale() { - const {width = 0, height = 0, fit, background} = this.attrs - if (!this.dom || !this.shouldCheckScale) return - const container = this.dom.getBoundingClientRect() - if (canUpscale(fit as any, container, {width, height})) return - if (this.useBackground) this.dom.style.backgroundSize = 'auto' - else this.dom.style.objectFit = 'none' - } - - get shouldCheckScale() { - const {width, height, fit, upScale} = this.attrs - const crop = fit === 'cover' || fit === 'contain' - return !upScale && width && height && crop - } - - get shouldCrop() { - const {fit = 'landscape', background} = this.attrs - return background || fit === 'cover' || fit === 'contain' - } - - get useBackground() { - const {background} = this.attrs - return background || (!supportsObjectFit && this.shouldCrop) - } - - render() { - const { - src, - children, - fit = 'landscape', - upScale, - background, - position = 'center center', - alt = '', - width, - height, - style, - onload, - onerror, - // These get passed by sizeof-loader, but we don't want them to be passed - // to the dom - type, - bytes, - ...attrs - } = this.attrs - const crop = this.shouldCrop - const tag = this.useBackground ? 'div' : 'img' - const focus = - typeof position === 'string' - ? position - : position && `${position.x * 100}% ${position.y * 100}%` - return m(tag, - { - ...(this.useBackground - ? { - role: 'img', - 'aria-label': alt, - style: { - backgroundImage: `url('${src}')`, - backgroundSize: crop && fit, - backgroundPosition: focus, - backgroundRepeat: 'no-repeat', - ...style - } - } - : { - src, - alt, - width, - height, - style: { - objectFit: crop && fit, - objectPosition: focus !== 'center center' && focus, - ...style - } - }), - ...addClasses(attrs, 'image', {mod: {crop}}) - }, - children - ) - } -} - -type Resizer = (info: ImageAttrs, container: Size) => ImageAttrs - -const ImageResizerContext = createContext() - -export class ImageResizer extends View<{ - resize: Resizer -}> { - render() { - const {resize} = this.attrs - return m(ImageResizerContext.Provider, {value: resize}, this.children) - } -} - -export class Image extends View { - cached: undefined | string - resolved: undefined | ImageAttrs - render() { - const { - children, - src, - width, - height, - fit, - position, - upScale, - background, - alt = '', - type, - bytes, - style, - ...rest - } = this.attrs - const crop = background || fit === 'cover' || fit === 'contain' - return m(ImageResizerContext.Consumer, (resize: Resizer | undefined) => { - if (!resize) return m(ImageBase, this.attrs, children) - const resolve = (dom: HTMLElement) => { - this.resolved = resize(this.attrs, { - width: dom.offsetWidth, - height: dom.offsetHeight - }) - this.cached = src - } - if (!this.dom) - return m('div', - { - ...addClasses(rest, 'image', {mod: {crop}}), - oncreate: vnode => { - resolve(vnode.dom as HTMLElement) - m.redraw() - } - }, - children - ) - if (this.cached !== src) resolve(this.dom) - return this.resolved && m(ImageBase, this.resolved, children) - }) - } -} diff --git a/src/ui/index.ts b/src/ui/index.ts deleted file mode 100755 index 6b1ed00..0000000 --- a/src/ui/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from './form' -export * from './maps' -export * from './breakpoint' -export * from './carousel' -export * from './component' -export * from './context' -export * from './icon' -export * from './image' -export * from './masonry' -export * from './mediaquery' -export * from './modal' -export * from './portal' -export * from './view' diff --git a/src/ui/maps/eventmanager.ts b/src/ui/maps/eventmanager.ts deleted file mode 100755 index c8ce159..0000000 --- a/src/ui/maps/eventmanager.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {ListenerCache} from '../../util/listenercache' -import {View} from '../view' - -export class EventManager extends View<{ - object: google.maps.MVCObject - on?: {[key: string]: any} -}> { - events!: ListenerCache - onInit = this.createCache - onBeforeUpdate = this.attachEvents - - createCache() { - const {object} = this.attrs - this.events = new ListenerCache({ - add: (key, listener) => { - const dissolve = object.addListener(key, listener) - return () => google.maps.event.removeListener(dissolve) - }, - hit: (key, event) => { - const {on = {}} = this.attrs - event.target = object - if (on && key in on) on[key](event) - } - }) - this.attachEvents() - } - - attachEvents() { - const {on = {}} = this.attrs - this.events.attach(Object.keys(on)) - } - - onRemove() { - this.events.remove() - } - - render() { - return this.children - } -} diff --git a/src/ui/maps/index.ts b/src/ui/maps/index.ts deleted file mode 100755 index 43ec588..0000000 --- a/src/ui/maps/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './maps' -export * from './marker' diff --git a/src/ui/maps/mappool.ts b/src/ui/maps/mappool.ts deleted file mode 100755 index cf7aa92..0000000 --- a/src/ui/maps/mappool.ts +++ /dev/null @@ -1,21 +0,0 @@ -export class MapPool { - pool: Array = [] - - create(construct: (dom: Element) => google.maps.Map) { - const container = () => { - const dom = document.createElement('div') - dom.style.height = '100%' - return dom - } - const instance = this.pool.length - ? (this.pool.pop() as google.maps.Map) - : construct(container()) - return instance - } - - release(map: google.maps.Map) { - const dom = map.getDiv() - if (dom.parentNode) dom.parentNode.removeChild(dom) - this.pool.push(map) - } -} diff --git a/src/ui/maps/maps.less b/src/ui/maps/maps.less deleted file mode 100755 index 94a1160..0000000 --- a/src/ui/maps/maps.less +++ /dev/null @@ -1,3 +0,0 @@ -.maps { - height: 100%; -} diff --git a/src/ui/maps/maps.ts b/src/ui/maps/maps.ts deleted file mode 100755 index aa84b10..0000000 --- a/src/ui/maps/maps.ts +++ /dev/null @@ -1,111 +0,0 @@ -import './maps.less' - -import loadGoogleMapsApi from 'load-google-maps-api' -import {m} from '../../hyperscript' -import {createContext} from '../context' -import {View} from '../view' -import {EventManager} from './eventmanager' -import {MapPool} from './mappool' - -export const MapsContext = createContext() - -export type MapsEvent = { - target: T - redraw: boolean -} - -export type MouseEvents = { - click?: (event?: google.maps.MouseEvent & MapsEvent) => void - dblclick?: (event?: google.maps.MouseEvent & MapsEvent) => void - rightclick?: (event?: google.maps.MouseEvent & MapsEvent) => void - mousemove?: (event?: google.maps.MouseEvent & MapsEvent) => void - mouseout?: (event?: google.maps.MouseEvent & MapsEvent) => void - mouseover?: (event?: google.maps.MouseEvent & MapsEvent) => void -} - -export type MapsEvents = MouseEvents & { - idle?: (event?: MapsEvent) => void - tilesloaded?: (event?: MapsEvent) => void - - drag?: (event?: MapsEvent) => void - dragend?: (event?: MapsEvent) => void - dragstart?: (event?: MapsEvent) => void - - bounds_changed?: (event?: MapsEvent) => void - center_changed?: (event?: MapsEvent) => void - heading_changed?: (event?: MapsEvent) => void - maptypeid_changed?: (event?: MapsEvent) => void - projection_changed?: (event?: MapsEvent) => void - tilt_changed?: (event?: MapsEvent) => void - zoom_changed?: (event?: MapsEvent) => void -} - -export class Maps extends View< - { - apiKey: string - region?: string - language?: string - class?: string - on?: MapsEvents - initial?: { - zoom?: number - center?: google.maps.LatLng | google.maps.LatLngLiteral - } - } & google.maps.MapOptions -> { - static pool = new MapPool() - map?: google.maps.Map - - onCreate() { - const { - children, - on, - apiKey, - region, - language, - class: className, - initial = {}, - ...options - } = this.attrs - loadGoogleMapsApi({key: apiKey, region, language}) - .then(maps => { - const map = Maps.pool.create(dom => new maps.Map(dom)) - const { - zoom = 7, - center = { - lat: 51.0030477, - lng: 4.5000955 - } - } = initial - map.setOptions({zoom, center, ...options}) - if (this.dom) this.dom.appendChild(map.getDiv()) - this.onRemove = () => { - Maps.pool.release(map) - } - this.map = map - }) - .then(m.redraw) - .catch(console.error) - } - - render() { - const {class: className, on, ...options} = this.attrs - if (this.map) { - if (options) this.map.setOptions(options) - } - return m('.maps', - {className}, - this.map && - m(MapsContext.Provider, - {value: this.map}, - m(EventManager, - { - on, - object: this.map - }, - this.children - ) - ) - ) - } -} diff --git a/src/ui/maps/marker.ts b/src/ui/maps/marker.ts deleted file mode 100755 index 538eb99..0000000 --- a/src/ui/maps/marker.ts +++ /dev/null @@ -1,61 +0,0 @@ -import {m} from '../../hyperscript' -import {View} from '../view' -import {EventManager} from './eventmanager' -import {MapsContext, MapsEvent, MouseEvents} from './maps' - -export type MarkerEvents = MouseEvents & { - mousedown?: ( - event?: google.maps.MouseEvent & MapsEvent - ) => void - mouseup?: ( - event?: google.maps.MouseEvent & MapsEvent - ) => void - - drag?: ( - event?: google.maps.MouseEvent & MapsEvent - ) => void - dragend?: ( - event?: google.maps.MouseEvent & MapsEvent - ) => void - dragstart?: ( - event?: google.maps.MouseEvent & MapsEvent - ) => void - - draggable_changed?: (event?: MapsEvent) => void - animation_changed?: (event?: MapsEvent) => void - clickable_changed?: (event?: MapsEvent) => void - cursor_changed?: (event?: MapsEvent) => void - flat_changed?: (event?: MapsEvent) => void - icon_changed?: (event?: MapsEvent) => void - position_changed?: (event?: MapsEvent) => void - shape_changed?: (event?: MapsEvent) => void - title_changed?: (event?: MapsEvent) => void - visible_changed?: (event?: MapsEvent) => void - zindex_changed?: (event?: MapsEvent) => void -} - -export class Marker extends View< - google.maps.MarkerOptions & { - on?: MarkerEvents - } -> { - marker?: google.maps.Marker - onRemove() { - if (this.marker) this.marker.setMap(null) - } - render() { - const {children, on, ...options} = this.attrs - return m(MapsContext.Consumer, (map?: google.maps.Map) => { - if (!map) throw 'No Maps parent detected' - if (this.marker) this.marker.setOptions(options) - else this.marker = new google.maps.Marker({map, ...options}) - return m(EventManager, - { - on, - object: this.marker - }, - this.children - ) - }) - } -} diff --git a/src/ui/masonry.less b/src/ui/masonry.less deleted file mode 100755 index 7ec21e9..0000000 --- a/src/ui/masonry.less +++ /dev/null @@ -1,8 +0,0 @@ -.masonry { - display: flex; - width: 100%; - - &-col { - min-width: 0; - } -} diff --git a/src/ui/masonry.ts b/src/ui/masonry.ts deleted file mode 100755 index 268a55f..0000000 --- a/src/ui/masonry.ts +++ /dev/null @@ -1,45 +0,0 @@ -import './masonry.less' - -import m, {Child} from 'mithril' -import {View} from './view' - -export class Masonry extends View<{ - cols: number - addClass?: (i: number, j: number) => string - children: Array -}> { - divide(items: Array, colsCount: number) { - const cols: Array> = Array(colsCount) - .fill(null) - .map(_ => []) - items.forEach((item, i) => { - const col = i % colsCount - cols[col].push(item) - }) - return cols - } - - render() { - const {children, cols: colsCount, addClass} = this.attrs - const cols = this.divide(children, colsCount) - return m('.masonry', - cols.map((children, i) => - m('.masonry-col', - { - style: { - 'flex-basis': 100 / cols.length + '%' - } - }, - children.map((item, j) => - m('.masonry-item', - { - class: addClass ? addClass(i, j) : '' - }, - item - ) - ) - ) - ) - ) - } -} diff --git a/src/ui/mediaquery.ts b/src/ui/mediaquery.ts deleted file mode 100755 index d5a5381..0000000 --- a/src/ui/mediaquery.ts +++ /dev/null @@ -1,18 +0,0 @@ -import m, {Children} from 'mithril' -import {Breakpoint} from './breakpoint' -import {View} from './view' - -export class MediaQuery extends View<{ - minWidth?: number - maxWidth?: number - view: () => Children -}> { - render() { - const {view, minWidth, maxWidth} = this.attrs - const rules = [] - if (minWidth) rules.push(`(min-width: ${minWidth}px)`) - if (maxWidth) rules.push(`(max-width: ${maxWidth}px)`) - const query = rules.join(' and ') - return m(Breakpoint, {[query]: true}, (match: boolean) => match && view()) - } -} diff --git a/src/ui/modal.less b/src/ui/modal.less deleted file mode 100755 index e2a9449..0000000 --- a/src/ui/modal.less +++ /dev/null @@ -1,49 +0,0 @@ -.modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - opacity: 0; - transition: opacity 0.35s ease-out; - overflow: auto; - - &.is-open { - opacity: 1; - } - - &-overlay { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.7); - z-index: -1; - pointer-events: none; - } - - &-container { - position: relative; - display: flex; - align-items: center; - justify-content: center; - min-height: 100%; - z-index: 1; - - &-content { - position: relative; - } - } - - &.mod-full { - .modal-container-content { - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - overflow: auto; - } - } -} diff --git a/src/ui/modal.ts b/src/ui/modal.ts deleted file mode 100755 index d34b66f..0000000 --- a/src/ui/modal.ts +++ /dev/null @@ -1,82 +0,0 @@ -import './modal.less' - -import {DOMAttrs} from '../hyperscript' -import m from 'mithril' -import {classes} from '../util/classes' -import lockScroll from '../util/lockscroll' -import {Component} from './component' - -export class ModalOverlay extends Component { - view() { - return m('.modal-overlay', this.attrs, this.children) - } -} - -export class Modal extends Component<{ - isOpen: boolean - close: () => void - zIndex?: number - mod?: any -}> { - opened = false - oncreate = this.lock - onupdate = this.lock - - lock() { - const {isOpen, close} = this.attrs - if (this.opened === isOpen) return - if (isOpen) window.addEventListener('keydown', this.closeByKey) - else window.removeEventListener('keydown', this.closeByKey) - this.opened = isOpen - } - - onremove() { - window.removeEventListener('keydown', this.closeByKey) - } - - closeByKey = (e: KeyboardEvent) => { - const {close} = this.attrs - if (e.keyCode !== 27) return - close() - m.redraw() - } - - view() { - const {isOpen, close, zIndex = 1000, mod} = this.attrs - if (!isOpen) return null - return m('.modal', - { - oncreate: ({dom}) => - setTimeout(() => { - lockScroll(true) - dom.classList.add('is-open') - }, 25), - onbeforeremove: ({dom}) => - new Promise(done => { - ;(dom as any).addEventListener( - 'transitionend', - () => { - lockScroll(false) - done() - }, - false, - {once: true} - ) - dom.classList.remove('is-open') - }), - onremove: () => lockScroll(false), - ...classes({mod}), - style: {zIndex} - }, - m('.modal-container', - { - onclick: (e: MouseEvent) => { - const target = e.target as HTMLElement - if (target && target.classList.contains('modal-container')) close() - } - }, - m('.modal-container-content', this.children) - ) - ) - } -} diff --git a/src/ui/portal.ts b/src/ui/portal.ts deleted file mode 100755 index b452141..0000000 --- a/src/ui/portal.ts +++ /dev/null @@ -1,20 +0,0 @@ -import m from 'mithril' -import {View} from './view' - -export class Portal extends View { - node = document.createElement('div') - - onCreate() { - document.body.appendChild(this.node) - m.mount(this.node, {view: () => this.children}) - } - - onRemove() { - m.mount(this.node, {view: () => null}) - document.body.removeChild(this.node) - } - - render() { - return null - } -} diff --git a/src/ui/view.ts b/src/ui/view.ts deleted file mode 100755 index 2602de5..0000000 --- a/src/ui/view.ts +++ /dev/null @@ -1,122 +0,0 @@ -import {ChildrenType} from '../hyperscript' -import { - Children, - ClassComponent, - CVnode, - CVnodeDOM, - Vnode, - VnodeDOM -} from 'mithril' -import {extractChildren} from '../util/children' - -declare global { - namespace JSX { - interface ElementAttributesProperty { - attrs: {} - } - interface ElementChildrenAttribute { - children: {} - } - } -} - -export type StatelessView = { - (attr: {children?: Children} & Attr): Children -} - -export abstract class View< - Attrs = {}, - State extends {} = {}, - Dom extends Element = Element -> implements ClassComponent { - attrs!: Readonly<{children?: Children}> & Readonly - state?: Readonly - dom: undefined | Dom - - constructor(vnode: CVnode) { - this.__update(vnode as Vnode) - } - - get children(): ChildrenType { - return this.attrs.children as ChildrenType - } - - // Public API - - onInit() {} - onCreate(dom: Dom) {} - onUpdate(dom: Dom) {} - onBeforeRemove(dom: Dom): void | Promise {} - onRemove() {} - onBeforeUpdate(attrs: Attrs): void | boolean {} - abstract render(): Children | null | void - - // Future (p)react connection - - setState( - state: - | (( - prevState: Readonly | undefined, - attrs: Readonly<{children?: Children}> & Readonly - ) => Pick | State | null) - | (Pick | State | null), - callback?: () => void - ) { - if (state === null) return - if (typeof state === 'function') - Object.assign(this.state, (state as any)(this.state, this.attrs)) - else Object.assign(this.state, state) - if (callback) callback() - } - - // Mithril connection - - /** @internal */ - oninit(vnode: Vnode) { - this.__update(vnode) - return this.onInit() - } - - /** @internal */ - oncreate(vnode: VnodeDOM) { - this.__update(vnode) - return this.onCreate(vnode.dom as Dom) - } - - /** @internal */ - onupdate(vnode: VnodeDOM) { - this.__update(vnode) - return this.onUpdate(vnode.dom as Dom) - } - - /** @internal */ - onbeforeremove(vnode: VnodeDOM) { - this.__update(vnode) - return this.onBeforeRemove(vnode.dom as Dom) - } - - /** @internal */ - onremove(vnode: VnodeDOM) { - this.__update(vnode) - return this.onRemove() - } - - /** @internal */ - onbeforeupdate(vnode: Vnode, old: CVnodeDOM) { - this.__update(vnode) - return this.onBeforeUpdate(old.attrs) - } - - view(vnode: Vnode) { - return this.render() - } - - /** @internal */ - __update(vnode: Vnode | VnodeDOM) { - if ('dom' in vnode && vnode.dom) this.dom = vnode.dom as Dom - this.attrs = { - ...vnode.attrs, - children: extractChildren(vnode.children) - } - } -} diff --git a/src/util/children.ts b/src/util/children.ts deleted file mode 100755 index a1dd885..0000000 --- a/src/util/children.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {Children, ChildArray} from 'mithril' - -export const extractChildren = (children: Children): Children => { - if (!Array.isArray(children)) return children - if (children[0] && typeof children[0] == 'function') - return children[0] - return ([] as ChildArray).concat(...children) -} \ No newline at end of file diff --git a/src/util/classes.ts b/src/util/classes.ts deleted file mode 100755 index 1f58243..0000000 --- a/src/util/classes.ts +++ /dev/null @@ -1,54 +0,0 @@ -import classNames from 'classnames' -import {DOMAttrs} from '../hyperscript' - -interface ClassDictionary { - [id: string]: any -} - -interface ClassArray extends Array {} - -type ClassValue = - | string - | ClassDictionary - | ClassArray - | undefined - | null - | boolean - | Function - -function prefixClassNames(prefix: string | null, input: Array) { - return classNames(input) - .split(' ') - .filter(v => v) - .map(name => (prefix ? `${prefix}-${name}` : name)) -} - -export function parseClasses( - classes: ClassValue -): ClassValue | Array { - if (typeof classes === 'function') - return `${classes}` - if (!classes || Array.isArray(classes) || typeof classes !== 'object') - return classes - return Object.keys(classes).map(key => - typeof classes[key] === 'object' || typeof classes[key] === 'string' || typeof classes[key] === 'function' - ? prefixClassNames( - key, - ([] as Array).concat(parseClasses(classes[key])) - ) - : classNames({[key]: classes[key]}) - ) -} - -export function classes(...classes: Array) { - const names = classNames(classes.map(parseClasses)) - return names ? {className: names} : {} -} - -export const addClasses = ( - attrs: DOMAttrs, - ...rest: Array -): DOMAttrs => { - const {class: c1, className: c2, ...props} = attrs - return {...classes(c1, c2, ...rest), ...props} -} diff --git a/src/util/fit.ts b/src/util/fit.ts deleted file mode 100755 index 7ba7dfa..0000000 --- a/src/util/fit.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Source: https://github.com/sroucheray/contain-cover/blob/master/contain-cover.js - -function fit(contains: boolean) { - return function( - containerWidth: number, - containerHeight: number, - width: number, - height: number - ) { - let doRatio = width / height - let cRatio = containerWidth / containerHeight - let targetWidth = 0 - let targetHeight = 0 - let test = contains ? doRatio > cRatio : doRatio < cRatio - - if (test) { - targetWidth = containerWidth - targetHeight = targetWidth / doRatio - } else { - targetHeight = containerHeight - targetWidth = targetHeight * doRatio - } - - return { - width: targetWidth, - height: targetHeight, - x: (containerWidth - targetWidth) / 2, - y: (containerHeight - targetHeight) / 2 - } - } -} - -export const contain = fit(true) -export const cover = fit(false) diff --git a/src/util/formutils.ts b/src/util/formutils.ts deleted file mode 100755 index 342ed9a..0000000 --- a/src/util/formutils.ts +++ /dev/null @@ -1,32 +0,0 @@ -export type Option = {key: string; label: string} - -export type OptionsArray = Array - -export type Options = OptionsArray | {[key: string]: string} - -export function cleanupOptions(options: Options): Array