@better-scroll/nested-scroll
Advanced tools
Comparing version 2.4.2 to 2.5.0
/*! | ||
* better-scroll / nested-scroll | ||
* (c) 2016-2021 ustbhuangyi | ||
* (c) 2016-2022 ustbhuangyi | ||
* Released under the MIT License. | ||
@@ -544,3 +544,2 @@ */ | ||
export default NestedScroll; | ||
export { DEFAUL_GROUP_ID }; | ||
export { DEFAUL_GROUP_ID, NestedScroll as default }; |
/*! | ||
* better-scroll / nested-scroll | ||
* (c) 2016-2021 ustbhuangyi | ||
* (c) 2016-2022 ustbhuangyi | ||
* Released under the MIT License. | ||
@@ -10,3 +10,3 @@ */ | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NestedScroll = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
})(this, (function (exports) { 'use strict'; | ||
@@ -552,6 +552,6 @@ /*! ***************************************************************************** | ||
exports.DEFAUL_GROUP_ID = DEFAUL_GROUP_ID; | ||
exports.default = NestedScroll; | ||
exports["default"] = NestedScroll; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).NestedScroll={})}(this,function(t){"use strict";function f(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var o=Array(t),r=0,e=0;e<n;e++)for(var s=arguments[e],i=0,a=s.length;i<a;i++,r++)o[r]=s[i];return o}var o="undefined"!=typeof window,e=o&&navigator.userAgent.toLowerCase();e&&/wechatdevtools/.test(e),e&&e.indexOf("android"),function(){if("string"==typeof e){var t=/os (\d\d?_\d(_\d)?)/.exec(e);if(!t)return;t=t[1].split("_").map(function(t){return parseInt(t,10)});13===t[0]&&t[1]}}();if(o)try{var n={};Object.defineProperty(n,"passive",{get:function(){}}),window.addEventListener("test-passive",function(){},n)}catch(t){}function i(t,o){if(t.findIndex)return t.findIndex(o);var r=-1;return t.some(function(t,e,n){n=o(t,e,n);if(n)return r=e,n}),r}var r=o&&document.createElement("div").style,s=function(){if(!o)return!1;for(var t=0,e=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];t<e.length;t++){var n=e[t];if(void 0!==r[n.value])return n.key}return!1}();function a(t){return!1===s?t:"standard"===s?"transitionEnd"===t?"transitionend":t:s+t.charAt(0).toUpperCase()+t.substr(1)}s&&"standard"!==s&&s.toLowerCase();a("transform"),a("transition");o&&a("perspective")in r,a("transitionTimingFunction"),a("transitionDuration"),a("transitionDelay"),a("transformOrigin"),a("transitionEnd"),a("transitionProperty");var c=(l.create=function(t){return new l(t)},l.prototype.hasAncestors=function(e){return-1<i(this.ancestors,function(t){return t[0]===e})},l.prototype.hasDescendants=function(e){return-1<i(this.descendants,function(t){return t[0]===e})},l.prototype.addAncestor=function(t,e){var n=this.ancestors;n.push([t,e]),n.sort(function(t,e){return t[1]-e[1]})},l.prototype.addDescendant=function(t,e){var n=this.descendants;n.push([t,e]),n.sort(function(t,e){return t[1]-e[1]})},l.prototype.removeAncestor=function(e){var t=this.ancestors;if(t.length){var n=i(this.ancestors,function(t){return t[0]===e});if(-1<n)return t.splice(n,1)}},l.prototype.removeDescendant=function(e){var t=this.descendants;if(t.length){var n=i(this.descendants,function(t){return t[0]===e});if(-1<n)return t.splice(n,1)}},l.prototype.registerHooks=function(t,e,n){t.on(e,n),this.hooksManager.push([t,e,n])},l.prototype.setAnalyzed=function(t){this.analyzed=t=void 0===t?!1:t},l.prototype.purge=function(){var e=this;this.ancestors.forEach(function(t){t[0].removeDescendant(e)}),this.descendants.forEach(function(t){t[0].removeAncestor(e)}),this.hooksManager.forEach(function(t){var e=t[0],n=t[1],t=t[2];e.off(n,t)}),this.hooksManager=[]},l);function l(t){this.ancestors=[],this.descendants=[],this.hooksManager=[],this.analyzed=!1,this.selfScroll=t}function v(t){t.forEach(function(t){t.enable()})}function y(t,e){t.forEach(function(t){t.hasHorizontalScroll!==e.hasHorizontalScroll&&t.hasVerticalScroll!==e.hasVerticalScroll||t.disable()})}var u=[{key:"purgeNestedScroll",name:"purgeNestedScroll"}].map(function(t){return{key:t.key,sourceKey:"plugins.nestedScroll."+t.name}}),d="INTERNAL_NESTED_SCROLL",n=(p.getAllNestedScrolls=function(){var e=p.instancesMap;return Object.keys(e).map(function(t){return e[t]})},p.purgeAllNestedScrolls=function(){p.getAllNestedScrolls().forEach(function(t){return t.purgeNestedScroll()})},p.prototype.handleOptions=function(t){t=!0===t.options.nestedScroll?{}:t.options.nestedScroll;this.options=function(t,e){for(var n in e)t[n]=e[n];return t}({groupId:d},t);t=typeof this.options.groupId;return"string"!=t&&"number"!=t&&console.error("[BScroll warn]: groupId must be string or number for NestedScroll plugin"),this.options.groupId},p.prototype.init=function(t){t.proxy(u),this.addBScroll(t),this.buildBScrollGraph(),this.analyzeBScrollGraph(),this.ensureEventInvokeSequence(),this.handleHooks(t)},p.prototype.handleHooks=function(t){var e=this;this.registerHooks(t.hooks,t.hooks.eventTypes.destroy,function(){e.deleteScroll(t)})},p.prototype.deleteScroll=function(e){e.wrapper.isBScrollContainer=void 0;var t=this.store,n=this.hooksFn,o=i(t,function(t){return t.selfScroll===e});-1<o&&(t[o].purge(),t.splice(o,1));var r,s=i(n,function(t){return t[0]===e.hooks});-1<s&&(t=(r=n[s])[0],o=r[1],r=r[2],t.off(o,r),n.splice(s,1))},p.prototype.addBScroll=function(t){this.store.push(c.create(t))},p.prototype.buildBScrollGraph=function(){for(var t,e=this.store,n=this.store.length,o=0;o<n;o++)for(var r,s=(r=e[o]).selfScroll.wrapper,i=0;i<n;i++){var a=(t=e[i]).selfScroll.wrapper;r!==t&&s.contains(a)&&(a=function(t,e){for(var n=0,o=t.parentNode;o&&o!==e;)n++,o=o.parentNode;return n}(a,s),r.hasDescendants(t)||r.addDescendant(t,a),t.hasAncestors(r)||t.addAncestor(r,a))}},p.prototype.analyzeBScrollGraph=function(){this.store.forEach(function(t){var p,u,h,e;t.analyzed||(p=t.ancestors,u=t.descendants,h=t.selfScroll,t.registerHooks(h,h.eventTypes.beforeScrollStart,function(){var t,e,n,o,r,s,i,a,c=p.map(function(t){return t[0].selfScroll}),l=u.map(function(t){return t[0].selfScroll});f(c,l).forEach(function(t){t.pending&&(t.stop(),t.resetPosition())}),t=h,e=h.hasHorizontalScroll,n=h.hasVerticalScroll,o=h.x,r=h.y,s=h.minScrollX,i=h.maxScrollX,a=h.minScrollY,l=h.maxScrollY,t=!1,n?t=a<r||r<l:e&&(t=s<o||o<i),t&&((t=h).scroller.reflow(),t.resetPosition(0)),c.forEach(function(t){var e=t.scroller,n=e.actions,t=e.scrollBehaviorX,e=e.scrollBehaviorY;n.fingerMoved=!0,n.contentMoved=!1,n.directionLockAction.reset(),t.start(),e.start(),t.resetStartPos(),e.resetStartPos(),n.startTime=+new Date}),y(c,h)}),t.registerHooks(h,h.eventTypes.touchEnd,function(){var t=p.map(function(t){return t[0].selfScroll}),e=u.map(function(t){return t[0].selfScroll});v(f(t,e))}),e=h.scroller.actions.hooks,t.registerHooks(e,e.eventTypes.detectMovingDirection,function(){var t,e,n,o,r,s,i,a,c=p.map(function(t){return t[0].selfScroll}),l=c[0],u=c.slice(1),f=h.scroller.actions.contentMoved,d=0===c.length;if(f)y(c,h);else if(!d&&(t=h,e=h.hasHorizontalScroll,n=h.hasVerticalScroll,o=h.x,r=h.y,s=h.minScrollX,i=h.maxScrollX,a=h.minScrollY,f=h.maxScrollY,c=h.movingDirectionX,d=h.movingDirectionY,t=!1,n?t=a<=r&&-1===d||r<=f&&1===d:e&&(t=s<=o&&-1===c||o<=i&&1===c),t))return y([h],h),l&&v([l]),y(u,h),!0}),t.setAnalyzed(!0))})},p.prototype.ensureEventInvokeSequence=function(){this.store.slice().sort(function(t,e){return t.descendants.length-e.descendants.length}).forEach(function(t){t.selfScroll.scroller.actionsHandler.rebindDOMEvents()})},p.prototype.registerHooks=function(t,e,n){t.on(e,n,this),this.hooksFn.push([t,e,n])},p.prototype.purgeNestedScroll=function(){var t=this.options.groupId;this.store.forEach(function(t){t.purge()}),this.store=[],this.hooksFn.forEach(function(t){var e=t[0],n=t[1],t=t[2];e.off(n,t)}),this.hooksFn=[],delete p.instancesMap[t]},p.pluginName="nestedScroll",p.instancesMap={},p);function p(t){var e=this.handleOptions(t),n=p.instancesMap[e];return n||((n=p.instancesMap[e]=this).store=[],n.hooksFn=[]),n.init(t),n}t.DEFAUL_GROUP_ID=d,t.default=n,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).NestedScroll={})}(this,function(t){"use strict";function f(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var o=Array(t),r=0,e=0;e<n;e++)for(var s=arguments[e],i=0,a=s.length;i<a;i++,r++)o[r]=s[i];return o}var o="undefined"!=typeof window,e=o&&navigator.userAgent.toLowerCase();if(e&&/wechatdevtools/.test(e),e&&e.indexOf("android"),"string"==typeof e)(e=/os (\d\d?_\d(_\d)?)/.exec(e))&&(13===(e=e[1].split("_").map(function(t){return parseInt(t,10)}))[0]&&e[1]);if(o)try{var n={};Object.defineProperty(n,"passive",{get:function(){}}),window.addEventListener("test-passive",function(){},n)}catch(t){}function i(t,o){var r;return t.findIndex?t.findIndex(o):(r=-1,t.some(function(t,e,n){t=o(t,e,n);if(t)return r=e,t}),r)}var r=o&&document.createElement("div").style,s=function(){if(o)for(var t=0,e=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];t<e.length;t++){var n=e[t];if(void 0!==r[n.value])return n.key}return!1}();function a(t){return!1===s?t:"standard"===s?"transitionEnd"===t?"transitionend":t:s+t.charAt(0).toUpperCase()+t.substr(1)}s&&"standard"!==s&&s.toLowerCase();a("transform"),a("transition");o&&a("perspective")in r,a("transitionTimingFunction"),a("transitionDuration"),a("transitionDelay"),a("transformOrigin"),a("transitionEnd"),a("transitionProperty"),l.create=function(t){return new l(t)},l.prototype.hasAncestors=function(e){return-1<i(this.ancestors,function(t){return t[0]===e})},l.prototype.hasDescendants=function(e){return-1<i(this.descendants,function(t){return t[0]===e})},l.prototype.addAncestor=function(t,e){var n=this.ancestors;n.push([t,e]),n.sort(function(t,e){return t[1]-e[1]})},l.prototype.addDescendant=function(t,e){var n=this.descendants;n.push([t,e]),n.sort(function(t,e){return t[1]-e[1]})},l.prototype.removeAncestor=function(e){var t=this.ancestors;if(t.length){var n=i(this.ancestors,function(t){return t[0]===e});if(-1<n)return t.splice(n,1)}},l.prototype.removeDescendant=function(e){var t=this.descendants;if(t.length){var n=i(this.descendants,function(t){return t[0]===e});if(-1<n)return t.splice(n,1)}},l.prototype.registerHooks=function(t,e,n){t.on(e,n),this.hooksManager.push([t,e,n])},l.prototype.setAnalyzed=function(t){this.analyzed=t=void 0===t?!1:t},l.prototype.purge=function(){var e=this;this.ancestors.forEach(function(t){t[0].removeDescendant(e)}),this.descendants.forEach(function(t){t[0].removeAncestor(e)}),this.hooksManager.forEach(function(t){var e=t[0],n=t[1],t=t[2];e.off(n,t)}),this.hooksManager=[]};var c=l;function l(t){this.ancestors=[],this.descendants=[],this.hooksManager=[],this.analyzed=!1,this.selfScroll=t}function v(t){t.forEach(function(t){t.enable()})}function y(t,e){t.forEach(function(t){t.hasHorizontalScroll!==e.hasHorizontalScroll&&t.hasVerticalScroll!==e.hasVerticalScroll||t.disable()})}var u=[{key:"purgeNestedScroll",name:"purgeNestedScroll"}].map(function(t){return{key:t.key,sourceKey:"plugins.nestedScroll."+t.name}}),d="INTERNAL_NESTED_SCROLL",e=(p.getAllNestedScrolls=function(){var e=p.instancesMap;return Object.keys(e).map(function(t){return e[t]})},p.purgeAllNestedScrolls=function(){p.getAllNestedScrolls().forEach(function(t){return t.purgeNestedScroll()})},p.prototype.handleOptions=function(t){t=!0===t.options.nestedScroll?{}:t.options.nestedScroll,this.options=function(t,e){for(var n in e)t[n]=e[n];return t}({groupId:d},t),t=typeof this.options.groupId;return"string"!=t&&"number"!=t&&console.error("[BScroll warn]: groupId must be string or number for NestedScroll plugin"),this.options.groupId},p.prototype.init=function(t){t.proxy(u),this.addBScroll(t),this.buildBScrollGraph(),this.analyzeBScrollGraph(),this.ensureEventInvokeSequence(),this.handleHooks(t)},p.prototype.handleHooks=function(t){var e=this;this.registerHooks(t.hooks,t.hooks.eventTypes.destroy,function(){e.deleteScroll(t)})},p.prototype.deleteScroll=function(e){e.wrapper.isBScrollContainer=void 0;var t,n,o=this.store,r=this.hooksFn,s=i(o,function(t){return t.selfScroll===e}),o=(-1<s&&(o[s].purge(),o.splice(s,1)),i(r,function(t){return t[0]===e.hooks}));-1<o&&(t=(s=r[o])[0],n=s[1],s=s[2],t.off(n,s),r.splice(o,1))},p.prototype.addBScroll=function(t){this.store.push(c.create(t))},p.prototype.buildBScrollGraph=function(){for(var t,e=this.store,n=this.store.length,o=0;o<n;o++)for(var r,s=(r=e[o]).selfScroll.wrapper,i=0;i<n;i++){var a=(t=e[i]).selfScroll.wrapper;r!==t&&s.contains(a)&&(a=function(t,e){for(var n=0,o=t.parentNode;o&&o!==e;)n++,o=o.parentNode;return n}(a,s),r.hasDescendants(t)||r.addDescendant(t,a),t.hasAncestors(r)||t.addAncestor(r,a))}},p.prototype.analyzeBScrollGraph=function(){this.store.forEach(function(t){var p,u,h,e;t.analyzed||(p=t.ancestors,u=t.descendants,h=t.selfScroll,t.registerHooks(h,h.eventTypes.beforeScrollStart,function(){var t,e,n,o,r,s,i,a,c=p.map(function(t){return t[0].selfScroll}),l=u.map(function(t){return t[0].selfScroll});f(c,l).forEach(function(t){t.pending&&(t.stop(),t.resetPosition())}),t=(l=h).hasHorizontalScroll,e=h.hasVerticalScroll,n=h.x,o=h.y,r=h.minScrollX,s=h.maxScrollX,i=h.minScrollY,l=h.maxScrollY,a=!1,e?a=i<o||o<l:t&&(a=r<n||n<s),a&&((e=h).scroller.reflow(),e.resetPosition(0)),c.forEach(function(t){var t=t.scroller,e=t.actions,n=t.scrollBehaviorX,t=t.scrollBehaviorY;e.fingerMoved=!0,e.contentMoved=!1,e.directionLockAction.reset(),n.start(),t.start(),n.resetStartPos(),t.resetStartPos(),e.startTime=+new Date}),y(c,h)}),t.registerHooks(h,h.eventTypes.touchEnd,function(){var t=p.map(function(t){return t[0].selfScroll}),e=u.map(function(t){return t[0].selfScroll});v(f(t,e))}),e=h.scroller.actions.hooks,t.registerHooks(e,e.eventTypes.detectMovingDirection,function(){var t,e,n,o,r,s,i,a,c=p.map(function(t){return t[0].selfScroll}),l=c[0],u=c.slice(1),f=h.scroller.actions.contentMoved,d=0===c.length;if(f)y(c,h);else if(!d&&(c=(f=h).hasHorizontalScroll,d=f.hasVerticalScroll,t=f.x,e=f.y,n=f.minScrollX,o=f.maxScrollX,r=f.minScrollY,s=f.maxScrollY,i=f.movingDirectionX,f=f.movingDirectionY,a=!1,d?a=r<=e&&-1===f||e<=s&&1===f:c&&(a=n<=t&&-1===i||t<=o&&1===i),a))return y([h],h),l&&v([l]),y(u,h),!0}),t.setAnalyzed(!0))})},p.prototype.ensureEventInvokeSequence=function(){this.store.slice().sort(function(t,e){return t.descendants.length-e.descendants.length}).forEach(function(t){t.selfScroll.scroller.actionsHandler.rebindDOMEvents()})},p.prototype.registerHooks=function(t,e,n){t.on(e,n,this),this.hooksFn.push([t,e,n])},p.prototype.purgeNestedScroll=function(){var t=this.options.groupId;this.store.forEach(function(t){t.purge()}),this.store=[],this.hooksFn.forEach(function(t){var e=t[0],n=t[1],t=t[2];e.off(n,t)}),this.hooksFn=[],delete p.instancesMap[t]},p.pluginName="nestedScroll",p.instancesMap={},p);function p(t){var e=this.handleOptions(t),n=p.instancesMap[e];return n||((n=p.instancesMap[e]=this).store=[],n.hooksFn=[]),n.init(t),n}t.DEFAUL_GROUP_ID=d,t.default=e,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "@better-scroll/nested-scroll", | ||
"version": "2.4.2", | ||
"version": "2.5.0", | ||
"description": "make your nested scrolls reconciliation", | ||
@@ -34,5 +34,5 @@ "author": { | ||
"dependencies": { | ||
"@better-scroll/core": "^2.4.2" | ||
"@better-scroll/core": "^2.5.0" | ||
}, | ||
"gitHead": "c97e67ecf15e616d998e67aa4ce15a7c429691c3" | ||
"gitHead": "0313d72f89a7e928522210d814b9025baf0559cb" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81423
1981
Updated@better-scroll/core@^2.5.0