diff --git a/docs/chainable-components.js b/docs/chainable-components.js index 0052f36..341b0f7 100644 --- a/docs/chainable-components.js +++ b/docs/chainable-components.js @@ -1,4 +1,4 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./demo/index.tsx")}({"./demo sync \\.*Demo\\.tsx$":function(e,t,n){var r={"./AllDemo.tsx":"./demo/AllDemo.tsx","./ContextDemo.tsx":"./demo/ContextDemo.tsx","./ReactRouterDemo.tsx":"./demo/ReactRouterDemo.tsx","./WithStateDemo.tsx":"./demo/WithStateDemo.tsx"};function o(e){var t=a(e);return n(t)}function a(e){var t=r[e];if(!(t+1)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return t}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id="./demo sync \\.*Demo\\.tsx$"},"./demo/AllDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/lib/withState.ts"),a=n("./src/ChainableComponent.ts"),i=n("./demo/Step.tsx");t.WithStateDemo=a.all([o.withState({initial:"string value"}),o.withState({initial:1}),o.withState({initial:2}),o.withState({initial:3}),o.withState({initial:5}),o.withState({initial:8})]).ap(function(e){var t=e[0],n=e[1],o=e[2],a=e[3],i=e[4],l=e[5];return r.createElement("div",null,r.createElement("div",null,"a: ",t.value," ",r.createElement("button",{onClick:function(){return t.update(t.value+1)}},"+")),r.createElement("div",null,"b: ",n.value," ",r.createElement("button",{onClick:function(){return n.update(n.value+1)}},"+")),r.createElement("div",null,"c: ",o.value," ",r.createElement("button",{onClick:function(){return o.update(o.value+1)}},"+")),r.createElement("div",null,"d: ",a.value," ",r.createElement("button",{onClick:function(){return a.update(a.value+1)}},"+")),r.createElement("div",null,"e: ",i.value," ",r.createElement("button",{onClick:function(){return i.update(i.value+1)}},"+")),r.createElement("div",null,"f: ",l.value," ",r.createElement("button",{onClick:function(){return l.update(l.value+1)}},"+")))}),t.default=function(){return r.createElement(i.default,{title:"withState Demo"},r.createElement("pre",{className:"code-sample"},"import { withState, all } from 'chainable-components';\n\nall([\n withState({initial: 'string value'}),\n withState({initial: 1}),\n withState({initial: 2}),\n withState({initial: 3}),\n withState({initial: 5}),\n withState({initial: 8})\n])\n.ap(([a, b, c, d, e, f]) => (\n
\n {/* a.value is inferred as a string */}\n
a: {a.value}
\n \n {/* b.value through f.value is inferred as a number */}\n
b: {b.value}
\n
c: {c.value}
\n
d: {d.value}
\n
e: {e.value}
\n
f: {f.value}
\n
\n));"),t.WithStateDemo)}},"./demo/ContextDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/ChainableComponent.ts"),a=n("./demo/Step.tsx"),i=r.createContext("Default Value"),l=i.Consumer,u=i.Provider,s=o.fromRenderProp(l)({children:function(){return"hmm, this should be necessary"}}).ap(function(e){return r.createElement("span",null,"Current context is:",r.createElement("pre",null,JSON.stringify(e,null,2)))}),c=function(){return r.createElement("div",null,s,r.createElement(u,{value:"Overriden value"},s))};t.default=function(){return r.createElement(a.default,{title:"React 16 Context Demo"},r.createElement("pre",{className:"code-sample"},"import { fromRenderProp } from 'chainable-components';\nconst { Consumer, Provider } = React.createContext(\"Default Value\");\nconst withStringContext = fromRenderProp(Consumer);\n\nconst DisplayContext =\nwithStringContext({ children: a => '' }).ap(\n context => {\n return (\n \n Current context is:\n
{JSON.stringify(context, null, 2)}
\n
\n );\n }\n\nconst ContextDemo = () => (\n
\n {DisplayContext}\n \n {DisplayContext}\n \n
\n);"),r.createElement(c,null))}},"./demo/ReactRouterDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./node_modules/react-router/es/index.js"),a=n("./src/ChainableComponent.ts"),i=n("./demo/Step.tsx"),l=n("./node_modules/history/createBrowserHistory.js").default(),u=a.fromRenderProp(o.Route);t.default=function(){return r.createElement(i.default,{title:"React Router Demo"},r.createElement("pre",{className:"code-sample"},"import { Route } from 'react-router';\nconst withRoute = fromRenderProp(Route);\n\nwithRoute({}).ap(\n route => {\n return (\n \n Current route is:\n
{route.history.location.pathname}
{/* route's type is automatically inferred. */}\n
\n );\n }\n)"),r.createElement(o.Router,{history:l},u({}).ap(function(e){return r.createElement("span",null,"Current route is:",r.createElement("pre",null,e.history.location.pathname)," ")})))}},"./demo/Step.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js");t.default=function(e){return r.createElement("div",{className:"step"},r.createElement("h4",{className:"step-header"},e.title),r.createElement("div",{className:"step-body"},e.children))}},"./demo/WithStateDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/lib/withState.ts"),a=n("./demo/Step.tsx");t.WithStateDemo=o.withState({initial:0}).chain(function(e){return o.withState({initial:16}).map(function(t){return{inner:t,outer:e}})}).ap(function(e){var t=e.inner,n=e.outer;return r.createElement("div",null,r.createElement("div",null,"Outer: ",n.value," ",r.createElement("button",{onClick:function(){return n.update(n.value+1)}},"+")),r.createElement("div",null,"Inner: ",t.value," ",r.createElement("button",{onClick:function(){return t.update(t.value+1)}},"+")))}),t.default=function(){return r.createElement(a.default,{title:"withState Demo"},r.createElement("pre",{className:"code-sample"},"import { withState } from 'chainable-components';\n\nwithState({initial: 0}).chain(outer => \n withState({initial: 16}).map(inner => \n ({inner, outer})\n )\n)\n.ap(({inner, outer}) => (\n
\n
Outer: {outer.value}
\n
Inner: {inner.value}
\n
\n))"),t.WithStateDemo)}},"./demo/demo.less":function(e,t,n){var r=n("./node_modules/css-loader/index.js??ref--8-1!./node_modules/less-loader/dist/cjs.js??ref--8-2!./demo/demo.less");"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0};n("./node_modules/style-loader/lib/addStyles.js")(r,o);r.locals&&(e.exports=r.locals)},"./demo/index.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./node_modules/react-dom/index.js"),a=n("./node_modules/react-hot-loader/index.js");n("./styles/index.less"),n("./demo/demo.less");var i,l=n("./demo sync \\.*Demo\\.tsx$"),u=document.getElementById("app");i=function(){return r.createElement("div",null,l.keys().map(function(e){return l(e)}).map(function(e,t){return r.createElement(e.default,{key:t})}))},o.render(r.createElement(a.AppContainer,null,r.createElement(i,null)),u)},"./node_modules/css-loader/index.js??ref--8-1!./node_modules/less-loader/dist/cjs.js??ref--8-2!./demo/demo.less":function(e,t,n){(e.exports=n("./node_modules/css-loader/lib/css-base.js")(!0)).push([e.i,"html,\nbody,\n#app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n#app {\n margin: 0 auto;\n width: 80%;\n}\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n}\n.step:last-child {\n margin-bottom: 5rem;\n}\n.step .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n}\n.step .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n}\n.step .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff;\n}\npre {\n font-family: monospace;\n}\n","",{version:3,sources:["/Users/pgray/dev/chainable-components/demo/demo.less","/Users/pgray/dev/chainable-components/demo/demo.less"],names:[],mappings:"AAAA;;;EACE,UAAA;EACA,aAAA;EACA,YAAA;EACA,uHAAA;CCGD;ADAD;EACE,eAAA;EACA,WAAA;CCED;ADCD;EACE,uBAAA;EACA,iBAAA;EACA,mBAAA;CCCD;ADAC;EACE,oBAAA;CCEH;ADPD;EAQI,uBAAA;EACA,UAAA;EACA,gBAAA;EACA,8BAAA;EACA,uBAAA;CCEH;ADdD;EAeI,gBAAA;EACA,oBAAA;CCEH;ADlBD;EAmBI,gEAAA;EACA,cAAA;EACA,iBAAA;EACA,uBAAA;EACA,YAAA;CCEH;ADED;EACE,uBAAA;CCAD",file:"demo.less",sourcesContent:["html, body, #app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n\n#app {\n margin: 0 auto;\n width: 80%;\n}\n\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n &:last-child {\n margin-bottom: 5rem;\n }\n .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n }\n .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n }\n .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff; \n }\n}\n\npre {\n font-family: monospace;\n}","html,\nbody,\n#app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n#app {\n margin: 0 auto;\n width: 80%;\n}\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n}\n.step:last-child {\n margin-bottom: 5rem;\n}\n.step .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n}\n.step .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n}\n.step .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff;\n}\npre {\n font-family: monospace;\n}\n"],sourceRoot:""}])},"./node_modules/css-loader/index.js??ref--8-1!./node_modules/less-loader/dist/cjs.js??ref--8-2!./styles/index.less":function(e,t,n){(e.exports=n("./node_modules/css-loader/lib/css-base.js")(!0)).push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"index.less",sourceRoot:""}])},"./node_modules/css-loader/lib/css-base.js":function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(i=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),a=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(a).concat([o]).join("\n")}var i;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o0&&void 0!==arguments[0]?arguments[0]:{};(0,i.default)(c.canUseDOM,"Browser history needs a DOM");var t=window.history,n=(0,c.supportsHistory)(),f=!(0,c.supportsPopStateOnHashChange)(),p=e.forceRefresh,h=void 0!==p&&p,m=e.getUserConfirmation,v=void 0===m?c.getConfirmation:m,y=e.keyLength,g=void 0===y?6:y,b=e.basename?(0,u.stripTrailingSlash)((0,u.addLeadingSlash)(e.basename)):"",w=function(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return(0,a.default)(!b||(0,u.hasBasename)(i,b),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+i+'" to begin with "'+b+'".'),b&&(i=(0,u.stripBasename)(i,b)),(0,l.createLocation)(i,r,n)},x=function(){return Math.random().toString(36).substr(2,g)},_=(0,s.default)(),E=function(e){o(D,e),D.length=t.length,_.notifyListeners(D.location,D.action)},C=function(e){(0,c.isExtraneousPopstateEvent)(e)||T(w(e.state))},k=function(){T(w(d()))},S=!1,T=function(e){S?(S=!1,E()):_.confirmTransitionTo(e,"POP",v,function(t){t?E({action:"POP",location:e}):P(e)})},P=function(e){var t=D.location,n=O.indexOf(t.key);-1===n&&(n=0);var r=O.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(S=!0,A(o))},j=w(d()),O=[j.key],R=function(e){return b+(0,u.createPath)(e)},A=function(e){t.go(e)},N=0,U=function(e){1===(N+=e)?((0,c.addEventListener)(window,"popstate",C),f&&(0,c.addEventListener)(window,"hashchange",k)):0===N&&((0,c.removeEventListener)(window,"popstate",C),f&&(0,c.removeEventListener)(window,"hashchange",k))},M=!1,D={length:t.length,action:"POP",location:j,createHref:R,push:function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,l.createLocation)(e,o,x(),D.location);_.confirmTransitionTo(i,"PUSH",v,function(e){if(e){var r=R(i),o=i.key,l=i.state;if(n)if(t.pushState({key:o,state:l},null,r),h)window.location.href=r;else{var u=O.indexOf(D.location.key),s=O.slice(0,-1===u?0:u+1);s.push(i.key),O=s,E({action:"PUSH",location:i})}else(0,a.default)(void 0===l,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=r}})},replace:function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,l.createLocation)(e,o,x(),D.location);_.confirmTransitionTo(i,"REPLACE",v,function(e){if(e){var r=R(i),o=i.key,l=i.state;if(n)if(t.replaceState({key:o,state:l},null,r),h)window.location.replace(r);else{var u=O.indexOf(D.location.key);-1!==u&&(O[u]=i.key),E({action:"REPLACE",location:i})}else(0,a.default)(void 0===l,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(r)}})},go:A,goBack:function(){return A(-1)},goForward:function(){return A(1)},block:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=_.setPrompt(e);return M||(U(1),M=!0),function(){return M&&(M=!1,U(-1)),t()}},listen:function(e){var t=_.appendListener(e);return U(1),function(){U(-1),t()}}};return D}},"./node_modules/history/createTransitionManager.js":function(e,t,n){"use strict";t.__esModule=!0;var r,o=n("./node_modules/warning/browser.js"),a=(r=o)&&r.__esModule?r:{default:r};t.default=function(){var e=null,t=[];return{setPrompt:function(t){return(0,a.default)(null==e,"A history supports only one prompt at a time"),e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var i="function"==typeof e?e(t,n):e;"string"==typeof i?"function"==typeof r?r(i,o):((0,a.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),o(!0)):o(!1!==i)}else o(!0)},appendListener:function(e){var n=!0,r=function(){n&&e.apply(void 0,arguments)};return t.push(r),function(){n=!1,t=t.filter(function(e){return e!==r})}},notifyListeners:function(){for(var e=arguments.length,n=Array(e),r=0;r (\n
\n {/* a.value is inferred as a string */}\n
a: {a.value}
\n \n {/* b.value through f.value is inferred as a number */}\n
b: {b.value}
\n
c: {c.value}
\n
d: {d.value}
\n
e: {e.value}
\n
f: {f.value}
\n
\n));"),t.AllDemo)}},"./demo/demos/ContextDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/ChainableComponent.ts"),a=n("./demo/Step.tsx"),i=r.createContext("Default Value"),l=i.Consumer,u=i.Provider,s=o.fromRenderProp(l)({children:function(){return"hmm, this should be necessary"}}).render(function(e){return r.createElement("span",null,"Current context is:",r.createElement("pre",null,JSON.stringify(e,null,2)))}),c=function(){return r.createElement("div",null,s,r.createElement(u,{value:"Overriden value"},s))};t.default=function(){return r.createElement(a.default,{title:"React 16 Context Demo"},r.createElement("pre",{className:"code-sample"},"import { fromRenderProp } from 'chainable-components';\nconst { Consumer, Provider } = React.createContext(\"Default Value\");\nconst withStringContext = fromRenderProp(Consumer);\n\nconst DisplayContext =\nwithStringContext({ children: a => '' }).render(\n context => {\n return (\n \n Current context is:\n
{JSON.stringify(context, null, 2)}
\n
\n );\n }\n\nconst ContextDemo = () => (\n
\n {DisplayContext}\n \n {DisplayContext}\n \n
\n);"),r.createElement(c,null))}},"./demo/demos/FromRenderDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/ChainableComponent.ts"),a=n("./demo/Step.tsx");t.FromRenderDemo=o.fromRender(function(e){return function(){return r.createElement("div",null,"Applied: ",e(5))}}).render(function(e){return r.createElement("div",null,"test: ",e)}),t.default=function(){return r.createElement(a.default,{title:"FromAp Demo"},r.createElement("pre",{className:"code-sample"},"import { withState, all } from 'chainable-components';"),t.FromRenderDemo)}},"./demo/demos/ReactRouterDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./node_modules/react-router/es/index.js"),a=n("./src/ChainableComponent.ts"),i=n("./demo/Step.tsx"),l=n("./node_modules/history/createBrowserHistory.js").default(),u=a.fromRenderProp(o.Route);t.default=function(){return r.createElement(i.default,{title:"React Router Demo"},r.createElement("pre",{className:"code-sample"},"import { Route } from 'react-router';\nconst withRoute = fromRenderProp(Route);\n\nwithRoute({}).render(\n route => {\n return (\n \n Current route is:\n
{route.history.location.pathname}
{/* route's type is automatically inferred. */}\n
\n );\n }\n)"),r.createElement(o.Router,{history:l},u({}).render(function(e){return r.createElement("span",null,"Current route is:",r.createElement("pre",null,e.history.location.pathname)," ")})))}},"./demo/demos/WithStateDemo.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./src/lib/withState.ts"),a=n("./demo/Step.tsx");t.WithStateDemo=o.withState({initial:0}).chain(function(e){return o.withState({initial:16}).map(function(t){return{inner:t,outer:e}})}).render(function(e){var t=e.inner,n=e.outer;return r.createElement("div",null,r.createElement("div",null,"Outer: ",n.value," ",r.createElement("button",{onClick:function(){return n.update(n.value+1)}},"+")),r.createElement("div",null,"Inner: ",t.value," ",r.createElement("button",{onClick:function(){return t.update(t.value+1)}},"+")))}),t.default=function(){return r.createElement(a.default,{title:"withState Demo"},r.createElement("pre",{className:"code-sample"},"import { withState } from 'chainable-components';\n\nwithState({initial: 0}).chain(outer => \n withState({initial: 16}).map(inner => \n ({inner, outer})\n )\n)\n.render(({inner, outer}) => (\n
\n
Outer: {outer.value}
\n
Inner: {inner.value}
\n
\n))"),t.WithStateDemo)}},"./demo/index.tsx":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("./node_modules/react/index.js"),o=n("./node_modules/react-dom/index.js"),a=n("./node_modules/react-hot-loader/index.js");n("./styles/index.less"),n("./demo/demo.less");var i,l=n("./demo/demos sync recursive \\.*\\.tsx$"),u=document.body;i=function(){return r.createElement("div",null,l.keys().map(function(e){return l(e)}).map(function(e,t){return r.createElement(e.default,{key:t})}))},o.render(r.createElement(a.AppContainer,null,r.createElement("div",{id:"app"},r.createElement(i,null))),u)},"./node_modules/css-loader/index.js??ref--8-1!./node_modules/less-loader/dist/cjs.js??ref--8-2!./demo/demo.less":function(e,t,n){(e.exports=n("./node_modules/css-loader/lib/css-base.js")(!0)).push([e.i,"html,\nbody,\n#app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n#app {\n margin: 0 auto;\n width: 80%;\n}\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n}\n.step:last-child {\n margin-bottom: 5rem;\n}\n.step .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n}\n.step .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n}\n.step .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff;\n}\npre {\n font-family: monospace;\n}\n","",{version:3,sources:["/Users/pgray/dev/chainable-components/demo/demo.less","/Users/pgray/dev/chainable-components/demo/demo.less"],names:[],mappings:"AAAA;;;EACE,UAAA;EACA,aAAA;EACA,YAAA;EACA,uHAAA;CCGD;ADAD;EACE,eAAA;EACA,WAAA;CCED;ADCD;EACE,uBAAA;EACA,iBAAA;EACA,mBAAA;CCCD;ADAC;EACE,oBAAA;CCEH;ADPD;EAQI,uBAAA;EACA,UAAA;EACA,gBAAA;EACA,8BAAA;EACA,uBAAA;CCEH;ADdD;EAeI,gBAAA;EACA,oBAAA;CCEH;ADlBD;EAmBI,gEAAA;EACA,cAAA;EACA,iBAAA;EACA,uBAAA;EACA,YAAA;CCEH;ADED;EACE,uBAAA;CCAD",file:"demo.less",sourcesContent:["html, body, #app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n\n#app {\n margin: 0 auto;\n width: 80%;\n}\n\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n &:last-child {\n margin-bottom: 5rem;\n }\n .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n }\n .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n }\n .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff; \n }\n}\n\npre {\n font-family: monospace;\n}","html,\nbody,\n#app {\n margin: 0;\n height: 100%;\n width: 100%;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n}\n#app {\n margin: 0 auto;\n width: 80%;\n}\n.step {\n border: 1px solid #ddd;\n margin-top: 2rem;\n border-radius: 4px;\n}\n.step:last-child {\n margin-bottom: 5rem;\n}\n.step .step-header {\n background-color: #eee;\n margin: 0;\n padding: 0.5rem;\n border-bottom: 1px solid #ddd;\n padding-bottom: 0.5rem;\n}\n.step .step-body {\n padding: 0.5rem;\n padding-top: 0.5rem;\n}\n.step .code-sample {\n font-family: 'Operator Mono', 'Courier New', Courier, monospace;\n padding: 1rem;\n overflow-x: auto;\n background-color: #555;\n color: #fff;\n}\npre {\n font-family: monospace;\n}\n"],sourceRoot:""}])},"./node_modules/css-loader/index.js??ref--8-1!./node_modules/less-loader/dist/cjs.js??ref--8-2!./styles/index.less":function(e,t,n){(e.exports=n("./node_modules/css-loader/lib/css-base.js")(!0)).push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"index.less",sourceRoot:""}])},"./node_modules/css-loader/lib/css-base.js":function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(i=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),a=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(a).concat([o]).join("\n")}var i;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o0&&void 0!==arguments[0]?arguments[0]:{};(0,i.default)(c.canUseDOM,"Browser history needs a DOM");var t=window.history,n=(0,c.supportsHistory)(),f=!(0,c.supportsPopStateOnHashChange)(),p=e.forceRefresh,h=void 0!==p&&p,m=e.getUserConfirmation,v=void 0===m?c.getConfirmation:m,y=e.keyLength,g=void 0===y?6:y,b=e.basename?(0,u.stripTrailingSlash)((0,u.addLeadingSlash)(e.basename)):"",w=function(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return(0,a.default)(!b||(0,u.hasBasename)(i,b),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+i+'" to begin with "'+b+'".'),b&&(i=(0,u.stripBasename)(i,b)),(0,l.createLocation)(i,r,n)},x=function(){return Math.random().toString(36).substr(2,g)},_=(0,s.default)(),E=function(e){o(D,e),D.length=t.length,_.notifyListeners(D.location,D.action)},C=function(e){(0,c.isExtraneousPopstateEvent)(e)||T(w(e.state))},k=function(){T(w(d()))},S=!1,T=function(e){S?(S=!1,E()):_.confirmTransitionTo(e,"POP",v,function(t){t?E({action:"POP",location:e}):P(e)})},P=function(e){var t=D.location,n=O.indexOf(t.key);-1===n&&(n=0);var r=O.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(S=!0,A(o))},j=w(d()),O=[j.key],R=function(e){return b+(0,u.createPath)(e)},A=function(e){t.go(e)},N=0,U=function(e){1===(N+=e)?((0,c.addEventListener)(window,"popstate",C),f&&(0,c.addEventListener)(window,"hashchange",k)):0===N&&((0,c.removeEventListener)(window,"popstate",C),f&&(0,c.removeEventListener)(window,"hashchange",k))},M=!1,D={length:t.length,action:"POP",location:j,createHref:R,push:function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,l.createLocation)(e,o,x(),D.location);_.confirmTransitionTo(i,"PUSH",v,function(e){if(e){var r=R(i),o=i.key,l=i.state;if(n)if(t.pushState({key:o,state:l},null,r),h)window.location.href=r;else{var u=O.indexOf(D.location.key),s=O.slice(0,-1===u?0:u+1);s.push(i.key),O=s,E({action:"PUSH",location:i})}else(0,a.default)(void 0===l,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=r}})},replace:function(e,o){(0,a.default)(!("object"===(void 0===e?"undefined":r(e))&&void 0!==e.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=(0,l.createLocation)(e,o,x(),D.location);_.confirmTransitionTo(i,"REPLACE",v,function(e){if(e){var r=R(i),o=i.key,l=i.state;if(n)if(t.replaceState({key:o,state:l},null,r),h)window.location.replace(r);else{var u=O.indexOf(D.location.key);-1!==u&&(O[u]=i.key),E({action:"REPLACE",location:i})}else(0,a.default)(void 0===l,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(r)}})},go:A,goBack:function(){return A(-1)},goForward:function(){return A(1)},block:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=_.setPrompt(e);return M||(U(1),M=!0),function(){return M&&(M=!1,U(-1)),t()}},listen:function(e){var t=_.appendListener(e);return U(1),function(){U(-1),t()}}};return D}},"./node_modules/history/createTransitionManager.js":function(e,t,n){"use strict";t.__esModule=!0;var r,o=n("./node_modules/warning/browser.js"),a=(r=o)&&r.__esModule?r:{default:r};t.default=function(){var e=null,t=[];return{setPrompt:function(t){return(0,a.default)(null==e,"A history supports only one prompt at a time"),e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var i="function"==typeof e?e(t,n):e;"string"==typeof i?"function"==typeof r?r(i,o):((0,a.default)(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),o(!0)):o(!1!==i)}else o(!0)},appendListener:function(e){var n=!0,r=function(){n&&e.apply(void 0,arguments)};return t.push(r),function(){n=!1,t=t.filter(function(e){return e!==r})}},notifyListeners:function(){for(var e=arguments.length,n=Array(e),r=0;rO.length&&O.push(e)}function N(e,t,n,r){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a=!1;if(null===e)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case u:case s:a=!0}}if(a)return n(r,e,""===t?"."+U(e,0):t),1;if(a=0,t=""===t?".":t+":",Array.isArray(e))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",n=e&&e.split("/")||[],a=t&&t.split("/")||[],i=e&&r(e),l=t&&r(t),u=i||l;if(e&&r(e)?a=n:n.length&&(a.pop(),a=a.concat(n)),!a.length)return"/";var s=void 0;if(a.length){var c=a[a.length-1];s="."===c||".."===c||""===c}else s=!1;for(var f=0,d=a.length;d>=0;d--){var p=a[d];"."===p?o(a,d):".."===p?(o(a,d),f++):f&&(o(a,d),f--)}if(!u)for(;f--;f)a.unshift("..");!u||""===a[0]||a[0]&&r(a[0])||a.unshift("");var h=a.join("/");return s&&"/"!==h.substr(-1)&&(h+="/"),h}},"./node_modules/style-loader/lib/addStyles.js":function(e,t,n){var r,o,a={},i=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(e){var t={};return function(e){if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,s=0,c=[],f=n("./node_modules/style-loader/lib/urls.js");function d(e,t){for(var n=0;n=0&&c.splice(t,1)}function v(e){var t=document.createElement("style");return e.attrs.type="text/css",y(t,e.attrs),h(e,t),t}function y(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function g(e,t){var n,r,o,a;if(t.transform&&e.css){if(!(a=t.transform(e.css)))return function(){};e.css=a}if(t.singleton){var i=s++;n=u||(u=v(t)),r=x.bind(null,n,i,!1),o=x.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",y(t,e.attrs),h(e,t),t}(t),r=function(e,t,n){var r=n.css,o=n.sourceMap,a=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||a)&&(r=f(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([r],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(i),l&&URL.revokeObjectURL(l)}.bind(null,n,t),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var r=[],o=0;oO.length&&O.push(e)}function N(e,t,n,r){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a=!1;if(null===e)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case u:case s:a=!0}}if(a)return n(r,e,""===t?"."+U(e,0):t),1;if(a=0,t=""===t?".":t+":",Array.isArray(e))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",n=e&&e.split("/")||[],a=t&&t.split("/")||[],i=e&&r(e),l=t&&r(t),u=i||l;if(e&&r(e)?a=n:n.length&&(a.pop(),a=a.concat(n)),!a.length)return"/";var s=void 0;if(a.length){var c=a[a.length-1];s="."===c||".."===c||""===c}else s=!1;for(var f=0,d=a.length;d>=0;d--){var p=a[d];"."===p?o(a,d):".."===p?(o(a,d),f++):f&&(o(a,d),f--)}if(!u)for(;f--;f)a.unshift("..");!u||""===a[0]||a[0]&&r(a[0])||a.unshift("");var h=a.join("/");return s&&"/"!==h.substr(-1)&&(h+="/"),h}},"./node_modules/style-loader/lib/addStyles.js":function(e,t,n){var r,o,a={},i=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(e){var t={};return function(e){if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,s=0,c=[],f=n("./node_modules/style-loader/lib/urls.js");function d(e,t){for(var n=0;n=0&&c.splice(t,1)}function v(e){var t=document.createElement("style");return e.attrs.type="text/css",y(t,e.attrs),h(e,t),t}function y(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function g(e,t){var n,r,o,a;if(t.transform&&e.css){if(!(a=t.transform(e.css)))return function(){};e.css=a}if(t.singleton){var i=s++;n=u||(u=v(t)),r=x.bind(null,n,i,!1),o=x.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",y(t,e.attrs),h(e,t),t}(t),r=function(e,t,n){var r=n.css,o=n.sourceMap,a=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||a)&&(r=f(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([r],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(i),l&&URL.revokeObjectURL(l)}.bind(null,n,t),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var r=[],o=0;o (\n
\n {/* a.value is inferred as a string */}\n
a: {a.value}
\n \n {/* b.value through f.value is inferred as a number */}\n
b: {b.value}
\n
c: {c.value}
\n
d: {d.value}
\n
e: {e.value}
\n
f: {f.value}
\n
\n ));\n\nexport default () => (\n \n
\n      {`import { withState, all } from 'chainable-components';\n\nall([\n  withState({initial: 'string value'}),\n  withState({initial: 1}),\n  withState({initial: 2}),\n  withState({initial: 3}),\n  withState({initial: 5}),\n  withState({initial: 8})\n])\n.ap(([a, b, c, d, e, f]) => (\n  
\n {/* a.value is inferred as a string */}\n
a: {a.value}
\n \n {/* b.value through f.value is inferred as a number */}\n
b: {b.value}
\n
c: {c.value}
\n
d: {d.value}
\n
e: {e.value}
\n
f: {f.value}
\n
\n));`}\n
\n {WithStateDemo}\n
\n);\n \n\n","import * as React from 'react';\nimport { fromRenderProp } from '../src/ChainableComponent';\n// how to create a context hoc?\nimport Step from './Step';\nconst { Consumer, Provider } = React.createContext(\"Default Value\");\n\nconst withContext = fromRenderProp(Consumer);\n\nconst DisplayContext =\n withContext({ children: () => 'hmm, this should be necessary' }).ap(\n context => {\n return (\n \n Current context is:\n
{JSON.stringify(context, null, 2)}
\n
\n );\n }\n );\n\nconst ContextDemo = () => (\n
\n {DisplayContext}\n \n {DisplayContext}\n \n
\n);\n\nexport default () => (\n \n
\n      {`import { fromRenderProp } from 'chainable-components';\nconst { Consumer, Provider } = React.createContext(\"Default Value\");\nconst withStringContext = fromRenderProp(Consumer);\n\nconst DisplayContext =\nwithStringContext({ children: a => '' }).ap(\n  context => {\n    return (\n      \n        Current context is:\n        
{JSON.stringify(context, null, 2)}
\n
\n );\n }\n\nconst ContextDemo = () => (\n
\n {DisplayContext}\n \n {DisplayContext}\n \n
\n);`}\n
\n \n
\n);\n","import * as React from 'react';;\nimport { Route, Router } from 'react-router';\nimport { fromRenderProp } from '../src/ChainableComponent';\nimport Step from './Step';\nimport createBrowserHistory from 'history/createBrowserHistory';\n\nconst customHistory = createBrowserHistory();\n\nconst withRoute = fromRenderProp(Route);\n\n// Route doesn't have any required props, so we can just pass the empty object here\nconst ReactRouterDemoInner: React.SFC = () => (\n \n
\n      {`import { Route } from 'react-router';\nconst withRoute = fromRenderProp(Route);\n\nwithRoute({}).ap(\n  route => {\n    return (\n      \n        Current route is:\n        
{route.history.location.pathname}
{/* route's type is automatically inferred. */}\n
\n );\n }\n)`}\n
\n \n {withRoute({}).ap(\n route => {\n return (\n \n Current route is:\n
{route.history.location.pathname}
{/* route's type is automatically inferred. */}\n
\n );\n }\n )}\n
\n
\n);\n\nexport default ReactRouterDemoInner;\n","import * as React from 'react';\n\ntype StepProps = {\n title: string,\n children: any\n};\n\nexport default (props: StepProps) => (\n
\n

{props.title}

\n
{props.children}
\n
\n);","import * as React from 'react';\nimport { withState } from '../src/lib/withState';\nimport Step from './Step';\n// import { all } from '../src/ChainableComponent';\n\nexport const WithStateDemo =\n withState({ initial: 0 }).chain(outer =>\n withState({ initial: 16 }).map(inner =>\n ({ inner, outer })\n )\n )\n .ap(({ inner, outer }) => (\n
\n
Outer: {outer.value}
\n
Inner: {inner.value}
\n
\n ));\n\nexport default () => (\n \n
\n      {`import { withState } from 'chainable-components';\n\nwithState({initial: 0}).chain(outer => \n  withState({initial: 16}).map(inner => \n    ({inner, outer})\n  )\n)\n.ap(({inner, outer}) => (\n  
\n
Outer: {outer.value}
\n
Inner: {inner.value}
\n
\n))`}\n
\n {WithStateDemo}\n
\n);\n // all([\n // withState({initial: 'yo'}),\n // withState({initial: 16})\n // ])\n // .ap(([outer, inner]) => (\n //
\n //
Outer: {outer.value}
\n //
Inner: {inner.value}
\n //
\n // ));\n\n","// style-loader: Adds some css to the DOM by adding a