@rematch/loading
Advanced tools
Comparing version 0.5.0 to 1.0.0-alpha.0
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function l(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,l)}s((o=o.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=o[2&i[0]?"return":i[0]?"throw":"next"])&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[0,r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&r[3]>i[1])){a.label=i[1];break}if(6===i[0]&&r[1]>a.label){a.label=r[1],r=i;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},i=commonjsGlobal&&commonjsGlobal.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&(n[o[r]]=e[o[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var a={global:0,models:{},effects:{}},l=function(e,t,o,r,i){return n({},e,{global:r(i.global),models:n({},e.models,(a={},a[t]=r(i.models[t]),a)),effects:n({},e.effects,(l={},l[t]=n({},e.effects[t],(s={},s[o]=r(i.effects[t][o]),s)),l))});var a,l,s},s=function(e,t){return void 0===t&&(t={}),Object.assign(e,n({},t,{models:Object.assign(e.models,n({},t.models)),effects:Object.assign(e.effects,n({},t.effects))}))},c=function(e,t,n){return function(o,r){var i=r.name,l=r.action;return a.global+=t,a.models[i]+=t,a.effects[i][l]+=t,n(o,i,l,e,a)}};t.default=function(e){void 0===e&&(e={}),e.loadingActionCreator||(e.loadingActionCreator=l),e.mergeInitialState||(e.mergeInitialState=s),e.model||(e.model={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.model&&e.model.name&&"string"!=typeof e.model.name)throw Error("loading plugin config model.name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist");if("function"!=typeof e.loadingActionCreator)throw Error("loading plugin config loadingActionCreator must be a function");if("function"!=typeof e.mergeInitialState)throw Error("loading plugin config mergeInitialState must be a function");if("object"!=typeof e.model)throw Error("loading plugin config model must be an object")}(e);var t=e.name||e.model.name||"loading",f=!0===e.asNumber?function(e){return e}:function(e){return e>0},u=e.model,d=u.reducers,m=i(u,["reducers"]),g=n({reducers:n({},d,{hide:c(f,-1,e.loadingActionCreator),show:c(f,1,e.loadingActionCreator)}),state:n({},a)},m,{name:t});return a.global=0,g.state=e.mergeInitialState(g.state,n({},a,{global:f(a.global)})),{config:{models:{loading:g}},init:function(i){var l=i.dispatch;return{onModel:function(i){var s=this,c=i.name;if(c!==t){a.models[c]=0,a.effects[c]={};var u,d,m={models:(u={},u[c]=f(a.models[c]),u),effects:(d={},d[c]={},d)};e.mergeInitialState(g.state,m),Object.keys(l[c]).forEach(function(t){if(!0===l[c][t].isEffect){a.effects[c][t]=0,m={effects:n({},m.effects,(u={},u[c]=n({},m.effects[c],(d={},d[t]=f(a.effects[c][t]),d)),u))};var i=c+"/"+t;if((!e.whitelist||e.whitelist.includes(i))&&(!e.blacklist||!e.blacklist.includes(i))){var u,d,g=l[c][t];l[c][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return o(s,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),l.loading.show({name:c,action:t}),[4,g.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return l.loading.hide({name:c,action:t}),[7];case 3:return[2]}})})}}}}),e.mergeInitialState(g.state,m)}}}}}}}),index=unwrapExports(lib);exports.default=index; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(i,l)}s((o=o.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=o[2&a[0]?"return":a[0]?"throw":"next"])&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[0,r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&r[3]>a[1])){i.label=a[1];break}if(6===a[0]&&r[1]>i.label){i.label=r[1],r=a;break}if(r&&r[2]>i.label){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};Object.defineProperty(t,"__esModule",{value:!0});var a={global:0,models:{},effects:{}},i=function(e,t){return function(o,r){var i,l,s,c=r.name,u=r.action;return a.global+=t,a.models[c]+=t,a.effects[c][u]+=t,n({},o,{global:e(a.global),models:n({},o.models,(i={},i[c]=e(a.models[c]),i)),effects:n({},o.effects,(l={},l[c]=n({},o.effects[c],(s={},s[u]=e(a.effects[c][u]),s)),l))})}};t.default=function(e){void 0===e&&(e={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist")}(e);var t=e.name||"loading",l=!0===e.asNumber?function(e){return e}:function(e){return e>0},s={name:t,reducers:{hide:i(l,-1),show:i(l,1)},state:n({},a)};return a.global=0,s.state.global=l(a.global),{config:{models:{loading:s}},onModel:function(n){var i=this,c=n.name;c!==t&&(a.models[c]=0,s.state.models[c]=l(a.models[c]),s.state.effects[c]={},Object.keys(this.dispatch[c]).forEach(function(t){if(!0===i.dispatch[c][t].isEffect){a.effects[c][t]=0,s.state.effects[c][t]=l(a.effects[c][t]);var n=c+"/"+t;if((!e.whitelist||e.whitelist.includes(n))&&(!e.blacklist||!e.blacklist.includes(n))){var u=i.dispatch[c][t];i.dispatch[c][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return o(i,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),this.dispatch.loading.show({name:c,action:t}),[4,u.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return this.dispatch.loading.hide({name:c,action:t}),[7];case 3:return[2]}})})}}}}))}}}}),index=unwrapExports(lib);exports.default=index; | ||
//# sourceMappingURL=rematch-loading.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function l(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,l)}s((o=o.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=o[2&i[0]?"return":i[0]?"throw":"next"])&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[0,r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&r[3]>i[1])){a.label=i[1];break}if(6===i[0]&&r[1]>a.label){a.label=r[1],r=i;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},i=commonjsGlobal&&commonjsGlobal.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&(n[o[r]]=e[o[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var a={global:0,models:{},effects:{}},l=function(e,t,o,r,i){return n({},e,{global:r(i.global),models:n({},e.models,(a={},a[t]=r(i.models[t]),a)),effects:n({},e.effects,(l={},l[t]=n({},e.effects[t],(s={},s[o]=r(i.effects[t][o]),s)),l))});var a,l,s},s=function(e,t){return void 0===t&&(t={}),Object.assign(e,n({},t,{models:Object.assign(e.models,n({},t.models)),effects:Object.assign(e.effects,n({},t.effects))}))},c=function(e,t,n){return function(o,r){var i=r.name,l=r.action;return a.global+=t,a.models[i]+=t,a.effects[i][l]+=t,n(o,i,l,e,a)}};t.default=function(e){void 0===e&&(e={}),e.loadingActionCreator||(e.loadingActionCreator=l),e.mergeInitialState||(e.mergeInitialState=s),e.model||(e.model={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.model&&e.model.name&&"string"!=typeof e.model.name)throw Error("loading plugin config model.name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist");if("function"!=typeof e.loadingActionCreator)throw Error("loading plugin config loadingActionCreator must be a function");if("function"!=typeof e.mergeInitialState)throw Error("loading plugin config mergeInitialState must be a function");if("object"!=typeof e.model)throw Error("loading plugin config model must be an object")}(e);var t=e.name||e.model.name||"loading",f=!0===e.asNumber?function(e){return e}:function(e){return e>0},u=e.model,d=u.reducers,m=i(u,["reducers"]),g=n({reducers:n({},d,{hide:c(f,-1,e.loadingActionCreator),show:c(f,1,e.loadingActionCreator)}),state:n({},a)},m,{name:t});return a.global=0,g.state=e.mergeInitialState(g.state,n({},a,{global:f(a.global)})),{config:{models:{loading:g}},init:function(i){var l=i.dispatch;return{onModel:function(i){var s=this,c=i.name;if(c!==t){a.models[c]=0,a.effects[c]={};var u,d,m={models:(u={},u[c]=f(a.models[c]),u),effects:(d={},d[c]={},d)};e.mergeInitialState(g.state,m),Object.keys(l[c]).forEach(function(t){if(!0===l[c][t].isEffect){a.effects[c][t]=0,m={effects:n({},m.effects,(u={},u[c]=n({},m.effects[c],(d={},d[t]=f(a.effects[c][t]),d)),u))};var i=c+"/"+t;if((!e.whitelist||e.whitelist.includes(i))&&(!e.blacklist||!e.blacklist.includes(i))){var u,d,g=l[c][t];l[c][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return o(s,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),l.loading.show({name:c,action:t}),[4,g.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return l.loading.hide({name:c,action:t}),[7];case 3:return[2]}})})}}}}),e.mergeInitialState(g.state,m)}}}}}}}),index=unwrapExports(lib);export default index; | ||
var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(i,l)}s((o=o.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=o[2&a[0]?"return":a[0]?"throw":"next"])&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[0,r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&r[3]>a[1])){i.label=a[1];break}if(6===a[0]&&r[1]>i.label){i.label=r[1],r=a;break}if(r&&r[2]>i.label){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};Object.defineProperty(t,"__esModule",{value:!0});var a={global:0,models:{},effects:{}},i=function(e,t){return function(o,r){var i,l,s,c=r.name,f=r.action;return a.global+=t,a.models[c]+=t,a.effects[c][f]+=t,n({},o,{global:e(a.global),models:n({},o.models,(i={},i[c]=e(a.models[c]),i)),effects:n({},o.effects,(l={},l[c]=n({},o.effects[c],(s={},s[f]=e(a.effects[c][f]),s)),l))})}};t.default=function(e){void 0===e&&(e={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist")}(e);var t=e.name||"loading",l=!0===e.asNumber?function(e){return e}:function(e){return e>0},s={name:t,reducers:{hide:i(l,-1),show:i(l,1)},state:n({},a)};return a.global=0,s.state.global=l(a.global),{config:{models:{loading:s}},onModel:function(n){var i=this,c=n.name;c!==t&&(a.models[c]=0,s.state.models[c]=l(a.models[c]),s.state.effects[c]={},Object.keys(this.dispatch[c]).forEach(function(t){if(!0===i.dispatch[c][t].isEffect){a.effects[c][t]=0,s.state.effects[c][t]=l(a.effects[c][t]);var n=c+"/"+t;if((!e.whitelist||e.whitelist.includes(n))&&(!e.blacklist||!e.blacklist.includes(n))){var f=i.dispatch[c][t];i.dispatch[c][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return o(i,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),this.dispatch.loading.show({name:c,action:t}),[4,f.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return this.dispatch.loading.hide({name:c,action:t}),[7];case 3:return[2]}})})}}}}))}}}}),index=unwrapExports(lib);export default index; | ||
//# sourceMappingURL=rematch-loading.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RematchLoading={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o,r=(function(e,n){var o=t&&t.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=t&&t.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{f(o.next(e))}catch(e){i(e)}}function l(e){try{f(o.throw(e))}catch(e){i(e)}}function f(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,l)}f((o=o.apply(e,t||[])).next())})},i=t&&t.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=o[2&i[0]?"return":i[0]?"throw":"next"])&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[0,r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&r[3]>i[1])){a.label=i[1];break}if(6===i[0]&&r[1]>a.label){a.label=r[1],r=i;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},a=t&&t.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&(n[o[r]]=e[o[r]])}return n};Object.defineProperty(n,"__esModule",{value:!0});var l={global:0,models:{},effects:{}},f=function(e,t,n,r,i){return o({},e,{global:r(i.global),models:o({},e.models,(a={},a[t]=r(i.models[t]),a)),effects:o({},e.effects,(l={},l[t]=o({},e.effects[t],(f={},f[n]=r(i.effects[t][n]),f)),l))});var a,l,f},s=function(e,t){return void 0===t&&(t={}),Object.assign(e,o({},t,{models:Object.assign(e.models,o({},t.models)),effects:Object.assign(e.effects,o({},t.effects))}))},c=function(e,t,n){return function(o,r){var i=r.name,a=r.action;return l.global+=t,l.models[i]+=t,l.effects[i][a]+=t,n(o,i,a,e,l)}};n.default=function(e){void 0===e&&(e={}),e.loadingActionCreator||(e.loadingActionCreator=f),e.mergeInitialState||(e.mergeInitialState=s),e.model||(e.model={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.model&&e.model.name&&"string"!=typeof e.model.name)throw Error("loading plugin config model.name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist");if("function"!=typeof e.loadingActionCreator)throw Error("loading plugin config loadingActionCreator must be a function");if("function"!=typeof e.mergeInitialState)throw Error("loading plugin config mergeInitialState must be a function");if("object"!=typeof e.model)throw Error("loading plugin config model must be an object")}(e);var t=e.name||e.model.name||"loading",n=!0===e.asNumber?function(e){return e}:function(e){return e>0},u=e.model,d=u.reducers,g=a(u,["reducers"]),b=o({reducers:o({},d,{hide:c(n,-1,e.loadingActionCreator),show:c(n,1,e.loadingActionCreator)}),state:o({},l)},g,{name:t});return l.global=0,b.state=e.mergeInitialState(b.state,o({},l,{global:n(l.global)})),{config:{models:{loading:b}},init:function(a){var f=a.dispatch;return{onModel:function(a){var s=this,c=a.name;if(c!==t){l.models[c]=0,l.effects[c]={};var u,d,g={models:(u={},u[c]=n(l.models[c]),u),effects:(d={},d[c]={},d)};e.mergeInitialState(b.state,g),Object.keys(f[c]).forEach(function(t){if(!0===f[c][t].isEffect){l.effects[c][t]=0,g={effects:o({},g.effects,(u={},u[c]=o({},g.effects[c],(d={},d[t]=n(l.effects[c][t]),d)),u))};var a=c+"/"+t;if((!e.whitelist||e.whitelist.includes(a))&&(!e.blacklist||!e.blacklist.includes(a))){var u,d,b=f[c][t];f[c][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return r(s,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),f.loading.show({name:c,action:t}),[4,b.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return f.loading.hide({name:c,action:t}),[7];case 3:return[2]}})})}}}}),e.mergeInitialState(b.state,g)}}}}}}}(n={exports:{}},n.exports),n.exports),i=(o=r)&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o;e.default=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RematchLoading={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o,r=(function(e,n){var o=t&&t.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;o>n;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=t&&t.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function l(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,l)}s((o=o.apply(e,t||[])).next())})},i=t&&t.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=o[2&i[0]?"return":i[0]?"throw":"next"])&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[0,r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&r[3]>i[1])){a.label=i[1];break}if(6===i[0]&&r[1]>a.label){a.label=r[1],r=i;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}};Object.defineProperty(n,"__esModule",{value:!0});var a={global:0,models:{},effects:{}},l=function(e,t){return function(n,r){var i,l,s,f=r.name,c=r.action;return a.global+=t,a.models[f]+=t,a.effects[f][c]+=t,o({},n,{global:e(a.global),models:o({},n.models,(i={},i[f]=e(a.models[f]),i)),effects:o({},n.effects,(l={},l[f]=o({},n.effects[f],(s={},s[c]=e(a.effects[f][c]),s)),l))})}};n.default=function(e){void 0===e&&(e={}),function(e){if(e.name&&"string"!=typeof e.name)throw Error("loading plugin config name must be a string");if(e.asNumber&&"boolean"!=typeof e.asNumber)throw Error("loading plugin config asNumber must be a boolean");if(e.whitelist&&!Array.isArray(e.whitelist))throw Error("loading plugin config whitelist must be an array of strings");if(e.blacklist&&!Array.isArray(e.blacklist))throw Error("loading plugin config blacklist must be an array of strings");if(e.whitelist&&e.blacklist)throw Error("loading plugin config cannot have both a whitelist & a blacklist")}(e);var t=e.name||"loading",n=!0===e.asNumber?function(e){return e}:function(e){return e>0},s={name:t,reducers:{hide:l(n,-1),show:l(n,1)},state:o({},a)};return a.global=0,s.state.global=n(a.global),{config:{models:{loading:s}},onModel:function(o){var l=this,f=o.name;f!==t&&(a.models[f]=0,s.state.models[f]=n(a.models[f]),s.state.effects[f]={},Object.keys(this.dispatch[f]).forEach(function(t){if(!0===l.dispatch[f][t].isEffect){a.effects[f][t]=0,s.state.effects[f][t]=n(a.effects[f][t]);var o=f+"/"+t;if((!e.whitelist||e.whitelist.includes(o))&&(!e.blacklist||!e.blacklist.includes(o))){var c=l.dispatch[f][t];l.dispatch[f][t]=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return r(l,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),this.dispatch.loading.show({name:f,action:t}),[4,c.apply(void 0,e)];case 1:return n.sent(),[3,3];case 2:return this.dispatch.loading.hide({name:f,action:t}),[7];case 3:return[2]}})})}}}}))}}}}(n={exports:{}},n.exports),n.exports),i=(o=r)&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o;e.default=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=rematch-loading.umd.js.map |
{ | ||
"name": "@rematch/loading", | ||
"version": "0.5.0", | ||
"version": "1.0.0-alpha.0", | ||
"description": "Loading indicator plugin for Rematch", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@rematch/core": "^0.4.1", | ||
"@rematch/core": "1.0.0-alpha.0", | ||
"@rematch/select": "^0.3.0", | ||
@@ -40,4 +40,4 @@ "immutable": "^4.0.0-rc.9", | ||
"peerDependencies": { | ||
"@rematch/core": ">0.4" | ||
"@rematch/core": ">=1.0.0-alpha.0" | ||
} | ||
} |
@@ -5,2 +5,10 @@ # Rematch Loading | ||
## Install | ||
```shell | ||
npm install @rematch/loading | ||
``` | ||
> For @rematch/core@0.x use @rematch/loading@0.5.0 | ||
## Example | ||
@@ -42,8 +50,2 @@ | ||
Install `@rematch/loading` as a dependency. | ||
```shell | ||
npm install @rematch/loading | ||
``` | ||
Configure loading. | ||
@@ -50,0 +52,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
201
58339
51