diff --git a/Cakefile b/Cakefile index dbe803d..9d0682c 100644 --- a/Cakefile +++ b/Cakefile @@ -1,6 +1,6 @@ [fs, {dirname}, {spawnSync}, CoffeeScript] = ['fs', 'path', 'child_process', 'coffeescript'].map require -modules = ['util', 'atom', 'reagent', 're-frame'] +modules = ['util', 'atom', 'reagent', 're-frame', 'jsx-runtime'] deps = "mithril/mount,mithril/render,mithril/redraw,mithril/hyperscript" depsRoute = "#{deps},mithril/route" diff --git a/README.md b/README.md index 952bf18..b7bc54f 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,8 @@ For further information, see [API reference](#api-reference) below and the follo * Q: I have a _huge_ amount of DB events per second in my app, can I disable the deep-equality check in `db` effect handler? A: Specify `eq` in [`rf._init`](docs/re-frame.md#_init-opts) to replace it with either [`eqShallow`](docs/util.md#eqShallow-a-b) or [`indentical`](docs/util.md#identical-a-b). +* Q: I hate commas and languages that aren't syntactical supersets of JS. Can I still use this somehow? + A: Well if you _absolutely must_, you can [use JSX](docs/jsx-runtime.md). (Note that JSX is not exatly a great match for Reagent components.) # Examples @@ -161,6 +163,7 @@ For further information, see [API reference](#api-reference) below and the follo * [Routing using `mithril/route` (from `mreframe-route.js`)](examples/route.js.html) (scripted in JavaScript) [[live]](https://lexofleviafan.github.io/mreframe/examples/route.js.html) * [Rendering HTML from Reagent components using `mithril-node-render`](examples/node-render.coffee) (scripted in CoffeeScript) +* [JSX usage example](examples/reagent.jsx) # API reference @@ -175,6 +178,8 @@ For further information, see [API reference](#api-reference) below and the follo for Mithril; * [`re-frame`](docs/re-frame.md) defines a system for managing state/side-effects in a Reagent/Mithril application. +There's also [`jsx-runtime`](docs/jsx-runtime.md) which isn't included in main module (it implements JSX support). + Each of these can be used separately (`require('mreframe/')`), or as part of the main module (`require('mreframe').`; `.reFrame` in case of `re-frame` module). Note that the nodeps bundle doesn't load Mithril libraries by default (so you'll have to call the `_init` function which it also exports). diff --git a/dist/mreframe-nodeps.js b/dist/mreframe-nodeps.js index 1b1e9ea..76e3d2e 100644 --- a/dist/mreframe-nodeps.js +++ b/dist/mreframe-nodeps.js @@ -47,7 +47,25 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= }).call(this); -},{"./util":"mreframe/util"}],"mreframe/re-frame":[function(require,module,exports){ +},{"./util":"mreframe/util"}],"mreframe/jsx-runtime":[function(require,module,exports){ +(function() { + var jsx, r; + + r = require('./reagent'); + + jsx = (tag, {children = [], ...attrs}, key) => { // this API isn't documented properly... + return r.with({key, ...attrs}, [tag].concat(children)); + }; + + module.exports = { + jsx, + jsxs: jsx, + Fragment: '<>' + }; + +}).call(this); + +},{"./reagent":"mreframe/reagent"}],"mreframe/re-frame":[function(require,module,exports){ (function() { /* @@ -542,7 +560,7 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= },{"./atom":"mreframe/atom","./reagent":"mreframe/reagent","./util":"mreframe/util"}],"mreframe/reagent":[function(require,module,exports){ (function() { - var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; + var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, _with, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; ({identical, eqShallow, isArray, keys, getIn, merge, assocIn, identity} = require('./util')); @@ -580,7 +598,7 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= }; _eqArgs = (xs, ys) => { - return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && xs.every((x, i) => { + return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && eqShallow(xs._meta, ys._meta) && xs.every((x, i) => { return eqShallow(x, ys[i]); })); }; @@ -596,13 +614,15 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= _rendering = (binding) => { return function(vnode) { + var _old; + _old = _vnode; _vnode = vnode; try { this._subs.clear(); this._argv = vnode.attrs.argv; // last render args return binding.call(this, vnode); } finally { - _vnode = null; + _vnode = _old; } }; }; @@ -691,7 +711,7 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= }; /* Adds metadata to the Hiccup form of a Reagent component or a fragment */ - exports.with = (meta, form) => { + exports.with = _with = (meta, form) => { form = form.slice(0); form._meta = meta; return form; @@ -810,7 +830,7 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= /* Converts a Mithril component into a Reagent component */ exports.adaptComponent = (c) => { return (...args) => { - return ['>', c, ...args]; + return _with(_vnode != null ? _vnode.attrs : void 0, ['>', c, ...args]); }; }; @@ -928,7 +948,7 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c= if (x == null) { return x; } else { - return x.__proto__.constructor; + return Object.getPrototypeOf(x).constructor; } }; diff --git a/dist/mreframe-nodeps.min.js b/dist/mreframe-nodeps.min.js index d168ba6..1d01fd4 100644 --- a/dist/mreframe-nodeps.min.js +++ b/dist/mreframe-nodeps.min.js @@ -1 +1 @@ -require=function(e){var t=function t(r,n){return t.m.hasOwnProperty(r)?t.m[r]:"function"!=typeof e||n?"function"==typeof t.r?t.r(r,1):void 0:e(r,1)};t.m={},t.r=e;var r={};(function(){var e,t,n,a,i,s,o,c,l,f,u,p,d,h,v,m,g,y,b,w,_;r.identity=d=e=>e,r.type=w=e=>null==e?e:e.__proto__.constructor,r.keys=m=e=>Object.keys(e||{}),r.vals=e=>Object.values(e||{}),t=Object.entries||(e=>m(e).map(t=>[t,e[t]])),r.entries=i=e=>t(e||{}),e=Object.fromEntries||(e=>g(...e.map(([e,t])=>({[e]:t})))),r.dict=t=>e(t||[]),r.isArray=h=Array.isArray,r.isDict=v=e=>w(e)===Object,r.isFn=e=>"function"==typeof e,r.merge=g=(...e)=>Object.assign({},...e),r.assoc=n=(e,t,r)=>((e=h(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=r,e),r.dissoc=(e,...t)=>(e=h(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),r.update=_=(e,t,r,...a)=>n(e,t,r(null!=e?e[t]:void 0,...a)),r.getIn=u=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),r.assocIn=a=(e,t,r)=>t.length<2?n(e,t[0],r):_(e,t[0],a,t.slice(1),r),r.updateIn=(e,t,r,...n)=>a(e,t,r(u(e,t),...n)),r.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(t*n,t*(n+1))),r.flatten=f=e=>h(e)?e.flatMap(f):e,r.repr=e=>JSON.stringify(e,y),r.identical=p=(e,t)=>e===t||e!=e&&t!=t,r.eq=s=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&o(e,t,s):v(e)&&v(t)&&c(e,t)),r.eqShallow=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&o(e,t,p):v(e)&&v(t)&&l(e,t)),b=t=>e(i(t).sort()),y=(e,t)=>w(t)===RegExp?""+t:v(t)?b(t):t,o=(e,t,r)=>e.length===t.length&&e.every((e,n)=>r(e,t[n])),c=(e,t,r=m(e),n=new Set(m(t)))=>r.length===n.size&&r.every(e=>n.has(e))&&r.every(r=>s(e[r],t[r])),l=(e,t,r=m(e))=>r.length===m(t).length&&r.every(r=>r in t&&p(e[r],t[r])),r.chain=(e,...t)=>t.map(e=>h(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),r.multi=(e=d)=>{var t,r,n;return r=new Map,t=()=>{throw TypeError("Invalid arguments")},n=Object.assign((...n)=>(r.get(e(...n))||t)(...n),{when:(e,t)=>(r.set(e,t),n),default:e=>(t=e,n)})}}).call(this);var n={};(function(){var e,t,a,i,s,o,c,l;({multi:a,type:l}=r),n.deref=t=a(l),n.resetVals=s=a(l).default((e,r)=>[t(e),i(e,r)]),n.reset=i=a(l).default((e,t)=>o(e,()=>t)),n.swapVals=c=a(l).default((e,r,...n)=>s(e,r(t(e),...n))),n.swap=o=a(l).default((...e)=>c(...e)[1]),n.compareAndSet=a(l).default((e,r,n)=>r===t(e)&&(i(e,n),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),i.when(e,(e,t)=>e.x=t),n.atom=t=>new e(t)}).call(this);var a={};(function(){var e,t,i,s,o,c,l,f,u,p,d,h,v,m,g,y,b,w,_,E,x,q,S,C,k,j,I,A,M,O,D,F,N,U,$,T,V;({identical:I,eqShallow:k,isArray:M,keys:O,getIn:j,merge:D,assocIn:x,identity:A}=r),({atom:q,deref:C,reset:U,swap:V}=n),d=y=p=A,f=$=(e,t)=>t,a._init=e=>{p=(null!=e?e.hyperscript:void 0)||p,f=p.fragment||$,y=(null!=e?e.redraw:void 0)||y,d=(null!=e?e.mount:void 0)||d},_=null,b=new Map,a.resetCache=()=>b.clear(),v=(e,t,r)=>{for(;e;)e.state._subs.set(t,r),e=e._parent;return r},c=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&e.every((e,r)=>k(e,t[r])),o=function(e){var t;return!c(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,r])=>v(e._parent,t,r)),!1)},w=e=>function(t){_=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{_=null}},l=e=>{var t;return b.has(e)||(t={oninit:function(r){this._comp=t,this._subs=new Map,this._atom=N(),this._view=e},onbeforeupdate:o,view:w((function(e){var t,r;return r=this._view.apply(e,t=e.attrs.argv.slice(1)),E("function"!=typeof r?r:(this._view=r).apply(e,t))}))},b.set(e,t)),b.get(e)},u=(e,t)=>"object"!=typeof t||M(t)?[e,E(t)]:[D(t,e)],h=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),a.asElement=E=e=>{var t,r;return M(e)?(t=e[0],r={...e._meta||{},_parent:_},">"===t?i(e[1],u(r,e[2]),e.slice(3).map(E)):"<>"===t?h(f(r,e.slice(1).map(E))):"string"==typeof t?i(t,u(r,e[1]),e.slice(2).map(E)):i("function"==typeof t?l(t):t,[{...r,argv:e}])):e},a.render=(e,t)=>d(t,{view:()=>E(e)}),a.with=(e,t)=>((t=t.slice(0))._meta=e,t),a.createClass=e=>{var t,r,n;return r={oninit:function(e){var n,a;this._comp=r,this._subs=new Map,this._atom=N("function"==typeof(n=t("getInitialState"))?n(e):void 0),"function"==typeof(a=t("constructor"))&&a(e,[e,e.attrs])},oncreate:(t=(t,r=e[t])=>r&&((e,t)=>{_=e;try{return r.apply(e,t||[e])}finally{_=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||o,onbeforeremove:t("beforeComponentUnmounts"),view:w(e.render||(n=e.reagentRender,function(e){return E(n.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},C.when(e,e=>v(_,e,e._deref())),U.when(e,(e,t)=>(I(t,e.x)||(e.x=t,y()),t)),a.atom=N=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},C.when(t,e=>v(_,e,e._deref())),U.when(t,(e,t)=>(I(t,e._deref())||(e.src(e.path,t),y()),t)),s=e=>(t,r)=>void 0===r?j(e._deref(),t):V(e,x,t,r),a.cursor=(e,r)=>new t("function"==typeof e?e:s(e),r),a.adaptComponent=e=>(...t)=>[">",e,...t],a.classNames=S=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),D(e,M(t)?D(...t.map(e=>e&&{[e]:e})):t)),{}),O(t).filter(e=>t[e]).join(" ")},m=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},g=(e,t={})=>{var r,n;for(r in e)n=e[r],t[r]="on"!==r.slice(0,2)?n:m(n);return t},F=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=S(e[t])),e),g(t)),i=(e,t,r)=>{var n,a,i;return n=null!=(null!=(a=t[1])&&null!=(i=a.attrs)?i.key:void 0)?r:[r],h(p(e,F(e,t[0]),t[1],...n))},a.createElement=(e,t,...r)=>i(e,[t||{}],r),a.currentComponent=()=>_,a.children=e=>e.children,a.props=e=>e.attrs,a.argv=e=>e.attrs.argv,a.stateAtom=T=e=>e.state._atom,a.state=e=>C(T(e)),a.replaceState=(e,t)=>U(T(e),t),a.setState=(e,t)=>V(T(e),D,t)}).call(this);var i={};(function(){var e,t,s,o,c,l,f,u,p,d,h,v,m,g,y,b,w,_,E,x,q,S,C,k,j,I,A,M,O,D,F,N,U,$,T,V,L,R,z,J,P,Q,W,B,G,H,K,X,Y,Z,ee,te,re,ne,ae,ie,se,oe,ce,le,fe,ue,pe,de,he,ve=[].splice;({identical:X,eq:P,eqShallow:Q,keys:re,dict:T,entries:J,isArray:Z,isDict:ee,isFn:te,getIn:K,merge:ne,assoc:j,assocIn:M,dissoc:R,update:de,repr:oe,identity:Y,chunks:F,flatten:B,chain:D}=r),({atom:O,deref:$,reset:ce,swap:ue}=n),({_init:y,atom:ae,cursor:U}=a),d=P,i._init=e=>{y(e),d=(null!=e?e.eq:void 0)||d},i.appDb=k=ae({}),W=O({}),z=O({}),N=O({}),fe=O({}),_=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),u=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),C=new Map,i.clearSubscriptionCache=()=>C.clear(),h=new Set,i.purgeEventQueue=()=>(h.forEach(clearTimeout),h.clear()),s=e=>t=>{t?ue(e,R,t):ce(e,{})},w=()=>{throw SyntaxError("re-frame: invalid subscription signals")},S=e=>{var t;return e.every(([e,t])=>"<-"===e&&Z(t))||w(),1===(t=e.map(e=>e[1])).length?()=>le(t[0]):()=>t.map(le)},l=e=>e._deref(),e=e=>Z(e)?e.map(l):ee(e)?T(J(e).map(([e,t])=>[e,l(t)])):l(e),i.regSub=(e,...t)=>{var r,n;n=t,[...t]=n,[r]=ve.call(t,-1),t=0===t.length?()=>k:1!==t.length?S(F(t,2)):te(t[0])?t[0]:w(),$(fe)[e]&&u("subscription",e),ue(fe,j,e,[t,r])},t=(t,r)=>n=>{var a,i,s,o,c;return a=e(t(n)),C.has(s=oe(n))&&([i,o]=C.get(s),Q(a,i))?o:(c=r(a,n),C.set(s,[a,c]),c)},c=new Map,i.subscribe=le=e=>{var r,n;return(r=$(fe)[e[0]])?(c.has(n=oe(e))||c.set(n,U(t(...r),e)),c.get(n)):_("subscription",e)},i.clearSub=(he=s(fe),e=>(e||c.clear(),he(e))),i.toInterceptor=pe=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||Y,after:(null!=e?e.after:void 0)||Y}),g=(e,t,r)=>t?t in(e||{})?e[t]:r:e,i.getCoeffect=G=(e,t,r)=>g(e.coeffects,t,r),i.getEffect=H=(e,t,r)=>g(e.effects,t,r),i.assocCoeffect=I=(e,t,r)=>M(e,["coeffects",t],r),i.assocEffect=A=(e,t,r)=>M(e,["effects",t],r),i.enqueue=(e,t)=>de(e,"queue",e=>[...e,...t]),m=e=>H(e,"db",G(e,"db")),E="re-frame-path/db-store",i.path=(...e)=>pe({id:"path",before:t=>{var r,n;return r=G(t,"db"),n=[...t[E]||[],r],D(t,[j,E,n],[I,"db",K(r,B(e))])},after:t=>{var r,n,a;return a=t[E],[...n]=a,[r]=ve.call(n,-1),D(t,[j,E,n],[A,"db",M(r,B(e),m(t))],[I,"db",r])}}),i.enrich=e=>pe({id:"enrich",after:t=>A(t,"db",e(m(t),G(t,"event")))}),x=e=>t=>{var r;return r=G(t,"event"),D(t,[I,"originalEvent",r],[I,"event",e(r)])},q=e=>I(e,"event",G(e,"originalEvent")),i.unwrap=pe({id:"unwrap",after:q,before:x(e=>e[1])}),i.trimV=pe({id:"trim-v",after:q,before:x(e=>e.slice(1))}),i.after=e=>pe({id:"after",after:t=>(e(m(t),G(t,"event")),t)}),i.onChanges=(e,t,...r)=>pe({id:"on-changes",after:n=>{var a,i,s,o;return a=G(n,"db"),i=m(n),[s,o]=[a,i].map(e=>r.map(t=>K(e,t))),o.every((e,t)=>X(e,s[t]))?n:A(n,"db",M(i,t,e(...o)))}}),i.regCofx=(e,t)=>{$(N)[e]&&u("coeffect",e),ue(N,j,e,t)},i.injectCofx=(e,t)=>pe({id:e,before:r=>$(N)[e]?de(r,"coeffects",$(N)[e],t):(_("coeffect",[e]),r)}),i.clearCofx=s(N),i.regEventDb=(e,t,r)=>(r||([t,r]=[[],t]),se(e,t,(e,t)=>({db:r(e.db,t)}))),o=e=>t=>ne(t,{effects:e(G(t),G(t,"event"))}),i.regEventFx=se=(e,t,r)=>(r||([t,r]=[[],t]),ie(e,t,o(r))),i.regEventCtx=ie=(e,t,r)=>{r||([t,r]=[[],t]),$(W)[e]&&u("event",e),ue(W,j,e,[B(t.filter(Y)),r])},i.clearEvent=s(W),b=(e,t)=>{var r,n;for(e=ne(e,{stack:[],queue:e.stack});e.queue.length>0;)[r,...n]=e.queue,e=r[t](ne(e,{queue:n})),e=ne(e,{stack:[r,...e.stack]});return e},i.dispatchSync=L=e=>{var t,r,n,a;return(n=$(W)[e[0]])?([a,r]=n,t={stack:a,coeffects:{event:e,db:l(k)}},D(t,[b,"before"],r,[b,"after"],H,J,v)):_("event",e)},f=({ms:e,dispatch:t})=>{var r;return h.add(r=setTimeout(()=>(h.delete(r),L(t)),e)),r},i.dispatch=V=e=>f({dispatch:e}),p={db:e=>{if(!d(e,l(k)))return ce(k,e)},fx:v=(e,t=$(z))=>e.filter(Y).forEach(([e,r])=>{var n;return(n=t[e]||p[e])?n(r):_("effect",[e])}),dispatchLater:f,dispatch:e=>f({dispatch:e})},i.regFx=(e,t)=>{$(z)[e]&&u("effect",e),ue(z,j,e,t)},i.clearFx=s(z),i.dsub=e=>$(le(e)),i.disp=(e,...t)=>e&&V([...e,...t])}).call(this);var s={};return function(){var e,t,o,c,l;l=r,t=n,c=a,({_init:e}=o=i),s={util:l,atom:t,reagent:c,reFrame:o,_init:e}}.call(this),t.m["mreframe/util"]=r,t.m["mreframe/atom"]=n,t.m["mreframe/reagent"]=a,t.m["mreframe/re-frame"]=i,t.m.mreframe=s,t}("function"==typeof require?require:void 0); \ No newline at end of file +require=function(e){var t=function t(r,n){return t.m.hasOwnProperty(r)?t.m[r]:"function"!=typeof e||n?"function"==typeof t.r?t.r(r,1):void 0:e(r,1)};t.m={},t.r=e;var r={};(function(){var e,t,n,a,i,s,o,c,l,f,u,d,p,v,h,m,g,y,b,w,_;r.identity=p=e=>e,r.type=w=e=>null==e?e:Object.getPrototypeOf(e).constructor,r.keys=m=e=>Object.keys(e||{}),r.vals=e=>Object.values(e||{}),t=Object.entries||(e=>m(e).map(t=>[t,e[t]])),r.entries=i=e=>t(e||{}),e=Object.fromEntries||(e=>g(...e.map(([e,t])=>({[e]:t})))),r.dict=t=>e(t||[]),r.isArray=v=Array.isArray,r.isDict=h=e=>w(e)===Object,r.isFn=e=>"function"==typeof e,r.merge=g=(...e)=>Object.assign({},...e),r.assoc=n=(e,t,r)=>((e=v(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=r,e),r.dissoc=(e,...t)=>(e=v(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),r.update=_=(e,t,r,...a)=>n(e,t,r(null!=e?e[t]:void 0,...a)),r.getIn=u=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),r.assocIn=a=(e,t,r)=>t.length<2?n(e,t[0],r):_(e,t[0],a,t.slice(1),r),r.updateIn=(e,t,r,...n)=>a(e,t,r(u(e,t),...n)),r.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(t*n,t*(n+1))),r.flatten=f=e=>v(e)?e.flatMap(f):e,r.repr=e=>JSON.stringify(e,y),r.identical=d=(e,t)=>e===t||e!=e&&t!=t,r.eq=s=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&o(e,t,s):h(e)&&h(t)&&c(e,t)),r.eqShallow=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&o(e,t,d):h(e)&&h(t)&&l(e,t)),b=t=>e(i(t).sort()),y=(e,t)=>w(t)===RegExp?""+t:h(t)?b(t):t,o=(e,t,r)=>e.length===t.length&&e.every((e,n)=>r(e,t[n])),c=(e,t,r=m(e),n=new Set(m(t)))=>r.length===n.size&&r.every(e=>n.has(e))&&r.every(r=>s(e[r],t[r])),l=(e,t,r=m(e))=>r.length===m(t).length&&r.every(r=>r in t&&d(e[r],t[r])),r.chain=(e,...t)=>t.map(e=>v(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),r.multi=(e=p)=>{var t,r,n;return r=new Map,t=()=>{throw TypeError("Invalid arguments")},n=Object.assign((...n)=>(r.get(e(...n))||t)(...n),{when:(e,t)=>(r.set(e,t),n),default:e=>(t=e,n)})}}).call(this);var n={};(function(){var e,t,a,i,s,o,c,l;({multi:a,type:l}=r),n.deref=t=a(l),n.resetVals=s=a(l).default((e,r)=>[t(e),i(e,r)]),n.reset=i=a(l).default((e,t)=>o(e,()=>t)),n.swapVals=c=a(l).default((e,r,...n)=>s(e,r(t(e),...n))),n.swap=o=a(l).default((...e)=>c(...e)[1]),n.compareAndSet=a(l).default((e,r,n)=>r===t(e)&&(i(e,n),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),i.when(e,(e,t)=>e.x=t),n.atom=t=>new e(t)}).call(this);var a={};(function(){var e,t,i,s,o,c,l,f,u,d,p,v,h,m,g,y,b,w,_,E,x,q,S,C,j,k,I,O,A,M,D,F,N,U,$,T,V,L;({identical:O,eqShallow:k,isArray:M,keys:D,getIn:I,merge:F,assocIn:q,identity:A}=r),({atom:S,deref:j,reset:$,swap:L}=n),p=y=d=A,f=T=(e,t)=>t,a._init=e=>{d=(null!=e?e.hyperscript:void 0)||d,f=d.fragment||T,y=(null!=e?e.redraw:void 0)||y,p=(null!=e?e.mount:void 0)||p},_=null,b=new Map,a.resetCache=()=>b.clear(),h=(e,t,r)=>{for(;e;)e.state._subs.set(t,r),e=e._parent;return r},c=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&k(e._meta,t._meta)&&e.every((e,r)=>k(e,t[r])),o=function(e){var t;return!c(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,r])=>h(e._parent,t,r)),!1)},w=e=>function(t){var r;r=_,_=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{_=r}},l=e=>{var t;return b.has(e)||(t={oninit:function(r){this._comp=t,this._subs=new Map,this._atom=U(),this._view=e},onbeforeupdate:o,view:w((function(e){var t,r;return r=this._view.apply(e,t=e.attrs.argv.slice(1)),x("function"!=typeof r?r:(this._view=r).apply(e,t))}))},b.set(e,t)),b.get(e)},u=(e,t)=>"object"!=typeof t||M(t)?[e,x(t)]:[F(t,e)],v=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),a.asElement=x=e=>{var t,r;return M(e)?(t=e[0],r={...e._meta||{},_parent:_},">"===t?i(e[1],u(r,e[2]),e.slice(3).map(x)):"<>"===t?v(f(r,e.slice(1).map(x))):"string"==typeof t?i(t,u(r,e[1]),e.slice(2).map(x)):i("function"==typeof t?l(t):t,[{...r,argv:e}])):e},a.render=(e,t)=>p(t,{view:()=>x(e)}),a.with=E=(e,t)=>((t=t.slice(0))._meta=e,t),a.createClass=e=>{var t,r,n;return r={oninit:function(e){var n,a;this._comp=r,this._subs=new Map,this._atom=U("function"==typeof(n=t("getInitialState"))?n(e):void 0),"function"==typeof(a=t("constructor"))&&a(e,[e,e.attrs])},oncreate:(t=(t,r=e[t])=>r&&((e,t)=>{_=e;try{return r.apply(e,t||[e])}finally{_=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||o,onbeforeremove:t("beforeComponentUnmounts"),view:w(e.render||(n=e.reagentRender,function(e){return x(n.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},j.when(e,e=>h(_,e,e._deref())),$.when(e,(e,t)=>(O(t,e.x)||(e.x=t,y()),t)),a.atom=U=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},j.when(t,e=>h(_,e,e._deref())),$.when(t,(e,t)=>(O(t,e._deref())||(e.src(e.path,t),y()),t)),s=e=>(t,r)=>void 0===r?I(e._deref(),t):L(e,q,t,r),a.cursor=(e,r)=>new t("function"==typeof e?e:s(e),r),a.adaptComponent=e=>(...t)=>E(null!=_?_.attrs:void 0,[">",e,...t]),a.classNames=C=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),F(e,M(t)?F(...t.map(e=>e&&{[e]:e})):t)),{}),D(t).filter(e=>t[e]).join(" ")},m=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},g=(e,t={})=>{var r,n;for(r in e)n=e[r],t[r]="on"!==r.slice(0,2)?n:m(n);return t},N=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=C(e[t])),e),g(t)),i=(e,t,r)=>{var n,a,i;return n=null!=(null!=(a=t[1])&&null!=(i=a.attrs)?i.key:void 0)?r:[r],v(d(e,N(e,t[0]),t[1],...n))},a.createElement=(e,t,...r)=>i(e,[t||{}],r),a.currentComponent=()=>_,a.children=e=>e.children,a.props=e=>e.attrs,a.argv=e=>e.attrs.argv,a.stateAtom=V=e=>e.state._atom,a.state=e=>j(V(e)),a.replaceState=(e,t)=>$(V(e),t),a.setState=(e,t)=>L(V(e),F,t)}).call(this);var i={};(function(){var e,t,s,o,c,l,f,u,d,p,v,h,m,g,y,b,w,_,E,x,q,S,C,j,k,I,O,A,M,D,F,N,U,$,T,V,L,P,R,z,J,Q,W,B,G,H,K,X,Y,Z,ee,te,re,ne,ae,ie,se,oe,ce,le,fe,ue,de,pe,ve,he=[].splice;({identical:X,eq:J,eqShallow:Q,keys:re,dict:T,entries:z,isArray:Z,isDict:ee,isFn:te,getIn:K,merge:ne,assoc:k,assocIn:A,dissoc:P,update:pe,repr:oe,identity:Y,chunks:F,flatten:B,chain:D}=r),({atom:M,deref:$,reset:ce,swap:ue}=n),({_init:y,atom:ae,cursor:U}=a),p=J,i._init=e=>{y(e),p=(null!=e?e.eq:void 0)||p},i.appDb=j=ae({}),W=M({}),R=M({}),N=M({}),fe=M({}),_=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),u=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),C=new Map,i.clearSubscriptionCache=()=>C.clear(),v=new Set,i.purgeEventQueue=()=>(v.forEach(clearTimeout),v.clear()),s=e=>t=>{t?ue(e,P,t):ce(e,{})},w=()=>{throw SyntaxError("re-frame: invalid subscription signals")},S=e=>{var t;return e.every(([e,t])=>"<-"===e&&Z(t))||w(),1===(t=e.map(e=>e[1])).length?()=>le(t[0]):()=>t.map(le)},l=e=>e._deref(),e=e=>Z(e)?e.map(l):ee(e)?T(z(e).map(([e,t])=>[e,l(t)])):l(e),i.regSub=(e,...t)=>{var r,n;n=t,[...t]=n,[r]=he.call(t,-1),t=0===t.length?()=>j:1!==t.length?S(F(t,2)):te(t[0])?t[0]:w(),$(fe)[e]&&u("subscription",e),ue(fe,k,e,[t,r])},t=(t,r)=>n=>{var a,i,s,o,c;return a=e(t(n)),C.has(s=oe(n))&&([i,o]=C.get(s),Q(a,i))?o:(c=r(a,n),C.set(s,[a,c]),c)},c=new Map,i.subscribe=le=e=>{var r,n;return(r=$(fe)[e[0]])?(c.has(n=oe(e))||c.set(n,U(t(...r),e)),c.get(n)):_("subscription",e)},i.clearSub=(ve=s(fe),e=>(e||c.clear(),ve(e))),i.toInterceptor=de=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||Y,after:(null!=e?e.after:void 0)||Y}),g=(e,t,r)=>t?t in(e||{})?e[t]:r:e,i.getCoeffect=G=(e,t,r)=>g(e.coeffects,t,r),i.getEffect=H=(e,t,r)=>g(e.effects,t,r),i.assocCoeffect=I=(e,t,r)=>A(e,["coeffects",t],r),i.assocEffect=O=(e,t,r)=>A(e,["effects",t],r),i.enqueue=(e,t)=>pe(e,"queue",e=>[...e,...t]),m=e=>H(e,"db",G(e,"db")),E="re-frame-path/db-store",i.path=(...e)=>de({id:"path",before:t=>{var r,n;return r=G(t,"db"),n=[...t[E]||[],r],D(t,[k,E,n],[I,"db",K(r,B(e))])},after:t=>{var r,n,a;return a=t[E],[...n]=a,[r]=he.call(n,-1),D(t,[k,E,n],[O,"db",A(r,B(e),m(t))],[I,"db",r])}}),i.enrich=e=>de({id:"enrich",after:t=>O(t,"db",e(m(t),G(t,"event")))}),x=e=>t=>{var r;return r=G(t,"event"),D(t,[I,"originalEvent",r],[I,"event",e(r)])},q=e=>I(e,"event",G(e,"originalEvent")),i.unwrap=de({id:"unwrap",after:q,before:x(e=>e[1])}),i.trimV=de({id:"trim-v",after:q,before:x(e=>e.slice(1))}),i.after=e=>de({id:"after",after:t=>(e(m(t),G(t,"event")),t)}),i.onChanges=(e,t,...r)=>de({id:"on-changes",after:n=>{var a,i,s,o;return a=G(n,"db"),i=m(n),[s,o]=[a,i].map(e=>r.map(t=>K(e,t))),o.every((e,t)=>X(e,s[t]))?n:O(n,"db",A(i,t,e(...o)))}}),i.regCofx=(e,t)=>{$(N)[e]&&u("coeffect",e),ue(N,k,e,t)},i.injectCofx=(e,t)=>de({id:e,before:r=>$(N)[e]?pe(r,"coeffects",$(N)[e],t):(_("coeffect",[e]),r)}),i.clearCofx=s(N),i.regEventDb=(e,t,r)=>(r||([t,r]=[[],t]),se(e,t,(e,t)=>({db:r(e.db,t)}))),o=e=>t=>ne(t,{effects:e(G(t),G(t,"event"))}),i.regEventFx=se=(e,t,r)=>(r||([t,r]=[[],t]),ie(e,t,o(r))),i.regEventCtx=ie=(e,t,r)=>{r||([t,r]=[[],t]),$(W)[e]&&u("event",e),ue(W,k,e,[B(t.filter(Y)),r])},i.clearEvent=s(W),b=(e,t)=>{var r,n;for(e=ne(e,{stack:[],queue:e.stack});e.queue.length>0;)[r,...n]=e.queue,e=r[t](ne(e,{queue:n})),e=ne(e,{stack:[r,...e.stack]});return e},i.dispatchSync=L=e=>{var t,r,n,a;return(n=$(W)[e[0]])?([a,r]=n,t={stack:a,coeffects:{event:e,db:l(j)}},D(t,[b,"before"],r,[b,"after"],H,z,h)):_("event",e)},f=({ms:e,dispatch:t})=>{var r;return v.add(r=setTimeout(()=>(v.delete(r),L(t)),e)),r},i.dispatch=V=e=>f({dispatch:e}),d={db:e=>{if(!p(e,l(j)))return ce(j,e)},fx:h=(e,t=$(R))=>e.filter(Y).forEach(([e,r])=>{var n;return(n=t[e]||d[e])?n(r):_("effect",[e])}),dispatchLater:f,dispatch:e=>f({dispatch:e})},i.regFx=(e,t)=>{$(R)[e]&&u("effect",e),ue(R,k,e,t)},i.clearFx=s(R),i.dsub=e=>$(le(e)),i.disp=(e,...t)=>e&&V([...e,...t])}).call(this);var s={};(function(){var e,t,o,c,l;l=r,t=n,c=a,({_init:e}=o=i),s={util:l,atom:t,reagent:c,reFrame:o,_init:e}}).call(this);var o={};return function(){var e;e=a,o={}}.call(this),t.m["mreframe/util"]=r,t.m["mreframe/atom"]=n,t.m["mreframe/reagent"]=a,t.m["mreframe/re-frame"]=i,t.m.mreframe=s,t.m["mreframe/jsx-runtime"]=o,t}("function"==typeof require?require:void 0); \ No newline at end of file diff --git a/dist/mreframe-route.js b/dist/mreframe-route.js index 8daa1b6..f72e40c 100644 --- a/dist/mreframe-route.js +++ b/dist/mreframe-route.js @@ -2254,7 +2254,25 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }).call(this); -},{"./util":25}],23:[function(require,module,exports){ +},{"./util":26}],23:[function(require,module,exports){ +(function() { + var jsx, r; + + r = require('./reagent'); + + jsx = (tag, {children = [], ...attrs}, key) => { // this API isn't documented properly... + return r.with({key, ...attrs}, [tag].concat(children)); + }; + + module.exports = { + jsx, + jsxs: jsx, + Fragment: '<>' + }; + +}).call(this); + +},{"./reagent":25}],24:[function(require,module,exports){ (function() { /* @@ -2747,9 +2765,9 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }).call(this); -},{"./atom":22,"./reagent":24,"./util":25}],24:[function(require,module,exports){ +},{"./atom":22,"./reagent":25,"./util":26}],25:[function(require,module,exports){ (function() { - var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; + var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, _with, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; ({identical, eqShallow, isArray, keys, getIn, merge, assocIn, identity} = require('./util')); @@ -2787,7 +2805,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }; _eqArgs = (xs, ys) => { - return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && xs.every((x, i) => { + return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && eqShallow(xs._meta, ys._meta) && xs.every((x, i) => { return eqShallow(x, ys[i]); })); }; @@ -2803,13 +2821,15 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : _rendering = (binding) => { return function(vnode) { + var _old; + _old = _vnode; _vnode = vnode; try { this._subs.clear(); this._argv = vnode.attrs.argv; // last render args return binding.call(this, vnode); } finally { - _vnode = null; + _vnode = _old; } }; }; @@ -2898,7 +2918,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }; /* Adds metadata to the Hiccup form of a Reagent component or a fragment */ - exports.with = (meta, form) => { + exports.with = _with = (meta, form) => { form = form.slice(0); form._meta = meta; return form; @@ -3017,7 +3037,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : /* Converts a Mithril component into a Reagent component */ exports.adaptComponent = (c) => { return (...args) => { - return ['>', c, ...args]; + return _with(_vnode != null ? _vnode.attrs : void 0, ['>', c, ...args]); }; }; @@ -3123,7 +3143,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }).call(this); -},{"./atom":22,"./util":25}],25:[function(require,module,exports){ +},{"./atom":22,"./util":26}],26:[function(require,module,exports){ (function() { var _dict, _entries, assoc, assocIn, entries, eq, eqArr, eqObj, eqObjShallow, eqShallow, flatten, getIn, identical, identity, isArray, isDict, keys, merge, replacer, sorter, type, update, vals; @@ -3135,7 +3155,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : if (x == null) { return x; } else { - return x.__proto__.constructor; + return Object.getPrototypeOf(x).constructor; } }; @@ -3358,7 +3378,13 @@ module.exports = require("./api/router")(typeof window !== "undefined" ? window }).call(this); -},{"./src/atom":22}],"mreframe/re-frame":[function(require,module,exports){ +},{"./src/atom":22}],"mreframe/jsx-runtime":[function(require,module,exports){ +(function() { + module.exports = require('./src/jsx-runtime'); + +}).call(this); + +},{"./src/jsx-runtime":23}],"mreframe/re-frame":[function(require,module,exports){ (function() { var hyperscript, mount, reFrame, redraw; @@ -3374,7 +3400,7 @@ module.exports = require("./api/router")(typeof window !== "undefined" ? window }).call(this); -},{"./src/re-frame":23,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/reagent":[function(require,module,exports){ +},{"./src/re-frame":24,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/reagent":[function(require,module,exports){ (function() { var hyperscript, mount, reagent, redraw; @@ -3390,13 +3416,13 @@ module.exports = require("./api/router")(typeof window !== "undefined" ? window }).call(this); -},{"./src/reagent":24,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/util":[function(require,module,exports){ +},{"./src/reagent":25,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/util":[function(require,module,exports){ (function() { module.exports = require('./src/util'); }).call(this); -},{"./src/util":25}],"mreframe":[function(require,module,exports){ +},{"./src/util":26}],"mreframe":[function(require,module,exports){ (function() { var _init, atom, exports, hyperscript, mount, reFrame, reagent, redraw, util; diff --git a/dist/mreframe-route.min.js b/dist/mreframe-route.min.js index 3471f41..33c7cba 100644 --- a/dist/mreframe-route.min.js +++ b/dist/mreframe-route.min.js @@ -1 +1 @@ -require=function(e){var t=function t(n,r){return t.m.hasOwnProperty(n)?t.m[n]:"function"!=typeof e||r?"function"==typeof t.r?t.r(n,1):void 0:e(n,1)};t.m={},t.r=e;var n,r,o=(n=function(e,t){(function(e,n){(function(){var r=b.nextTick,o=(Function.prototype.apply,Array.prototype.slice),i={},l=0;function a(e,t){this._id=e,this._clearFn=t}a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},t.setImmediate="function"==typeof e?e:function(e){var n=l++,a=!(arguments.length<2)&&o.call(arguments,1);return i[n]=!0,r((function(){i[n]&&(a?e.apply(null,a):e.call(null),t.clearImmediate(n))})),n},t.clearImmediate="function"==typeof n?n:function(e){delete i[e]}}).call(this)}).call(this,o({}).setImmediate,o({}).clearImmediate)},function(e){return r||n(r={exports:{},parent:e},r.exports),r.exports}),i={};function l(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}l.normalize=function(e){return Array.isArray(e)?l("[",void 0,void 0,l.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:l("#",void 0,void 0,String(e),void 0,void 0)},l.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r0&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)};h.trust=function(e){return null==e&&(e=""),i("<",void 0,void 0,e,void 0,void 0)},h.fragment=function(){var e=a.apply(0,arguments);return e.tag="[",e.children=i.normalizeChildren(e.children),e},d=h;var p,v,m=function(e){var t,n=e&&e.document,o={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function l(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 s(e){var t=e.state;try{return this.apply(t,arguments)}finally{a(e,t)}}function u(){try{return n.activeElement}catch(r){return null}}function c(e,t,n,r,o,i,l){for(var a=n;a'+t.children+"",l=l.firstChild):l.innerHTML=t.children,t.dom=l.firstChild,t.domSize=l.childNodes.length,t.instance=[];for(var a,s=n.createDocumentFragment();a=l.firstChild;)t.instance.push(a),s.appendChild(a);b(e,s,o)}function p(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)c(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)x(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!l)for(;u=u&&S>=s&&(p=t[_],b=n[S],p.key===b.key);)p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),_--,S--;for(;_>=u&&S>=s&&(d=t[u],h=n[s],d.key===h.key);)u++,s++,d!==h&&v(e,d,h,r,g(t,u,o),i);for(;_>=u&&S>=s&&s!==S&&d.key===b.key&&p.key===h.key;)w(e,p,k=g(t,u,o)),p!==h&&v(e,p,h,r,k,i),++s<=--S&&w(e,d,o),d!==b&&v(e,d,b,r,o,i),null!=b.dom&&(o=b.dom),u++,p=t[--_],b=n[S],d=t[u],h=n[s];for(;_>=u&&S>=s&&p.key===b.key;)p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),S--,p=t[--_],b=n[S];if(s>S)x(e,t,u,_+1);else if(u>_)c(e,n,s,S+1,r,o,i);else{var j,T,A=o,C=S-s+1,I=new Array(C),O=0,N=0,$=2147483647,z=0;for(N=0;N=s;N--){null==j&&(j=m(t,u,_+1));var L=j[(b=n[N]).key];null!=L&&($=L<$?L:-1,I[N-s]=L,p=t[L],t[L]=null,p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),z++)}if(o=A,z!==_-u+1&&x(e,t,u,_+1),0===z)c(e,n,s,S+1,r,o,i);else if(-1===$)for(O=(T=function(e){var t=[0],n=0,r=0,o=0,i=y.length=e.length;for(o=0;o>>1)+(r>>>1)+(n&r&1);e[t[a]]0&&(y[o]=t[n-1]),t[n]=o)}}for(r=t[(n=t.length)-1];n-- >0;)t[n]=r,r=y[r];return y.length=0,t}(I)).length-1,N=S;N>=s;N--)h=n[N],-1===I[N-s]?f(e,h,r,i,o):T[O]===N-s?O--:w(e,h,o),null!=h.dom&&(o=n[N].dom);else for(N=S;N>=s;N--)h=n[N],-1===I[N-s]&&f(e,h,r,i,o),null!=h.dom&&(o=n[N].dom)}}else{var P=t.lengthP&&x(e,t,s,t.length),n.length>P&&c(e,n,s,n.length,r,o,i)}}}function v(e,t,n,r,o,a){var u=t.tag;if(u===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=s.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=s.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof u)switch(null!=n.attrs&&D(n.attrs,n,r),u){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?(_(e,t),h(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,a,o);break;case"[":!function(e,t,n,r,o,i){p(e,t.children,n.children,r,o,i);var l=0,a=n.children;if(n.dom=null,null!=a){for(var s=0;s-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var O,N=/[A-Z]/g;function $(e){return"-"+e.toLowerCase()}function z(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(N,$)}function L(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(z(r),String(o));else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(z(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(z(r))}}function P(){this._=t}function M(e,n,r){if(null!=e.events){if(e.events._=t,e.events[n]===r)return;null==r||"function"!=typeof r&&"object"!=typeof r?(null!=e.events[n]&&e.dom.removeEventListener(n.slice(2),e.events,!1),e.events[n]=void 0):(null==e.events[n]&&e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}else null==r||"function"!=typeof r&&"object"!=typeof r||(e.events=new P,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}function q(e,t,n){"function"==typeof e.oninit&&s.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(s.bind(e.oncreate,t))}function D(e,t,n){"function"==typeof e.onupdate&&n.push(s.bind(e.onupdate,t))}return P.prototype=Object.create(null),P.prototype.handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,n,r){if(!e)throw new TypeError("DOM element being rendered to does not exist.");if(null!=O&&e.contains(O))throw new TypeError("Node is currently being rendered to and thus is locked.");var o=t,l=O,a=[],s=u(),c=e.namespaceURI;O=e,t="function"==typeof r?r:void 0;try{null==e.vnodes&&(e.textContent=""),n=i.normalizeChildren(Array.isArray(n)?n:[n]),p(e,e.vnodes,n,a,null,"http://www.w3.org/1999/xhtml"===c?void 0:c),e.vnodes=n,null!=s&&u()!==s&&"function"==typeof s.focus&&s.focus();for(var f=0;f=0&&(o.splice(r,2),r<=a&&(a-=2),e(t,[])),null!=n&&(o.push(t,n),e(t,i(n),u))},redraw:u}}(m,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),g=y.mount,w=y.redraw,b={},k=b={};function x(){throw new Error("setTimeout has not been defined")}function E(){throw new Error("clearTimeout has not been defined")}function _(e){if(p===setTimeout)return setTimeout(e,0);if((p===x||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(r){try{return p.call(null,e,0)}catch(r){return p.call(this,e,0)}}}!function(){try{p="function"==typeof setTimeout?setTimeout:x}catch(r){p=x}try{v="function"==typeof clearTimeout?clearTimeout:E}catch(r){v=E}}();var S,j=[],T=!1,A=-1;function C(){T&&S&&(T=!1,S.length?j=S.concat(j):A=-1,j.length&&I())}function I(){if(!T){var e=_(C);T=!0;for(var t=j.length;t;){for(S=j,j=[];++A1)for(var n=1;n0||e(n)}}var o=n(s);try{e(n(a),o)}catch(r){o(r)}}d(n)};t.prototype.then=function(e,n){var o,i,l=this._instance;function a(e,t,n,a){t.push((function(t){if("function"!=typeof e)n(t);else try{o(e(t))}catch(r){i&&i(r)}})),"function"==typeof l.retry&&a===l.state&&l.retry()}var s=new t((function(e,t){o=e,i=t}));return a(e,l.resolvers,o,!0),a(n,l.rejectors,i,!1),s},t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(e){return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))},t.resolve=function(e){return e instanceof t?e:new t((function(t){t(e)}))},t.reject=function(e){return new t((function(t,n){n(e)}))},t.all=function(e){return new t((function(t,n){var r=e.length,o=0,i=[];if(0===e.length)t([]);else for(var l=0;l=0&&(h+=e.slice(n,o)),u>=0&&(h+=(n<0?"?":"&")+s.slice(u,f));var p=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var t=[];for(var n in e)r(n,e[n]);return t.join("&");function r(e,n){if(Array.isArray(n))for(var o=0;o=0&&(h+=e.slice(r)),c>=0&&(h+=(r<0?"":"&")+s.slice(c)),h};function M(e){try{return decodeURIComponent(e)}catch(t){return e}}var q=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o-1&&s.pop();for(var c=0;c1&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:q(e.slice(t+1,r))}},F=new RegExp("^(?:key|oninit|oncreate|onbeforeupdate|onupdate|onbeforeremove|onremove)$"),R={};function U(e){try{return decodeURIComponent(e)}catch(r){return e}}var K=function(e,t){var n,r,o,l,a,u,c=null==e?null:"function"==typeof e.setImmediate?e.setImmediate:e.setTimeout,f=z.resolve(),d=!1,p=!1,v=0,m=R,y={onbeforeupdate:function(){return!(!(v=v?2:1)||R===m)},onremove:function(){e.removeEventListener("popstate",b,!1),e.removeEventListener("hashchange",w,!1)},view:function(){if(v&&R!==m){var e=[i(o,l.key,l)];return m&&(e=m.render(e[0])),e}}},g=x.SKIP={};function w(){d=!1;var i=e.location.hash;"#"!==x.prefix[0]&&(i=e.location.search+i,"?"!==x.prefix[0]&&"/"!==(i=e.location.pathname+i)[0]&&(i="/"+i));var s=i.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,U).slice(x.prefix.length),c=D(s);function h(e){console.error(e),k(r,null,{replace:!0})}L(c.params,e.history.state),function e(i){for(;ie,H.type=w=e=>null==e?e:e.__proto__.constructor,H.keys=v=e=>Object.keys(e||{}),H.vals=e=>Object.values(e||{}),t=Object.entries||(e=>v(e).map(t=>[t,e[t]])),H.entries=o=e=>t(e||{}),e=Object.fromEntries||(e=>m(...e.map(([e,t])=>({[e]:t})))),H.dict=t=>e(t||[]),H.isArray=h=Array.isArray,H.isDict=p=e=>w(e)===Object,H.isFn=e=>"function"==typeof e,H.merge=m=(...e)=>Object.assign({},...e),H.assoc=n=(e,t,n)=>((e=h(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=n,e),H.dissoc=(e,...t)=>(e=h(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),H.update=b=(e,t,r,...o)=>n(e,t,r(null!=e?e[t]:void 0,...o)),H.getIn=c=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),H.assocIn=r=(e,t,o)=>t.length<2?n(e,t[0],o):b(e,t[0],r,t.slice(1),o),H.updateIn=(e,t,n,...o)=>r(e,t,n(c(e,t),...o)),H.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(t*r,t*(r+1))),H.flatten=u=e=>h(e)?e.flatMap(u):e,H.repr=e=>JSON.stringify(e,y),H.identical=f=(e,t)=>e===t||e!=e&&t!=t,H.eq=i=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&l(e,t,i):p(e)&&p(t)&&a(e,t)),H.eqShallow=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&l(e,t,f):p(e)&&p(t)&&s(e,t)),g=t=>e(o(t).sort()),y=(e,t)=>w(t)===RegExp?""+t:p(t)?g(t):t,l=(e,t,n)=>e.length===t.length&&e.every((e,r)=>n(e,t[r])),a=(e,t,n=v(e),r=new Set(v(t)))=>n.length===r.size&&n.every(e=>r.has(e))&&n.every(n=>i(e[n],t[n])),s=(e,t,n=v(e))=>n.length===v(t).length&&n.every(n=>n in t&&f(e[n],t[n])),H.chain=(e,...t)=>t.map(e=>h(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),H.multi=(e=d)=>{var t,n,r;return n=new Map,t=()=>{throw TypeError("Invalid arguments")},r=Object.assign((...r)=>(n.get(e(...r))||t)(...r),{when:(e,t)=>(n.set(e,t),r),default:e=>(t=e,r)})}}).call(this);var V={};(function(){V=H}).call(this);var B={};(function(){var e,t,n,r,o,i,l,a;({multi:n,type:a}=H),B.deref=t=n(a),B.resetVals=o=n(a).default((e,n)=>[t(e),r(e,n)]),B.reset=r=n(a).default((e,t)=>i(e,()=>t)),B.swapVals=l=n(a).default((e,n,...r)=>o(e,n(t(e),...r))),B.swap=i=n(a).default((...e)=>l(...e)[1]),B.compareAndSet=n(a).default((e,n,o)=>n===t(e)&&(r(e,o),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),r.when(e,(e,t)=>e.x=t),B.atom=t=>new e(t)}).call(this);var J={};(function(){J=B}).call(this);var Q={};(function(){var e,t,n,r,o,i,l,a,s,u,c,f,d,h,p,v,m,y,g,w,b,k,x,E,_,S,j,T,A,C,I,O,N,$,z,L,P;({identical:j,eqShallow:_,isArray:A,keys:C,getIn:S,merge:I,assocIn:b,identity:T}=H),({atom:k,deref:E,reset:$,swap:P}=B),c=v=u=T,a=z=(e,t)=>t,Q._init=e=>{u=(null!=e?e.hyperscript:void 0)||u,a=u.fragment||z,v=(null!=e?e.redraw:void 0)||v,c=(null!=e?e.mount:void 0)||c},g=null,m=new Map,Q.resetCache=()=>m.clear(),d=(e,t,n)=>{for(;e;)e.state._subs.set(t,n),e=e._parent;return n},i=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&e.every((e,n)=>_(e,t[n])),o=function(e){var t;return!i(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,n])=>d(e._parent,t,n)),!1)},y=e=>function(t){g=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{g=null}},l=e=>{var t;return m.has(e)||(t={oninit:function(n){this._comp=t,this._subs=new Map,this._atom=N(),this._view=e},onbeforeupdate:o,view:y((function(e){var t,n;return n=this._view.apply(e,t=e.attrs.argv.slice(1)),w("function"!=typeof n?n:(this._view=n).apply(e,t))}))},m.set(e,t)),m.get(e)},s=(e,t)=>"object"!=typeof t||A(t)?[e,w(t)]:[I(t,e)],f=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),Q.asElement=w=e=>{var t,r;return A(e)?(t=e[0],r={...e._meta||{},_parent:g},">"===t?n(e[1],s(r,e[2]),e.slice(3).map(w)):"<>"===t?f(a(r,e.slice(1).map(w))):"string"==typeof t?n(t,s(r,e[1]),e.slice(2).map(w)):n("function"==typeof t?l(t):t,[{...r,argv:e}])):e},Q.render=(e,t)=>c(t,{view:()=>w(e)}),Q.with=(e,t)=>((t=t.slice(0))._meta=e,t),Q.createClass=e=>{var t,n,r;return n={oninit:function(e){var r,o;this._comp=n,this._subs=new Map,this._atom=N("function"==typeof(r=t("getInitialState"))?r(e):void 0),"function"==typeof(o=t("constructor"))&&o(e,[e,e.attrs])},oncreate:(t=(t,n=e[t])=>n&&((e,t)=>{g=e;try{return n.apply(e,t||[e])}finally{g=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||o,onbeforeremove:t("beforeComponentUnmounts"),view:y(e.render||(r=e.reagentRender,function(e){return w(r.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},E.when(e,e=>d(g,e,e._deref())),$.when(e,(e,t)=>(j(t,e.x)||(e.x=t,v()),t)),Q.atom=N=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},E.when(t,e=>d(g,e,e._deref())),$.when(t,(e,t)=>(j(t,e._deref())||(e.src(e.path,t),v()),t)),r=e=>(t,n)=>void 0===n?S(e._deref(),t):P(e,b,t,n),Q.cursor=(e,n)=>new t("function"==typeof e?e:r(e),n),Q.adaptComponent=e=>(...t)=>[">",e,...t],Q.classNames=x=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),I(e,A(t)?I(...t.map(e=>e&&{[e]:e})):t)),{}),C(t).filter(e=>t[e]).join(" ")},h=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},p=(e,t={})=>{var n,r;for(n in e)r=e[n],t[n]="on"!==n.slice(0,2)?r:h(r);return t},O=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=x(e[t])),e),p(t)),n=(e,t,n)=>{var r,o,i;return r=null!=(null!=(o=t[1])&&null!=(i=o.attrs)?i.key:void 0)?n:[n],f(u(e,O(e,t[0]),t[1],...r))},Q.createElement=(e,t,...r)=>n(e,[t||{}],r),Q.currentComponent=()=>g,Q.children=e=>e.children,Q.props=e=>e.attrs,Q.argv=e=>e.attrs.argv,Q.stateAtom=L=e=>e.state._atom,Q.state=e=>E(L(e)),Q.replaceState=(e,t)=>$(L(e),t),Q.setState=(e,t)=>P(L(e),I,t)}).call(this);var W={};(function(){var e,t,n,r;t=g,r=w,e=d,W=n=Q,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var Y={};(function(){var e,t,n,r,o,i,l,a,s,u,c,f,d,h,p,v,m,y,g,w,b,k,x,E,_,S,j,T,A,C,I,O,N,$,z,L,P,M,q,D,F,R,U,K,V,J,W,Z,G,X,ee,te,ne,re,oe,ie,le,ae,se,ue,ce,fe,de,he,pe,ve=[].splice;({identical:Z,eq:F,eqShallow:R,keys:ne,dict:z,entries:D,isArray:X,isDict:ee,isFn:te,getIn:W,merge:re,assoc:_,assocIn:T,dissoc:M,update:he,repr:ae,identity:G,chunks:I,flatten:K,chain:C}=H),({atom:A,deref:$,reset:se,swap:fe}=B),({_init:p,atom:oe,cursor:N}=Q),u=F,Y._init=e=>{p(e),u=(null!=e?e.eq:void 0)||u},Y.appDb=E=oe({}),U=A({}),q=A({}),O=A({}),ce=A({}),y=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),a=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),x=new Map,Y.clearSubscriptionCache=()=>x.clear(),c=new Set,Y.purgeEventQueue=()=>(c.forEach(clearTimeout),c.clear()),n=e=>t=>{t?fe(e,M,t):se(e,{})},m=()=>{throw SyntaxError("re-frame: invalid subscription signals")},k=e=>{var t;return e.every(([e,t])=>"<-"===e&&X(t))||m(),1===(t=e.map(e=>e[1])).length?()=>ue(t[0]):()=>t.map(ue)},i=e=>e._deref(),e=e=>X(e)?e.map(i):ee(e)?z(D(e).map(([e,t])=>[e,i(t)])):i(e),Y.regSub=(e,...t)=>{var n,r;r=t,[...t]=r,[n]=ve.call(t,-1),t=0===t.length?()=>E:1!==t.length?k(I(t,2)):te(t[0])?t[0]:m(),$(ce)[e]&&a("subscription",e),fe(ce,_,e,[t,n])},t=(t,n)=>r=>{var o,i,l,a,s;return o=e(t(r)),x.has(l=ae(r))&&([i,a]=x.get(l),R(o,i))?a:(s=n(o,r),x.set(l,[o,s]),s)},o=new Map,Y.subscribe=ue=e=>{var n,r;return(n=$(ce)[e[0]])?(o.has(r=ae(e))||o.set(r,N(t(...n),e)),o.get(r)):y("subscription",e)},Y.clearSub=(pe=n(ce),e=>(e||o.clear(),pe(e))),Y.toInterceptor=de=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||G,after:(null!=e?e.after:void 0)||G}),h=(e,t,n)=>t?t in(e||{})?e[t]:n:e,Y.getCoeffect=V=(e,t,n)=>h(e.coeffects,t,n),Y.getEffect=J=(e,t,n)=>h(e.effects,t,n),Y.assocCoeffect=S=(e,t,n)=>T(e,["coeffects",t],n),Y.assocEffect=j=(e,t,n)=>T(e,["effects",t],n),Y.enqueue=(e,t)=>he(e,"queue",e=>[...e,...t]),d=e=>J(e,"db",V(e,"db")),g="re-frame-path/db-store",Y.path=(...e)=>de({id:"path",before:t=>{var n,r;return n=V(t,"db"),r=[...t[g]||[],n],C(t,[_,g,r],[S,"db",W(n,K(e))])},after:t=>{var n,r,o;return o=t[g],[...r]=o,[n]=ve.call(r,-1),C(t,[_,g,r],[j,"db",T(n,K(e),d(t))],[S,"db",n])}}),Y.enrich=e=>de({id:"enrich",after:t=>j(t,"db",e(d(t),V(t,"event")))}),w=e=>t=>{var n;return n=V(t,"event"),C(t,[S,"originalEvent",n],[S,"event",e(n)])},b=e=>S(e,"event",V(e,"originalEvent")),Y.unwrap=de({id:"unwrap",after:b,before:w(e=>e[1])}),Y.trimV=de({id:"trim-v",after:b,before:w(e=>e.slice(1))}),Y.after=e=>de({id:"after",after:t=>(e(d(t),V(t,"event")),t)}),Y.onChanges=(e,t,...n)=>de({id:"on-changes",after:r=>{var o,i,l,a;return o=V(r,"db"),i=d(r),[l,a]=[o,i].map(e=>n.map(t=>W(e,t))),a.every((e,t)=>Z(e,l[t]))?r:j(r,"db",T(i,t,e(...a)))}}),Y.regCofx=(e,t)=>{$(O)[e]&&a("coeffect",e),fe(O,_,e,t)},Y.injectCofx=(e,t)=>de({id:e,before:n=>$(O)[e]?he(n,"coeffects",$(O)[e],t):(y("coeffect",[e]),n)}),Y.clearCofx=n(O),Y.regEventDb=(e,t,n)=>(n||([t,n]=[[],t]),le(e,t,(e,t)=>({db:n(e.db,t)}))),r=e=>t=>re(t,{effects:e(V(t),V(t,"event"))}),Y.regEventFx=le=(e,t,n)=>(n||([t,n]=[[],t]),ie(e,t,r(n))),Y.regEventCtx=ie=(e,t,n)=>{n||([t,n]=[[],t]),$(U)[e]&&a("event",e),fe(U,_,e,[K(t.filter(G)),n])},Y.clearEvent=n(U),v=(e,t)=>{var n,r;for(e=re(e,{stack:[],queue:e.stack});e.queue.length>0;)[n,...r]=e.queue,e=n[t](re(e,{queue:r})),e=re(e,{stack:[n,...e.stack]});return e},Y.dispatchSync=P=e=>{var t,n,r,o;return(r=$(U)[e[0]])?([o,n]=r,t={stack:o,coeffects:{event:e,db:i(E)}},C(t,[v,"before"],n,[v,"after"],J,D,f)):y("event",e)},l=({ms:e,dispatch:t})=>{var n;return c.add(n=setTimeout(()=>(c.delete(n),P(t)),e)),n},Y.dispatch=L=e=>l({dispatch:e}),s={db:e=>{if(!u(e,i(E)))return se(E,e)},fx:f=(e,t=$(q))=>e.filter(G).forEach(([e,n])=>{var r;return(r=t[e]||s[e])?r(n):y("effect",[e])}),dispatchLater:l,dispatch:e=>l({dispatch:e})},Y.regFx=(e,t)=>{$(q)[e]&&a("effect",e),fe(q,_,e,t)},Y.clearFx=n(q),Y.dsub=e=>$(ue(e)),Y.disp=(e,...t)=>e&&L([...e,...t])}).call(this);var Z={};(function(){var e,t,n,r;t=g,r=w,e=d,Z=n=Y,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var G={};return function(){var e,t,n,r,o;o=V,t=J,r=W,({_init:e}=n=Z),G={util:o,atom:t,reagent:r,reFrame:n,_init:e}}.call(this),t.m["mithril/hyperscript"]=d,t.m["mithril/render"]=m,t.m["mithril/mount"]=g,t.m["mithril/redraw"]=w,t.m["mithril/route"]=K,t.m["mreframe/util"]=V,t.m["mreframe/atom"]=J,t.m["mreframe/reagent"]=W,t.m["mreframe/re-frame"]=Z,t.m.mreframe=G,t}("function"==typeof require?require:void 0); \ No newline at end of file +require=function(e){var t=function t(n,r){return t.m.hasOwnProperty(n)?t.m[n]:"function"!=typeof e||r?"function"==typeof t.r?t.r(n,1):void 0:e(n,1)};t.m={},t.r=e;var n,r,o=(n=function(e,t){(function(e,n){(function(){var r=b.nextTick,o=(Function.prototype.apply,Array.prototype.slice),i={},l=0;function a(e,t){this._id=e,this._clearFn=t}a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},t.setImmediate="function"==typeof e?e:function(e){var n=l++,a=!(arguments.length<2)&&o.call(arguments,1);return i[n]=!0,r((function(){i[n]&&(a?e.apply(null,a):e.call(null),t.clearImmediate(n))})),n},t.clearImmediate="function"==typeof n?n:function(e){delete i[e]}}).call(this)}).call(this,o({}).setImmediate,o({}).clearImmediate)},function(e){return r||n(r={exports:{},parent:e},r.exports),r.exports}),i={};function l(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}l.normalize=function(e){return Array.isArray(e)?l("[",void 0,void 0,l.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:l("#",void 0,void 0,String(e),void 0,void 0)},l.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r0&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)};h.trust=function(e){return null==e&&(e=""),i("<",void 0,void 0,e,void 0,void 0)},h.fragment=function(){var e=a.apply(0,arguments);return e.tag="[",e.children=i.normalizeChildren(e.children),e},d=h;var p,v,m=function(e){var t,n=e&&e.document,o={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function l(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 s(e){var t=e.state;try{return this.apply(t,arguments)}finally{a(e,t)}}function u(){try{return n.activeElement}catch(r){return null}}function c(e,t,n,r,o,i,l){for(var a=n;a'+t.children+"",l=l.firstChild):l.innerHTML=t.children,t.dom=l.firstChild,t.domSize=l.childNodes.length,t.instance=[];for(var a,s=n.createDocumentFragment();a=l.firstChild;)t.instance.push(a),s.appendChild(a);b(e,s,o)}function p(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)c(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)k(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!l)for(;u=u&&S>=s&&(p=t[_],b=n[S],p.key===b.key);)p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),_--,S--;for(;_>=u&&S>=s&&(d=t[u],h=n[s],d.key===h.key);)u++,s++,d!==h&&v(e,d,h,r,g(t,u,o),i);for(;_>=u&&S>=s&&s!==S&&d.key===b.key&&p.key===h.key;)w(e,p,x=g(t,u,o)),p!==h&&v(e,p,h,r,x,i),++s<=--S&&w(e,d,o),d!==b&&v(e,d,b,r,o,i),null!=b.dom&&(o=b.dom),u++,p=t[--_],b=n[S],d=t[u],h=n[s];for(;_>=u&&S>=s&&p.key===b.key;)p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),S--,p=t[--_],b=n[S];if(s>S)k(e,t,u,_+1);else if(u>_)c(e,n,s,S+1,r,o,i);else{var j,T,A=o,C=S-s+1,O=new Array(C),I=0,N=0,$=2147483647,z=0;for(N=0;N=s;N--){null==j&&(j=m(t,u,_+1));var L=j[(b=n[N]).key];null!=L&&($=L<$?L:-1,O[N-s]=L,p=t[L],t[L]=null,p!==b&&v(e,p,b,r,o,i),null!=b.dom&&(o=b.dom),z++)}if(o=A,z!==_-u+1&&k(e,t,u,_+1),0===z)c(e,n,s,S+1,r,o,i);else if(-1===$)for(I=(T=function(e){var t=[0],n=0,r=0,o=0,i=y.length=e.length;for(o=0;o>>1)+(r>>>1)+(n&r&1);e[t[a]]0&&(y[o]=t[n-1]),t[n]=o)}}for(r=t[(n=t.length)-1];n-- >0;)t[n]=r,r=y[r];return y.length=0,t}(O)).length-1,N=S;N>=s;N--)h=n[N],-1===O[N-s]?f(e,h,r,i,o):T[I]===N-s?I--:w(e,h,o),null!=h.dom&&(o=n[N].dom);else for(N=S;N>=s;N--)h=n[N],-1===O[N-s]&&f(e,h,r,i,o),null!=h.dom&&(o=n[N].dom)}}else{var P=t.lengthP&&k(e,t,s,t.length),n.length>P&&c(e,n,s,n.length,r,o,i)}}}function v(e,t,n,r,o,a){var u=t.tag;if(u===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=s.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=s.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof u)switch(null!=n.attrs&&D(n.attrs,n,r),u){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?(_(e,t),h(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,a,o);break;case"[":!function(e,t,n,r,o,i){p(e,t.children,n.children,r,o,i);var l=0,a=n.children;if(n.dom=null,null!=a){for(var s=0;s-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var I,N=/[A-Z]/g;function $(e){return"-"+e.toLowerCase()}function z(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(N,$)}function L(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(z(r),String(o));else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(z(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(z(r))}}function P(){this._=t}function M(e,n,r){if(null!=e.events){if(e.events._=t,e.events[n]===r)return;null==r||"function"!=typeof r&&"object"!=typeof r?(null!=e.events[n]&&e.dom.removeEventListener(n.slice(2),e.events,!1),e.events[n]=void 0):(null==e.events[n]&&e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}else null==r||"function"!=typeof r&&"object"!=typeof r||(e.events=new P,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}function q(e,t,n){"function"==typeof e.oninit&&s.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(s.bind(e.oncreate,t))}function D(e,t,n){"function"==typeof e.onupdate&&n.push(s.bind(e.onupdate,t))}return P.prototype=Object.create(null),P.prototype.handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,n,r){if(!e)throw new TypeError("DOM element being rendered to does not exist.");if(null!=I&&e.contains(I))throw new TypeError("Node is currently being rendered to and thus is locked.");var o=t,l=I,a=[],s=u(),c=e.namespaceURI;I=e,t="function"==typeof r?r:void 0;try{null==e.vnodes&&(e.textContent=""),n=i.normalizeChildren(Array.isArray(n)?n:[n]),p(e,e.vnodes,n,a,null,"http://www.w3.org/1999/xhtml"===c?void 0:c),e.vnodes=n,null!=s&&u()!==s&&"function"==typeof s.focus&&s.focus();for(var f=0;f=0&&(o.splice(r,2),r<=a&&(a-=2),e(t,[])),null!=n&&(o.push(t,n),e(t,i(n),u))},redraw:u}}(m,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),g=y.mount,w=y.redraw,b={},x=b={};function k(){throw new Error("setTimeout has not been defined")}function E(){throw new Error("clearTimeout has not been defined")}function _(e){if(p===setTimeout)return setTimeout(e,0);if((p===k||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(r){try{return p.call(null,e,0)}catch(r){return p.call(this,e,0)}}}!function(){try{p="function"==typeof setTimeout?setTimeout:k}catch(r){p=k}try{v="function"==typeof clearTimeout?clearTimeout:E}catch(r){v=E}}();var S,j=[],T=!1,A=-1;function C(){T&&S&&(T=!1,S.length?j=S.concat(j):A=-1,j.length&&O())}function O(){if(!T){var e=_(C);T=!0;for(var t=j.length;t;){for(S=j,j=[];++A1)for(var n=1;n0||e(n)}}var o=n(s);try{e(n(a),o)}catch(r){o(r)}}d(n)};t.prototype.then=function(e,n){var o,i,l=this._instance;function a(e,t,n,a){t.push((function(t){if("function"!=typeof e)n(t);else try{o(e(t))}catch(r){i&&i(r)}})),"function"==typeof l.retry&&a===l.state&&l.retry()}var s=new t((function(e,t){o=e,i=t}));return a(e,l.resolvers,o,!0),a(n,l.rejectors,i,!1),s},t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(e){return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))},t.resolve=function(e){return e instanceof t?e:new t((function(t){t(e)}))},t.reject=function(e){return new t((function(t,n){n(e)}))},t.all=function(e){return new t((function(t,n){var r=e.length,o=0,i=[];if(0===e.length)t([]);else for(var l=0;l=0&&(h+=e.slice(n,o)),u>=0&&(h+=(n<0?"?":"&")+s.slice(u,f));var p=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var t=[];for(var n in e)r(n,e[n]);return t.join("&");function r(e,n){if(Array.isArray(n))for(var o=0;o=0&&(h+=e.slice(r)),c>=0&&(h+=(r<0?"":"&")+s.slice(c)),h};function M(e){try{return decodeURIComponent(e)}catch(t){return e}}var q=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o-1&&s.pop();for(var c=0;c1&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:q(e.slice(t+1,r))}},F=new RegExp("^(?:key|oninit|oncreate|onbeforeupdate|onupdate|onbeforeremove|onremove)$"),R={};function U(e){try{return decodeURIComponent(e)}catch(r){return e}}var K=function(e,t){var n,r,o,l,a,u,c=null==e?null:"function"==typeof e.setImmediate?e.setImmediate:e.setTimeout,f=z.resolve(),d=!1,p=!1,v=0,m=R,y={onbeforeupdate:function(){return!(!(v=v?2:1)||R===m)},onremove:function(){e.removeEventListener("popstate",b,!1),e.removeEventListener("hashchange",w,!1)},view:function(){if(v&&R!==m){var e=[i(o,l.key,l)];return m&&(e=m.render(e[0])),e}}},g=k.SKIP={};function w(){d=!1;var i=e.location.hash;"#"!==k.prefix[0]&&(i=e.location.search+i,"?"!==k.prefix[0]&&"/"!==(i=e.location.pathname+i)[0]&&(i="/"+i));var s=i.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,U).slice(k.prefix.length),c=D(s);function h(e){console.error(e),x(r,null,{replace:!0})}L(c.params,e.history.state),function e(i){for(;ie,H.type=w=e=>null==e?e:Object.getPrototypeOf(e).constructor,H.keys=v=e=>Object.keys(e||{}),H.vals=e=>Object.values(e||{}),t=Object.entries||(e=>v(e).map(t=>[t,e[t]])),H.entries=o=e=>t(e||{}),e=Object.fromEntries||(e=>m(...e.map(([e,t])=>({[e]:t})))),H.dict=t=>e(t||[]),H.isArray=h=Array.isArray,H.isDict=p=e=>w(e)===Object,H.isFn=e=>"function"==typeof e,H.merge=m=(...e)=>Object.assign({},...e),H.assoc=n=(e,t,n)=>((e=h(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=n,e),H.dissoc=(e,...t)=>(e=h(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),H.update=b=(e,t,r,...o)=>n(e,t,r(null!=e?e[t]:void 0,...o)),H.getIn=c=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),H.assocIn=r=(e,t,o)=>t.length<2?n(e,t[0],o):b(e,t[0],r,t.slice(1),o),H.updateIn=(e,t,n,...o)=>r(e,t,n(c(e,t),...o)),H.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(t*r,t*(r+1))),H.flatten=u=e=>h(e)?e.flatMap(u):e,H.repr=e=>JSON.stringify(e,y),H.identical=f=(e,t)=>e===t||e!=e&&t!=t,H.eq=i=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&l(e,t,i):p(e)&&p(t)&&a(e,t)),H.eqShallow=(e,t)=>e===t||(e!=e?t!=t:h(e)?h(t)&&l(e,t,f):p(e)&&p(t)&&s(e,t)),g=t=>e(o(t).sort()),y=(e,t)=>w(t)===RegExp?""+t:p(t)?g(t):t,l=(e,t,n)=>e.length===t.length&&e.every((e,r)=>n(e,t[r])),a=(e,t,n=v(e),r=new Set(v(t)))=>n.length===r.size&&n.every(e=>r.has(e))&&n.every(n=>i(e[n],t[n])),s=(e,t,n=v(e))=>n.length===v(t).length&&n.every(n=>n in t&&f(e[n],t[n])),H.chain=(e,...t)=>t.map(e=>h(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),H.multi=(e=d)=>{var t,n,r;return n=new Map,t=()=>{throw TypeError("Invalid arguments")},r=Object.assign((...r)=>(n.get(e(...r))||t)(...r),{when:(e,t)=>(n.set(e,t),r),default:e=>(t=e,r)})}}).call(this);var V={};(function(){V=H}).call(this);var B={};(function(){var e,t,n,r,o,i,l,a;({multi:n,type:a}=H),B.deref=t=n(a),B.resetVals=o=n(a).default((e,n)=>[t(e),r(e,n)]),B.reset=r=n(a).default((e,t)=>i(e,()=>t)),B.swapVals=l=n(a).default((e,n,...r)=>o(e,n(t(e),...r))),B.swap=i=n(a).default((...e)=>l(...e)[1]),B.compareAndSet=n(a).default((e,n,o)=>n===t(e)&&(r(e,o),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),r.when(e,(e,t)=>e.x=t),B.atom=t=>new e(t)}).call(this);var J={};(function(){J=B}).call(this);var Q={};(function(){var e,t,n,r,o,i,l,a,s,u,c,f,d,h,p,v,m,y,g,w,b,x,k,E,_,S,j,T,A,C,O,I,N,$,z,L,P,M;({identical:T,eqShallow:S,isArray:C,keys:O,getIn:j,merge:I,assocIn:x,identity:A}=H),({atom:k,deref:_,reset:z,swap:M}=B),c=v=u=A,a=L=(e,t)=>t,Q._init=e=>{u=(null!=e?e.hyperscript:void 0)||u,a=u.fragment||L,v=(null!=e?e.redraw:void 0)||v,c=(null!=e?e.mount:void 0)||c},g=null,m=new Map,Q.resetCache=()=>m.clear(),d=(e,t,n)=>{for(;e;)e.state._subs.set(t,n),e=e._parent;return n},i=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&S(e._meta,t._meta)&&e.every((e,n)=>S(e,t[n])),o=function(e){var t;return!i(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,n])=>d(e._parent,t,n)),!1)},y=e=>function(t){var n;n=g,g=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{g=n}},l=e=>{var t;return m.has(e)||(t={oninit:function(n){this._comp=t,this._subs=new Map,this._atom=$(),this._view=e},onbeforeupdate:o,view:y((function(e){var t,n;return n=this._view.apply(e,t=e.attrs.argv.slice(1)),b("function"!=typeof n?n:(this._view=n).apply(e,t))}))},m.set(e,t)),m.get(e)},s=(e,t)=>"object"!=typeof t||C(t)?[e,b(t)]:[I(t,e)],f=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),Q.asElement=b=e=>{var t,r;return C(e)?(t=e[0],r={...e._meta||{},_parent:g},">"===t?n(e[1],s(r,e[2]),e.slice(3).map(b)):"<>"===t?f(a(r,e.slice(1).map(b))):"string"==typeof t?n(t,s(r,e[1]),e.slice(2).map(b)):n("function"==typeof t?l(t):t,[{...r,argv:e}])):e},Q.render=(e,t)=>c(t,{view:()=>b(e)}),Q.with=w=(e,t)=>((t=t.slice(0))._meta=e,t),Q.createClass=e=>{var t,n,r;return n={oninit:function(e){var r,o;this._comp=n,this._subs=new Map,this._atom=$("function"==typeof(r=t("getInitialState"))?r(e):void 0),"function"==typeof(o=t("constructor"))&&o(e,[e,e.attrs])},oncreate:(t=(t,n=e[t])=>n&&((e,t)=>{g=e;try{return n.apply(e,t||[e])}finally{g=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||o,onbeforeremove:t("beforeComponentUnmounts"),view:y(e.render||(r=e.reagentRender,function(e){return b(r.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},_.when(e,e=>d(g,e,e._deref())),z.when(e,(e,t)=>(T(t,e.x)||(e.x=t,v()),t)),Q.atom=$=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},_.when(t,e=>d(g,e,e._deref())),z.when(t,(e,t)=>(T(t,e._deref())||(e.src(e.path,t),v()),t)),r=e=>(t,n)=>void 0===n?j(e._deref(),t):M(e,x,t,n),Q.cursor=(e,n)=>new t("function"==typeof e?e:r(e),n),Q.adaptComponent=e=>(...t)=>w(null!=g?g.attrs:void 0,[">",e,...t]),Q.classNames=E=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),I(e,C(t)?I(...t.map(e=>e&&{[e]:e})):t)),{}),O(t).filter(e=>t[e]).join(" ")},h=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},p=(e,t={})=>{var n,r;for(n in e)r=e[n],t[n]="on"!==n.slice(0,2)?r:h(r);return t},N=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=E(e[t])),e),p(t)),n=(e,t,n)=>{var r,o,i;return r=null!=(null!=(o=t[1])&&null!=(i=o.attrs)?i.key:void 0)?n:[n],f(u(e,N(e,t[0]),t[1],...r))},Q.createElement=(e,t,...r)=>n(e,[t||{}],r),Q.currentComponent=()=>g,Q.children=e=>e.children,Q.props=e=>e.attrs,Q.argv=e=>e.attrs.argv,Q.stateAtom=P=e=>e.state._atom,Q.state=e=>_(P(e)),Q.replaceState=(e,t)=>z(P(e),t),Q.setState=(e,t)=>M(P(e),I,t)}).call(this);var W={};(function(){var e,t,n,r;t=g,r=w,e=d,W=n=Q,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var Y={};(function(){var e,t,n,r,o,i,l,a,s,u,c,f,d,h,p,v,m,y,g,w,b,x,k,E,_,S,j,T,A,C,O,I,N,$,z,L,P,M,q,D,F,R,U,K,V,J,W,Z,G,X,ee,te,ne,re,oe,ie,le,ae,se,ue,ce,fe,de,he,pe,ve=[].splice;({identical:Z,eq:F,eqShallow:R,keys:ne,dict:z,entries:D,isArray:X,isDict:ee,isFn:te,getIn:W,merge:re,assoc:_,assocIn:T,dissoc:M,update:he,repr:ae,identity:G,chunks:O,flatten:K,chain:C}=H),({atom:A,deref:$,reset:se,swap:fe}=B),({_init:p,atom:oe,cursor:N}=Q),u=F,Y._init=e=>{p(e),u=(null!=e?e.eq:void 0)||u},Y.appDb=E=oe({}),U=A({}),q=A({}),I=A({}),ce=A({}),y=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),a=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),k=new Map,Y.clearSubscriptionCache=()=>k.clear(),c=new Set,Y.purgeEventQueue=()=>(c.forEach(clearTimeout),c.clear()),n=e=>t=>{t?fe(e,M,t):se(e,{})},m=()=>{throw SyntaxError("re-frame: invalid subscription signals")},x=e=>{var t;return e.every(([e,t])=>"<-"===e&&X(t))||m(),1===(t=e.map(e=>e[1])).length?()=>ue(t[0]):()=>t.map(ue)},i=e=>e._deref(),e=e=>X(e)?e.map(i):ee(e)?z(D(e).map(([e,t])=>[e,i(t)])):i(e),Y.regSub=(e,...t)=>{var n,r;r=t,[...t]=r,[n]=ve.call(t,-1),t=0===t.length?()=>E:1!==t.length?x(O(t,2)):te(t[0])?t[0]:m(),$(ce)[e]&&a("subscription",e),fe(ce,_,e,[t,n])},t=(t,n)=>r=>{var o,i,l,a,s;return o=e(t(r)),k.has(l=ae(r))&&([i,a]=k.get(l),R(o,i))?a:(s=n(o,r),k.set(l,[o,s]),s)},o=new Map,Y.subscribe=ue=e=>{var n,r;return(n=$(ce)[e[0]])?(o.has(r=ae(e))||o.set(r,N(t(...n),e)),o.get(r)):y("subscription",e)},Y.clearSub=(pe=n(ce),e=>(e||o.clear(),pe(e))),Y.toInterceptor=de=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||G,after:(null!=e?e.after:void 0)||G}),h=(e,t,n)=>t?t in(e||{})?e[t]:n:e,Y.getCoeffect=V=(e,t,n)=>h(e.coeffects,t,n),Y.getEffect=J=(e,t,n)=>h(e.effects,t,n),Y.assocCoeffect=S=(e,t,n)=>T(e,["coeffects",t],n),Y.assocEffect=j=(e,t,n)=>T(e,["effects",t],n),Y.enqueue=(e,t)=>he(e,"queue",e=>[...e,...t]),d=e=>J(e,"db",V(e,"db")),g="re-frame-path/db-store",Y.path=(...e)=>de({id:"path",before:t=>{var n,r;return n=V(t,"db"),r=[...t[g]||[],n],C(t,[_,g,r],[S,"db",W(n,K(e))])},after:t=>{var n,r,o;return o=t[g],[...r]=o,[n]=ve.call(r,-1),C(t,[_,g,r],[j,"db",T(n,K(e),d(t))],[S,"db",n])}}),Y.enrich=e=>de({id:"enrich",after:t=>j(t,"db",e(d(t),V(t,"event")))}),w=e=>t=>{var n;return n=V(t,"event"),C(t,[S,"originalEvent",n],[S,"event",e(n)])},b=e=>S(e,"event",V(e,"originalEvent")),Y.unwrap=de({id:"unwrap",after:b,before:w(e=>e[1])}),Y.trimV=de({id:"trim-v",after:b,before:w(e=>e.slice(1))}),Y.after=e=>de({id:"after",after:t=>(e(d(t),V(t,"event")),t)}),Y.onChanges=(e,t,...n)=>de({id:"on-changes",after:r=>{var o,i,l,a;return o=V(r,"db"),i=d(r),[l,a]=[o,i].map(e=>n.map(t=>W(e,t))),a.every((e,t)=>Z(e,l[t]))?r:j(r,"db",T(i,t,e(...a)))}}),Y.regCofx=(e,t)=>{$(I)[e]&&a("coeffect",e),fe(I,_,e,t)},Y.injectCofx=(e,t)=>de({id:e,before:n=>$(I)[e]?he(n,"coeffects",$(I)[e],t):(y("coeffect",[e]),n)}),Y.clearCofx=n(I),Y.regEventDb=(e,t,n)=>(n||([t,n]=[[],t]),le(e,t,(e,t)=>({db:n(e.db,t)}))),r=e=>t=>re(t,{effects:e(V(t),V(t,"event"))}),Y.regEventFx=le=(e,t,n)=>(n||([t,n]=[[],t]),ie(e,t,r(n))),Y.regEventCtx=ie=(e,t,n)=>{n||([t,n]=[[],t]),$(U)[e]&&a("event",e),fe(U,_,e,[K(t.filter(G)),n])},Y.clearEvent=n(U),v=(e,t)=>{var n,r;for(e=re(e,{stack:[],queue:e.stack});e.queue.length>0;)[n,...r]=e.queue,e=n[t](re(e,{queue:r})),e=re(e,{stack:[n,...e.stack]});return e},Y.dispatchSync=P=e=>{var t,n,r,o;return(r=$(U)[e[0]])?([o,n]=r,t={stack:o,coeffects:{event:e,db:i(E)}},C(t,[v,"before"],n,[v,"after"],J,D,f)):y("event",e)},l=({ms:e,dispatch:t})=>{var n;return c.add(n=setTimeout(()=>(c.delete(n),P(t)),e)),n},Y.dispatch=L=e=>l({dispatch:e}),s={db:e=>{if(!u(e,i(E)))return se(E,e)},fx:f=(e,t=$(q))=>e.filter(G).forEach(([e,n])=>{var r;return(r=t[e]||s[e])?r(n):y("effect",[e])}),dispatchLater:l,dispatch:e=>l({dispatch:e})},Y.regFx=(e,t)=>{$(q)[e]&&a("effect",e),fe(q,_,e,t)},Y.clearFx=n(q),Y.dsub=e=>$(ue(e)),Y.disp=(e,...t)=>e&&L([...e,...t])}).call(this);var Z={};(function(){var e,t,n,r;t=g,r=w,e=d,Z=n=Y,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var G={};(function(){var e,t,n,r,o;o=V,t=J,r=W,({_init:e}=n=Z),G={util:o,atom:t,reagent:r,reFrame:n,_init:e}}).call(this);var X={};(function(){var e,t;t=Q,X={jsx:e=(e,{children:n=[],...r},o)=>t.with({key:o,...r},[e].concat(n)),jsxs:e,Fragment:"<>"}}).call(this);var ee={};return function(){ee=X}.call(this),t.m["mithril/hyperscript"]=d,t.m["mithril/render"]=m,t.m["mithril/mount"]=g,t.m["mithril/redraw"]=w,t.m["mithril/route"]=K,t.m["mreframe/util"]=V,t.m["mreframe/atom"]=J,t.m["mreframe/reagent"]=W,t.m["mreframe/re-frame"]=Z,t.m.mreframe=G,t.m["mreframe/jsx-runtime"]=ee,t}("function"==typeof require?require:void 0); \ No newline at end of file diff --git a/dist/mreframe.js b/dist/mreframe.js index c5eadb9..0ddfe50 100644 --- a/dist/mreframe.js +++ b/dist/mreframe.js @@ -1307,7 +1307,25 @@ module.exports = {}.hasOwnProperty }).call(this); -},{"./util":13}],11:[function(require,module,exports){ +},{"./util":14}],11:[function(require,module,exports){ +(function() { + var jsx, r; + + r = require('./reagent'); + + jsx = (tag, {children = [], ...attrs}, key) => { // this API isn't documented properly... + return r.with({key, ...attrs}, [tag].concat(children)); + }; + + module.exports = { + jsx, + jsxs: jsx, + Fragment: '<>' + }; + +}).call(this); + +},{"./reagent":13}],12:[function(require,module,exports){ (function() { /* @@ -1800,9 +1818,9 @@ module.exports = {}.hasOwnProperty }).call(this); -},{"./atom":10,"./reagent":12,"./util":13}],12:[function(require,module,exports){ +},{"./atom":10,"./reagent":13,"./util":14}],13:[function(require,module,exports){ (function() { - var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; + var RAtom, RCursor, _createElement, _cursor, _detectChanges, _eqArgs, _fnElement, _fragment_, _meta, _mithril_, _mount_, _moveParent, _propagate, _quiet, _quietEvents, _redraw_, _renderCache, _rendering, _vnode, _with, argv, asElement, assocIn, atom, children, classNames, deref, eqShallow, getIn, identical, identity, isArray, keys, merge, prepareAttrs, props, ratom, reset, second, stateAtom, swap; ({identical, eqShallow, isArray, keys, getIn, merge, assocIn, identity} = require('./util')); @@ -1840,7 +1858,7 @@ module.exports = {}.hasOwnProperty }; _eqArgs = (xs, ys) => { - return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && xs.every((x, i) => { + return (!xs && !ys) || ((xs != null ? xs.length : void 0) === (ys != null ? ys.length : void 0) && eqShallow(xs._meta, ys._meta) && xs.every((x, i) => { return eqShallow(x, ys[i]); })); }; @@ -1856,13 +1874,15 @@ module.exports = {}.hasOwnProperty _rendering = (binding) => { return function(vnode) { + var _old; + _old = _vnode; _vnode = vnode; try { this._subs.clear(); this._argv = vnode.attrs.argv; // last render args return binding.call(this, vnode); } finally { - _vnode = null; + _vnode = _old; } }; }; @@ -1951,7 +1971,7 @@ module.exports = {}.hasOwnProperty }; /* Adds metadata to the Hiccup form of a Reagent component or a fragment */ - exports.with = (meta, form) => { + exports.with = _with = (meta, form) => { form = form.slice(0); form._meta = meta; return form; @@ -2070,7 +2090,7 @@ module.exports = {}.hasOwnProperty /* Converts a Mithril component into a Reagent component */ exports.adaptComponent = (c) => { return (...args) => { - return ['>', c, ...args]; + return _with(_vnode != null ? _vnode.attrs : void 0, ['>', c, ...args]); }; }; @@ -2176,7 +2196,7 @@ module.exports = {}.hasOwnProperty }).call(this); -},{"./atom":10,"./util":13}],13:[function(require,module,exports){ +},{"./atom":10,"./util":14}],14:[function(require,module,exports){ (function() { var _dict, _entries, assoc, assocIn, entries, eq, eqArr, eqObj, eqObjShallow, eqShallow, flatten, getIn, identical, identity, isArray, isDict, keys, merge, replacer, sorter, type, update, vals; @@ -2188,7 +2208,7 @@ module.exports = {}.hasOwnProperty if (x == null) { return x; } else { - return x.__proto__.constructor; + return Object.getPrototypeOf(x).constructor; } }; @@ -2404,7 +2424,13 @@ module.exports = require("./render/render")(typeof window !== "undefined" ? wind }).call(this); -},{"./src/atom":10}],"mreframe/re-frame":[function(require,module,exports){ +},{"./src/atom":10}],"mreframe/jsx-runtime":[function(require,module,exports){ +(function() { + module.exports = require('./src/jsx-runtime'); + +}).call(this); + +},{"./src/jsx-runtime":11}],"mreframe/re-frame":[function(require,module,exports){ (function() { var hyperscript, mount, reFrame, redraw; @@ -2420,7 +2446,7 @@ module.exports = require("./render/render")(typeof window !== "undefined" ? wind }).call(this); -},{"./src/re-frame":11,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/reagent":[function(require,module,exports){ +},{"./src/re-frame":12,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/reagent":[function(require,module,exports){ (function() { var hyperscript, mount, reagent, redraw; @@ -2436,13 +2462,13 @@ module.exports = require("./render/render")(typeof window !== "undefined" ? wind }).call(this); -},{"./src/reagent":12,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/util":[function(require,module,exports){ +},{"./src/reagent":13,"mithril/hyperscript":"mithril/hyperscript","mithril/mount":"mithril/mount","mithril/redraw":"mithril/redraw"}],"mreframe/util":[function(require,module,exports){ (function() { module.exports = require('./src/util'); }).call(this); -},{"./src/util":13}],"mreframe":[function(require,module,exports){ +},{"./src/util":14}],"mreframe":[function(require,module,exports){ (function() { var _init, atom, exports, hyperscript, mount, reFrame, reagent, redraw, util; diff --git a/dist/mreframe.min.js b/dist/mreframe.min.js index 75864c0..aa5bfd8 100644 --- a/dist/mreframe.min.js +++ b/dist/mreframe.min.js @@ -1 +1 @@ -require=function(e){var t=function t(n,r){return t.m.hasOwnProperty(n)?t.m[n]:"function"!=typeof e||r?"function"==typeof t.r?t.r(n,1):void 0:e(n,1)};t.m={},t.r=e;var n={};function r(e,t,n,r,l,i){return{tag:e,key:t,attrs:n,children:r,text:l,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}r.normalize=function(e){return Array.isArray(e)?r("[",void 0,void 0,r.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:r("#",void 0,void 0,String(e),void 0,void 0)},r.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,l=1;l0&&(l.className=r.join(" ")),o[e]={tag:n,attrs:l}}(e),t):(t.tag=e,t)};c.trust=function(e){return null==e&&(e=""),n("<",void 0,void 0,e,void 0,void 0)},c.fragment=function(){var e=l.apply(0,arguments);return e.tag="[",e.children=n.normalizeChildren(e.children),e},u=c;var f=function(e){var t,r=e&&e.document,l={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function i(e){return e.attrs&&e.attrs.xmlns||l[e.tag]}function a(e,t){if(e.state!==t)throw new Error("'vnode.state' must not be modified.")}function o(e){var t=e.state;try{return this.apply(t,arguments)}finally{a(e,t)}}function s(){try{return r.activeElement}catch(e){return null}}function u(e,t,n,r,l,i,a){for(var o=n;o'+t.children+"",a=a.firstChild):a.innerHTML=t.children,t.dom=a.firstChild,t.domSize=a.childNodes.length,t.instance=[];for(var o,s=r.createDocumentFragment();o=a.firstChild;)t.instance.push(o),s.appendChild(o);w(e,s,l)}function v(e,t,n,r,l,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)u(e,n,0,n.length,r,l,i);else if(null==n||0===n.length)k(e,t,0,t.length);else{var a=null!=t[0]&&null!=t[0].key,o=null!=n[0]&&null!=n[0].key,s=0,f=0;if(!a)for(;f=f&&E>=s&&(w=t[S],b=n[E],w.key===b.key);)w!==b&&h(e,w,b,r,l,i),null!=b.dom&&(l=b.dom),S--,E--;for(;S>=f&&E>=s&&(d=t[f],v=n[s],d.key===v.key);)f++,s++,d!==v&&h(e,d,v,r,g(t,f,l),i);for(;S>=f&&E>=s&&s!==E&&d.key===b.key&&w.key===v.key;)y(e,w,_=g(t,f,l)),w!==v&&h(e,w,v,r,_,i),++s<=--E&&y(e,d,l),d!==b&&h(e,d,b,r,l,i),null!=b.dom&&(l=b.dom),f++,w=t[--S],b=n[E],d=t[f],v=n[s];for(;S>=f&&E>=s&&w.key===b.key;)w!==b&&h(e,w,b,r,l,i),null!=b.dom&&(l=b.dom),E--,w=t[--S],b=n[E];if(s>E)k(e,t,f,S+1);else if(f>S)u(e,n,s,E+1,r,l,i);else{var A,C,z=l,N=E-s+1,j=new Array(N),$=0,I=0,q=2147483647,M=0;for(I=0;I=s;I--){null==A&&(A=m(t,f,S+1));var O=A[(b=n[I]).key];null!=O&&(q=O>>1)+(r>>>1)+(n&r&1);e[t[o]]0&&(p[l]=t[n-1]),t[n]=l)}}for(r=t[(n=t.length)-1];n-- >0;)t[n]=r,r=p[r];return p.length=0,t}(j)).length-1,I=E;I>=s;I--)v=n[I],-1===j[I-s]?c(e,v,r,i,l):C[$]===I-s?$--:y(e,v,l),null!=v.dom&&(l=n[I].dom);else for(I=E;I>=s;I--)v=n[I],-1===j[I-s]&&c(e,v,r,i,l),null!=v.dom&&(l=n[I].dom)}}else{var T=t.lengthT&&k(e,t,s,t.length),n.length>T&&u(e,n,s,n.length,r,l,i)}}}function h(e,t,r,l,a,s){var u=t.tag;if(u===r.tag){if(r.state=t.state,r.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=o.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=o.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(r,t))return;if("string"==typeof u)switch(null!=r.attrs&&D(r.attrs,r,l),u){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}(t,r);break;case"<":!function(e,t,n,r,l){t.children!==n.children?(_(e,t),d(e,n,r,l)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,r,s,a);break;case"[":!function(e,t,n,r,l,i){v(e,t.children,n.children,r,l,i);var a=0,o=n.children;if(n.dom=null,null!=o){for(var s=0;s-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var j,$=/[A-Z]/g;function I(e){return"-"+e.toLowerCase()}function q(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace($,I)}function M(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!=(l=n[r])&&e.style.setProperty(q(r),String(l));else{for(var r in n){var l;null!=(l=n[r])&&(l=String(l))!==String(t[r])&&e.style.setProperty(q(r),l)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(q(r))}}function O(){this._=t}function T(e,n,r){if(null!=e.events){if(e.events._=t,e.events[n]===r)return;null==r||"function"!=typeof r&&"object"!=typeof r?(null!=e.events[n]&&e.dom.removeEventListener(n.slice(2),e.events,!1),e.events[n]=void 0):(null==e.events[n]&&e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}else null==r||"function"!=typeof r&&"object"!=typeof r||(e.events=new O,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}function L(e,t,n){"function"==typeof e.oninit&&o.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(o.bind(e.oncreate,t))}function D(e,t,n){"function"==typeof e.onupdate&&n.push(o.bind(e.onupdate,t))}return O.prototype=Object.create(null),O.prototype.handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,r,l){if(!e)throw new TypeError("DOM element being rendered to does not exist.");if(null!=j&&e.contains(j))throw new TypeError("Node is currently being rendered to and thus is locked.");var i=t,a=j,o=[],u=s(),c=e.namespaceURI;j=e,t="function"==typeof l?l:void 0;try{null==e.vnodes&&(e.textContent=""),r=n.normalizeChildren(Array.isArray(r)?r:[r]),v(e,e.vnodes,r,o,null,"http://www.w3.org/1999/xhtml"===c?void 0:c),e.vnodes=r,null!=u&&s()!==u&&"function"==typeof u.focus&&u.focus();for(var f=0;f=0&&(l.splice(i,2),i<=a&&(a-=2),e(t,[])),null!=r&&(l.push(t,r),e(t,n(r),s))},redraw:s}}(f,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),v=d.mount,h=d.redraw,m={};(function(){var e,t,n,r,l,i,a,o,s,u,c,f,d,v,h,p,g,y,w,b,k;m.identity=d=e=>e,m.type=b=e=>null==e?e:e.__proto__.constructor,m.keys=p=e=>Object.keys(e||{}),m.vals=e=>Object.values(e||{}),t=Object.entries||(e=>p(e).map(t=>[t,e[t]])),m.entries=l=e=>t(e||{}),e=Object.fromEntries||(e=>g(...e.map(([e,t])=>({[e]:t})))),m.dict=t=>e(t||[]),m.isArray=v=Array.isArray,m.isDict=h=e=>b(e)===Object,m.isFn=e=>"function"==typeof e,m.merge=g=(...e)=>Object.assign({},...e),m.assoc=n=(e,t,n)=>((e=v(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=n,e),m.dissoc=(e,...t)=>(e=v(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),m.update=k=(e,t,r,...l)=>n(e,t,r(null!=e?e[t]:void 0,...l)),m.getIn=c=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),m.assocIn=r=(e,t,l)=>t.length<2?n(e,t[0],l):k(e,t[0],r,t.slice(1),l),m.updateIn=(e,t,n,...l)=>r(e,t,n(c(e,t),...l)),m.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(t*r,t*(r+1))),m.flatten=u=e=>v(e)?e.flatMap(u):e,m.repr=e=>JSON.stringify(e,y),m.identical=f=(e,t)=>e===t||e!=e&&t!=t,m.eq=i=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&a(e,t,i):h(e)&&h(t)&&o(e,t)),m.eqShallow=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&a(e,t,f):h(e)&&h(t)&&s(e,t)),w=t=>e(l(t).sort()),y=(e,t)=>b(t)===RegExp?""+t:h(t)?w(t):t,a=(e,t,n)=>e.length===t.length&&e.every((e,r)=>n(e,t[r])),o=(e,t,n=p(e),r=new Set(p(t)))=>n.length===r.size&&n.every(e=>r.has(e))&&n.every(n=>i(e[n],t[n])),s=(e,t,n=p(e))=>n.length===p(t).length&&n.every(n=>n in t&&f(e[n],t[n])),m.chain=(e,...t)=>t.map(e=>v(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),m.multi=(e=d)=>{var t,n,r;return n=new Map,t=()=>{throw TypeError("Invalid arguments")},r=Object.assign((...r)=>(n.get(e(...r))||t)(...r),{when:(e,t)=>(n.set(e,t),r),default:e=>(t=e,r)})}}).call(this);var p={};(function(){p=m}).call(this);var g={};(function(){var e,t,n,r,l,i,a,o;({multi:n,type:o}=m),g.deref=t=n(o),g.resetVals=l=n(o).default((e,n)=>[t(e),r(e,n)]),g.reset=r=n(o).default((e,t)=>i(e,()=>t)),g.swapVals=a=n(o).default((e,n,...r)=>l(e,n(t(e),...r))),g.swap=i=n(o).default((...e)=>a(...e)[1]),g.compareAndSet=n(o).default((e,n,l)=>n===t(e)&&(r(e,l),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),r.when(e,(e,t)=>e.x=t),g.atom=t=>new e(t)}).call(this);var y={};(function(){y=g}).call(this);var w={};(function(){var e,t,n,r,l,i,a,o,s,u,c,f,d,v,h,p,y,b,k,x,_,S,E,A,C,z,N,j,$,I,q,M,O,T,L,D,F;({identical:N,eqShallow:C,isArray:$,keys:I,getIn:z,merge:q,assocIn:_,identity:j}=m),({atom:S,deref:A,reset:T,swap:F}=g),c=p=u=j,o=L=(e,t)=>t,w._init=e=>{u=(null!=e?e.hyperscript:void 0)||u,o=u.fragment||L,p=(null!=e?e.redraw:void 0)||p,c=(null!=e?e.mount:void 0)||c},k=null,y=new Map,w.resetCache=()=>y.clear(),d=(e,t,n)=>{for(;e;)e.state._subs.set(t,n),e=e._parent;return n},i=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&e.every((e,n)=>C(e,t[n])),l=function(e){var t;return!i(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,n])=>d(e._parent,t,n)),!1)},b=e=>function(t){k=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{k=null}},a=e=>{var t;return y.has(e)||(t={oninit:function(n){this._comp=t,this._subs=new Map,this._atom=O(),this._view=e},onbeforeupdate:l,view:b((function(e){var t,n;return n=this._view.apply(e,t=e.attrs.argv.slice(1)),x("function"!=typeof n?n:(this._view=n).apply(e,t))}))},y.set(e,t)),y.get(e)},s=(e,t)=>"object"!=typeof t||$(t)?[e,x(t)]:[q(t,e)],f=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),w.asElement=x=e=>{var t,r;return $(e)?(t=e[0],r={...e._meta||{},_parent:k},">"===t?n(e[1],s(r,e[2]),e.slice(3).map(x)):"<>"===t?f(o(r,e.slice(1).map(x))):"string"==typeof t?n(t,s(r,e[1]),e.slice(2).map(x)):n("function"==typeof t?a(t):t,[{...r,argv:e}])):e},w.render=(e,t)=>c(t,{view:()=>x(e)}),w.with=(e,t)=>((t=t.slice(0))._meta=e,t),w.createClass=e=>{var t,n,r;return n={oninit:function(e){var r,l;this._comp=n,this._subs=new Map,this._atom=O("function"==typeof(r=t("getInitialState"))?r(e):void 0),"function"==typeof(l=t("constructor"))&&l(e,[e,e.attrs])},oncreate:(t=(t,n=e[t])=>n&&((e,t)=>{k=e;try{return n.apply(e,t||[e])}finally{k=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||l,onbeforeremove:t("beforeComponentUnmounts"),view:b(e.render||(r=e.reagentRender,function(e){return x(r.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},A.when(e,e=>d(k,e,e._deref())),T.when(e,(e,t)=>(N(t,e.x)||(e.x=t,p()),t)),w.atom=O=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},A.when(t,e=>d(k,e,e._deref())),T.when(t,(e,t)=>(N(t,e._deref())||(e.src(e.path,t),p()),t)),r=e=>(t,n)=>void 0===n?z(e._deref(),t):F(e,_,t,n),w.cursor=(e,n)=>new t("function"==typeof e?e:r(e),n),w.adaptComponent=e=>(...t)=>[">",e,...t],w.classNames=E=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),q(e,$(t)?q(...t.map(e=>e&&{[e]:e})):t)),{}),I(t).filter(e=>t[e]).join(" ")},v=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},h=(e,t={})=>{var n,r;for(n in e)r=e[n],t[n]="on"!==n.slice(0,2)?r:v(r);return t},M=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=E(e[t])),e),h(t)),n=(e,t,n)=>{var r,l,i;return r=null!=(null!=(l=t[1])&&null!=(i=l.attrs)?i.key:void 0)?n:[n],f(u(e,M(e,t[0]),t[1],...r))},w.createElement=(e,t,...r)=>n(e,[t||{}],r),w.currentComponent=()=>k,w.children=e=>e.children,w.props=e=>e.attrs,w.argv=e=>e.attrs.argv,w.stateAtom=D=e=>e.state._atom,w.state=e=>A(D(e)),w.replaceState=(e,t)=>T(D(e),t),w.setState=(e,t)=>F(D(e),q,t)}).call(this);var b={};(function(){var e,t,n,r;t=v,r=h,e=u,b=n=w,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var k={};(function(){var e,t,n,r,l,i,a,o,s,u,c,f,d,v,h,p,y,b,x,_,S,E,A,C,z,N,j,$,I,q,M,O,T,L,D,F,P,U,H,V,R,B,J,Q,W,Y,Z,G,K,X,ee,te,ne,re,le,ie,ae,oe,se,ue,ce,fe,de,ve,he,me=[].splice;({identical:G,eq:R,eqShallow:B,keys:ne,dict:D,entries:V,isArray:X,isDict:ee,isFn:te,getIn:Z,merge:re,assoc:z,assocIn:$,dissoc:U,update:ve,repr:oe,identity:K,chunks:M,flatten:Q,chain:q}=m),({atom:I,deref:L,reset:se,swap:fe}=g),({_init:h,atom:le,cursor:T}=w),u=R,k._init=e=>{h(e),u=(null!=e?e.eq:void 0)||u},k.appDb=C=le({}),J=I({}),H=I({}),O=I({}),ce=I({}),b=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),o=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),A=new Map,k.clearSubscriptionCache=()=>A.clear(),c=new Set,k.purgeEventQueue=()=>(c.forEach(clearTimeout),c.clear()),n=e=>t=>{t?fe(e,U,t):se(e,{})},y=()=>{throw SyntaxError("re-frame: invalid subscription signals")},E=e=>{var t;return e.every(([e,t])=>"<-"===e&&X(t))||y(),1===(t=e.map(e=>e[1])).length?()=>ue(t[0]):()=>t.map(ue)},i=e=>e._deref(),e=e=>X(e)?e.map(i):ee(e)?D(V(e).map(([e,t])=>[e,i(t)])):i(e),k.regSub=(e,...t)=>{var n,r;r=t,[...t]=r,[n]=me.call(t,-1),t=0===t.length?()=>C:1!==t.length?E(M(t,2)):te(t[0])?t[0]:y(),L(ce)[e]&&o("subscription",e),fe(ce,z,e,[t,n])},t=(t,n)=>r=>{var l,i,a,o,s;return l=e(t(r)),A.has(a=oe(r))&&([i,o]=A.get(a),B(l,i))?o:(s=n(l,r),A.set(a,[l,s]),s)},l=new Map,k.subscribe=ue=e=>{var n,r;return(n=L(ce)[e[0]])?(l.has(r=oe(e))||l.set(r,T(t(...n),e)),l.get(r)):b("subscription",e)},k.clearSub=(he=n(ce),e=>(e||l.clear(),he(e))),k.toInterceptor=de=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||K,after:(null!=e?e.after:void 0)||K}),v=(e,t,n)=>t?t in(e||{})?e[t]:n:e,k.getCoeffect=W=(e,t,n)=>v(e.coeffects,t,n),k.getEffect=Y=(e,t,n)=>v(e.effects,t,n),k.assocCoeffect=N=(e,t,n)=>$(e,["coeffects",t],n),k.assocEffect=j=(e,t,n)=>$(e,["effects",t],n),k.enqueue=(e,t)=>ve(e,"queue",e=>[...e,...t]),d=e=>Y(e,"db",W(e,"db")),x="re-frame-path/db-store",k.path=(...e)=>de({id:"path",before:t=>{var n,r;return n=W(t,"db"),r=[...t[x]||[],n],q(t,[z,x,r],[N,"db",Z(n,Q(e))])},after:t=>{var n,r,l;return l=t[x],[...r]=l,[n]=me.call(r,-1),q(t,[z,x,r],[j,"db",$(n,Q(e),d(t))],[N,"db",n])}}),k.enrich=e=>de({id:"enrich",after:t=>j(t,"db",e(d(t),W(t,"event")))}),_=e=>t=>{var n;return n=W(t,"event"),q(t,[N,"originalEvent",n],[N,"event",e(n)])},S=e=>N(e,"event",W(e,"originalEvent")),k.unwrap=de({id:"unwrap",after:S,before:_(e=>e[1])}),k.trimV=de({id:"trim-v",after:S,before:_(e=>e.slice(1))}),k.after=e=>de({id:"after",after:t=>(e(d(t),W(t,"event")),t)}),k.onChanges=(e,t,...n)=>de({id:"on-changes",after:r=>{var l,i,a,o;return l=W(r,"db"),i=d(r),[a,o]=[l,i].map(e=>n.map(t=>Z(e,t))),o.every((e,t)=>G(e,a[t]))?r:j(r,"db",$(i,t,e(...o)))}}),k.regCofx=(e,t)=>{L(O)[e]&&o("coeffect",e),fe(O,z,e,t)},k.injectCofx=(e,t)=>de({id:e,before:n=>L(O)[e]?ve(n,"coeffects",L(O)[e],t):(b("coeffect",[e]),n)}),k.clearCofx=n(O),k.regEventDb=(e,t,n)=>(n||([t,n]=[[],t]),ae(e,t,(e,t)=>({db:n(e.db,t)}))),r=e=>t=>re(t,{effects:e(W(t),W(t,"event"))}),k.regEventFx=ae=(e,t,n)=>(n||([t,n]=[[],t]),ie(e,t,r(n))),k.regEventCtx=ie=(e,t,n)=>{n||([t,n]=[[],t]),L(J)[e]&&o("event",e),fe(J,z,e,[Q(t.filter(K)),n])},k.clearEvent=n(J),p=(e,t)=>{var n,r;for(e=re(e,{stack:[],queue:e.stack});e.queue.length>0;)[n,...r]=e.queue,e=n[t](re(e,{queue:r})),e=re(e,{stack:[n,...e.stack]});return e},k.dispatchSync=P=e=>{var t,n,r,l;return(r=L(J)[e[0]])?([l,n]=r,t={stack:l,coeffects:{event:e,db:i(C)}},q(t,[p,"before"],n,[p,"after"],Y,V,f)):b("event",e)},a=({ms:e,dispatch:t})=>{var n;return c.add(n=setTimeout(()=>(c.delete(n),P(t)),e)),n},k.dispatch=F=e=>a({dispatch:e}),s={db:e=>{if(!u(e,i(C)))return se(C,e)},fx:f=(e,t=L(H))=>e.filter(K).forEach(([e,n])=>{var r;return(r=t[e]||s[e])?r(n):b("effect",[e])}),dispatchLater:a,dispatch:e=>a({dispatch:e})},k.regFx=(e,t)=>{L(H)[e]&&o("effect",e),fe(H,z,e,t)},k.clearFx=n(H),k.dsub=e=>L(ue(e)),k.disp=(e,...t)=>e&&F([...e,...t])}).call(this);var x={};(function(){var e,t,n,r;t=v,r=h,e=u,x=n=k,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var _={};return function(){var e,t,n,r,l;l=p,t=y,r=b,({_init:e}=n=x),_={util:l,atom:t,reagent:r,reFrame:n,_init:e}}.call(this),t.m["mithril/hyperscript"]=u,t.m["mithril/render"]=f,t.m["mithril/mount"]=v,t.m["mithril/redraw"]=h,t.m["mreframe/util"]=p,t.m["mreframe/atom"]=y,t.m["mreframe/reagent"]=b,t.m["mreframe/re-frame"]=x,t.m.mreframe=_,t}("function"==typeof require?require:void 0); \ No newline at end of file +require=function(e){var t=function t(n,r){return t.m.hasOwnProperty(n)?t.m[n]:"function"!=typeof e||r?"function"==typeof t.r?t.r(n,1):void 0:e(n,1)};t.m={},t.r=e;var n={};function r(e,t,n,r,l,a){return{tag:e,key:t,attrs:n,children:r,text:l,dom:a,domSize:void 0,state:void 0,events:void 0,instance:void 0}}r.normalize=function(e){return Array.isArray(e)?r("[",void 0,void 0,r.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:r("#",void 0,void 0,String(e),void 0,void 0)},r.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,l=1;l0&&(l.className=r.join(" ")),o[e]={tag:n,attrs:l}}(e),t):(t.tag=e,t)};c.trust=function(e){return null==e&&(e=""),n("<",void 0,void 0,e,void 0,void 0)},c.fragment=function(){var e=l.apply(0,arguments);return e.tag="[",e.children=n.normalizeChildren(e.children),e},u=c;var f=function(e){var t,r=e&&e.document,l={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function a(e){return e.attrs&&e.attrs.xmlns||l[e.tag]}function i(e,t){if(e.state!==t)throw new Error("'vnode.state' must not be modified.")}function o(e){var t=e.state;try{return this.apply(t,arguments)}finally{i(e,t)}}function s(){try{return r.activeElement}catch(e){return null}}function u(e,t,n,r,l,a,i){for(var o=n;o'+t.children+"",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length,t.instance=[];for(var o,s=r.createDocumentFragment();o=i.firstChild;)t.instance.push(o),s.appendChild(o);w(e,s,l)}function v(e,t,n,r,l,a){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)u(e,n,0,n.length,r,l,a);else if(null==n||0===n.length)k(e,t,0,t.length);else{var i=null!=t[0]&&null!=t[0].key,o=null!=n[0]&&null!=n[0].key,s=0,f=0;if(!i)for(;f=f&&E>=s&&(w=t[S],b=n[E],w.key===b.key);)w!==b&&m(e,w,b,r,l,a),null!=b.dom&&(l=b.dom),S--,E--;for(;S>=f&&E>=s&&(d=t[f],v=n[s],d.key===v.key);)f++,s++,d!==v&&m(e,d,v,r,g(t,f,l),a);for(;S>=f&&E>=s&&s!==E&&d.key===b.key&&w.key===v.key;)y(e,w,_=g(t,f,l)),w!==v&&m(e,w,v,r,_,a),++s<=--E&&y(e,d,l),d!==b&&m(e,d,b,r,l,a),null!=b.dom&&(l=b.dom),f++,w=t[--S],b=n[E],d=t[f],v=n[s];for(;S>=f&&E>=s&&w.key===b.key;)w!==b&&m(e,w,b,r,l,a),null!=b.dom&&(l=b.dom),E--,w=t[--S],b=n[E];if(s>E)k(e,t,f,S+1);else if(f>S)u(e,n,s,E+1,r,l,a);else{var A,C,j=l,z=E-s+1,N=new Array(z),$=0,I=0,O=2147483647,q=0;for(I=0;I=s;I--){null==A&&(A=h(t,f,S+1));var M=A[(b=n[I]).key];null!=M&&(O=M>>1)+(r>>>1)+(n&r&1);e[t[o]]0&&(p[l]=t[n-1]),t[n]=l)}}for(r=t[(n=t.length)-1];n-- >0;)t[n]=r,r=p[r];return p.length=0,t}(N)).length-1,I=E;I>=s;I--)v=n[I],-1===N[I-s]?c(e,v,r,a,l):C[$]===I-s?$--:y(e,v,l),null!=v.dom&&(l=n[I].dom);else for(I=E;I>=s;I--)v=n[I],-1===N[I-s]&&c(e,v,r,a,l),null!=v.dom&&(l=n[I].dom)}}else{var T=t.lengthT&&k(e,t,s,t.length),n.length>T&&u(e,n,s,n.length,r,l,a)}}}function m(e,t,r,l,i,s){var u=t.tag;if(u===r.tag){if(r.state=t.state,r.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=o.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=o.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(r,t))return;if("string"==typeof u)switch(null!=r.attrs&&F(r.attrs,r,l),u){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}(t,r);break;case"<":!function(e,t,n,r,l){t.children!==n.children?(_(e,t),d(e,n,r,l)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,r,s,i);break;case"[":!function(e,t,n,r,l,a){v(e,t.children,n.children,r,l,a);var i=0,o=n.children;if(n.dom=null,null!=o){for(var s=0;s-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var N,$=/[A-Z]/g;function I(e){return"-"+e.toLowerCase()}function O(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace($,I)}function q(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!=(l=n[r])&&e.style.setProperty(O(r),String(l));else{for(var r in n){var l;null!=(l=n[r])&&(l=String(l))!==String(t[r])&&e.style.setProperty(O(r),l)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(O(r))}}function M(){this._=t}function T(e,n,r){if(null!=e.events){if(e.events._=t,e.events[n]===r)return;null==r||"function"!=typeof r&&"object"!=typeof r?(null!=e.events[n]&&e.dom.removeEventListener(n.slice(2),e.events,!1),e.events[n]=void 0):(null==e.events[n]&&e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}else null==r||"function"!=typeof r&&"object"!=typeof r||(e.events=new M,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=r)}function L(e,t,n){"function"==typeof e.oninit&&o.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(o.bind(e.oncreate,t))}function F(e,t,n){"function"==typeof e.onupdate&&n.push(o.bind(e.onupdate,t))}return M.prototype=Object.create(null),M.prototype.handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,r,l){if(!e)throw new TypeError("DOM element being rendered to does not exist.");if(null!=N&&e.contains(N))throw new TypeError("Node is currently being rendered to and thus is locked.");var a=t,i=N,o=[],u=s(),c=e.namespaceURI;N=e,t="function"==typeof l?l:void 0;try{null==e.vnodes&&(e.textContent=""),r=n.normalizeChildren(Array.isArray(r)?r:[r]),v(e,e.vnodes,r,o,null,"http://www.w3.org/1999/xhtml"===c?void 0:c),e.vnodes=r,null!=u&&s()!==u&&"function"==typeof u.focus&&u.focus();for(var f=0;f=0&&(l.splice(a,2),a<=i&&(i-=2),e(t,[])),null!=r&&(l.push(t,r),e(t,n(r),s))},redraw:s}}(f,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),v=d.mount,m=d.redraw,h={};(function(){var e,t,n,r,l,a,i,o,s,u,c,f,d,v,m,p,g,y,w,b,k;h.identity=d=e=>e,h.type=b=e=>null==e?e:Object.getPrototypeOf(e).constructor,h.keys=p=e=>Object.keys(e||{}),h.vals=e=>Object.values(e||{}),t=Object.entries||(e=>p(e).map(t=>[t,e[t]])),h.entries=l=e=>t(e||{}),e=Object.fromEntries||(e=>g(...e.map(([e,t])=>({[e]:t})))),h.dict=t=>e(t||[]),h.isArray=v=Array.isArray,h.isDict=m=e=>b(e)===Object,h.isFn=e=>"function"==typeof e,h.merge=g=(...e)=>Object.assign({},...e),h.assoc=n=(e,t,n)=>((e=v(e)&&Number.isInteger(t)&&t>=0?e.slice(0):{...e})[t]=n,e),h.dissoc=(e,...t)=>(e=v(e)?e.slice(0):{...e},t.forEach(t=>delete e[t]),e),h.update=k=(e,t,r,...l)=>n(e,t,r(null!=e?e[t]:void 0,...l)),h.getIn=c=(e,t)=>t.reduce((e,t)=>null!=e?e[t]:void 0,e),h.assocIn=r=(e,t,l)=>t.length<2?n(e,t[0],l):k(e,t[0],r,t.slice(1),l),h.updateIn=(e,t,n,...l)=>r(e,t,n(c(e,t),...l)),h.chunks=(e,t)=>Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(t*r,t*(r+1))),h.flatten=u=e=>v(e)?e.flatMap(u):e,h.repr=e=>JSON.stringify(e,y),h.identical=f=(e,t)=>e===t||e!=e&&t!=t,h.eq=a=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&i(e,t,a):m(e)&&m(t)&&o(e,t)),h.eqShallow=(e,t)=>e===t||(e!=e?t!=t:v(e)?v(t)&&i(e,t,f):m(e)&&m(t)&&s(e,t)),w=t=>e(l(t).sort()),y=(e,t)=>b(t)===RegExp?""+t:m(t)?w(t):t,i=(e,t,n)=>e.length===t.length&&e.every((e,r)=>n(e,t[r])),o=(e,t,n=p(e),r=new Set(p(t)))=>n.length===r.size&&n.every(e=>r.has(e))&&n.every(n=>a(e[n],t[n])),s=(e,t,n=p(e))=>n.length===p(t).length&&n.every(n=>n in t&&f(e[n],t[n])),h.chain=(e,...t)=>t.map(e=>v(e)?e:[e]).reduce((e,t)=>t[0](e,...t.slice(1)),e),h.multi=(e=d)=>{var t,n,r;return n=new Map,t=()=>{throw TypeError("Invalid arguments")},r=Object.assign((...r)=>(n.get(e(...r))||t)(...r),{when:(e,t)=>(n.set(e,t),r),default:e=>(t=e,r)})}}).call(this);var p={};(function(){p=h}).call(this);var g={};(function(){var e,t,n,r,l,a,i,o;({multi:n,type:o}=h),g.deref=t=n(o),g.resetVals=l=n(o).default((e,n)=>[t(e),r(e,n)]),g.reset=r=n(o).default((e,t)=>a(e,()=>t)),g.swapVals=i=n(o).default((e,n,...r)=>l(e,n(t(e),...r))),g.swap=a=n(o).default((...e)=>i(...e)[1]),g.compareAndSet=n(o).default((e,n,l)=>n===t(e)&&(r(e,l),!0)),e=function(e){this.x=e},t.when(e,e=>e.x),r.when(e,(e,t)=>e.x=t),g.atom=t=>new e(t)}).call(this);var y={};(function(){y=g}).call(this);var w={};(function(){var e,t,n,r,l,a,i,o,s,u,c,f,d,v,m,p,y,b,k,x,_,S,E,A,C,j,z,N,$,I,O,q,M,T,L,F,D,P;({identical:N,eqShallow:j,isArray:I,keys:O,getIn:z,merge:q,assocIn:S,identity:$}=h),({atom:E,deref:C,reset:L,swap:P}=g),c=p=u=$,o=F=(e,t)=>t,w._init=e=>{u=(null!=e?e.hyperscript:void 0)||u,o=u.fragment||F,p=(null!=e?e.redraw:void 0)||p,c=(null!=e?e.mount:void 0)||c},k=null,y=new Map,w.resetCache=()=>y.clear(),d=(e,t,n)=>{for(;e;)e.state._subs.set(t,n),e=e._parent;return n},a=(e,t)=>!e&&!t||(null!=e?e.length:void 0)===(null!=t?t.length:void 0)&&j(e._meta,t._meta)&&e.every((e,n)=>j(e,t[n])),l=function(e){var t;return!a(e.attrs.argv,this._argv)||(t=Array.from(this._subs)).some(([e,t])=>e._deref()!==t)||(t.forEach(([t,n])=>d(e._parent,t,n)),!1)},b=e=>function(t){var n;n=k,k=t;try{return this._subs.clear(),this._argv=t.attrs.argv,e.call(this,t)}finally{k=n}},i=e=>{var t;return y.has(e)||(t={oninit:function(n){this._comp=t,this._subs=new Map,this._atom=T(),this._view=e},onbeforeupdate:l,view:b((function(e){var t,n;return n=this._view.apply(e,t=e.attrs.argv.slice(1)),_("function"!=typeof n?n:(this._view=n).apply(e,t))}))},y.set(e,t)),y.get(e)},s=(e,t)=>"object"!=typeof t||I(t)?[e,_(t)]:[q(t,e)],f=e=>(e.attrs&&(e._parent=e.attrs._parent||null,delete e.attrs._parent),e),w.asElement=_=e=>{var t,r;return I(e)?(t=e[0],r={...e._meta||{},_parent:k},">"===t?n(e[1],s(r,e[2]),e.slice(3).map(_)):"<>"===t?f(o(r,e.slice(1).map(_))):"string"==typeof t?n(t,s(r,e[1]),e.slice(2).map(_)):n("function"==typeof t?i(t):t,[{...r,argv:e}])):e},w.render=(e,t)=>c(t,{view:()=>_(e)}),w.with=x=(e,t)=>((t=t.slice(0))._meta=e,t),w.createClass=e=>{var t,n,r;return n={oninit:function(e){var r,l;this._comp=n,this._subs=new Map,this._atom=T("function"==typeof(r=t("getInitialState"))?r(e):void 0),"function"==typeof(l=t("constructor"))&&l(e,[e,e.attrs])},oncreate:(t=(t,n=e[t])=>n&&((e,t)=>{k=e;try{return n.apply(e,t||[e])}finally{k=null}}))("componentDidMount"),onupdate:t("componentDidUpdate"),onremove:t("componentWillUnmount"),onbeforeupdate:t("shouldComponentUpdate")||l,onbeforeremove:t("beforeComponentUnmounts"),view:b(e.render||(r=e.reagentRender,function(e){return _(r.apply(e,e.attrs.argv.slice(1)))}))}},e=function(e){this.x=e,this._deref=()=>this.x},C.when(e,e=>d(k,e,e._deref())),L.when(e,(e,t)=>(N(t,e.x)||(e.x=t,p()),t)),w.atom=T=t=>new e(t),t=function(e,t){this.src=e,this.path=t,this._deref=()=>this.src(this.path)},C.when(t,e=>d(k,e,e._deref())),L.when(t,(e,t)=>(N(t,e._deref())||(e.src(e.path,t),p()),t)),r=e=>(t,n)=>void 0===n?z(e._deref(),t):P(e,S,t,n),w.cursor=(e,n)=>new t("function"==typeof e?e:r(e),n),w.adaptComponent=e=>(...t)=>x(null!=k?k.attrs:void 0,[">",e,...t]),w.classNames=A=(...e)=>{var t;return t=e.reduce((e,t)=>("object"!=typeof t&&(t=(""+t).split(" ")),q(e,I(t)?q(...t.map(e=>e&&{[e]:e})):t)),{}),O(t).filter(e=>t[e]).join(" ")},v=e=>"function"!=typeof e?e:function(t){return t.redraw=!1,e.call(this,t)},m=(e,t={})=>{var n,r;for(n in e)r=e[n],t[n]="on"!==n.slice(0,2)?r:v(r);return t},M=(e,t)=>"string"!=typeof e?t:["class","className","classList"].reduce((e,t)=>(e[t]&&(e[t]=A(e[t])),e),m(t)),n=(e,t,n)=>{var r,l,a;return r=null!=(null!=(l=t[1])&&null!=(a=l.attrs)?a.key:void 0)?n:[n],f(u(e,M(e,t[0]),t[1],...r))},w.createElement=(e,t,...r)=>n(e,[t||{}],r),w.currentComponent=()=>k,w.children=e=>e.children,w.props=e=>e.attrs,w.argv=e=>e.attrs.argv,w.stateAtom=D=e=>e.state._atom,w.state=e=>C(D(e)),w.replaceState=(e,t)=>L(D(e),t),w.setState=(e,t)=>P(D(e),q,t)}).call(this);var b={};(function(){var e,t,n,r;t=v,r=m,e=u,b=n=w,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var k={};(function(){var e,t,n,r,l,a,i,o,s,u,c,f,d,v,m,p,y,b,x,_,S,E,A,C,j,z,N,$,I,O,q,M,T,L,F,D,P,U,H,V,R,B,J,Q,W,Y,Z,G,K,X,ee,te,ne,re,le,ae,ie,oe,se,ue,ce,fe,de,ve,me,he=[].splice;({identical:G,eq:R,eqShallow:B,keys:ne,dict:F,entries:V,isArray:X,isDict:ee,isFn:te,getIn:Z,merge:re,assoc:j,assocIn:$,dissoc:U,update:ve,repr:oe,identity:K,chunks:q,flatten:Q,chain:O}=h),({atom:I,deref:L,reset:se,swap:fe}=g),({_init:m,atom:le,cursor:T}=w),u=R,k._init=e=>{m(e),u=(null!=e?e.eq:void 0)||u},k.appDb=C=le({}),J=I({}),H=I({}),M=I({}),ce=I({}),b=(e,[t])=>console.error(`re-frame: no ${e} handler registered for: '${t}'`),o=(e,t)=>console.warn(`re-frame: overwriting ${e} handler for: '${t}'`),A=new Map,k.clearSubscriptionCache=()=>A.clear(),c=new Set,k.purgeEventQueue=()=>(c.forEach(clearTimeout),c.clear()),n=e=>t=>{t?fe(e,U,t):se(e,{})},y=()=>{throw SyntaxError("re-frame: invalid subscription signals")},E=e=>{var t;return e.every(([e,t])=>"<-"===e&&X(t))||y(),1===(t=e.map(e=>e[1])).length?()=>ue(t[0]):()=>t.map(ue)},a=e=>e._deref(),e=e=>X(e)?e.map(a):ee(e)?F(V(e).map(([e,t])=>[e,a(t)])):a(e),k.regSub=(e,...t)=>{var n,r;r=t,[...t]=r,[n]=he.call(t,-1),t=0===t.length?()=>C:1!==t.length?E(q(t,2)):te(t[0])?t[0]:y(),L(ce)[e]&&o("subscription",e),fe(ce,j,e,[t,n])},t=(t,n)=>r=>{var l,a,i,o,s;return l=e(t(r)),A.has(i=oe(r))&&([a,o]=A.get(i),B(l,a))?o:(s=n(l,r),A.set(i,[l,s]),s)},l=new Map,k.subscribe=ue=e=>{var n,r;return(n=L(ce)[e[0]])?(l.has(r=oe(e))||l.set(r,T(t(...n),e)),l.get(r)):b("subscription",e)},k.clearSub=(me=n(ce),e=>(e||l.clear(),me(e))),k.toInterceptor=de=e=>({id:null!=e?e.id:void 0,before:(null!=e?e.before:void 0)||K,after:(null!=e?e.after:void 0)||K}),v=(e,t,n)=>t?t in(e||{})?e[t]:n:e,k.getCoeffect=W=(e,t,n)=>v(e.coeffects,t,n),k.getEffect=Y=(e,t,n)=>v(e.effects,t,n),k.assocCoeffect=z=(e,t,n)=>$(e,["coeffects",t],n),k.assocEffect=N=(e,t,n)=>$(e,["effects",t],n),k.enqueue=(e,t)=>ve(e,"queue",e=>[...e,...t]),d=e=>Y(e,"db",W(e,"db")),x="re-frame-path/db-store",k.path=(...e)=>de({id:"path",before:t=>{var n,r;return n=W(t,"db"),r=[...t[x]||[],n],O(t,[j,x,r],[z,"db",Z(n,Q(e))])},after:t=>{var n,r,l;return l=t[x],[...r]=l,[n]=he.call(r,-1),O(t,[j,x,r],[N,"db",$(n,Q(e),d(t))],[z,"db",n])}}),k.enrich=e=>de({id:"enrich",after:t=>N(t,"db",e(d(t),W(t,"event")))}),_=e=>t=>{var n;return n=W(t,"event"),O(t,[z,"originalEvent",n],[z,"event",e(n)])},S=e=>z(e,"event",W(e,"originalEvent")),k.unwrap=de({id:"unwrap",after:S,before:_(e=>e[1])}),k.trimV=de({id:"trim-v",after:S,before:_(e=>e.slice(1))}),k.after=e=>de({id:"after",after:t=>(e(d(t),W(t,"event")),t)}),k.onChanges=(e,t,...n)=>de({id:"on-changes",after:r=>{var l,a,i,o;return l=W(r,"db"),a=d(r),[i,o]=[l,a].map(e=>n.map(t=>Z(e,t))),o.every((e,t)=>G(e,i[t]))?r:N(r,"db",$(a,t,e(...o)))}}),k.regCofx=(e,t)=>{L(M)[e]&&o("coeffect",e),fe(M,j,e,t)},k.injectCofx=(e,t)=>de({id:e,before:n=>L(M)[e]?ve(n,"coeffects",L(M)[e],t):(b("coeffect",[e]),n)}),k.clearCofx=n(M),k.regEventDb=(e,t,n)=>(n||([t,n]=[[],t]),ie(e,t,(e,t)=>({db:n(e.db,t)}))),r=e=>t=>re(t,{effects:e(W(t),W(t,"event"))}),k.regEventFx=ie=(e,t,n)=>(n||([t,n]=[[],t]),ae(e,t,r(n))),k.regEventCtx=ae=(e,t,n)=>{n||([t,n]=[[],t]),L(J)[e]&&o("event",e),fe(J,j,e,[Q(t.filter(K)),n])},k.clearEvent=n(J),p=(e,t)=>{var n,r;for(e=re(e,{stack:[],queue:e.stack});e.queue.length>0;)[n,...r]=e.queue,e=n[t](re(e,{queue:r})),e=re(e,{stack:[n,...e.stack]});return e},k.dispatchSync=P=e=>{var t,n,r,l;return(r=L(J)[e[0]])?([l,n]=r,t={stack:l,coeffects:{event:e,db:a(C)}},O(t,[p,"before"],n,[p,"after"],Y,V,f)):b("event",e)},i=({ms:e,dispatch:t})=>{var n;return c.add(n=setTimeout(()=>(c.delete(n),P(t)),e)),n},k.dispatch=D=e=>i({dispatch:e}),s={db:e=>{if(!u(e,a(C)))return se(C,e)},fx:f=(e,t=L(H))=>e.filter(K).forEach(([e,n])=>{var r;return(r=t[e]||s[e])?r(n):b("effect",[e])}),dispatchLater:i,dispatch:e=>i({dispatch:e})},k.regFx=(e,t)=>{L(H)[e]&&o("effect",e),fe(H,j,e,t)},k.clearFx=n(H),k.dsub=e=>L(ue(e)),k.disp=(e,...t)=>e&&D([...e,...t])}).call(this);var x={};(function(){var e,t,n,r;t=v,r=m,e=u,x=n=k,n._init({redraw:r,hyperscript:e,mount:t})}).call(this);var _={};(function(){var e,t,n,r,l;l=p,t=y,r=b,({_init:e}=n=x),_={util:l,atom:t,reagent:r,reFrame:n,_init:e}}).call(this);var S={};(function(){var e,t;t=w,S={jsx:e=(e,{children:n=[],...r},l)=>t.with({key:l,...r},[e].concat(n)),jsxs:e,Fragment:"<>"}}).call(this);var E={};return function(){E=S}.call(this),t.m["mithril/hyperscript"]=u,t.m["mithril/render"]=f,t.m["mithril/mount"]=v,t.m["mithril/redraw"]=m,t.m["mreframe/util"]=p,t.m["mreframe/atom"]=y,t.m["mreframe/reagent"]=b,t.m["mreframe/re-frame"]=x,t.m.mreframe=_,t.m["mreframe/jsx-runtime"]=E,t}("function"==typeof require?require:void 0); \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 844add3..7ed846d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,3 +8,5 @@ Exports the following items: * [`reagent`](reagent.md) – the `mreframe/reagent` submodule * [`reFrame`](re-frame.md) – the `mreframe/re-frame` submodule * [`_init (opts)`](re-frame.md#_init-opts) from re-frame submodule + +There's also [`jsx-runtime`](jsx-runtime.md) which isn't included in main module (it implements JSX support). diff --git a/docs/jsx-runtime.md b/docs/jsx-runtime.md new file mode 100644 index 0000000..10def58 --- /dev/null +++ b/docs/jsx-runtime.md @@ -0,0 +1,61 @@ +## `jsx-runtime` module + +Implements a JSX interface for [Babel API](https://babeljs.io/docs/babel-plugin-transform-react-jsx). +You're likely not going to use this directly. + +Exports the following items: +* `jsx (tag, {children?, ...attrs}, key?)` – a replacement for single-child (or childless) JSX element +* `jsxs (tag, {children=[], ...attrs}, key?)` – a replacement for multi-child JSX element +* `Fragment` – the `tag` value for `<>` tags (equals to `'<>'`, as per Hiccup definition) + + +### Usage + +In order to use `mreframe` with JSX, you need to do the following: +* install NPM packages `@babel/cli`, `@babel/core`, `@babel/plugin-transform-react-jsx`; + optionally `@babel/plugin-transform-modules-commonjs` (to use produced files directly in browser) +* configure Babel (i.e. in `.babelrc`): + ```js + { + "plugins": [ + ["@babel/plugin-transform-react-jsx", { + "runtime": "automatic", + "importSource": "mreframe" + }], + // uncomment this to have require() instead of import; this makes JSX output messier though + //["@babel/plugin-transform-modules-commonjs"] + ] + } + ``` +* add a `script` command (in `package.json`) to run Babel; e.g. + ```json + { + ... + "script": { + "build": "babel src/ -d dist/" + } + ... + } + ``` + such a command can be run as `npm run build` (or `yarn build` when using `yarn`) + + +### Issues + +JSX is not particularly compatible with Reagent-style components; you're likely to encounter following issues: + +* component arguments have to be passed as `children` array; this may take one of the following forms: + - `{[foo, bar, baz]}` + - `{foo}{bar}{baz}` + - `{[Component, foo, bar, baz]}` + +* single arguments can be passed without wrapping into an array… unless it's an array value: in this case not + wrapping it would result in it being treated as an argument list + +* attributes can be used, but they're _not_ included in the component arguments; they're passed as `meta`/`attrs` + (i.e. `r.props( r.currentComponent() )`) + +* native (Mithril) components must be [adapted](reagent.md#adaptComponent-c) before you can use them + +* attributes named `children` or `argv` are unsupported diff --git a/docs/reagent.md b/docs/reagent.md index f3ea537..235122f 100644 --- a/docs/reagent.md +++ b/docs/reagent.md @@ -81,10 +81,11 @@ Note regarding `classList`: in Mithril, it works same way as `class` or `classNa except that including classes in tag selector (e.g. `div.foo`) _overrides_ it instead of it being appended to generated CSS classes. ### [`adaptComponent (c)`](http://reagent-project.github.io/docs/master/reagent.core.html#var-adapt-react-class) -Converts a Mithril component into a Reagent component. +Converts a Mithril component into a Reagent component. +Its arguments are passed to the vnode as `children`, and metadata is passed as `attrs`. ```js -var x = r.adaptComponent({view: ({children}) => m('div', "Hello, World", children)}), - y = () => [x, 1, 2, 3] // ~ ['>', x, 1, 2, 3] +var x = r.adaptComponent({view: ({attrs, children}) => m('div', attrs, "Hello, World", children)}), + y = () => r.with(meta, [x, 1, 2, 3]) // ~ ['>', x, meta, 1, 2, 3] ``` ### [`asElement (form)`](http://reagent-project.github.io/docs/master/reagent.core.html#var-as-element) diff --git a/examples/reagent.js.html b/examples/reagent.js.html index 792d91c..c4f7f93 100644 --- a/examples/reagent.js.html +++ b/examples/reagent.js.html @@ -6,7 +6,7 @@