Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wechat-mini-program-extend

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wechat-mini-program-extend - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

2

dist/core/EventBusInstaller.js

@@ -1,1 +0,1 @@

"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_EventEmitter=_interopRequireDefault(require("./EventEmitter"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var r=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,r?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}var EVTSign=Symbol("__wxEVT__"),OriginalSourceSign=Symbol("_originalSource"),SourceSign=Symbol("_source"),EventSign=Symbol("_event"),DataSign=Symbol("_data"),HandledSign=Symbol("_handled"),EventArgs=function(){function r(e,t,n){_classCallCheck(this,r),Object.defineProperty(this,OriginalSourceSign,{enumerable:!1,configurable:!1,value:e}),Object.defineProperty(this,SourceSign,{enumerable:!1,configurable:!1,value:null}),Object.defineProperty(this,EventSign,{enumerable:!1,configurable:!1,value:t}),Object.defineProperty(this,DataSign,{enumerable:!1,configurable:!1,value:n})}return _createClass(r,[{key:"originalSource",get:function(){return Reflect.get(this,OriginalSourceSign)}},{key:"event",get:function(){return Reflect.get(this,EventSign)}},{key:"data",get:function(){return Reflect.get(this,DataSign)}},{key:"source",get:function(){return Reflect.get(this,SourceSign)},set:function(e){Reflect.set(this,SourceSign,e)}}]),r}(),RoutedEventArgs=function(){_inherits(o,EventArgs);var r=_createSuper(o);function o(e,t,n){return _classCallCheck(this,o),n=r.call(this,e,t,n),Object.defineProperty(_assertThisInitialized(n),HandledSign,{enumerable:!1,configurable:!0,value:!1}),n}return _createClass(o,[{key:"handled",get:function(){return Reflect.get(this,HandledSign)},set:function(e){Reflect.set(this,HandledSign,e)}}]),o}(),EventBusInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"definitionFilter",value:function(e,t,n,r,o){r.behaviors=[Behavior({created:function(){var e,t,n,r,o,i,a=this;Object.defineProperty(this,EVTSign,{configurable:!1,enumerable:!1,value:new _EventEmitter.default}),Object.hasOwnProperty.call(this,"$emit")||(e=function(e,t){for(var n=new RoutedEventArgs(a,e,t),r=a.$parent;r;){if(Reflect.get(r,EVTSign).emit(n.event,n),!0===n.handled)break;r=r.$parent}},Object.defineProperty(this,"$emit",{configurable:!1,enumerable:!1,get:function(){return e}})),Object.hasOwnProperty.call(this,"$on")||(t=function(e,t){Reflect.get(a,EVTSign).on(e,t)},Object.defineProperty(this,"$on",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$off")||(n=function(e,t){Reflect.get(a,EVTSign).off(e,t)},Object.defineProperty(this,"$off",{configurable:!1,enumerable:!1,get:function(){return n}})),Object.hasOwnProperty.call(this,"$once")||(r=function(e,t){Reflect.get(a,EVTSign).once(e,t)},Object.defineProperty(this,"$once",{configurable:!1,enumerable:!1,get:function(){return r}})),Object.hasOwnProperty.call(this,"$dispatch")||(o=function(e,t){for(var n=[],r=new RoutedEventArgs(a,e,t),o=a;o;)n.push(o),o=o.$parent;n.reverse();for(var i=0,c=n;i<c.length;i++){var u=c[i];if(Reflect.get(u,EVTSign).emit(r.event,r),!0===r.handled)break}},Object.defineProperty(this,"$dispatch",{configurable:!1,enumerable:!1,get:function(){return o}})),Object.hasOwnProperty.call(this,"$broadcast")||(i=function(e,t){for(var n=new EventArgs(a,e,t),r=a;r.$parent;)r=r.$parent;for(var o=[r],i=[];o.length;){var c=o.pop();c!==a&&i.push(c),Array.isArray(c.$children)&&c.$children.length&&Array.prototype.push.apply(o,c.$children)}i.forEach(function(e){Reflect.get(e,EVTSign).emit(n.event,n)})},Object.defineProperty(this,"$broadcast",{configurable:!1,enumerable:!1,get:function(){return i}}))},detached:function(){var e=Reflect.get(this,EVTSign);e&&e.off(),Reflect.deleteProperty(this,EVTSign)}})].concat(r.behaviors||[])}}]),t}();exports.default=EventBusInstaller;
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_EventEmitter=_interopRequireDefault(require("./EventEmitter"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var r=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,r?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}var EVTSign=Symbol("__wxEVT__"),OriginalSourceSign=Symbol("_originalSource"),SourceSign=Symbol("_source"),EventSign=Symbol("_event"),DataSign=Symbol("_data"),HandledSign=Symbol("_handled"),EventArgs=function(){function r(e,t,n){_classCallCheck(this,r),Object.defineProperty(this,OriginalSourceSign,{enumerable:!1,configurable:!1,value:e}),Object.defineProperty(this,SourceSign,{enumerable:!1,configurable:!1,value:null}),Object.defineProperty(this,EventSign,{enumerable:!1,configurable:!1,value:t}),Object.defineProperty(this,DataSign,{enumerable:!1,configurable:!1,value:n})}return _createClass(r,[{key:"originalSource",get:function(){return Reflect.get(this,OriginalSourceSign)}},{key:"event",get:function(){return Reflect.get(this,EventSign)}},{key:"data",get:function(){return Reflect.get(this,DataSign)}},{key:"source",get:function(){return Reflect.get(this,SourceSign)},set:function(e){Reflect.set(this,SourceSign,e)}}]),r}(),RoutedEventArgs=function(){_inherits(o,EventArgs);var r=_createSuper(o);function o(e,t,n){return _classCallCheck(this,o),n=r.call(this,e,t,n),Object.defineProperty(_assertThisInitialized(n),HandledSign,{enumerable:!1,configurable:!0,value:!1}),n}return _createClass(o,[{key:"handled",get:function(){return Reflect.get(this,HandledSign)},set:function(e){Reflect.set(this,HandledSign,e)}}]),o}(),EventBusInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"definitionFilter",value:function(e,t,n,r,o){r.behaviors=[Behavior({created:function(){var e,t,n,r,o,i,a=this;Object.defineProperty(this,EVTSign,{configurable:!1,enumerable:!1,value:new _EventEmitter.default}),Object.hasOwnProperty.call(this,"$emit")||(e=function(e,t){for(var n=new RoutedEventArgs(a,e,t),r=a.$parent;r;){if(Reflect.get(r,EVTSign).emit(n.event,n),!0===n.handled)break;r=r.$parent}},Object.defineProperty(this,"$emit",{configurable:!1,enumerable:!1,get:function(){return e}})),Object.hasOwnProperty.call(this,"$on")||(t=function(e,t){Reflect.get(a,EVTSign).on(e,t)},Object.defineProperty(this,"$on",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$off")||(n=function(e,t){Reflect.get(a,EVTSign).off(e,t)},Object.defineProperty(this,"$off",{configurable:!1,enumerable:!1,get:function(){return n}})),Object.hasOwnProperty.call(this,"$once")||(r=function(e,t){Reflect.get(a,EVTSign).once(e,t)},Object.defineProperty(this,"$once",{configurable:!1,enumerable:!1,get:function(){return r}})),Object.hasOwnProperty.call(this,"$dispatch")||(o=function(e,t){for(var n=[],r=new RoutedEventArgs(a,e,t),o=a;o;)n.push(o),o=o.$parent;n.reverse();for(var i=0,c=n;i<c.length;i++){var u=c[i],u=Reflect.get(u,EVTSign);if(u&&(u.emit(r.event,r),!0===r.handled))break}},Object.defineProperty(this,"$dispatch",{configurable:!1,enumerable:!1,get:function(){return o}})),Object.hasOwnProperty.call(this,"$broadcast")||(i=function(e,t){for(var n=new EventArgs(a,e,t),r=a;r.$parent;)r=r.$parent;for(var o=[r],i=[];o.length;){var c=o.pop();c!==a&&i.push(c),Array.isArray(c.$children)&&c.$children.length&&Array.prototype.push.apply(o,c.$children)}i.forEach(function(e){Reflect.get(e,EVTSign).emit(n.event,n)})},Object.defineProperty(this,"$broadcast",{configurable:!1,enumerable:!1,get:function(){return i}}))},detached:function(){var e=Reflect.get(this,EVTSign);e&&e.off(),Reflect.deleteProperty(this,EVTSign)}})].concat(r.behaviors||[])}}]),t}();exports.default=EventBusInstaller;

@@ -1,1 +0,1 @@

"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Deconstruct=require("../libs/Deconstruct"),_Invocation=require("../libs/Invocation");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var LifeCycleInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"behaviorLifeCycleDefinition",value:function(e,t,n,o){var r=arguments,i=this,c=(0,_Deconstruct.Deconstruct)({},{ready:function(){return function(){t.get("ready").apply(this,arguments)}},lifetimes:function(){return{created:function(){t.get("lifetimes").created.apply(this,arguments)},moved:function(){t.get("lifetimes").moved.apply(i,r)},attached:function(){t.get("lifetimes").attached.apply(this,arguments)},detached:function(){t.get("lifetimes").detached.apply(this,arguments)}}},pageLifetimes:function(){return{show:function(){t.get("pageLifetimes").show.apply(this,arguments)},hide:function(){t.get("pageLifetimes").hide.apply(this,arguments)},resize:function(){t.get("pageLifetimes").resize.apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(c)])}},{key:"compatibleLifeCycleDefinition",value:function(e,t,n,o){var r=(0,_Deconstruct.Deconstruct)({},{lifetimes:function(){return{created:function(){t.get("beforeMount").apply(this,arguments)},attached:function(){t.get("mounted").apply(this,arguments)},detached:function(){t.get("beforeDestroy").apply(this,arguments),t.get("destroyed").apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(r)])}},{key:"definitionFilter",value:function(e,t,n,o){this.behaviorLifeCycleDefinition(e,t,n,o),this.compatibleLifeCycleDefinition(e,t,n,o)}},{key:"installBehaviorLifeCycle",value:function(t,n,o){var e,r=t.installers.map(function(e){return e.lifetimes(t,n,o)}).filter(function(e){return!!e}),i=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).filter(function(e){return!!e});n.set("ready",(e=t.installers.map(function(e){return e.ready}),function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})})),n.set("lifetimes",(0,_Deconstruct.Deconstruct)({},{created:function(){var e=r.map(function(e){return e.created}).concat(t.installers.map(function(e){return e.created})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},moved:function(){var e=r.map(function(e){return e.moved}).concat(t.installers.map(function(e){return e.moved})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},attached:function(){var e=r.map(function(e){return e.attached}).concat(t.installers.map(function(e){return e.attached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},detached:function(){var e=r.map(function(e){return e.detached}).concat(t.installers.map(function(e){return e.detached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}})),n.set("pageLifetimes",(0,_Deconstruct.Deconstruct)({},{show:function(){var e=i.map(function(e){return e.show}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},hide:function(){var e=i.map(function(e){return e.hide}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},resize:function(){var e=i.map(function(e){return e.resize}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}}))}},{key:"installCompatibleLifeCycle",value:function(e,t,n){var o,r,i,c,u;t.set("beforeCreate",(o=e.installers.map(function(e){return e.beforeCreate}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;o.forEach(function(e){return e.apply(n,t)})})),t.set("beforeMount",(r=e.installers.map(function(e){return e.beforeMount}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;r.forEach(function(e){return e.apply(n,t)})})),t.set("mounted",(i=e.installers.map(function(e){return e.mounted}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;i.forEach(function(e){return e.apply(n,t)})})),t.set("beforeDestroy",(c=e.installers.map(function(e){return e.beforeDestroy}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;c.forEach(function(e){return e.apply(n,t)})})),t.set("destroyed",(u=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;u.forEach(function(e){return e.apply(n,t)})}))}},{key:"installOptionsLifeCycle",value:function(e,t,n){var o;t.set("beforeCreate",(o=n.beforeCreate,(0,_Invocation.Invocation)(t.get("beforeCreate"),null,o))),t.set("beforeMount",(o=n.beforeMount,(0,_Invocation.Invocation)(t.get("beforeMount"),null,o))),t.set("mounted",(o=n.mounted,(0,_Invocation.Invocation)(t.get("mounted"),null,o))),t.set("beforeDestroy",(o=n.beforeDestroy,(0,_Invocation.Invocation)(t.get("beforeDestroy"),null,o))),t.set("destroyed",(n=n.destroyed,(0,_Invocation.Invocation)(t.get("destroyed"),null,n)))}},{key:"lifetimes",value:function(e,t,n){var o=n.lifetimes,r=n.created,i=n.attached,c=n.moved,u=n.detached;return(0,_Deconstruct.Deconstruct)(n,{created:null,attached:null,moved:null,detached:null,lifetimes:null}),{created:o&&o.created?o.created:r,attached:o&&o.attached?o.attached:i,moved:o&&o.moved?o.moved:c,detached:o&&o.detached?o.detached:u}}},{key:"pageLifetimes",value:function(e,t,n){var o=n.pageLifetimes,r=n.onShow,i=n.onHide,c=n.onResize;return(0,_Deconstruct.Deconstruct)(n,{onShow:null,onHide:null,onResize:null,pageLifetimes:null}),{show:o&&o.show?o.show:r,hide:o&&o.hide?o.hide:i,resize:o&&o.resize?o.resize:c}}},{key:"install",value:function(e,t,n){this.installBehaviorLifeCycle(e,t,n),this.installCompatibleLifeCycle(e,t,n),this.installOptionsLifeCycle(e,t,n);var o=n.onLoad,r=n.onShow,i=n.onReady,c=n.onHide,u=n.onUnload,a=n.onPullDownRefresh,f=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,d=n.onTabItemTap,h=n.onPageScroll,e=n.onResize,y=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:o,onShow:r,onReady:i,onHide:c,onUnload:u,onPullDownRefresh:a,onReachBottom:f,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:d,onPageScroll:h,onResize:e,ready:function(){(0,_common.isFunction)(y)&&y.apply(this,arguments),(0,_common.isFunction)(i)&&i.apply(this,arguments)},error:n}))}},{key:"build",value:function(e,t,n){n=n.definitionFilter;return Object.assign({},t.get("lifecycle"),(0,_common.removeEmpty)({definitionFilter:n}))}}]),t}();exports.default=LifeCycleInstaller;
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Deconstruct=require("../libs/Deconstruct"),_Invocation=require("../libs/Invocation");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var LifeCycleInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"behaviorLifeCycleDefinition",value:function(e,t,n,o){var r=arguments,i=this,c=(0,_Deconstruct.Deconstruct)({},{ready:function(){return function(){t.get("ready").apply(this,arguments)}},lifetimes:function(){return{created:function(){t.get("lifetimes").created.apply(this,arguments)},moved:function(){t.get("lifetimes").moved.apply(i,r)},attached:function(){t.get("lifetimes").attached.apply(this,arguments)},detached:function(){t.get("lifetimes").detached.apply(this,arguments)}}},pageLifetimes:function(){return{show:function(){t.get("pageLifetimes").show.apply(this,arguments)},hide:function(){t.get("pageLifetimes").hide.apply(this,arguments)},resize:function(){t.get("pageLifetimes").resize.apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(c)])}},{key:"compatibleLifeCycleDefinition",value:function(e,t,n,o){var r=(0,_Deconstruct.Deconstruct)({},{ready:function(){return function(){t.get("mounted").apply(this,arguments)}},lifetimes:function(){return{attached:function(){t.get("beforeMount").apply(this,arguments)},detached:function(){t.get("beforeDestroy").apply(this,arguments),t.get("destroyed").apply(this,arguments)}}}});o.behaviors=(o.behaviors||[]).concat([Behavior(r)])}},{key:"definitionFilter",value:function(e,t,n,o){this.behaviorLifeCycleDefinition(e,t,n,o),this.compatibleLifeCycleDefinition(e,t,n,o)}},{key:"installBehaviorLifeCycle",value:function(t,n,o){var e,r=t.installers.map(function(e){return e.lifetimes(t,n,o)}).filter(function(e){return!!e}),i=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).filter(function(e){return!!e});n.set("ready",(e=t.installers.map(function(e){return e.ready}),function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})})),n.set("lifetimes",(0,_Deconstruct.Deconstruct)({},{created:function(){var e=r.map(function(e){return e.created}).concat(t.installers.map(function(e){return e.created})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},moved:function(){var e=r.map(function(e){return e.moved}).concat(t.installers.map(function(e){return e.moved})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},attached:function(){var e=r.map(function(e){return e.attached}).concat(t.installers.map(function(e){return e.attached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},detached:function(){var e=r.map(function(e){return e.detached}).concat(t.installers.map(function(e){return e.detached})).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}})),n.set("pageLifetimes",(0,_Deconstruct.Deconstruct)({},{show:function(){var e=i.map(function(e){return e.show}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},hide:function(){var e=i.map(function(e){return e.hide}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}},resize:function(){var e=i.map(function(e){return e.resize}).filter(function(e){return(0,_common.isFunction)(e)});return function(){var t=arguments,n=this;e.forEach(function(e){return e.apply(n,t)})}}}))}},{key:"installCompatibleLifeCycle",value:function(e,t,n){var o,r,i,c,u;t.set("beforeCreate",(o=e.installers.map(function(e){return e.beforeCreate}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;o.forEach(function(e){return e.apply(n,t)})})),t.set("beforeMount",(r=e.installers.map(function(e){return e.beforeMount}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;r.forEach(function(e){return e.apply(n,t)})})),t.set("mounted",(i=e.installers.map(function(e){return e.mounted}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;i.forEach(function(e){return e.apply(n,t)})})),t.set("beforeDestroy",(c=e.installers.map(function(e){return e.beforeDestroy}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;c.forEach(function(e){return e.apply(n,t)})})),t.set("destroyed",(u=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;u.forEach(function(e){return e.apply(n,t)})}))}},{key:"installOptionsLifeCycle",value:function(e,t,n){var o;t.set("beforeCreate",(o=n.beforeCreate,(0,_Invocation.Invocation)(t.get("beforeCreate"),null,o))),t.set("beforeMount",(o=n.beforeMount,(0,_Invocation.Invocation)(t.get("beforeMount"),null,o))),t.set("mounted",(o=n.mounted,(0,_Invocation.Invocation)(t.get("mounted"),null,o))),t.set("beforeDestroy",(o=n.beforeDestroy,(0,_Invocation.Invocation)(t.get("beforeDestroy"),null,o))),t.set("destroyed",(n=n.destroyed,(0,_Invocation.Invocation)(t.get("destroyed"),null,n)))}},{key:"lifetimes",value:function(e,t,n){var o=n.lifetimes,r=n.created,i=n.attached,c=n.moved,u=n.detached;return(0,_Deconstruct.Deconstruct)(n,{created:null,attached:null,moved:null,detached:null,lifetimes:null}),{created:o&&o.created?o.created:r,attached:o&&o.attached?o.attached:i,moved:o&&o.moved?o.moved:c,detached:o&&o.detached?o.detached:u}}},{key:"pageLifetimes",value:function(e,t,n){var o=n.pageLifetimes,r=n.onShow,i=n.onHide,c=n.onResize;return(0,_Deconstruct.Deconstruct)(n,{onShow:null,onHide:null,onResize:null,pageLifetimes:null}),{show:o&&o.show?o.show:r,hide:o&&o.hide?o.hide:i,resize:o&&o.resize?o.resize:c}}},{key:"install",value:function(e,t,n){this.installBehaviorLifeCycle(e,t,n),this.installCompatibleLifeCycle(e,t,n),this.installOptionsLifeCycle(e,t,n);var o=n.onLoad,r=n.onShow,i=n.onReady,c=n.onHide,u=n.onUnload,a=n.onPullDownRefresh,f=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,d=n.onTabItemTap,h=n.onPageScroll,e=n.onResize,y=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:o,onShow:r,onReady:i,onHide:c,onUnload:u,onPullDownRefresh:a,onReachBottom:f,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:d,onPageScroll:h,onResize:e,ready:function(){(0,_common.isFunction)(y)&&y.apply(this,arguments),(0,_common.isFunction)(i)&&i.apply(this,arguments)},error:n}))}},{key:"build",value:function(e,t,n){n=n.definitionFilter;return Object.assign({},t.get("lifecycle"),(0,_common.removeEmpty)({definitionFilter:n}))}}]),t}();exports.default=LifeCycleInstaller;

@@ -1,1 +0,1 @@

"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_Blend=require("../libs/Blend"),_Stream=require("../libs/Stream"),_Invocation=require("../libs/Invocation"),_Optional=require("../libs/Optional"),_common=require("../utils/common"),_lifecycle=_interopRequireDefault(require("../utils/lifecycle")),_options=_interopRequireDefault(require("../utils/options")),_excluded=["extends","mixins"];function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,i=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(o=r.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){l=!0,n=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw n}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _objectWithoutProperties(t,e){if(null==t)return{};var r,o=_objectWithoutPropertiesLoose(t,e);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(t),i=0;i<n.length;i++)r=n[i],0<=e.indexOf(r)||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r]);return o}function _objectWithoutPropertiesLoose(t,e){if(null==t)return{};for(var r,o={},n=Object.keys(t),i=0;i<n.length;i++)r=n[i],0<=e.indexOf(r)||(o[r]=t[r]);return o}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,e=function(){};return{s:e,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,i=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){a=!0,n=t},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw n}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _createSuper(r){var o=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,o?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _possibleConstructorReturn(t,e){if(e&&("object"===_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var MixinInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"collectOptions",value:function(){var e=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Map;Array.isArray(t.mixins)&&t.mixins.forEach(function(t){return e.collectOptions(r,t,o)});var n,i=_createForOfIteratorHelper(r);try{for(i.s();!(n=i.n()).done;){var a=n.value;Reflect.has(t,a)&&(o.has(a)||o.set(a,[]),o.get(a).push(t[a]))}}catch(t){i.e(t)}finally{i.f()}return o}},{key:"overrideOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,Object.assign.apply(void 0,[{}].concat(e.get(t)))]}).collect(_Stream.Collectors.toMap())}},{key:"overrideMembers",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,Object.assign.apply(void 0,[{}].concat(e.get(t)))]}).collect(_Stream.Collectors.toMap())}},{key:"combineOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,(0,_Blend.Blend)({},e.get(t))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,(0,_Invocation.Invocation)(e.get(t))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesMembers",value:function(t,o){var n=this;return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return o.has(t)&&0<o.get(t).length})).map(function(t){var e=_Stream.Stream.of(_Stream.Stream.of(o.get(t)).map(function(t){return Object.keys(t)}).flat()).distinct().collect(_Stream.Collectors.toList()),r=o.get(t);return[t,n.seriesOptions(e,_Stream.Stream.of(e).map(function(e){return[e,r.map(function(t){return t[e]})]}).collect(_Stream.Collectors.toMap(!0)))]}).collect(_Stream.Collectors.toMap())}},{key:"concatOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,_toConsumableArray(new Set(_Stream.Stream.of(e.get(t)).flat()))]}).collect(_Stream.Collectors.toMap())}},{key:"reduceConfiguration",value:function(t){var e={};if(t.extends){var r=t.extends,o=t.mixins,n=_objectWithoutProperties(t,_excluded);return this.reduceConfiguration(Object.assign({mixins:[r].concat(o||[])},n))}Object.assign(e,this.concatOptions(["behaviors","externalClasses"],this.collectOptions(["behaviors","externalClasses"],t))),Object.assign(e,this.overrideOptions(["methods","properties","props","relations","options","inject"],this.collectOptions(["methods","properties","props","relations","options","inject"],t))),Object.assign(e,this.overrideMembers(["computed","observers"],this.collectOptions(["computed","observers"],t))),Object.assign(e,this.combineOptions(["data","provide"],this.collectOptions(["data","provide"],t))),Object.assign(e,this.seriesMembers(["lifetimes","pageLifetimes"],this.collectOptions(["lifetimes","pageLifetimes"],t))),Object.assign(e,this.seriesOptions(["definitionFilter"],this.collectOptions(["definitionFilter"],t))),Object.assign(e,this.seriesOptions(_lifecycle.default,this.collectOptions(_lifecycle.default,t))),_Optional.Optional.of(this.collectOptions(["watch"],t).get("watch")).ifPresent(function(r){var t=_Stream.Stream.of(_Stream.Stream.of(r).map(function(t){return Object.keys(t)}).flat()).distinct().collect(_Stream.Collectors.toList());Object.assign(e,{watch:_Stream.Stream.of(t).map(function(e){var t=r.map(function(t){return t[e]});return[e,1<t.length?(0,_Invocation.Invocation)(_Stream.Stream.of(t).flat()):t[0]]}).collect(_Stream.Collectors.toMap())})});var i,n=_Stream.Stream.of(Object.entries(t)).filter(function(t){return!_lifecycle.default.has(t[0])&&!_options.default.has(t[0])}).collect(_Stream.Collectors.groupingBy(function(t){return(0,_common.isFunction)(t[1])?"methods":"staticData"})),t=n.methods,n=n.staticData;return Array.isArray(t)&&(i=_Stream.Stream.of(t).collect(_Stream.Collectors.toMap()),_Optional.Optional.of(e.methods).ifPresentOrElse(function(t){Object.assign(t,i)},function(){Object.assign(e,{methods:i})})),Array.isArray(n)&&Object.assign(e,_Stream.Stream.of(n).collect(_Stream.Collectors.toMap())),e}},{key:"configuration",value:function(t,e,r){return this.reduceConfiguration(r)}},{key:"build",value:function(t,e,r){var o=_Stream.Stream.of(Object.entries(r)).filter(function(t){var e=_slicedToArray(t,2),t=e[0],e=e[1];return!(0,_common.isFunction)(e)&&!_options.default.has(t)&&!_lifecycle.default.has(t)}).collect(_Stream.Collectors.toMap()),n=r.externalClasses,i=r.options,a=r.relations,r=r.behaviors;return Object.assign({},o,(0,_common.removeEmpty)({externalClasses:n,options:i,relations:a,behaviors:r}))}}]),e}();exports.default=MixinInstaller;
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_Blend=require("../libs/Blend"),_Stream=require("../libs/Stream"),_Invocation=require("../libs/Invocation"),_Optional=require("../libs/Optional"),_common=require("../utils/common"),_lifecycle=_interopRequireDefault(require("../utils/lifecycle")),_options=_interopRequireDefault(require("../utils/options")),_excluded=["extends","mixins"];function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,i=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(o=r.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){l=!0,n=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw n}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _objectWithoutProperties(t,e){if(null==t)return{};var r,o=_objectWithoutPropertiesLoose(t,e);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(t),i=0;i<n.length;i++)r=n[i],0<=e.indexOf(r)||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r]);return o}function _objectWithoutPropertiesLoose(t,e){if(null==t)return{};for(var r,o={},n=Object.keys(t),i=0;i<n.length;i++)r=n[i],0<=e.indexOf(r)||(o[r]=t[r]);return o}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,e=function(){};return{s:e,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,i=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){a=!0,n=t},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw n}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _createSuper(r){var o=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,o?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _possibleConstructorReturn(t,e){if(e&&("object"===_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var MixinInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"collectOptions",value:function(){var e=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Map;Array.isArray(t.mixins)&&t.mixins.forEach(function(t){return e.collectOptions(r,t,o)});var n,i=_createForOfIteratorHelper(r);try{for(i.s();!(n=i.n()).done;){var a=n.value;Reflect.has(t,a)&&(o.has(a)||o.set(a,[]),o.get(a).push(t[a]))}}catch(t){i.e(t)}finally{i.f()}return o}},{key:"overrideOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,Object.assign.apply(void 0,[{}].concat(e.get(t)))]}).collect(_Stream.Collectors.toMap())}},{key:"overrideMembers",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,Object.assign.apply(void 0,[{}].concat(e.get(t)))]}).collect(_Stream.Collectors.toMap())}},{key:"combineOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,(0,_Blend.Blend)({},e.get(t))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,(0,_Invocation.Invocation)(e.get(t))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesMembers",value:function(t,o){var n=this;return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return o.has(t)&&0<o.get(t).length})).map(function(t){var e=_Stream.Stream.of(_Stream.Stream.of(o.get(t)).map(function(t){return Object.keys(t)}).flat()).distinct().collect(_Stream.Collectors.toList()),r=o.get(t);return[t,n.seriesOptions(e,_Stream.Stream.of(e).map(function(e){return[e,r.map(function(t){return t[e]})]}).collect(_Stream.Collectors.toMap(!0)))]}).collect(_Stream.Collectors.toMap())}},{key:"concatOptions",value:function(t,e){return _Stream.Stream.of((Array.isArray(t)?t:_toConsumableArray(t)).filter(function(t){return e.has(t)&&0<e.get(t).length})).map(function(t){return[t,_toConsumableArray(new Set(_Stream.Stream.of(e.get(t)).flat()))]}).collect(_Stream.Collectors.toMap())}},{key:"reduceConfiguration",value:function(t){var e={};if(t.extends){var r=t.extends,o=t.mixins,n=_objectWithoutProperties(t,_excluded);return this.reduceConfiguration(Object.assign({mixins:[r].concat(o||[])},n))}Object.assign(e,this.concatOptions(["behaviors","externalClasses"],this.collectOptions(["behaviors","externalClasses"],t))),Object.assign(e,this.overrideOptions(["methods","properties","props","relations","options","inject"],this.collectOptions(["methods","properties","props","relations","options","inject"],t))),Object.assign(e,this.overrideMembers(["computed","observers"],this.collectOptions(["computed","observers"],t))),Object.assign(e,this.combineOptions(["data","provide"],this.collectOptions(["data","provide"],t))),Object.assign(e,this.seriesMembers(["lifetimes","pageLifetimes"],this.collectOptions(["lifetimes","pageLifetimes"],t))),Object.assign(e,this.seriesOptions(["definitionFilter"],this.collectOptions(["definitionFilter"],t))),Object.assign(e,this.seriesOptions(_lifecycle.default,this.collectOptions(_lifecycle.default,t))),_Optional.Optional.of(this.collectOptions(["watch"],t).get("watch")).ifPresent(function(r){var t=_Stream.Stream.of(_Stream.Stream.of(r).map(function(t){return Object.keys(t)}).flat()).distinct().collect(_Stream.Collectors.toList());Object.assign(e,{watch:_Stream.Stream.of(t).map(function(e){var t=r.map(function(t){return t[e]});return[e,1<t.length?(0,_Invocation.Invocation)(_Stream.Stream.of(t).flat()):t[0]]}).collect(_Stream.Collectors.toMap())})});var i,n=_Stream.Stream.of(Object.entries(t)).filter(function(t){return!_lifecycle.default.has(t[0])&&!_options.default.has(t[0])}).collect(_Stream.Collectors.groupingBy(function(t){return(0,_common.isFunction)(t[1])?"methods":"staticData"})),t=n.methods,n=n.staticData;return Array.isArray(t)&&(i=_Stream.Stream.of(t).collect(_Stream.Collectors.toMap()),_Optional.Optional.of(e.methods).ifPresentOrElse(function(t){Object.assign(t,i)},function(){Object.assign(e,{methods:i})})),Array.isArray(n)&&Object.assign(e,_Stream.Stream.of(n).collect(_Stream.Collectors.toMap())),e}},{key:"configuration",value:function(t,e,r){return this.reduceConfiguration(r)}},{key:"definitionFilter",value:function(t,e,r,o,n){o.behaviors&&(o.behaviors=(o.behaviors||[]).concat(r.behaviors||[]))}},{key:"build",value:function(t,e,r){var o=_Stream.Stream.of(Object.entries(r)).filter(function(t){var e=_slicedToArray(t,2),t=e[0],e=e[1];return!(0,_common.isFunction)(e)&&!_options.default.has(t)&&!_lifecycle.default.has(t)}).collect(_Stream.Collectors.toMap()),n=r.externalClasses,i=r.options,r=r.relations;return Object.assign({},o,(0,_common.removeEmpty)({externalClasses:n,options:i,relations:r}))}}]),e}();exports.default=MixinInstaller;

@@ -1,1 +0,1 @@

"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _relations,_OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var PARENT_TAG_OBFS="parent-".concat((0,_common.uuid)()),CHILD_TAG_OBFS="child-".concat((0,_common.uuid)()),MATCH_PARENTS=new Map;function injectParentInstance(e,t){Object.defineProperty(e,"$parent",{configurable:!0,enumerable:!1,get:function(){return t}})}function deleteParentProperty(e){Reflect.deleteProperty(e,"$parent")}function appendChildInstance(e,t){Reflect.has(e,"$children")||Object.defineProperty(e,"$children",{configurable:!1,enumerable:!1,value:[]});var r=Reflect.get(t,"__wxExparserNodeId__");e.$children.some(function(e){return Reflect.get(e,"__wxExparserNodeId__")===r})||e.$children.push(t)}function removeChildInstance(e,t){var r;Reflect.has(e,"$children")&&(r=Reflect.get(t,"__wxExparserNodeId__"),0<=(t=e.$children.findIndex(function(e){return Reflect.get(e,"__wxExparserNodeId__")===r}))&&e.$children.splice(t,1))}var ParentBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&(this.$parent||injectParentInstance(this,e))},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&deleteParentProperty(e,this)}}),ChildBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&appendChildInstance(e,this)},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&removeChildInstance(e,this)}}),LinkBehavior=Behavior({relations:(_defineProperty(_relations={},PARENT_TAG_OBFS,{type:"parent",target:ParentBehavior,linked:function(e){var t=this,r=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});this.$parent&&Reflect.get(this.$parent,"__wxExparserNodeId__")!==Reflect.get(r,"__wxExparserNodeId__")||injectParentInstance(this,e)},unlinked:function(){this.$parent&&removeChildInstance(this.$parent,this),deleteParentProperty(this)}}),_defineProperty(_relations,CHILD_TAG_OBFS,{type:"child",target:ChildBehavior,linked:function(e){var t=this,r=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});e.$parent&&Reflect.get(e.$parent,"__wxExparserNodeId__")!==Reflect.get(r,"__wxExparserNodeId__")||appendChildInstance(this,e),removeChildInstance(r,e)},unlinked:function(e){e.$parent&&removeChildInstance(e.$parent,e),removeChildInstance(this,e)}}),_relations)}),RelationsInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"definitionFilter",value:function(e,t,r,n,o){n.behaviors=[ParentBehavior,ChildBehavior,LinkBehavior].concat(n.behaviors||[])}},{key:"configuration",value:function(e,t,r){r=r.parent,r=void 0===r?null:r;return r&&(MATCH_PARENTS.has(r)||MATCH_PARENTS.set(r,[]),r.startsWith("/")?t.set("parent",r.slice(1)):t.set("parent",r)),null}},{key:"lifetimes",value:function(e,t,r){var n=t.get("parent");return{created:function(){var e;0<MATCH_PARENTS.size&&(e=MATCH_PARENTS.get(this.is),Array.isArray(e)&&e.push(this),n&&MATCH_PARENTS.has(n)&&(e=MATCH_PARENTS.get(n),Array.isArray(e)&&0<e.length&&(injectParentInstance(this,e=e[e.length-1]),appendChildInstance(e,this))))},attached:function(){var e,t;0<MATCH_PARENTS.size&&(e=MATCH_PARENTS.get(this.is),Array.isArray(e)&&(0<=(t=e.indexOf(this))&&e.splice(t,1),e.length<=0&&MATCH_PARENTS.delete(this.is)))}}}},{key:"install",value:function(e,t,r){r=r.relations,r=void 0===r?null:r;t.set("relations",Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.relations()})),[r])))}},{key:"build",value:function(e,t,r){return{relations:t.get("relations")}}}]),t}();exports.default=RelationsInstaller;
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _OptionInstaller2=_interopRequireDefault(require("./OptionInstaller")),_common=require("../utils/common"),_Stream=require("../libs/Stream");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(c)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var PARENT_TAG_OBS="parent-".concat((0,_common.uuid)()),CHILD_TAG_OBS="child-".concat((0,_common.uuid)()),RelationSign=Symbol("__wxREL__"),RTCSign=Symbol("__wxRTC__"),RTCGetterSign=Symbol("__wxRTC_Getter__"),ExecutedDescendantSign=Symbol("__wxEXE_Descendant");function injectParentInstance(e,t){Object.defineProperty(e,"$parent",{configurable:!0,enumerable:!1,get:function(){return t}})}function deleteParentProperty(e){Reflect.deleteProperty(e,"$parent")}function appendChildInstance(e,t){Reflect.has(e,"$children")||Object.defineProperty(e,"$children",{configurable:!1,enumerable:!1,value:[]});var r=Reflect.get(t,"__wxExparserNodeId__");e.$children.some(function(e){return Reflect.get(e,"__wxExparserNodeId__")===r})||e.$children.push(t)}function removeChildInstance(e,t){var r;Reflect.has(e,"$children")&&(r=Reflect.get(t,"__wxExparserNodeId__"),0<=(t=e.$children.findIndex(function(e){return Reflect.get(e,"__wxExparserNodeId__")===r}))&&e.$children.splice(t,1))}var ParentBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&(this.$parent||injectParentInstance(this,Reflect.get(e,RTCGetterSign)()))},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&deleteParentProperty(e,this)}}),ChildBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&appendChildInstance(e,Reflect.get(this,RTCGetterSign)())},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&removeChildInstance(e,this)}}),RelationsInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"getRuntimeContext",value:function(e,t,r){return Reflect.has(e,RTCSign)?Reflect.get(e,RTCSign).get(e,t.get("properties"),t.get("computed"),r):e}},{key:"releaseRuntimeContext",value:function(e){Reflect.has(e,RTCSign)&&(Reflect.get(e,RTCSign).release(),Reflect.deleteProperty(this,RTCSign))}},{key:"definitionFilter",value:function(e,t,r,n,i){n.behaviors=[ParentBehavior,ChildBehavior].concat(n.behaviors||[])}},{key:"relations",value:function(){function a(e){return Reflect.get(e,RTCGetterSign)()}function n(r,n,e,t,i){var o=Reflect.get(n,RelationSign);o&&o[e]&&(!o[e].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!r.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(e=Reflect.get(r,RelationSign))[t]&&e[t].forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];t.target!==ParentBehavior&&t.target!==ChildBehavior&&n.hasBehavior(t.target)&&(0,_common.isFunction)(t[i])&&t[i].call(a(r),a(n),e)}))}var e={};return _defineProperty(e,PARENT_TAG_OBS,{type:"parent",target:ParentBehavior,linked:function(e){injectParentInstance(this,a(e)),n(this,e,"child","parent","linked")},linkChanged:function(e){n(this,e,"child","parent","linkChanged")},unlinked:function(e){n(this,e,"child","parent","unlinked"),deleteParentProperty(this)}}),_defineProperty(e,CHILD_TAG_OBS,{type:"child",target:ChildBehavior,linked:function(e){var t=this,r=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});appendChildInstance(this,a(e)),removeChildInstance(r,e),n(this,e,"parent","child","linked")},linkChanged:function(e){n(this,e,"parent","child","linkChanged")},unlinked:function(e){n(this,e,"parent","child","unlinked"),removeChildInstance(this,e)}}),e}},{key:"lifetimes",value:function(t,n,i){var o=this;return{created:function(){var e,r=this;Object.defineProperty(this,RTCSign,{configurable:!1,enumerable:!1,value:t.createRuntimeContextSingleton(),writable:!1}),Object.defineProperty(this,RTCGetterSign,{configurable:!1,enumerable:!1,value:function(){return t=(e=r).setData.bind(r),o.getRuntimeContext(e,n,t);var e,t},writable:!1}),Object.defineProperty(this,ExecutedDescendantSign,{configurable:!1,enumerable:!1,value:[],writable:!1}),i.relations&&(e=_Stream.Stream.of(Object.entries(i.relations)).collect(_Stream.Collectors.groupingBy(function(e){return _slicedToArray(e,2)[1].type})),Reflect.set(this,RelationSign,e))},attached:function(){var e=Reflect.get(this,ExecutedDescendantSign);Array.isArray(e)&&e.splice(0)},detached:function(){e=this,o.releaseRuntimeContext(e),Reflect.deleteProperty(this,RTCGetterSign);var e=Reflect.get(this,ExecutedDescendantSign);Array.isArray(e)&&e.splice(0),Reflect.deleteProperty(this,ExecutedDescendantSign)}}}},{key:"install",value:function(e,t,r){var n,l,a;r.relations?(r=(n=_Stream.Stream.of(Object.entries(r.relations)).filter(function(e){e=_slicedToArray(e,2)[1];return"ancestor"===e.type||"descendant"===e.type}).collect(_Stream.Collectors.groupingBy(function(e){return _slicedToArray(e,2)[1].type}))).ancestor,n=n.descendant,l=function(e){return Reflect.get(e,RTCGetterSign)()},a=function(r,n,i,e,t,o){var a=[],c=Reflect.get(n,RelationSign);return c&&c[t]&&(!c[t].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!i.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(t=Reflect.get(i,RelationSign))[e]&&t[e].forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];r.includes(e)||t.target!==ParentBehavior&&t.target!==ChildBehavior&&n.hasBehavior(t.target)&&(0,_common.isFunction)(t[o])&&(a.push(e),t[o].call(l(i),l(n),e))})),a},Array.isArray(r)&&r.forEach(function(e){var e=_slicedToArray(e,2),n=e[0],e=e[1],i=e.linked,r=e.linkChanged,o=e.unlinked;(0,_common.isFunction)(i)&&(e.linked=function(e){var t=Reflect.get(this,ExecutedDescendantSign),r=a(t,this,e,"descendant","ancestor","linked");r.length&&Array.prototype.push.apply(t,r),i.call(l(this),l(e),n)}),(0,_common.isFunction)(r)&&(e.linkChanged=function(e){r.call(l(this),l(e),n);var t=Reflect.get(this,ExecutedDescendantSign),e=a(t,this,e,"descendant","ancestor","linkChanged");e.length&&Array.prototype.push.apply(t,e)}),(0,_common.isFunction)(o)&&(e.unlinked=function(e){o.call(l(this),l(e),n);var t=Reflect.get(this,ExecutedDescendantSign),e=a(t,this,e,"descendant","ancestor","linkChanged");e.length&&Array.prototype.push.apply(t,e)})}),t.set("relations",Object.assign(this.relations(),r?_Stream.Stream.of(r).collect(_Stream.Collectors.toMap()):null,n?_Stream.Stream.of(n).collect(_Stream.Collectors.toMap()):null))):t.set("relations",this.relations())}},{key:"build",value:function(e,t,r){return{relations:t.get("relations")}}}]),t}();exports.default=RelationsInstaller;
declare namespace extend {
class EventArgs {
originalSource: object;
event: string;
data: any;
source: any;
}
class RoutedEventArgs extends EventArgs {
handled: boolean;
}
type PropType = string | number | boolean | object;

@@ -157,2 +168,14 @@

inject(): object;
$emit: (event: string, data: any) => void;
$dispatch: (event: string, data: any) => void;
$broadcast: (event: string, data: any) => void;
$once: (event: string, listener: (event: string, data: EventArgs) => void) => void;
$on: (event: string, listener: (event: string, data: EventArgs) => void) => void;
$off: (event?: string, listener?: (event: string, data: EventArgs) => void) => void;
}

@@ -159,0 +182,0 @@ }

declare namespace extend {
class EventArgs {
originalSource: object;
event: string;
data: any;
source: any;
}
class RoutedEventArgs extends EventArgs {
handled: boolean;
}
type PropType = string | number | boolean | object;

@@ -157,2 +168,14 @@

inject(): object;
$emit: (event: string, data: any) => void;
$dispatch: (event: string, data: any) => void;
$broadcast: (event: string, data: any) => void;
$once: (event: string, listener: (event: string, data: EventArgs) => void) => void;
$on: (event: string, listener: (event: string, data: EventArgs) => void) => void;
$off: (event?: string, listener?: (event: string, data: EventArgs) => void) => void;
}

@@ -159,0 +182,0 @@ }

{
"name": "wechat-mini-program-extend",
"version": "1.0.8",
"version": "1.1.0",
"repository": "git@github.com:sitorhy/wechat-mini-program-extend.git",

@@ -5,0 +5,0 @@ "author": "sitorhy <sitorhy>",

@@ -78,2 +78,20 @@ # wechat-mini-program-extend

### 小程序生命周期
```
Page.created > Component.created
> Page.attached = PageEx.beforeMount
> Component.attached = ComponentEx.beforeMount
> Component.relations
> Page.onLoad
> Page.onShow
> Component.lifetimes.show or ComponentEx.onShow
> ComponentEx.mounted = Component.ready = ComponentEx.onReady
> PageEx.mounted
> Page.onReady
```
+ 同级`Component`深度优先触发。 <br>`A(parent)` ← `B(child) `<br>`A.attached` > `B.attached` > `relations.child(A,B)` > `relations.parent(A,B)` <br>
+ `onShow` `onHide` / `pageLifetimes.show` `pageLifetimes.hide` 互斥,不要同时配置。
+ 如果关闭掉开发工具的模拟器,`Page.onReady`不会触发,但`Page.onShow`会触发,再次打开模拟器,`Page.onReady`触发。
## API

@@ -206,10 +224,16 @@

PageEx({
data: {
color: 'red'
},
computed: {
numStyle() {
return `color:${this.color}`; // String
data: {
color: 'red',
num: 100
},
computed: {
numStyle() {
const styles = [`color:${this.color}`];
return styles.join("");
},
classes() {
const classes = ["class1", "class2"];
return classes.join(" ");
}
}
}
});

@@ -283,3 +307,3 @@ ```

```javascript
```
arr[0].num 114 => 514

@@ -430,4 +454,5 @@ arr2 [{"num":1919}] => [{"num":810}]

指向父组件或页面。
小程序`relations`执行在`attached/mounted`回调之后,需要在`ready/onReady`生命周期中进行首次访问。
小程序`relations`执行在`attached`回调之后,在`mounted`,`onReady`,`ready`生命周期中进行首次访问。<br>
`mounted`执行前默认绑定`Page`,任何时候可以向页面发送事件。
<br>

@@ -438,3 +463,3 @@

与当前实例有直接关系的子组件,`$children`不保证任何方式顺序的排列。
`在`ready/onReady/onLoad`中获取。
在`ready`,`onReady`,`onLoad`,`mounted`中获取。

@@ -445,9 +470,45 @@ <br>

* **parent**
* **relations**
强制指定父组件路径,可提前在mounted生命周期中访问$parent,匹配最接近的对象,查询失败则执行默认行为。
如果目标组件路径在发布后会改变,可在编译期访问全局对象`__modules__`进行匹配确认。
通常用不上,`$parent`,`$children`不完整,避免在回调中使用。
```javascript
// behaviors.js 导出
const ParentBehavior = Behavior({});
const ChildBehavior = Behavior({});
<br>
// 子组件
ComponentEx({
behaviors: [ChildBehavior],
relations: {
'getParent': {
type: 'parent',
target: ParentBehavior,
linked: function (target, key) {
console.log(key); // getParent
},
unlinked: function (target, key) {
}
}
}
});
// 父组件
ComponentEx({
behaviors: [ParentBehavior],
relations: {
'getChild': {
type: 'child',
target: ChildBehavior,
linked: function (target, key) {
console.log(key); // getChild
},
unlinked: function (target, key) {
}
}
}
});
```
### 实例方法 / 数据

@@ -516,3 +577,4 @@

​ 事件总线为框架内建通讯机制,与小程序的事件机制无直接关系。
避免频繁使用`$parrent`,`$children`进行数据交互。<br>
事件总线为框架内建通讯机制,与小程序的事件机制无直接关系。

@@ -519,0 +581,0 @@ * **$emit**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc