wechat-mini-program-extend
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -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 _FrameworkInstaller2=_interopRequireDefault(require("./FrameworkInstaller"));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 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 BehaviorInstaller=function(){_inherits(t,_FrameworkInstaller2["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){}},{key:"behaviors",value:function(){return[]}},{key:"properties",value:function(){return{}}},{key:"observers",value:function(e,t,r){return null}},{key:"data",value:function(){return null}},{key:"methods",value:function(){return null}},{key:"ready",value:function(){}},{key:"moved",value:function(){}},{key:"options",value:function(){return null}},{key:"lifetimes",value:function(e,t,r){return null}},{key:"pageLifetimes",value:function(e,t,r){return null}},{key:"externalClasses",value:function(){return[]}},{key:"relations",value:function(e,t,r){return null}}]),t}();exports.default=BehaviorInstaller; | ||
"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 _FrameworkInstaller2=_interopRequireDefault(require("./FrameworkInstaller"));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 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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 BehaviorInstaller=function(){_inherits(t,_FrameworkInstaller2["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){}},{key:"behaviors",value:function(){return[]}},{key:"properties",value:function(){return{}}},{key:"observers",value:function(e,t,r){return null}},{key:"data",value:function(){return null}},{key:"methods",value:function(){return null}},{key:"ready",value:function(){}},{key:"moved",value:function(){}},{key:"options",value:function(){return null}},{key:"lifetimes",value:function(e,t,r){return null}},{key:"pageLifetimes",value:function(e,t,r){return null}},{key:"externalClasses",value:function(){return[]}},{key:"relations",value:function(e,t,r){return null}}]),t}();exports.default=BehaviorInstaller; |
@@ -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"),_Stream=require("../libs/Stream"),_object=require("../utils/object");function _interopRequireDefault(e){return e&&e.__esModule?e:{default: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 _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw r}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,t=function(){};return{s:t,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t}}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 r,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,r=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw r}}}}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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)}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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_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 n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var CMPCLockSign=Symbol("__wxCMPCLock__"),CMPCRTCLockSign=Symbol("__wxCMPCRTCLock__"),CMPCSubmitSign=Symbol("__wxCMPCSubmit__"),LockInstallBehavior=Behavior({lifetimes:{created:function(){Object.defineProperty(this,CMPCLockSign,{value:new Set,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(this,CMPCSubmitSign,{value:new Set,writable:!1,enumerable:!1,configurable:!0})}}}),PropertyMonitor={lock:function(e,t){Reflect.get(e,CMPCLockSign).add(t)},unlock:function(e,t){Reflect.get(e,CMPCLockSign).delete(t)},isLocked:function(e,t){return Reflect.get(e,CMPCLockSign).has(t)}},RuntimeContextMonitor={lock:function(e){Object.defineProperty(e,CMPCRTCLockSign,{configurable:!0,value:!0,writable:!1,enumerable:!1})},unlock:function(e){Reflect.deleteProperty(e,CMPCRTCLockSign)},isLocked:function(e){return Reflect.has(e,CMPCRTCLockSign)}},PropertiesCollection={add:function(e,t){Reflect.get(e,CMPCSubmitSign).add(t)},delete:function(e,t){Reflect.get(e,CMPCSubmitSign).delete(t)},clear:function(e){Reflect.get(e,CMPCSubmitSign).clear()},size:function(e){return Reflect.get(e,CMPCSubmitSign).size},all:function(e){return _toConsumableArray(Reflect.get(e,CMPCSubmitSign))},slice:function(e,t){return this.all(e).slice(t)}},ComputedInstaller=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,o,r){o.behaviors=[LockInstallBehavior].concat(o.behaviors||[])}},{key:"lifetimes",value:function(t,a,e){return{created:function(){RuntimeContextMonitor.lock(this)},attached:function(){var n,o,e,r,i=this;!0!==t._initializationCompatibleContextEnabled&&(n=new Map,o=[],a.set("linkAge",n),e=t.getRuntimeContextSingleton(this).intercept(function(e,t,n){o.includes(e)||0!==n||o.push(e)},function(e){var t=(0,_object.selectPathRoot)(e);o.splice(0).map(function(e){return(0,_object.selectPathRoot)(e)}).filter(function(e){return e!==t}).forEach(function(e){n.has(e)||n.set(e,[]);e=n.get(e);e.includes(t)||e.push(t)})}),r=a.get("computed"),((0,_common.isPlainObject)(r)?Object.keys(r).filter(function(e){return(0,_common.isPlainObject)(r[e])&&(0,_common.isFunction)(r[e].get)||(0,_common.isFunction)(r[e])}):[]).forEach(function(e){var t=(0,_common.isFunction)(r[e].get)?r[e].get:r[e];(0,_common.isFunction)(t)&&(i[e]=t.call(i))}),e()),RuntimeContextMonitor.unlock(this)}}}},{key:"beforeUpdate",value:function(e,t,n,o,r){if(!RuntimeContextMonitor.isLocked(o)){var i,a=t.get("linkAge"),c=t.get("computed"),l=e.getRuntimeContextSingleton(o).get(),e=PropertiesCollection.size(o);for(i in r){var u=r[i],s=(0,_object.selectPathRoot)(i);if(PropertiesCollection.add(o,s),delete r[i],!PropertyMonitor.isLocked(o,s)){if(PropertyMonitor.lock(o,s),s!==i)(0,_object.getData)(o.data,i)!==u&&(0,_object.setData)(o.data,_defineProperty({},i,u));else{var f=c[s]&&(0,_common.isFunction)(c[s].set)?c[s].set:null;if(u!==o.data[s])if((0,_common.isFunction)(f)){f.call(l,u);f=c[s]&&(0,_common.isFunction)(c[s].get)?c[s].get:c[s];if(!(0,_common.isFunction)(f))throw new Error('Getter is missing for computed property "'.concat(s,'".'));o.data[s]=f.call(l)}else(0,_object.setData)(o.data,_defineProperty({},i,u))}u=a.get(s);u&&u.forEach(function(e){var t;PropertyMonitor.isLocked(o,e)||(t=c[e]&&(0,_common.isFunction)(c[e].get)?c[e].get:c[e],(0,_common.isFunction)(t)?l[e]=t.call(l):l[e]=o.data[e])}),PropertyMonitor.unlock(o,s)}}RuntimeContextMonitor.lock(o);var p,y={},m=_createForOfIteratorHelper(PropertiesCollection.slice(o,e));try{for(m.s();!(p=m.n()).done;){var _=p.value;y[_]=o.data[_],PropertiesCollection.delete(o,_)}}catch(e){m.e(e)}finally{m.f()}t=t.get("originalSetData")||this.setData;(0,_common.isFunction)(t)&&t(y),RuntimeContextMonitor.unlock(o)}}},{key:"observers",value:function(e,a,t){var n,o=a.get("properties"),c=a.get("computed"),r={};for(n in o)!function(i){r[i]=function(){var e=a.get("linkAge");if(e){e=e.get(i);if(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var o=t.value,r=c[o]&&(0,_common.isFunction)(c[o].get)?c[o].get:c[o];if(!(0,_common.isFunction)(r))throw new Error('Getter is missing for computed property "'.concat(o,'".'));this[o]=r.call(this)}}catch(e){n.e(e)}finally{n.f()}}}}}(n);return r}},{key:"install",value:function(e,t,n){var o=t.get("properties"),r=t.get("methods"),i=t.get("state"),a=t.has("constants")?t.get("constants"):e.createConstantsContext(n),c=t.get("beforeCreate"),n=n.computed,n=void 0===n?null:n;t.set("computed",_Stream.Stream.of(Object.entries(Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.computed()})),[n])))).map(function(e){var t=_slicedToArray(e,2),n=t[0],e=t[1],t={get:null,set:null};return e&&((0,_common.isFunction)(e)?t.get=e:(0,_common.isFunction)(e.get)&&(t.get=e.get),(0,_common.isFunction)(e.set)&&(t.set=e.set)),[n,t]}).collect(_Stream.Collectors.toMap())),(0,_common.isFunction)(c)&&(!0===e._initializationCompatibleContextEnabled?(n=e.createInitializationContextSingleton(),e=e.getComputedDependencies(i,o,t.get("computed"),r,a),t.set("linkAge",e),c.call(n.get(i,e,o,t.get("computed"),r,a)),n.release()):c.call(void 0))}}]),t}();exports.default=ComputedInstaller; | ||
"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"),_object=require("../utils/object");function _interopRequireDefault(e){return e&&e.__esModule?e:{default: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 _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 _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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var CMPCLockSign=Symbol("__wxCMPCLock__"),CMPCRTCLockSign=Symbol("__wxCMPCRTCLock__"),CMPCSubmitSign=Symbol("__wxCMPCSubmit__"),LockInstallBehavior=Behavior({lifetimes:{created:function(){Object.defineProperty(this,CMPCLockSign,{value:new Set,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(this,CMPCSubmitSign,{value:new Set,writable:!1,enumerable:!1,configurable:!0})}}}),PropertyMonitor={lock:function(e,t){Reflect.get(e,CMPCLockSign).add(t)},unlock:function(e,t){Reflect.get(e,CMPCLockSign).delete(t)},isLocked:function(e,t){return Reflect.get(e,CMPCLockSign).has(t)}},RuntimeContextMonitor={lock:function(e){Object.defineProperty(e,CMPCRTCLockSign,{configurable:!0,value:!0,writable:!1,enumerable:!1})},unlock:function(e){Reflect.deleteProperty(e,CMPCRTCLockSign)},isLocked:function(e){return Reflect.has(e,CMPCRTCLockSign)}},PropertiesCollection={add:function(e,t){Reflect.get(e,CMPCSubmitSign).add(t)},delete:function(e,t){Reflect.get(e,CMPCSubmitSign).delete(t)},clear:function(e){Reflect.get(e,CMPCSubmitSign).clear()},size:function(e){return Reflect.get(e,CMPCSubmitSign).size},all:function(e){return _toConsumableArray(Reflect.get(e,CMPCSubmitSign))},slice:function(e,t){return this.all(e).slice(t)}},ComputedInstaller=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=[LockInstallBehavior].concat(r.behaviors||[])}},{key:"lifetimes",value:function(t,a,e){return{created:function(){RuntimeContextMonitor.lock(this)},attached:function(){var n,r,e,o,i=this;!0!==t._initializationCompatibleContextEnabled&&(n=new Map,r=[],a.set("linkAge",n),e=t.getRuntimeContextSingleton(this).intercept(function(e,t,n){r.includes(e)||0!==n||r.push(e)},function(e){var t=(0,_object.selectPathRoot)(e);r.splice(0).map(function(e){return(0,_object.selectPathRoot)(e)}).filter(function(e){return e!==t}).forEach(function(e){n.has(e)||n.set(e,[]);e=n.get(e);e.includes(t)||e.push(t)})}),o=a.get("computed"),((0,_common.isPlainObject)(o)?Object.keys(o).filter(function(e){return(0,_common.isPlainObject)(o[e])&&(0,_common.isFunction)(o[e].get)||(0,_common.isFunction)(o[e])}):[]).forEach(function(e){var t=(0,_common.isFunction)(o[e].get)?o[e].get:o[e];(0,_common.isFunction)(t)&&(i[e]=t.call(i))}),e()),RuntimeContextMonitor.unlock(this)}}}},{key:"beforeUpdate",value:function(e,t,s,n,f){if(!RuntimeContextMonitor.isLocked(n)){var r,p=t.get("linkAge"),o=t.get("computed"),i=e.getRuntimeContextSingleton(n).get(),e=PropertiesCollection.size(n);for(r in f){var a=f[r],c=(0,_object.selectPathRoot)(r);if(PropertiesCollection.add(n,c),delete f[r],!PropertyMonitor.isLocked(n,c)){if(PropertyMonitor.lock(n,c),c!==r)(0,_object.getData)(n.data,r)!==a&&(0,_object.setData)(n.data,_defineProperty({},r,a));else{var l=o[c]&&(0,_common.isFunction)(o[c].set)?o[c].set:null;if(a!==n.data[c])if((0,_common.isFunction)(l)){l.call(i,a);l=o[c]&&(0,_common.isFunction)(o[c].get)?o[c].get:o[c];if(!(0,_common.isFunction)(l))throw new Error('Getter is missing for computed property "'.concat(c,'".'));n.data[c]=l.call(i)}else(0,_object.setData)(n.data,_defineProperty({},r,a))}l=p.get(c);l&&l.forEach(function(e){var t;PropertyMonitor.isLocked(n,e)||(t=o[e]&&(0,_common.isFunction)(o[e].get)?o[e].get:o[e],(0,_common.isFunction)(t)?i[e]=t.call(i):i[e]=n.data[e])}),PropertyMonitor.unlock(n,c)}}RuntimeContextMonitor.lock(n);var y,m={},u=_createForOfIteratorHelper(PropertiesCollection.slice(n,e));try{for(u.s();!(y=u.n()).done;){var b=y.value;m[b]=n.data[b],PropertiesCollection.delete(n,b)}}catch(e){u.e(e)}finally{u.f()}e=t.get("originalSetData")||this.setData;(0,_common.isFunction)(e)&&e(m),RuntimeContextMonitor.unlock(n)}}},{key:"observers",value:function(e,a,t){var n,r=a.get("properties"),c=a.get("computed"),o={};for(n in r)!function(i){o[i]=function(){var e=a.get("linkAge");if(e){e=e.get(i);if(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var r=t.value,o=c[r]&&(0,_common.isFunction)(c[r].get)?c[r].get:c[r];if(!(0,_common.isFunction)(o))throw new Error('Getter is missing for computed property "'.concat(r,'".'));this[r]=o.call(this)}}catch(e){n.e(e)}finally{n.f()}}}}}(n);return o}},{key:"install",value:function(e,t,n){var r=t.get("properties"),o=t.get("methods"),i=t.get("state"),a=t.has("constants")?t.get("constants"):e.createConstantsContext(n),c=t.get("beforeCreate"),n=n.computed,n=void 0===n?null:n;t.set("computed",_Stream.Stream.of(Object.entries(Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.computed()})),[n])))).map(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1],n={get:null,set:null};return e&&((0,_common.isFunction)(e)?n.get=e:(0,_common.isFunction)(e.get)&&(n.get=e.get),(0,_common.isFunction)(e.set)&&(n.set=e.set)),[t,n]}).collect(_Stream.Collectors.toMap())),(0,_common.isFunction)(c)&&(!0===e._initializationCompatibleContextEnabled?(n=e.createInitializationContextSingleton(),e=e.getComputedDependencies(i,r,t.get("computed"),o,a),t.set("linkAge",e),c.call(n.get(i,e,r,t.get("computed"),o,a)),n.release()):c.call(void 0))}}]),t}();exports.default=ComputedInstaller; |
@@ -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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 ConstantsInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(t,e,r){r=t.createConstantsContext(r);e.set("constants",r)}}]),e}();exports.default=ConstantsInstaller; | ||
"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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 ConstantsInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(t,e,r){t=t.createConstantsContext(r);e.set("constants",t)}}]),e}();exports.default=ConstantsInstaller; |
@@ -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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 ContextInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(r,o,n,t,e){t.behaviors=[Behavior({lifetimes:{created:function(){var t=o.get("properties"),e=o.get("computed");r.getRuntimeContextSingleton(this).get(n,this,t,e,o.get("originalSetData")||this.setData.bind(this))}}})].concat(t.behaviors)}}]),e}();exports.default=ContextInstaller; | ||
"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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 ContextInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(r,o,n,t,e){t.behaviors=[Behavior({lifetimes:{created:function(){var t=o.get("properties"),e=o.get("computed");r.getRuntimeContextSingleton(this).get(n,this,t,e,o.get("originalSetData")||this.setData.bind(this))}}})].concat(t.behaviors)}}]),e}();exports.default=ContextInstaller; |
@@ -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")),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 DataInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(t,e,n){e.set("data",function(){var r=this;return t.installers.map(function(t){return t.data()}).concat(n.data).reduce(function(t,e){return Object.assign(t,(0,_common.isFunction)(e)?e.call(r):e)},{})})}}]),e}();exports.default=DataInstaller; | ||
"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")),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 DataInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(t,e,o){e.set("data",function(){var r=this;return t.installers.map(function(t){return t.data()}).concat(o.data).reduce(function(t,e){return Object.assign(t,(0,_common.isFunction)(e)?e.call(r):e)},{})})}}]),e}();exports.default=DataInstaller; |
@@ -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("../libs/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,writable:!0,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,writable:!0}),n}return _createClass(o,[{key:"handled",get:function(){return Reflect.get(this,HandledSign)},set:function(e){Reflect.set(this,HandledSign,e)}}]),o}(),BusInstallBehavior=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;r;){var o=Reflect.get(r,EVTSign);if(o&&(o.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){var n=Reflect.get(a,EVTSign);n&&n.on(e,t)},Object.defineProperty(this,"$on",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$off")||(n=function(e,t){var n=Reflect.get(a,EVTSign);n&&n.off(e,t)},Object.defineProperty(this,"$off",{configurable:!1,enumerable:!1,get:function(){return n}})),Object.hasOwnProperty.call(this,"$once")||(r=function(e,t){var n=Reflect.get(a,EVTSign);n&&n.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){e=Reflect.get(e,EVTSign);e&&e.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)}}),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=[BusInstallBehavior].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("../libs/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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 _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),Object.defineProperty(e,"prototype",{writable:!1}),e}var EVTSign=Symbol("__wxEVT__"),OriginalSourceSign=Symbol("_originalSource"),SourceSign=Symbol("_source"),EventSign=Symbol("_event"),DataSign=Symbol("_data"),HandledSign=Symbol("_handled"),EventArgs=function(){function n(e,t,r){_classCallCheck(this,n),Object.defineProperty(this,OriginalSourceSign,{enumerable:!1,configurable:!1,value:e}),Object.defineProperty(this,SourceSign,{enumerable:!1,configurable:!1,writable:!0,value:null}),Object.defineProperty(this,EventSign,{enumerable:!1,configurable:!1,value:t}),Object.defineProperty(this,DataSign,{enumerable:!1,configurable:!1,value:r})}return _createClass(n,[{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)}}]),n}(),RoutedEventArgs=function(){_inherits(o,EventArgs);var n=_createSuper(o);function o(e,t,r){return _classCallCheck(this,o),e=n.call(this,e,t,r),Object.defineProperty(_assertThisInitialized(e),HandledSign,{enumerable:!1,configurable:!0,value:!1,writable:!0}),e}return _createClass(o,[{key:"handled",get:function(){return Reflect.get(this,HandledSign)},set:function(e){Reflect.set(this,HandledSign,e)}}]),o}(),BusInstallBehavior=Behavior({created:function(){var e,t,r,n,o,i,u=this;Object.defineProperty(this,EVTSign,{configurable:!1,enumerable:!1,value:new _EventEmitter.default}),Object.hasOwnProperty.call(this,"$emit")||(e=function(e,t){for(var r=new RoutedEventArgs(u,e,t),n=u;n;){var o=Reflect.get(n,EVTSign);if(o&&(o.emit(r.event,r),!0===r.handled))break;n=n.$parent}},Object.defineProperty(this,"$emit",{configurable:!1,enumerable:!1,get:function(){return e}})),Object.hasOwnProperty.call(this,"$on")||(t=function(e,t){var r=Reflect.get(u,EVTSign);r&&r.on(e,t)},Object.defineProperty(this,"$on",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$off")||(r=function(e,t){var r=Reflect.get(u,EVTSign);r&&r.off(e,t)},Object.defineProperty(this,"$off",{configurable:!1,enumerable:!1,get:function(){return r}})),Object.hasOwnProperty.call(this,"$once")||(n=function(e,t){var r=Reflect.get(u,EVTSign);r&&r.once(e,t)},Object.defineProperty(this,"$once",{configurable:!1,enumerable:!1,get:function(){return n}})),Object.hasOwnProperty.call(this,"$dispatch")||(o=function(e,t){for(var r=[],n=new RoutedEventArgs(u,e,t),o=u;o;)r.push(o),o=o.$parent;r.reverse();for(var i=0,c=r;i<c.length;i++){var a=c[i],a=Reflect.get(a,EVTSign);if(a&&(a.emit(n.event,n),!0===n.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 r=new EventArgs(u,e,t),n=u;n.$parent;)n=n.$parent;for(var o=[n],i=[];o.length;){var c=o.pop();c!==u&&i.push(c),Array.isArray(c.$children)&&c.$children.length&&Array.prototype.push.apply(o,c.$children)}i.forEach(function(e){e=Reflect.get(e,EVTSign);e&&e.emit(r.event,r)})},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)}}),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,r,n,o){n.behaviors=[BusInstallBehavior].concat(n.behaviors||[])}}]),t}();exports.default=EventBusInstaller; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function _createClass(e,r,n){return r&&_defineProperties(e.prototype,r),n&&_defineProperties(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var FrameworkInstaller=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"configuration",value:function(e,r,n){return null}},{key:"install",value:function(e,r,n){return n}},{key:"build",value:function(e,r,n){return{}}}]),e}();exports.default=FrameworkInstaller; | ||
"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var FrameworkInstaller=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"configuration",value:function(e,r,t){return null}},{key:"install",value:function(e,r,t){return t}},{key:"build",value:function(e,r,t){return{}}}]),e}();exports.default=FrameworkInstaller; |
@@ -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")),_Stream=require("../libs/Stream"),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default: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 n=0,e=function(){};return{s:e,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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 o,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,o=t},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}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 _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,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 HookInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(n,e,t){var r=e.get("watch");if(["lifetimes","pageLifetimes","methods","observers","lifecycle"].forEach(function(t){e.has(t)&&(0,_common.isPlainObject)(e.get(t))&&e.set(t,_Stream.Stream.of(Object.entries(e.get(t))).filter(function(t){t=_slicedToArray(t,2)[1];return(0,_common.isFunction)(t)}).map(function(t){var e=_slicedToArray(t,2),t=e[0],r=e[1];return[t,function(){if((0,_common.isFunction)(r))return r.apply(n.getRuntimeContextSingleton(this).get(),arguments)}]}).collect(_Stream.Collectors.toMap()))}),r)for(var o=0,i=Object.values(r);o<i.length;o++)i[o].forEach(function(t){var e=t.handler;(0,_common.isFunction)(e)&&(t.handler=function(){e.apply(n.getRuntimeContextSingleton(this).get(),arguments)})});var a,u=_createForOfIteratorHelper(e.keys());try{for(u.s();!(a=u.n()).done;){var l=a.value;!["data","beforeCreate","provide"].includes(l)&&(0,_common.isFunction)(e.get(l))&&function(){var t=e.get(l);e.set(l,function(){t.apply(n.getRuntimeContextSingleton(this).get(),arguments)})}()}}catch(t){u.e(t)}finally{u.f()}}}]),e}();exports.default=HookInstaller; | ||
"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")),_Stream=require("../libs/Stream"),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _createForOfIteratorHelper(t,e){var r,n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length)return n&&(t=n),r=0,{s:e=function(){},n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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 o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}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 _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,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 HookInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"install",value:function(n,e,t){var r=e.get("watch");if(["lifetimes","pageLifetimes","methods","observers","lifecycle"].forEach(function(t){e.has(t)&&(0,_common.isPlainObject)(e.get(t))&&e.set(t,_Stream.Stream.of(Object.entries(e.get(t))).filter(function(t){t=_slicedToArray(t,2)[1];return(0,_common.isFunction)(t)}).map(function(t){var t=_slicedToArray(t,2),e=t[0],r=t[1];return[e,function(){if((0,_common.isFunction)(r))return r.apply(n.getRuntimeContextSingleton(this).get(),arguments)}]}).collect(_Stream.Collectors.toMap()))}),r)for(var o=0,i=Object.values(r);o<i.length;o++)i[o].forEach(function(t){var e=t.handler;(0,_common.isFunction)(e)&&(t.handler=function(){e.apply(n.getRuntimeContextSingleton(this).get(),arguments)})});var a,u=_createForOfIteratorHelper(e.keys());try{for(u.s();!(a=u.n()).done;){var l=a.value;!["data","beforeCreate","provide"].includes(l)&&(0,_common.isFunction)(e.get(l))&&!function(){var t=e.get(l);e.set(l,function(){t.apply(n.getRuntimeContextSingleton(this).get(),arguments)})}()}}catch(t){u.e(t)}finally{u.f()}}}]),e}();exports.default=HookInstaller; |
@@ -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");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 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 InstanceInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"lifetimes",value:function(o,i,c){return{created:function(){var e,t,r,n;Object.hasOwnProperty.call(this,"$set")||(e=function(e,t,r){return Reflect.set(e,t,r),r},Object.defineProperty(this,"$set",{configurable:!1,enumerable:!1,get:function(){return e}})),Object.hasOwnProperty.call(this,"$delete")||(t=function(e,t){Reflect.deleteProperty(e,t)},Object.defineProperty(this,"$delete",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$nextTick")||(r=function(e){(0,_common.isFunction)(e)&&wx.nextTick(e)},Object.defineProperty(this,"$nextTick",{configurable:!1,enumerable:!1,get:function(){return r}})),Object.hasOwnProperty.call(this,"$root")||Object.defineProperty(this,"$root",{configurable:!1,enumerable:!1,get:function(){var t=this;return getCurrentPages().find(function(e){return e.__wxWebviewId__===t.__wxWebviewId__})}}),Object.hasOwnProperty.call(this,"$options")||(n=i.has("constants")?i.get("constants"):o.createConstantsContext(c),Object.defineProperty(this,"$options",{configurable:!1,enumerable:!1,get:function(){return c?n:{}}}))}}}}]),t}();exports.default=InstanceInstaller; | ||
"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");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 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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 InstanceInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"lifetimes",value:function(o,i,c){return{created:function(){var e,t,r,n;Object.hasOwnProperty.call(this,"$set")||(e=function(e,t,r){return Reflect.set(e,t,r),r},Object.defineProperty(this,"$set",{configurable:!1,enumerable:!1,get:function(){return e}})),Object.hasOwnProperty.call(this,"$delete")||(t=function(e,t){Reflect.deleteProperty(e,t)},Object.defineProperty(this,"$delete",{configurable:!1,enumerable:!1,get:function(){return t}})),Object.hasOwnProperty.call(this,"$nextTick")||(r=function(e){(0,_common.isFunction)(e)&&wx.nextTick(e)},Object.defineProperty(this,"$nextTick",{configurable:!1,enumerable:!1,get:function(){return r}})),Object.hasOwnProperty.call(this,"$root")||Object.defineProperty(this,"$root",{configurable:!1,enumerable:!1,get:function(){var t=this;return getCurrentPages().find(function(e){return e.__wxWebviewId__===t.__wxWebviewId__})}}),Object.hasOwnProperty.call(this,"$options")||(n=i.has("constants")?i.get("constants"):o.createConstantsContext(c),Object.defineProperty(this,"$options",{configurable:!1,enumerable:!1,get:function(){return c?n:{}}}))}}}}]),t}();exports.default=InstanceInstaller; |
@@ -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 i=arguments,r=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(r,i)},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 i=(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(i)])}},{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,i=o.created,r=o.attached,c=o.moved,a=o.detached,u=o.onShow,f=o.onHide,s=o.onResize,a={created:o.lifetimes&&o.lifetimes.created?o.lifetimes.created:i,attached:o.lifetimes&&o.lifetimes.attached?o.lifetimes.attached:r,moved:o.lifetimes&&o.lifetimes.moved?o.lifetimes.moved:c,detached:o.lifetimes&&o.lifetimes.detached?o.lifetimes.detached:a},s={show:o.pageLifetimes&&o.pageLifetimes.show?o.pageLifetimes.show:u,hide:o.pageLifetimes&&o.pageLifetimes.hide?o.pageLifetimes.hide:f,resize:o.pageLifetimes&&o.pageLifetimes.resize?o.pageLifetimes.resize:s},l=t.installers.map(function(e){return e.lifetimes(t,n,o)}).concat(a).filter(function(e){return!!e}),p=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).concat(s).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=l.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=l.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=l.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=l.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=p.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=p.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=p.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,i,r,c,a;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",(i=e.installers.map(function(e){return e.beforeMount}).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("mounted",(r=e.installers.map(function(e){return e.mounted}).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("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",(a=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;a.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:"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,i=n.onShow,r=n.onReady,c=n.onHide,a=n.onUnload,u=n.onPullDownRefresh,f=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,m=n.onTabItemTap,h=n.onSaveExitState,d=n.onPageScroll,e=n.onResize,y=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:o,onShow:i,onReady:r,onHide:c,onUnload:a,onPullDownRefresh:u,onReachBottom:f,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:m,onSaveExitState:h,onPageScroll:d,onResize:e,ready:function(){(0,_common.isFunction)(y)&&y.apply(this,arguments),(0,_common.isFunction)(r)&&r.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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 i=arguments,r=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(r,i)},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 i=(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(i)])}},{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,i=o.created,r=o.attached,c=o.moved,a=o.detached,s=o.onShow,l=o.onHide,p=o.onResize,i={created:o.lifetimes&&o.lifetimes.created?o.lifetimes.created:i,attached:o.lifetimes&&o.lifetimes.attached?o.lifetimes.attached:r,moved:o.lifetimes&&o.lifetimes.moved?o.lifetimes.moved:c,detached:o.lifetimes&&o.lifetimes.detached?o.lifetimes.detached:a},r={show:o.pageLifetimes&&o.pageLifetimes.show?o.pageLifetimes.show:s,hide:o.pageLifetimes&&o.pageLifetimes.hide?o.pageLifetimes.hide:l,resize:o.pageLifetimes&&o.pageLifetimes.resize?o.pageLifetimes.resize:p},u=t.installers.map(function(e){return e.lifetimes(t,n,o)}).concat(i).filter(function(e){return!!e}),f=t.installers.map(function(e){return e.pageLifetimes(t,n,o)}).concat(r).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=u.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=u.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=u.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=u.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=f.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=f.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=f.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,i,r,c,a;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",(i=e.installers.map(function(e){return e.beforeMount}).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("mounted",(r=e.installers.map(function(e){return e.mounted}).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("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",(a=e.installers.map(function(e){return e.destroyed}).filter(function(e){return(0,_common.isFunction)(e)}),function(){var t=arguments,n=this;a.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",(o=n.destroyed,(0,_Invocation.Invocation)(t.get("destroyed"),null,o)))}},{key:"install",value:function(e,t,n){this.installBehaviorLifeCycle(e,t,n),this.installCompatibleLifeCycle(e,t,n),this.installOptionsLifeCycle(e,t,n);var e=n.onLoad,o=n.onShow,i=n.onReady,r=n.onHide,c=n.onUnload,a=n.onPullDownRefresh,u=n.onReachBottom,s=n.onShareAppMessage,l=n.onShareTimeline,p=n.onAddToFavorites,m=n.onTabItemTap,y=n.onSaveExitState,d=n.onPageScroll,h=n.onResize,f=n.ready,n=n.error;t.set("lifecycle",(0,_common.removeEmpty)({onLoad:e,onShow:o,onReady:i,onHide:r,onUnload:c,onPullDownRefresh:a,onReachBottom:u,onShareAppMessage:s,onShareTimeline:l,onAddToFavorites:p,onTabItemTap:m,onSaveExitState:y,onPageScroll:d,onResize:h,ready:function(){(0,_common.isFunction)(f)&&f.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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 _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 _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 _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 MethodsInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(t,e,r,o,n){Object.assign(o,{behaviors:(o.behaviors||[]).concat(Behavior({methods:e.get("methods")}))})}},{key:"install",value:function(t,e,r){r=r.methods,r=void 0===r?null:r;e.set("methods",Object.assign.apply(void 0,[{}].concat(_toConsumableArray(t.installers.map(function(t){return t.methods()})),[r])))}}]),e}();exports.default=MethodsInstaller; | ||
"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"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 _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 _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 _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),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 MethodsInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(t,e,r,o,n){Object.assign(o,{behaviors:(o.behaviors||[]).concat(Behavior({methods:e.get("methods")}))})}},{key:"install",value:function(t,e,r){r=r.methods,r=void 0===r?null:r;e.set("methods",Object.assign.apply(void 0,[{}].concat(_toConsumableArray(t.installers.map(function(t){return t.methods()})),[r])))}}]),e}();exports.default=MethodsInstaller; |
@@ -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")),_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(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};for(var r,o={},n=Object.keys(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||(o[r]=e[r]);return o}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 _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 _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,t=function(){};return{s:t,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t}}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(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,n=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw n}}}}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,o=new Array(t);r<t;r++)o[r]=e[r];return o}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}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 o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);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)}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 MixinInstaller=function(){_inherits(o,_OptionInstaller2["default"]);var e=_createSuper(o);function o(){return _classCallCheck(this,o),e.apply(this,arguments)}return _createClass(o,[{key:"collectOptions",value:function(){var t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Map;Array.isArray(e.mixins)&&e.mixins.forEach(function(e){return t.collectOptions(r,e,o)});var n,i=_createForOfIteratorHelper(r);try{for(i.s();!(n=i.n()).done;){var a=n.value;Reflect.has(e,a)&&(o.has(a)||o.set(a,[]),o.get(a).push(e[a]))}}catch(e){i.e(e)}finally{i.f()}return o}},{key:"overrideOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,Object.assign.apply(void 0,[{}].concat(t.get(e)))]}).collect(_Stream.Collectors.toMap())}},{key:"overrideMembers",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,Object.assign.apply(void 0,[{}].concat(t.get(e)))]}).collect(_Stream.Collectors.toMap())}},{key:"combineOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,(0,_Blend.Blend)({},t.get(e))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,(0,_Invocation.Invocation)(t.get(e))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesMembers",value:function(e,o){var n=this;return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return o.has(e)&&0<o.get(e).length})).map(function(e){var t=_Stream.Stream.of(_Stream.Stream.of(o.get(e)).map(function(e){return Object.keys(e)}).flat()).distinct().collect(_Stream.Collectors.toList()),r=o.get(e);return[e,n.seriesOptions(t,_Stream.Stream.of(t).map(function(t){return[t,r.map(function(e){return e[t]})]}).collect(_Stream.Collectors.toMap(!0)))]}).collect(_Stream.Collectors.toMap())}},{key:"concatOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,_toConsumableArray(new Set(_Stream.Stream.of(t.get(e)).flat()))]}).collect(_Stream.Collectors.toMap())}},{key:"reduceConfiguration",value:function(e){var t={};if(e.extends){var r=e.extends,o=e.mixins,n=_objectWithoutProperties(e,_excluded);return this.reduceConfiguration(Object.assign({mixins:[r].concat(o||[])},n))}Object.assign(t,this.concatOptions(["behaviors","externalClasses"],this.collectOptions(["behaviors","externalClasses"],e))),Object.assign(t,this.overrideOptions(["methods","properties","props","relations","options","inject"],this.collectOptions(["methods","properties","props","relations","options","inject"],e))),Object.assign(t,this.overrideMembers(["computed","observers"],this.collectOptions(["computed","observers"],e))),Object.assign(t,this.combineOptions(["data","provide"],this.collectOptions(["data","provide"],e))),Object.assign(t,this.seriesMembers(["lifetimes","pageLifetimes"],this.collectOptions(["lifetimes","pageLifetimes"],e))),Object.assign(t,this.seriesOptions(["definitionFilter"],this.collectOptions(["definitionFilter"],e))),Object.assign(t,this.seriesOptions(_lifecycle.default,this.collectOptions(_lifecycle.default,e))),_Optional.Optional.of(this.collectOptions(["watch"],e).get("watch")).ifPresent(function(r){var e=_Stream.Stream.of(_Stream.Stream.of(r).map(function(e){return Object.keys(e)}).flat()).distinct().collect(_Stream.Collectors.toList());Object.assign(t,{watch:_Stream.Stream.of(e).map(function(t){var e=r.map(function(e){return e[t]});return[t,1<e.length?(0,_Invocation.Invocation)(_Stream.Stream.of(e).flat()):e[0]]}).collect(_Stream.Collectors.toMap())})});var i,n=_Stream.Stream.of(Object.entries(e)).filter(function(e){return!_lifecycle.default.has(e[0])&&!_options.default.has(e[0])}).collect(_Stream.Collectors.groupingBy(function(e){return(0,_common.isFunction)(e[1])?"methods":"staticData"})),e=n.methods,n=n.staticData;return Array.isArray(e)&&(i=_Stream.Stream.of(e).collect(_Stream.Collectors.toMap()),_Optional.Optional.of(t.methods).ifPresentOrElse(function(e){Object.assign(e,i)},function(){Object.assign(t,{methods:i})})),Array.isArray(n)&&Object.assign(t,_Stream.Stream.of(n).collect(_Stream.Collectors.toMap())),t}},{key:"configuration",value:function(e,t,r){return r&&o.globalMixins.length&&(r.mixins=o.globalMixins.concat(Array.isArray(r.mixins)?r.mixins:[])),this.reduceConfiguration(r)}},{key:"definitionFilter",value:function(e,t,r,o,n){o.behaviors&&(o.behaviors=(o.behaviors||[]).concat(r.behaviors||[]))}},{key:"build",value:function(e,t,r){var o=_Stream.Stream.of(Object.keys(r).filter(function(e){return!(0,_common.isFunction)(r[e])&&!_options.default.has(e)&&!_lifecycle.default.has(e)})).map(function(e){return[e,r[e]]}).collect(_Stream.Collectors.toMap()),n=r.externalClasses,i=r.options,a=r.relations;return Object.assign({},o,(0,_common.removeEmpty)({externalClasses:n,options:i,relations:a}))}}],[{key:"addGlobalMixin",value:function(e){o.globalMixins.includes(e)||o.globalMixins.push(e)}},{key:"removeGlobalMixin",value:function(e){e=o.globalMixins.indexOf(e);0<=e&&o.globalMixins.splice(e,1)}},{key:"clearGlobalMixins",value:function(){o.globalMixins.splice(0)}}]),o}();_defineProperty(exports.default=MixinInstaller,"globalMixins",[]); | ||
"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")),_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(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};for(var r,o={},n=Object.keys(e),i=0;i<n.length;i++)r=n[i],0<=t.indexOf(r)||(o[r]=e[r]);return o}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 _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 _createForOfIteratorHelper(e,t){var r,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};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(){o=o.call(e)},n:function(){var e=o.next();return i=e.done,e},e:function(e){a=!0,n=e},f:function(){try{i||null==o.return||o.return()}finally{if(a)throw n}}}}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,o=new Array(t);r<t;r++)o[r]=e[r];return o}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);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)}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 MixinInstaller=function(){_inherits(o,_OptionInstaller2["default"]);var e=_createSuper(o);function o(){return _classCallCheck(this,o),e.apply(this,arguments)}return _createClass(o,[{key:"collectOptions",value:function(){var e,t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Map,i=(Array.isArray(o.mixins)&&o.mixins.forEach(function(e){return t.collectOptions(r,e,n)}),_createForOfIteratorHelper(r));try{for(i.s();!(e=i.n()).done;){var a=e.value;Reflect.has(o,a)&&(n.has(a)||n.set(a,[]),n.get(a).push(o[a]))}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"overrideOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,Object.assign.apply(void 0,[{}].concat(t.get(e)))]}).collect(_Stream.Collectors.toMap())}},{key:"overrideMembers",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,Object.assign.apply(void 0,[{}].concat(t.get(e)))]}).collect(_Stream.Collectors.toMap())}},{key:"combineOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,(0,_Blend.Blend)({},t.get(e))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,(0,_Invocation.Invocation)(t.get(e))]}).collect(_Stream.Collectors.toMap())}},{key:"seriesMembers",value:function(e,o){var n=this;return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return o.has(e)&&0<o.get(e).length})).map(function(e){var t=_Stream.Stream.of(_Stream.Stream.of(o.get(e)).map(function(e){return Object.keys(e)}).flat()).distinct().collect(_Stream.Collectors.toList()),r=o.get(e);return[e,n.seriesOptions(t,_Stream.Stream.of(t).map(function(t){return[t,r.map(function(e){return e[t]})]}).collect(_Stream.Collectors.toMap(!0)))]}).collect(_Stream.Collectors.toMap())}},{key:"concatOptions",value:function(e,t){return _Stream.Stream.of((Array.isArray(e)?e:_toConsumableArray(e)).filter(function(e){return t.has(e)&&0<t.get(e).length})).map(function(e){return[e,_toConsumableArray(new Set(_Stream.Stream.of(t.get(e)).flat()))]}).collect(_Stream.Collectors.toMap())}},{key:"reduceConfiguration",value:function(e){var t={};if(e.extends)return o=e.extends,n=e.mixins,i=_objectWithoutProperties(e,_excluded),this.reduceConfiguration(Object.assign({mixins:[o].concat(n||[])},i));Object.assign(t,this.concatOptions(["behaviors","externalClasses"],this.collectOptions(["behaviors","externalClasses"],e))),Object.assign(t,this.overrideOptions(["methods","properties","props","relations","options","inject"],this.collectOptions(["methods","properties","props","relations","options","inject"],e))),Object.assign(t,this.overrideMembers(["computed","observers"],this.collectOptions(["computed","observers"],e))),Object.assign(t,this.combineOptions(["data","provide"],this.collectOptions(["data","provide"],e))),Object.assign(t,this.seriesMembers(["lifetimes","pageLifetimes"],this.collectOptions(["lifetimes","pageLifetimes"],e))),Object.assign(t,this.seriesOptions(["definitionFilter"],this.collectOptions(["definitionFilter"],e))),Object.assign(t,this.seriesOptions(_lifecycle.default,this.collectOptions(_lifecycle.default,e))),_Optional.Optional.of(this.collectOptions(["watch"],e).get("watch")).ifPresent(function(r){var e=_Stream.Stream.of(_Stream.Stream.of(r).map(function(e){return Object.keys(e)}).flat()).distinct().collect(_Stream.Collectors.toList());Object.assign(t,{watch:_Stream.Stream.of(e).map(function(t){var e=r.map(function(e){return e[t]});return[t,e]}).collect(_Stream.Collectors.toMap())})});var r,o=_Stream.Stream.of(Object.entries(e)).filter(function(e){return!_lifecycle.default.has(e[0])&&!_options.default.has(e[0])}).collect(_Stream.Collectors.groupingBy(function(e){return(0,_common.isFunction)(e[1])?"methods":"staticData"})),n=o.methods,i=o.staticData;return Array.isArray(n)&&(r=_Stream.Stream.of(n).collect(_Stream.Collectors.toMap()),_Optional.Optional.of(t.methods).ifPresentOrElse(function(e){Object.assign(e,r)},function(){Object.assign(t,{methods:r})})),Array.isArray(i)&&Object.assign(t,_Stream.Stream.of(i).collect(_Stream.Collectors.toMap())),t}},{key:"configuration",value:function(e,t,r){return r&&o.globalMixins.length&&(r.mixins=o.globalMixins.concat(Array.isArray(r.mixins)?r.mixins:[])),this.reduceConfiguration(r)}},{key:"definitionFilter",value:function(e,t,r,o,n){o.behaviors&&(o.behaviors=(o.behaviors||[]).concat(r.behaviors||[]))}},{key:"build",value:function(e,t,r){var o=_Stream.Stream.of(Object.keys(r).filter(function(e){return!(0,_common.isFunction)(r[e])&&!_options.default.has(e)&&!_lifecycle.default.has(e)})).map(function(e){return[e,r[e]]}).collect(_Stream.Collectors.toMap()),n=r.externalClasses,i=r.options,a=r.relations;return Object.assign({},o,(0,_common.removeEmpty)({externalClasses:n,options:i,relations:a}))}}],[{key:"addGlobalMixin",value:function(e){o.globalMixins.includes(e)||o.globalMixins.push(e)}},{key:"removeGlobalMixin",value:function(e){e=o.globalMixins.indexOf(e);0<=e&&o.globalMixins.splice(e,1)}},{key:"clearGlobalMixins",value:function(){o.globalMixins.splice(0)}}]),o}();_defineProperty(exports.default=MixinInstaller,"globalMixins",[]); |
@@ -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 _OptionInstaller=_interopRequireDefault(require("./OptionInstaller")),_MethodsInstaller=_interopRequireDefault(require("./MethodsInstaller")),_ConstantsInstaller=_interopRequireDefault(require("./ConstantsInstaller")),_PropertiesInstaller=_interopRequireDefault(require("./PropertiesInstaller")),_DataInstaller=_interopRequireDefault(require("./DataInstaller")),_StateInstaller=_interopRequireDefault(require("./StateInstaller")),_ProviderInstaller=_interopRequireDefault(require("./ProviderInstaller")),_WatcherInstaller=_interopRequireDefault(require("./WatcherInstaller")),_HookInstaller=_interopRequireDefault(require("./HookInstaller")),_ComputedInstaller=_interopRequireDefault(require("./ComputedInstaller")),_MixinInstaller=_interopRequireDefault(require("./MixinInstaller")),_LifeCycleInstaller=_interopRequireDefault(require("./LifeCycleInstaller")),_InstanceInstaller=_interopRequireDefault(require("./InstanceInstaller")),_RelationsInstaller=_interopRequireDefault(require("./RelationsInstaller")),_EventBusInstaller=_interopRequireDefault(require("./EventBusInstaller")),_UpdateInstaller=_interopRequireDefault(require("./UpdateInstaller")),_ContextInstaller=_interopRequireDefault(require("./ContextInstaller")),_Singleton3=require("../libs/Singleton"),_common=require("../utils/common"),_object=require("../utils/object"),_default=_interopRequireDefault(require("../libs/rfdc/default")),_Stream=require("../libs/Stream"),_options=_interopRequireDefault(require("../utils/options")),_lifecycle=_interopRequireDefault(require("../utils/lifecycle"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _createForOfIteratorHelper(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,t=function(){};return{s:t,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}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 o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){e=_superPropBase(e,t);if(e){t=Object.getOwnPropertyDescriptor(e,t);return t.get?t.get.call(n):t.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return 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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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}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 _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var RTCSign=Symbol("__wxRTC__"),InstallersSingleton=function(){_inherits(n,_Singleton3.Singleton);var t=_createSuper(n);function n(){var e;return _classCallCheck(this,n),_defineProperty(_assertThisInitialized(e=t.call(this,function(){return _toConsumableArray(e._installers.entries()).sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})})),"_installers",new Map),e}return _createClass(n,[{key:"prepare",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100;e instanceof _OptionInstaller.default&&(this._installers.has(e)||this._installers.set(e,t))}}]),n}(),RuntimeContextSingleton=function(){_inherits(c,_Singleton3.Singleton);var o=_createSuper(c);function c(){var e;_classCallCheck(this,c);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return _defineProperty(_assertThisInitialized(e=o.call.apply(o,[this].concat(n))),"__interceptors",[]),e}return _createClass(c,[{key:"get",value:function(){var r=this,e=Array.prototype.slice.call(arguments),t=e[0],n=e[1],o=e[2],i=e[3],a=e[4],l=e[5],e=e[6];return this.intercept(l,e),_get(_getPrototypeOf(c.prototype),"get",this).call(this,t,n,o,i,a,function(e,t,n){r.__interceptors.length&&r.__onStateGetting(e,t,n)},function(e,t,n){r.__interceptors.length&&r.__onStateSetting(e,t,n)})}},{key:"__onStateGetting",value:function(e,t,n){var r,o=_createForOfIteratorHelper(this.__interceptors);try{for(o.s();!(r=o.n()).done;){var i=r.value.get;i&&i(e,t,n)}}catch(e){o.e(e)}finally{o.f()}}},{key:"__onStateSetting",value:function(e,t,n){var r,o=_createForOfIteratorHelper(this.__interceptors);try{for(o.s();!(r=o.n()).done;){var i=r.value.set;i&&i(e,t,n)}}catch(e){o.e(e)}finally{o.f()}}},{key:"intercept",value:function(t,n){var e=this;return!t&&!n||0<=this.__interceptors.findIndex(function(e){return e.get===t&&e.set===n})?null:(this.__interceptors.push({get:t,set:n}),function(){e.cancelIntercept(t,n)})}},{key:"cancelIntercept",value:function(t,n){var e=this.__interceptors.findIndex(function(e){return e.get===t&&e.set===n});0<=e&&this.__interceptors.splice(e,1)}}]),c}(),MPExtender=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_installers",new InstallersSingleton),_defineProperty(this,"_context",new Map),_defineProperty(this,"_initializationCompatibleContextEnabled",!1),this.use(new _MixinInstaller.default,5),this.use(new _LifeCycleInstaller.default,10),this.use(new _MethodsInstaller.default,15),this.use(new _ConstantsInstaller.default,20),this.use(new _PropertiesInstaller.default,25),this.use(new _DataInstaller.default,30),this.use(new _StateInstaller.default,35),this.use(new _ComputedInstaller.default,40),this.use(new _ProviderInstaller.default,50),this.use(new _WatcherInstaller.default,55),this.use(new _InstanceInstaller.default,95),this.use(new _EventBusInstaller.default,150),this.use(new _RelationsInstaller.default,200),this.use(new _HookInstaller.default,250),this.use(new _ContextInstaller.default,300),this.use(new _UpdateInstaller.default,350)}return _createClass(e,[{key:"installers",get:function(){return this._installers.get()}},{key:"use",value:function(e){this._installers.prepare(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100)}},{key:"createRuntimeCompatibleContext",value:function(a,l,i,c,u){var s=this,f=(0,_object.createReactiveObject)(l.data,l.data,function(e,t){var n,r,o,i=_defineProperty({},e,t);n=a,r=l,o=i,s.installers.forEach(function(e){e.beforeUpdate(s,s._context,n,r,o)}),u(i,function(){var t,n,r;t=a,n=l,r=i,s.installers.forEach(function(e){e.updated(s,s._context,t,n,r)})})},"",5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,6<arguments.length&&void 0!==arguments[6]?arguments[6]:null),p=new _Singleton3.Singleton(function(n){var e={};Object.keys(i).forEach(function(t){Object.defineProperty(e,t,{get:function(){return Reflect.get(n,t)},set:function(e){Reflect.set(n,t,e)}})})});return new Proxy(l,{ownKeys:function(e){return _toConsumableArray(new Set(["$data","$props"].concat(Object.keys(l)).concat(Object.keys(l.data))))},has:function(e,t){return!!["$data","$props"].includes(t)||(Reflect.has(l.data,t)||Reflect.has(l,t))},get:function(e,t,n){if("$data"===t){var r=Object.keys(l.data||{}).filter(function(e){return(!i||!Reflect.has(i,e))&&(!c||!Reflect.has(c,e))}),o={};return r.forEach(function(t){Object.defineProperty(o,t,{get:function(){return Reflect.get(f,t)},set:function(e){Reflect.set(f,t,e)}})}),o}if("$props"===t)return p.get(f);if(Reflect.has(e,t)){r=Reflect.get(e,t);return(0,_common.isFunction)(r)?r.bind(e):r}return Reflect.has(l.data,t)?Reflect.get(f,t):Reflect.get(e,t)},set:function(e,t,n,r){return!["$data","$props"].includes(t)&&(Reflect.has(l.data,t)||i&&Reflect.has(i,t)||c&&Reflect.has(c,t)?Reflect.set(f,t,n):Reflect.set(l,t,n))},deleteProperty:function(e,t){return!["$data","$props"].includes(t)&&(Reflect.has(l.data,t)?Reflect.deleteProperty(l.data,t):Reflect.deleteProperty(e,t))}})}},{key:"createRuntimeContextSingleton",value:function(){var l=this;return new RuntimeContextSingleton(function(e,t,n,r,o,i,a){return l.createRuntimeCompatibleContext(e,t,n,r,o,i,a)})}},{key:"getRuntimeContextSingleton",value:function(e){return Reflect.has(e,RTCSign)||Object.defineProperty(e,RTCSign,{value:this.createRuntimeContextSingleton(),configurable:!0,enumerable:!1,writable:!1}),Reflect.get(e,RTCSign)}},{key:"deleteRuntimeContextSingleton",value:function(e){var t=this.getRuntimeContextSingleton();t&&t.release(),Reflect.has(e,RTCSign)&&Reflect.deleteProperty(e,RTCSign)}},{key:"createConstantsContext",value:function(o){var e=_Stream.Stream.of(Object.keys(o).filter(function(e){return!_options.default.has(e)&&!_lifecycle.default.has(e)})).map(function(e){return[e,o[e]]}).collect(_Stream.Collectors.toMap());return new Proxy(e,{set:function(e,t,n,r){return!!Reflect.set(e,t,n)&&(Reflect.has(o,t)&&Reflect.set(o,t,n),!0)}})}},{key:"createPropertiesCompatibleContext",value:function(n,o){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=new _Singleton3.Singleton(function(n){var e={};Object.keys(o).forEach(function(t){Object.defineProperty(e,t,{get:function(){return Reflect.get(n,t)},set:function(e){Reflect.set(n,t,e)}})})}),a=new Proxy(n,{has:function(e,t){return Reflect.has(e,t)||["$options","$props"].includes(t)},ownKeys:function(e){return _toConsumableArray(new Set(["$options","$props"].concat(Object.keys(e))))},get:function(e,t,n){if("$options"===t)return r;if("$props"===t)return i.get(n);if(Reflect.has(e,t))return Reflect.get(e,t);if(Reflect.has(o,t)){t=Reflect.get(o,t);return Reflect.has(t,"value")?t.value:(0,_common.isFunction)(t.default)?t.default.call(n):t.default}},set:function(e,t,n,r){return!["$options","$props"].includes(t)&&(Reflect.has(o,t)&&Reflect.set(o[t],"value",n),Reflect.set(e,t,n))}});return Object.keys(o).forEach(function(e){var t=o[e];Reflect.has(n,e)||(Reflect.has(t,"value")?n[e]=t.value:(0,_common.isFunction)(t.default)?n[e]=t.default.call(a):n[e]=t.default)}),a}},{key:"createDataCompatibleContext",value:function(i,a,e,l,c){var t,u=this.createPropertiesCompatibleContext(i,a||{},5<arguments.length&&void 0!==arguments[5]?arguments[5]:{}),n=new Proxy(i,{has:function(e,t){return Reflect.has(e,t)||Reflect.has(u,t)||!c&&Reflect.has(c,t)||!l&&Reflect.has(l,t)||["data","$data"].includes(t)},ownKeys:function(e){var t=[];return[c,u,l,e].forEach(function(e){e&&Array.prototype.push.apply(t,Object.keys(e))}),_toConsumableArray(new Set(["data","$data"].concat(t)))},get:function(e,t,n){if("data"===t)return e;if("$data"===t){var r=Object.keys(i).filter(function(e){return(!a||!Reflect.has(a,e))&&(!l||!Reflect.has(l,e))}),o={};return r.forEach(function(e){Object.defineProperty(o,e,{get:function(){return Reflect.get(n,e)},set:function(e){Reflect.set(n,t,e)}})}),o}if(Reflect.has(u,t))return Reflect.get(u,t);if(c&&Reflect.has(c,t)){r=c[t];return(0,_common.isFunction)(r)?r.bind(n):r}return Reflect.get(e,t)},set:function(e,t,n,r){return!["data","$data"].includes(t)&&(Reflect.has(u,t)?Reflect.set(u,t,n):c&&Reflect.has(c,t)?Reflect.set(c,t,n):Reflect.set(e,t,n))}});return(0,_common.isFunction)(e)?(t=e.call(n),Object.keys(t).forEach(function(e){if(Reflect.has(i,e))throw new Error('The data property "'.concat(e,'" is already declared as a prop. Use prop default value instead.'))}),Object.assign(i,t)):(e&&Object.keys(e).forEach(function(e){if(Reflect.has(i,e))throw new Error('The data property "'.concat(e,'" is already declared as a prop. Use prop default value instead.'))}),Object.assign(i,e)),n}},{key:"getComputedDependencies",value:function(e,t,n,r){var o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},i=(0,_default.default)(e),a=new Map,l=[],e=(0,_object.createReactiveObject)(i,i,function(e,t){(0,_object.setData)(i,_defineProperty({},e,t))},"",function(e,t,n){l.includes(e)||0!==n||l.push(e)},function(e,t,n){var r=(0,_object.selectPathRoot)(e);l.splice(0).map(function(e){return(0,_object.selectPathRoot)(e)}).filter(function(e){return e!==r}).forEach(function(e){a.has(e)||a.set(e,[]);e=a.get(e);e.includes(r)||e.push(r)})}),c=this.createDataCompatibleContext(e,t,null,n,r,o);return((0,_common.isPlainObject)(n)?Object.keys(n).filter(function(e){return(0,_common.isPlainObject)(n[e])&&(0,_common.isFunction)(n[e].get)||(0,_common.isFunction)(n[e])}):[]).forEach(function(e){var t;Reflect.has(i,e)||(t=(0,_common.isFunction)(n[e].get)?n[e].get:n[e],(0,_common.isFunction)(t)&&(c[e]=t.call(c)))}),a}},{key:"createInitializationCompatibleContext",value:function(o,i,e,a,t){var n=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{},l=new Set,r=(0,_object.createReactiveObject)(o,o,function(e,t){var n=(0,_object.selectPathRoot)(e);if(!l.has(n)){if(l.add(n),n!==e)(0,_object.getData)(o,e)!==t&&(0,_object.setData)(o,_defineProperty({},e,t));else{var r=a[n]&&(0,_common.isFunction)(a[n].set)?a[n].set:null;if(t!==o[n])if((0,_common.isFunction)(r)){r.call(c,t);r=a[n]&&(0,_common.isFunction)(a[n].get)?a[n].get:a[n];if(!(0,_common.isFunction)(r))throw new Error('Getter is missing for computed property "'.concat(n,'".'));o[n]=r.call(c)}else(0,_object.setData)(o,_defineProperty({},e,t))}t=i.get(n);t&&t.forEach(function(e){var t;l.has(e)||(t=a[e]&&(0,_common.isFunction)(a[e].get)?a[e].get:a[e],(0,_common.isFunction)(t)?c[e]=t.call(c):c[e]=o[e])}),l.delete(n)}}),c=this.createDataCompatibleContext(r,e,null,a,t,n);return((0,_common.isPlainObject)(a)?Object.keys(a).filter(function(e){return(0,_common.isPlainObject)(a[e])&&(0,_common.isFunction)(a[e].get)||(0,_common.isFunction)(a[e])}):[]).forEach(function(e){var t;Reflect.has(o,e)||(t=a[e]&&(0,_common.isFunction)(a[e].get)?a[e].get:a[e],(0,_common.isFunction)(t)&&(o[e]=t.call(c)))}),c}},{key:"createInitializationContextSingleton",value:function(){var a=this;return new _Singleton3.Singleton(function(e,t,n,r,o,i){return a.createInitializationCompatibleContext(e,t,n,r,o,i)})}},{key:"extends",value:function(e){var r=this,o=e,i=this.installers,t={};i.forEach(function(e){e=e.configuration(r,r._context,o);e&&Object.assign(t,e)}),i.forEach(function(e){e.install(r,r._context,t)});var n={behaviors:[Behavior({definitionFilter:function(t,n){i.forEach(function(e){e.definitionFilter(r,r._context,o,t,n);e=e.behaviors();Array.isArray(e)&&e.length&&(t.behaviors=_Stream.Stream.of((t.behaviors||[]).concat(e)).distinct().collect(_Stream.Collectors.toList()))})}})]};return i.forEach(function(e){Object.assign(n,e.build(r,r._context,t))}),n}}],[{key:"getRuntimeContext",value:function(e){if(!Reflect.has(e,RTCSign))throw new Error("Runtime context has not been initialized.");return Reflect.get(e,RTCSign).get()}}]),e}();exports.default=MPExtender; | ||
"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 _OptionInstaller=_interopRequireDefault(require("./OptionInstaller")),_MethodsInstaller=_interopRequireDefault(require("./MethodsInstaller")),_ConstantsInstaller=_interopRequireDefault(require("./ConstantsInstaller")),_PropertiesInstaller=_interopRequireDefault(require("./PropertiesInstaller")),_DataInstaller=_interopRequireDefault(require("./DataInstaller")),_StateInstaller=_interopRequireDefault(require("./StateInstaller")),_ProviderInstaller=_interopRequireDefault(require("./ProviderInstaller")),_WatcherInstaller=_interopRequireDefault(require("./WatcherInstaller")),_HookInstaller=_interopRequireDefault(require("./HookInstaller")),_ComputedInstaller=_interopRequireDefault(require("./ComputedInstaller")),_MixinInstaller=_interopRequireDefault(require("./MixinInstaller")),_LifeCycleInstaller=_interopRequireDefault(require("./LifeCycleInstaller")),_InstanceInstaller=_interopRequireDefault(require("./InstanceInstaller")),_RelationsInstaller=_interopRequireDefault(require("./RelationsInstaller")),_EventBusInstaller=_interopRequireDefault(require("./EventBusInstaller")),_UpdateInstaller=_interopRequireDefault(require("./UpdateInstaller")),_ContextInstaller=_interopRequireDefault(require("./ContextInstaller")),_StoreInstaller=_interopRequireDefault(require("./StoreInstaller")),_Singleton3=require("../libs/Singleton"),_common=require("../utils/common"),_object=require("../utils/object"),_default=_interopRequireDefault(require("../libs/rfdc/default")),_Stream=require("../libs/Stream"),_options=_interopRequireDefault(require("../utils/options")),_lifecycle=_interopRequireDefault(require("../utils/lifecycle"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _createForOfIteratorHelper(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=_superPropBase(e,t);if(r)return r=Object.getOwnPropertyDescriptor(r,t),r.get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return 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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var RTCSign=Symbol("__wxRTC__"),InstallersSingleton=function(){_inherits(n,_Singleton3.Singleton);var t=_createSuper(n);function n(){var e;return _classCallCheck(this,n),_defineProperty(_assertThisInitialized(e=t.call(this,function(){return _toConsumableArray(e._installers.entries()).sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})})),"_installers",new Map),e}return _createClass(n,[{key:"prepare",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100;e instanceof _OptionInstaller.default&&(this._installers.has(e)||this._installers.set(e,t))}}]),n}(),RuntimeContextSingleton=function(){_inherits(f,_Singleton3.Singleton);var o=_createSuper(f);function f(){var e;_classCallCheck(this,f);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return _defineProperty(_assertThisInitialized(e=o.call.apply(o,[this].concat(n))),"__interceptors",[]),e}return _createClass(f,[{key:"get",value:function(){var l=this,e=Array.prototype.slice.call(arguments),t=e[0],n=e[1],r=e[2],u=e[3],s=e[4],o=e[5],i=e[6],a=e[7],c=e[8],e=e[9];return this.intercept(void 0===o?null:o,void 0===i?null:i,void 0===a?null:a,void 0===c?null:c,void 0===e?null:e),_get(_getPrototypeOf(f.prototype),"get",this).call(this,t,n,r,u,s,function(e,t,n){l.__interceptors.length&&l.__onStateGetting(e,t,n)},function(e,t,n){l.__interceptors.length&&l.__onStateSetting(e,t,n)},function(e,t,n){l.__interceptors.length&&l.__onStateDeleted(e,t,n)},function(e,t,n,r,o,i,a){l.__interceptors.length&&l.__beforeMethodCall(e,t,n,r,o,i,a)},function(e,t,n,r){l.__interceptors.length&&l.__afterMethodCall(e,t,n,r)})}},{key:"__onStateGetting",value:function(e,t,n){var r,o=_createForOfIteratorHelper(this.__interceptors);try{for(o.s();!(r=o.n()).done;){var i=r.value.get;if(i&&!0===i(e,t,n))break}}catch(e){o.e(e)}finally{o.f()}}},{key:"__onStateSetting",value:function(e,t,n){var r,o=_createForOfIteratorHelper(this.__interceptors);try{for(o.s();!(r=o.n()).done;){var i=r.value.set;if(i&&!0===i(e,t,n))break}}catch(e){o.e(e)}finally{o.f()}}},{key:"__onStateDeleted",value:function(e,t,n){var r,o=_createForOfIteratorHelper(this.__interceptors);try{for(o.s();!(r=o.n()).done;){var i=r.value.del;if(i&&!0===i(e,t,n))break}}catch(e){o.e(e)}finally{o.f()}}},{key:"__beforeMethodCall",value:function(e,t,n,r,o,i,a){var l,c=_createForOfIteratorHelper(this.__interceptors);try{for(c.s();!(l=c.n()).done;){var u=l.value.before;if(u&&!0===u(e,t,n,r,o,i,a))break}}catch(e){c.e(e)}finally{c.f()}}},{key:"__afterMethodCall",value:function(e,t,n,r){var o,i=_createForOfIteratorHelper(this.__interceptors);try{for(i.s();!(o=i.n()).done;){var a=o.value.after;if(a&&!0===a(e,t,n,r))break}}catch(e){i.e(e)}finally{i.f()}}},{key:"intercept",value:function(t,n,r,o,i){var e=this;return!(t||n||r||o||i)||0<=this.__interceptors.findIndex(function(e){return e.get===t&&e.set===n&&e.del===r&&e.before===o&&e.after===i})?null:(this.__interceptors.push({get:t,set:n,del:r,before:o,after:i}),function(){e.cancelIntercept(t,n,r,o,i)})}},{key:"cancelIntercept",value:function(t,n,r,o,i){var e=this.__interceptors.findIndex(function(e){return e.get===t&&e.set===n&&e.del===r&&e.before===o&&e.after===i});0<=e&&this.__interceptors.splice(e,1)}}]),f}(),MPExtender=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_installers",new InstallersSingleton),_defineProperty(this,"_context",new Map),_defineProperty(this,"_initializationCompatibleContextEnabled",!1),this.use(new _MixinInstaller.default,5),this.use(new _LifeCycleInstaller.default,10),this.use(new _MethodsInstaller.default,15),this.use(new _ConstantsInstaller.default,20),this.use(new _PropertiesInstaller.default,25),this.use(new _DataInstaller.default,30),this.use(new _StateInstaller.default,35),this.use(new _ComputedInstaller.default,40),this.use(new _StoreInstaller.default,45),this.use(new _ProviderInstaller.default,50),this.use(new _WatcherInstaller.default,55),this.use(new _InstanceInstaller.default,95),this.use(new _EventBusInstaller.default,150),this.use(new _RelationsInstaller.default,200),this.use(new _HookInstaller.default,250),this.use(new _ContextInstaller.default,300),this.use(new _UpdateInstaller.default,350)}return _createClass(e,[{key:"installers",get:function(){return this._installers.get()}},{key:"use",value:function(e){this._installers.prepare(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100)}},{key:"createRuntimeCompatibleContext",value:function(i,a,l,c,u){function s(t,n,r){o.installers.forEach(function(e){e.beforeUpdate(o,o._context,t,n,r)})}function f(t,n,r){o.installers.forEach(function(e){e.updated(o,o._context,t,n,r)})}var o=this,e=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,t=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null,_=7<arguments.length&&void 0!==arguments[7]?arguments[7]:null,d=8<arguments.length&&void 0!==arguments[8]?arguments[8]:null,h=9<arguments.length&&void 0!==arguments[9]?arguments[9]:null,y=[],p=(0,_object.createReactiveObject)(a.data,a.data,function(e,t){var n=_defineProperty({},e,t);s(i,a,n),u(n,function(){f(i,a,n)})},"",e,t,function(e,t,n){var r,o=(0,_object.selectPathParent)(e);y.includes(o)||(r=_defineProperty({},e,n),s(i,a,r),u(r,function(){f(i,a,r)})),_.call(void 0,e,t,n)},function(e,t,n,r,o,i,a){Array.isArray(a)&&["push","splice","shift","pop","fill","unshift","reverse","copyWithin"].includes(t)&&y.push(e),d.call(void 0,e,t,n,r,o,i,a)},function(e,t,n,r){y.splice(0).forEach(function(e){var t=_defineProperty({},e,r);s(i,a,t),u(t,function(){f(i,a,t)})}),h.call(void 0,e,t,n,r)}),v=new _Singleton3.Singleton(function(n){var e={};Object.keys(l).forEach(function(t){Object.defineProperty(e,t,{get:function(){return Reflect.get(n,t)},set:function(e){Reflect.set(n,t,e)}})})});return new Proxy(a,{ownKeys:function(e){return _toConsumableArray(new Set(["$data","$props"].concat(Object.keys(a)).concat(Object.keys(a.data))))},has:function(e,t){return!!["$data","$props"].includes(t)||(Reflect.has(a.data,t)||Reflect.has(a,t))},get:function(e,t,n){var r,o;return"$data"===t?(o=Object.keys(a.data||{}).filter(function(e){return(!l||!Reflect.has(l,e))&&(!c||!Reflect.has(c,e))}),r={},o.forEach(function(t){Object.defineProperty(r,t,{get:function(){return Reflect.get(p,t)},set:function(e){Reflect.set(p,t,e)}})}),r):"$props"===t?v.get(p):Reflect.has(e,t)?(o=Reflect.get(e,t),(0,_common.isFunction)(o)?o.bind(e):o):Reflect.has(a.data,t)?Reflect.get(p,t):Reflect.get(e,t)},set:function(e,t,n,r){return!["$data","$props"].includes(t)&&(Reflect.has(a.data,t)||l&&Reflect.has(l,t)||c&&Reflect.has(c,t)?Reflect.set(p,t,n):Reflect.set(a,t,n))},deleteProperty:function(e,t){return!["$data","$props"].includes(t)&&(Reflect.has(a.data,t)?Reflect.deleteProperty(a.data,t):Reflect.deleteProperty(e,t))}})}},{key:"createRuntimeContextSingleton",value:function(){var i=this;return new RuntimeContextSingleton(function(e,t,n,r,o){return i.createRuntimeCompatibleContext(e,t,n,r,o,5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,6<arguments.length&&void 0!==arguments[6]?arguments[6]:null,7<arguments.length&&void 0!==arguments[7]?arguments[7]:null,8<arguments.length&&void 0!==arguments[8]?arguments[8]:null,9<arguments.length&&void 0!==arguments[9]?arguments[9]:null)})}},{key:"getRuntimeContextSingleton",value:function(e){return Reflect.has(e,RTCSign)||Object.defineProperty(e,RTCSign,{value:this.createRuntimeContextSingleton(),configurable:!0,enumerable:!1,writable:!1}),Reflect.get(e,RTCSign)}},{key:"deleteRuntimeContextSingleton",value:function(e){var t=this.getRuntimeContextSingleton();t&&t.release(),Reflect.has(e,RTCSign)&&Reflect.deleteProperty(e,RTCSign)}},{key:"createConstantsContext",value:function(o){var e=_Stream.Stream.of(Object.keys(o).filter(function(e){return!_options.default.has(e)&&!_lifecycle.default.has(e)})).map(function(e){return[e,o[e]]}).collect(_Stream.Collectors.toMap());return new Proxy(e,{set:function(e,t,n,r){return!!Reflect.set(e,t,n)&&(Reflect.has(o,t)&&Reflect.set(o,t,n),!0)}})}},{key:"createPropertiesCompatibleContext",value:function(n,o){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=new _Singleton3.Singleton(function(n){var e={};Object.keys(o).forEach(function(t){Object.defineProperty(e,t,{get:function(){return Reflect.get(n,t)},set:function(e){Reflect.set(n,t,e)}})})}),a=new Proxy(n,{has:function(e,t){return Reflect.has(e,t)||["$options","$props"].includes(t)},ownKeys:function(e){return _toConsumableArray(new Set(["$options","$props"].concat(Object.keys(e))))},get:function(e,t,n){return"$options"===t?r:"$props"===t?i.get(n):Reflect.has(e,t)?Reflect.get(e,t):Reflect.has(o,t)?(e=Reflect.get(o,t),Reflect.has(e,"value")?e.value:(0,_common.isFunction)(e.default)?e.default.call(n):e.default):void 0},set:function(e,t,n,r){return!["$options","$props"].includes(t)&&(Reflect.has(o,t)&&Reflect.set(o[t],"value",n),Reflect.set(e,t,n))}});return Object.keys(o).forEach(function(e){var t=o[e];Reflect.has(n,e)||(Reflect.has(t,"value")?n[e]=t.value:(0,_common.isFunction)(t.default)?n[e]=t.default.call(a):n[e]=t.default)}),a}},{key:"createDataCompatibleContext",value:function(i,a,e,l,c){var t,u=this.createPropertiesCompatibleContext(i,a||{},5<arguments.length&&void 0!==arguments[5]?arguments[5]:{}),n=new Proxy(i,{has:function(e,t){return Reflect.has(e,t)||Reflect.has(u,t)||!c&&Reflect.has(c,t)||!l&&Reflect.has(l,t)||["data","$data"].includes(t)},ownKeys:function(e){var t=[];return[c,u,l,e].forEach(function(e){e&&Array.prototype.push.apply(t,Object.keys(e))}),_toConsumableArray(new Set(["data","$data"].concat(t)))},get:function(e,t,n){return"data"===t?e:"$data"===t?(o=Object.keys(i).filter(function(e){return(!a||!Reflect.has(a,e))&&(!l||!Reflect.has(l,e))}),r={},o.forEach(function(e){Object.defineProperty(r,e,{get:function(){return Reflect.get(n,e)},set:function(e){Reflect.set(n,t,e)}})}),r):Reflect.has(u,t)?Reflect.get(u,t):c&&Reflect.has(c,t)?(o=c[t],(0,_common.isFunction)(o)?o.bind(n):o):Reflect.get(e,t);var r,o},set:function(e,t,n,r){return!["data","$data"].includes(t)&&(Reflect.has(u,t)?Reflect.set(u,t,n):c&&Reflect.has(c,t)?Reflect.set(c,t,n):Reflect.set(e,t,n))}});return(0,_common.isFunction)(e)?(t=e.call(n),Object.keys(t).forEach(function(e){if(Reflect.has(i,e))throw new Error('The data property "'.concat(e,'" is already declared as a prop. Use prop default value instead.'))}),Object.assign(i,t)):(e&&Object.keys(e).forEach(function(e){if(Reflect.has(i,e))throw new Error('The data property "'.concat(e,'" is already declared as a prop. Use prop default value instead.'))}),Object.assign(i,e)),n}},{key:"getComputedDependencies",value:function(e,t,n,r){var o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},i=(0,_default.default)(e),a=new Map,l=[],e=(0,_object.createReactiveObject)(i,i,function(e,t){(0,_object.setData)(i,_defineProperty({},e,t))},"",function(e,t,n){l.includes(e)||0!==n||l.push(e)},function(e,t,n){var r=(0,_object.selectPathRoot)(e);l.splice(0).map(function(e){return(0,_object.selectPathRoot)(e)}).filter(function(e){return e!==r}).forEach(function(e){a.has(e)||a.set(e,[]);e=a.get(e);e.includes(r)||e.push(r)})}),c=this.createDataCompatibleContext(e,t,null,n,r,o);return((0,_common.isPlainObject)(n)?Object.keys(n).filter(function(e){return(0,_common.isPlainObject)(n[e])&&(0,_common.isFunction)(n[e].get)||(0,_common.isFunction)(n[e])}):[]).forEach(function(e){var t;Reflect.has(i,e)||(t=(0,_common.isFunction)(n[e].get)?n[e].get:n[e],(0,_common.isFunction)(t)&&(c[e]=t.call(c)))}),a}},{key:"createInitializationCompatibleContext",value:function(o,i,e,a,t){var n=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{},l=new Set,c=[],r=(0,_object.createReactiveObject)(o,o,function(e,t){var n=(0,_object.selectPathRoot)(e);if(!l.has(n)){if(l.add(n),n!==e)(0,_object.getData)(o,e)!==t&&(0,_object.setData)(o,_defineProperty({},e,t));else{var r=a[n]&&(0,_common.isFunction)(a[n].set)?a[n].set:null;if(t!==o[n])if((0,_common.isFunction)(r)){r.call(u,t);r=a[n]&&(0,_common.isFunction)(a[n].get)?a[n].get:a[n];if(!(0,_common.isFunction)(r))throw new Error('Getter is missing for computed property "'.concat(n,'".'));o[n]=r.call(u)}else(0,_object.setData)(o,_defineProperty({},e,t))}r=i.get(n);r&&r.forEach(function(e){var t;l.has(e)||(t=a[e]&&(0,_common.isFunction)(a[e].get)?a[e].get:a[e],(0,_common.isFunction)(t)?u[e]=t.call(u):u[e]=o[e])}),l.delete(n)}},"",null,null,function(e,t,n){var r=(0,_object.selectPathParent)(e);c.includes(r)||(r=_defineProperty({},e,n),(0,_object.setData)(o,r))},function(e,t,n,r,o,i,a){Array.isArray(a)&&["push","splice","shift","pop","fill","unshift","reverse","copyWithin"].includes(t)&&c.push(e)},function(e,t,n,r){c.splice(0).forEach(function(e){e=_defineProperty({},e,r);(0,_object.setData)(o,e)})}),u=this.createDataCompatibleContext(r,e,null,a,t,n);return((0,_common.isPlainObject)(a)?Object.keys(a).filter(function(e){return(0,_common.isPlainObject)(a[e])&&(0,_common.isFunction)(a[e].get)||(0,_common.isFunction)(a[e])}):[]).forEach(function(e){var t;Reflect.has(o,e)||(t=a[e]&&(0,_common.isFunction)(a[e].get)?a[e].get:a[e],(0,_common.isFunction)(t)&&(o[e]=t.call(u)))}),u}},{key:"createInitializationContextSingleton",value:function(){var a=this;return new _Singleton3.Singleton(function(e,t,n,r,o,i){return a.createInitializationCompatibleContext(e,t,n,r,o,i)})}},{key:"extends",value:function(e){var r=this,o=e,i=this.installers,t={},n=(i.forEach(function(e){e=e.configuration(r,r._context,o);e&&Object.assign(t,e)}),i.forEach(function(e){e.install(r,r._context,t)}),{behaviors:[Behavior({definitionFilter:function(t,n){i.forEach(function(e){e.definitionFilter(r,r._context,o,t,n);e=e.behaviors();Array.isArray(e)&&e.length&&(t.behaviors=_Stream.Stream.of((t.behaviors||[]).concat(e)).distinct().collect(_Stream.Collectors.toList()))})}})]});return i.forEach(function(e){Object.assign(n,e.build(r,r._context,t))}),n}}],[{key:"getRuntimeContext",value:function(e){if(!Reflect.has(e,RTCSign))throw new Error("Runtime context has not been initialized.");return Reflect.get(e,RTCSign).get()}}]),e}();exports.default=MPExtender; |
@@ -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 _BehaviorInstaller2=_interopRequireDefault(require("./BehaviorInstaller"));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 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 OptionInstaller=function(){_inherits(t,_BehaviorInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.call(this)}return _createClass(t,[{key:"computed",value:function(){return null}},{key:"watch",value:function(){return null}},{key:"beforeCreate",value:function(){}},{key:"created",value:function(){}},{key:"beforeMount",value:function(){}},{key:"mounted",value:function(){}},{key:"beforeUpdate",value:function(e,t,r,n,o){}},{key:"updated",value:function(e,t,r,n,o){}},{key:"beforeDestroy",value:function(){}},{key:"destroyed",value:function(){}},{key:"provide",value:function(){return null}},{key:"inject",value:function(){return null}}]),t}();exports.default=OptionInstaller; | ||
"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 _BehaviorInstaller2=_interopRequireDefault(require("./BehaviorInstaller"));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 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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 OptionInstaller=function(){_inherits(t,_BehaviorInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.call(this)}return _createClass(t,[{key:"computed",value:function(){return null}},{key:"watch",value:function(){return null}},{key:"beforeCreate",value:function(){}},{key:"created",value:function(){}},{key:"beforeMount",value:function(){}},{key:"mounted",value:function(){}},{key:"beforeUpdate",value:function(e,t,r,n,o){}},{key:"updated",value:function(e,t,r,n,o){}},{key:"beforeDestroy",value:function(){}},{key:"destroyed",value:function(){}},{key:"provide",value:function(){return null}},{key:"inject",value:function(){return null}}]),t}();exports.default=OptionInstaller; |
@@ -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")),_Stream=require("../libs/Stream"),_Invocation=require("../libs/Invocation"),_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 _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 _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,o=new Array(t);r<t;r++)o[r]=e[r];return o}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return a}}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}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 o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);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 PropertiesInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"lifetimes",value:function(e,t,r){return{attached:function(){var r=this,e=t.get("properties");e&&Object.entries(e).filter(function(e){e=_slicedToArray(e,2)[1];return(0,_common.isFunction)(e.validator)}).forEach(function(e){var t=_slicedToArray(e,2),e=t[0];t[1].validator.apply(r,[r.data[e]])})}}}},{key:"install",value:function(e,t,r){r=Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.properties()})),[r.props,r.properties])),r=_Stream.Stream.of(Object.entries(r)).map(function(e){var r,o,n,t=_slicedToArray(e,2),e=t[0],t=t[1];if(t===Number)return[e,{type:Number,value:0}];if(t===String)return[e,{type:String,value:""}];if(t===Boolean)return[e,{type:Boolean,value:!1}];if(t===Array)return[e,{type:Array,value:[]}];if(t===Object)return[e,{type:Object,value:null}];if(null===t)return[e,{type:null,value:null}];if((0,_common.isPlainObject)(t)){var a=Object.assign({},{type:Array.isArray(t.type)?t.type[0]||null:Array.isArray(t.optionalTypes)?t.optionalTypes[0]:t.type||Object},(0,_common.removeEmpty)({optionalTypes:Array.isArray(t.type)?_toConsumableArray(t.type).concat(Array.isArray(t.optionalTypes)?t.optionalTypes:[]):Array.isArray(t.optionalTypes)?_toConsumableArray(t.optionalTypes):null}),Object.hasOwnProperty.call(t,"value")?(0,_common.isFunction)(t.value)?{default:t.value}:{value:t.value}:Object.hasOwnProperty.call(t,"default")?(0,_common.isFunction)(t.default)?{default:t.default}:{value:t.default}:[Number,String,Boolean,Array].includes(t.type)?{value:t.type.call(void 0).valueOf()}:Object===t.type?{value:null}:null);return((0,_common.isFunction)(t.observer)||(0,_common.isFunction)(t.validator)||!0===t.required)&&Object.assign(a,{required:t.required,validator:(r=e.toString(),o=t.required,n=t.validator,function(e,t){!0!==o||null!=e&&""!==e?(0,_common.isFunction)(n)&&(n.call(this,e,t)||console.warn("".concat(this.is,': custom validator failed for prop "').concat(r,'"'))):console.warn('Missing required prop: "'.concat(r,'"'))}),observer:(0,_Invocation.Invocation)(t.observer,function(e,t){a.validator.call(this,e,t)})}),[e,a]}throw new Error("Bad type definition ".concat(t&&(t.name||t.toString())," for ").concat(t))}).collect(_Stream.Collectors.toMap());t.set("properties",Object.assign({},r))}}]),t}();exports.default=PropertiesInstaller; | ||
"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")),_Stream=require("../libs/Stream"),_Invocation=require("../libs/Invocation"),_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 _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 _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,o=new Array(t);r<t;r++)o[r]=e[r];return o}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return a}}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 o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 o=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);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 PropertiesInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"lifetimes",value:function(e,t,r){return{attached:function(){var r=this,e=t.get("properties");e&&Object.entries(e).filter(function(e){e=_slicedToArray(e,2)[1];return(0,_common.isFunction)(e.validator)}).forEach(function(e){var e=_slicedToArray(e,2),t=e[0];e[1].validator.apply(r,[r.data[t]])})}}}},{key:"install",value:function(e,t,r){e=Object.assign.apply(void 0,[{}].concat(_toConsumableArray(e.installers.map(function(e){return e.properties()})),[r.props,r.properties])),r=_Stream.Stream.of(Object.entries(e)).map(function(e){var r,o,n,a,e=_slicedToArray(e,2),t=e[0],e=e[1];if(e===Number)return[t,{type:Number,value:0}];if(e===String)return[t,{type:String,value:""}];if(e===Boolean)return[t,{type:Boolean,value:!1}];if(e===Array)return[t,{type:Array,value:[]}];if(e===Object)return[t,{type:Object,value:null}];if(null===e)return[t,{type:null,value:null}];if((0,_common.isPlainObject)(e))return r=Object.assign({},{type:Array.isArray(e.type)?e.type[0]||null:Array.isArray(e.optionalTypes)?e.optionalTypes[0]:e.type||Object},(0,_common.removeEmpty)({optionalTypes:Array.isArray(e.type)?_toConsumableArray(e.type).concat(Array.isArray(e.optionalTypes)?e.optionalTypes:[]):Array.isArray(e.optionalTypes)?_toConsumableArray(e.optionalTypes):null}),Object.hasOwnProperty.call(e,"value")?(0,_common.isFunction)(e.value)?{default:e.value}:{value:e.value}:Object.hasOwnProperty.call(e,"default")?(0,_common.isFunction)(e.default)?{default:e.default}:{value:e.default}:[Number,String,Boolean,Array].includes(e.type)?{value:e.type.call(void 0).valueOf()}:Object===e.type?{value:null}:null),((0,_common.isFunction)(e.observer)||(0,_common.isFunction)(e.validator)||!0===e.required)&&Object.assign(r,{required:e.required,validator:(o=t.toString(),n=e.required,a=e.validator,function(e,t){!0!==n||null!=e&&""!==e?(0,_common.isFunction)(a)&&(a.call(this,e,t)||console.warn("".concat(this.is,': custom validator failed for prop "').concat(o,'"'))):console.warn('Missing required prop: "'.concat(o,'"'))}),observer:(0,_Invocation.Invocation)(e.observer,function(e,t){r.validator.call(this,e,t)})}),[t,r];throw new Error("Bad type definition ".concat(e&&(e.name||e.toString())," for ").concat(e))}).collect(_Stream.Collectors.toMap());t.set("properties",Object.assign({},r))}}]),t}();exports.default=PropertiesInstaller; |
@@ -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"),_Blend=require("../libs/Blend");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 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}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,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var ANCESTOR_TAG_OBS="ancestor-".concat((0,_common.uuid)()),DESCENDANT_TAG_OBS="descendant-".concat((0,_common.uuid)()),ProvideSign=Symbol("__wxProvide__"),InjectSign=Symbol("__wxInject__"),ProvideBehavior=Behavior({}),InjectBehavior=Behavior({}),LinkBehavior=Behavior({relations:(_defineProperty(_relations={},ANCESTOR_TAG_OBS,{type:"ancestor",target:ProvideBehavior,linked:function(e){var r,n=this,t=getCurrentPages().find(function(e){return e.__wxWebviewId__===n.__wxWebviewId__}),o=Reflect.get(e,ProvideSign),e=Reflect.get(this,InjectSign),i=Object.assign({},Reflect.get(t,ProvideSign),Reflect.get(this,ProvideSign),o);Reflect.defineProperty(this,ProvideSign,i),e&&(r={},Object.entries(e).forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];Object.assign(r,_defineProperty({},e,Reflect.get(i,t.from)||((0,_common.isFunction)(t.default)?t.default.call(n):t.default)))}),Object.keys(r).length&&this.setData(r))},unlinked:function(){Reflect.deleteProperty(this,ProvideSign),Reflect.deleteProperty(this,InjectSign)}}),_defineProperty(_relations,DESCENDANT_TAG_OBS,{type:"descendant",target:InjectBehavior}),_relations)}),ProviderInstaller=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(n,o,e,t,r){t.behaviors=(t.behaviors||[]).concat([Behavior({attached:function(){var e=o.get("provide"),t=o.get("inject"),r=n.getRuntimeContextSingleton(this).get();(0,_common.isFunction)(e)&&(r=e.call(r),Object.defineProperty(this,ProvideSign,{enumerable:!1,configurable:!0,value:r})),t&&Object.defineProperty(this,InjectSign,{enumerable:!1,configurable:!0,value:t})}}),ProvideBehavior,InjectBehavior,LinkBehavior])}},{key:"install",value:function(e,t,r){try{var n={},o=[];e.installers.map(function(e){return e.provide()}).concat((r||{}).provide).forEach(function(e){e&&((0,_common.isFunction)(e)?o.push(e):Object.assign(n,e))});(o.length||Object.keys(n).length)&&t.set("provide",(0,_Blend.Blend)(n,function(){var r=this;return o.reduce(function(e,t){return Object.assign(e,t.call(r))},{})}))}catch(e){throw e}try{var i={};e.installers.map(function(e){return e.inject()}).concat((r||{}).inject).forEach(function(e){e&&(Array.isArray(e)?e.forEach(function(e){(0,_common.isString)(e)||(0,_common.isSymbol)(e)?Object.assign(i,_defineProperty({},e,{from:e,default:void 0})):Object.entries(e).forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];Object.assign(i,_defineProperty({},e,{from:e,default:(0,_common.isPlainObject)(t)?t.default:void 0}))})}):Object.entries(e).forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];Object.assign(i,_defineProperty({},e,{from:e,default:(0,_common.isPlainObject)(t)?t.default:void 0}))}))}),Object.keys(i).length&&t.set("inject",i)}catch(e){throw e}}}]),t}();exports.default=ProviderInstaller; | ||
"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"),_Blend=require("../libs/Blend");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 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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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}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,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var ANCESTOR_TAG_OBS="ancestor-".concat((0,_common.uuid)()),DESCENDANT_TAG_OBS="descendant-".concat((0,_common.uuid)()),ProvideSign=Symbol("__wxProvide__"),InjectSign=Symbol("__wxInject__"),ProvideBehavior=Behavior({}),InjectBehavior=Behavior({}),LinkBehavior=Behavior({relations:(_defineProperty(_relations={},ANCESTOR_TAG_OBS,{type:"ancestor",target:ProvideBehavior,linked:function(e){var r,n=this,t=getCurrentPages().find(function(e){return e.__wxWebviewId__===n.__wxWebviewId__}),e=Reflect.get(e,ProvideSign),o=Reflect.get(this,InjectSign),i=Object.assign({},Reflect.get(t,ProvideSign),Reflect.get(this,ProvideSign),e);Reflect.defineProperty(this,ProvideSign,i),o&&(r={},Object.entries(o).forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];Object.assign(r,_defineProperty({},t,Reflect.get(i,e.from)||((0,_common.isFunction)(e.default)?e.default.call(n):e.default)))}),Object.keys(r).length&&this.setData(r))},unlinked:function(){Reflect.deleteProperty(this,ProvideSign),Reflect.deleteProperty(this,InjectSign)}}),_defineProperty(_relations,DESCENDANT_TAG_OBS,{type:"descendant",target:InjectBehavior}),_relations)}),ProviderInstaller=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(n,o,e,t,r){t.behaviors=(t.behaviors||[]).concat([Behavior({attached:function(){var e=o.get("provide"),t=o.get("inject"),r=n.getRuntimeContextSingleton(this).get();(0,_common.isFunction)(e)&&(e=e.call(r),Object.defineProperty(this,ProvideSign,{enumerable:!1,configurable:!0,value:e})),t&&Object.defineProperty(this,InjectSign,{enumerable:!1,configurable:!0,value:t})}}),ProvideBehavior,InjectBehavior,LinkBehavior])}},{key:"install",value:function(e,t,r){try{var n={},o=[];e.installers.map(function(e){return e.provide()}).concat((r||{}).provide).forEach(function(e){e&&((0,_common.isFunction)(e)?o.push(e):Object.assign(n,e))});(o.length||Object.keys(n).length)&&t.set("provide",(0,_Blend.Blend)(n,function(){var r=this;return o.reduce(function(e,t){return Object.assign(e,t.call(r))},{})}))}catch(e){throw e}try{var i={};e.installers.map(function(e){return e.inject()}).concat((r||{}).inject).forEach(function(e){e&&(Array.isArray(e)?e.forEach(function(e){(0,_common.isString)(e)||(0,_common.isSymbol)(e)?Object.assign(i,_defineProperty({},e,{from:e,default:void 0})):Object.entries(e).forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];Object.assign(i,_defineProperty({},t,{from:t,default:(0,_common.isPlainObject)(e)?e.default:void 0}))})}):Object.entries(e).forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];Object.assign(i,_defineProperty({},t,{from:t,default:(0,_common.isPlainObject)(e)?e.default:void 0}))}))}),Object.keys(i).length&&t.set("inject",i)}catch(e){throw e}}}]),t}();exports.default=ProviderInstaller; |
@@ -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"),_Stream=require("../libs/Stream"),_MPExtender=_interopRequireDefault(require("./MPExtender"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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}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 _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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var PARENT_TAG_OBS="parent-".concat((0,_common.uuid)()),CHILD_TAG_OBS="child-".concat((0,_common.uuid)()),RelationSign=Symbol("__wxREL__"),ExecutedDescendantSign=Symbol("__wxEXE_DESC__"),RelationInjection={injectParent:function(e,t){Object.defineProperty(e,"$parent",{configurable:!0,enumerable:!1,writable:!1,value:t})},deleteParent:function(e){Reflect.deleteProperty(e,"$parent")},appendChild:function(e,t){Reflect.has(e,"$children")||Object.defineProperty(e,"$children",{configurable:!0,enumerable:!1,writable:!1,value:[]});var n=Reflect.get(t,"__wxExparserNodeId__");e.$children.some(function(e){return Reflect.get(e,"__wxExparserNodeId__")===n})||e.$children.push(t)},removeChild:function(e,t){var n;Reflect.has(e,"$children")&&(n=Reflect.get(t,"__wxExparserNodeId__"),0<=(t=e.$children.findIndex(function(e){return Reflect.get(e,"__wxExparserNodeId__")===n}))&&e.$children.splice(t,1),e.$children.length||Reflect.deleteProperty(e,"$children"))}},RelationshipManager={get:function(e){return Reflect.get(e,RelationSign)},set:function(e,t){Object.defineProperty(e,RelationSign,{value:t,configurable:!0,enumerable:!1,writable:!1})},delete:function(e){Reflect.deleteProperty(e,RelationSign)},exists:function(e){return Reflect.has(e,RelationSign)},call:function(n,r,e,t,i){var o=RelationshipManager.get(r);o&&o[e]&&(!o[e].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!n.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(e=RelationshipManager.get(n))[t]&&e[t].forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];t.target!==ParentBehavior&&t.target!==ChildBehavior&&r.hasBehavior(t.target)&&(0,_common.isFunction)(t[i])&&t[i].call(_MPExtender.default.getRuntimeContext(n),_MPExtender.default.getRuntimeContext(r),e)}))},callOnce:function(n,r,i,e,t,o){var a=[],l=RelationshipManager.get(r);return l&&l[t]&&(!l[t].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!i.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(t=RelationshipManager.get(i))[e]&&t[e].forEach(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];n.includes(e)||t.target!==ParentBehavior&&t.target!==ChildBehavior&&r.hasBehavior(t.target)&&(0,_common.isFunction)(t[o])&&(a.push(e),t[o].call(_MPExtender.default.getRuntimeContext(i),_MPExtender.default.getRuntimeContext(r),e))})),a}},ExecutedRelationsInstallBehavior=Behavior({created:function(){Object.defineProperty(this,ExecutedDescendantSign,{configurable:!0,enumerable:!1,value:[],writable:!1})},detached:function(){var e=Reflect.get(this,ExecutedDescendantSign);Array.isArray(e)&&e.splice(0),Reflect.deleteProperty(this,ExecutedDescendantSign)}}),ExecutedRelationCollection={get:function(e){return Reflect.get(e,ExecutedDescendantSign)},push:function(e,t){Array.prototype.push.apply(this.get(e),t)}},ParentBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationshipManager.exists(this)?Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&RelationInjection.injectParent(this,_MPExtender.default.getRuntimeContext(this)):Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&RelationInjection.injectParent(this,e)},detached:function(){RelationInjection.deleteParent(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__")&&RelationInjection.appendChild(e,_MPExtender.default.getRuntimeContext(this))},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.removeChild(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:"definitionFilter",value:function(e,t,n,r,i){r.behaviors=[ExecutedRelationsInstallBehavior,ParentBehavior,ChildBehavior].concat(r.behaviors||[])}},{key:"lifetimes",value:function(e,t,n){return{created:function(){var e;n.relations&&(e=_Stream.Stream.of(Object.entries(n.relations)).collect(_Stream.Collectors.groupingBy(function(e){return _slicedToArray(e,2)[1].type})),RelationshipManager.set(this,e))},attached:function(){var e=ExecutedRelationCollection.get(this);Array.isArray(e)&&e.splice(0)}}}},{key:"install",value:function(a,t,n){var r={};a.installers.forEach(function(e){Object.assign(r,e.relations(a,t,n))}),Object.assign(r,n.relations);var e=_Stream.Stream.of(Object.entries(r)).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})),i=e.ancestor,e=e.descendant;Array.isArray(i)&&i.forEach(function(e){var e=_slicedToArray(e,2),n=e[0],e=e[1],r=e.linked,i=e.linkChanged,o=e.unlinked;(0,_common.isFunction)(r)&&(e.linked=function(e){var t=ExecutedRelationCollection.get(this),t=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linked");t.length&&ExecutedRelationCollection.push(this,t),r.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n)}),(0,_common.isFunction)(i)&&(e.linkChanged=function(e){i.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n);var t=ExecutedRelationCollection.get(this),e=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linkChanged");e.length&&ExecutedRelationCollection.push(this,e)}),(0,_common.isFunction)(o)&&(e.unlinked=function(e){o.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n);var t=ExecutedRelationCollection.get(this),e=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linkChanged");e.length&&ExecutedRelationCollection.push(this,e)})}),t.set("relations",Object.assign(r,i?_Stream.Stream.of(i).collect(_Stream.Collectors.toMap()):null,e?_Stream.Stream.of(e).collect(_Stream.Collectors.toMap()):null,(_defineProperty(e={},PARENT_TAG_OBS,{type:"parent",target:ParentBehavior,linked:function(e){var t=this,n=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.removeChild(n,this),RelationInjection.injectParent(this,a.getRuntimeContextSingleton(e).get()),RelationshipManager.call(this,e,"child","parent","linked")},linkChanged:function(e){RelationshipManager.call(this,e,"child","parent","linkChanged")},unlinked:function(e){RelationshipManager.call(this,e,"child","parent","unlinked"),RelationInjection.deleteParent(this)}}),_defineProperty(e,CHILD_TAG_OBS,{type:"child",target:ChildBehavior,linked:function(e){var t=this,n=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.appendChild(this,a.getRuntimeContextSingleton(e).get()),RelationInjection.removeChild(n,e),RelationshipManager.call(this,e,"parent","child","linked")},linkChanged:function(e){RelationshipManager.call(this,e,"parent","child","linkChanged")},unlinked:function(e){RelationshipManager.call(this,e,"parent","child","unlinked"),RelationInjection.removeChild(this,e)}}),e)))}},{key:"build",value:function(e,t,n){if("string"==typeof __wxAppCurrentFile__&&__wxConfig){var r=__wxAppCurrentFile__.replace(/.js$/,"");if(0<=__wxConfig.pages.indexOf(r))return null}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"),_MPExtender=_interopRequireDefault(require("./MPExtender"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 _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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var PARENT_TAG_OBS="parent-".concat((0,_common.uuid)()),CHILD_TAG_OBS="child-".concat((0,_common.uuid)()),RelationSign=Symbol("__wxREL__"),ExecutedDescendantSign=Symbol("__wxEXE_DESC__"),RelationInjection={injectParent:function(e,t){Object.defineProperty(e,"$parent",{configurable:!0,enumerable:!1,writable:!1,value:t})},deleteParent:function(e){Reflect.deleteProperty(e,"$parent")},appendChild:function(e,t){Reflect.has(e,"$children")||Object.defineProperty(e,"$children",{configurable:!0,enumerable:!1,writable:!1,value:[]});var n=Reflect.get(t,"__wxExparserNodeId__");e.$children.some(function(e){return Reflect.get(e,"__wxExparserNodeId__")===n})||e.$children.push(t)},removeChild:function(e,t){var n;Reflect.has(e,"$children")&&(n=Reflect.get(t,"__wxExparserNodeId__"),0<=(t=e.$children.findIndex(function(e){return Reflect.get(e,"__wxExparserNodeId__")===n}))&&e.$children.splice(t,1),e.$children.length||Reflect.deleteProperty(e,"$children"))}},RelationshipManager={get:function(e){return Reflect.get(e,RelationSign)},set:function(e,t){Object.defineProperty(e,RelationSign,{value:t,configurable:!0,enumerable:!1,writable:!1})},delete:function(e){Reflect.deleteProperty(e,RelationSign)},exists:function(e){return Reflect.has(e,RelationSign)},call:function(n,r,e,t,i){var o=RelationshipManager.get(r);o&&o[e]&&(!o[e].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!n.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(o=RelationshipManager.get(n))[t]&&o[t].forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];e.target!==ParentBehavior&&e.target!==ChildBehavior&&r.hasBehavior(e.target)&&(0,_common.isFunction)(e[i])&&e[i].call(_MPExtender.default.getRuntimeContext(n),_MPExtender.default.getRuntimeContext(r),t)}))},callOnce:function(n,r,i,e,t,o){var a=[],l=RelationshipManager.get(r);return l&&l[t]&&(!l[t].some(function(e){e=_slicedToArray(e,2)[1];return!(!e.target||!i.hasBehavior(e.target))&&e.target!==ParentBehavior&&e.target!==ChildBehavior})||(l=RelationshipManager.get(i))[e]&&l[e].forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];n.includes(t)||e.target!==ParentBehavior&&e.target!==ChildBehavior&&r.hasBehavior(e.target)&&(0,_common.isFunction)(e[o])&&(a.push(t),e[o].call(_MPExtender.default.getRuntimeContext(i),_MPExtender.default.getRuntimeContext(r),t))})),a}},ExecutedRelationsInstallBehavior=Behavior({created:function(){Object.defineProperty(this,ExecutedDescendantSign,{configurable:!0,enumerable:!1,value:[],writable:!1})},detached:function(){var e=Reflect.get(this,ExecutedDescendantSign);Array.isArray(e)&&e.splice(0),Reflect.deleteProperty(this,ExecutedDescendantSign)}}),ExecutedRelationCollection={get:function(e){return Reflect.get(e,ExecutedDescendantSign)},push:function(e,t){Array.prototype.push.apply(this.get(e),t)}},ParentBehavior=Behavior({attached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationshipManager.exists(this)?Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&RelationInjection.injectParent(this,_MPExtender.default.getRuntimeContext(this)):Reflect.get(this,"__wxExparserNodeId__")!==Reflect.get(e,"__wxExparserNodeId__")&&RelationInjection.injectParent(this,e)},detached:function(){RelationInjection.deleteParent(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__")&&RelationInjection.appendChild(e,_MPExtender.default.getRuntimeContext(this))},detached:function(){var t=this,e=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.removeChild(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:"definitionFilter",value:function(e,t,n,r,i){r.behaviors=[ExecutedRelationsInstallBehavior,ParentBehavior,ChildBehavior].concat(r.behaviors||[])}},{key:"lifetimes",value:function(e,t,n){return{created:function(){var e;n.relations&&(e=_Stream.Stream.of(Object.entries(n.relations)).collect(_Stream.Collectors.groupingBy(function(e){return _slicedToArray(e,2)[1].type})),RelationshipManager.set(this,e))},attached:function(){var e=ExecutedRelationCollection.get(this);Array.isArray(e)&&e.splice(0)}}}},{key:"install",value:function(a,t,n){var r={},e=(a.installers.forEach(function(e){Object.assign(r,e.relations(a,t,n))}),Object.assign(r,n.relations),_Stream.Stream.of(Object.entries(r)).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}))),i=e.ancestor,e=e.descendant;Array.isArray(i)&&i.forEach(function(e){var e=_slicedToArray(e,2),n=e[0],e=e[1],r=e.linked,i=e.linkChanged,o=e.unlinked;(0,_common.isFunction)(r)&&(e.linked=function(e){var t=ExecutedRelationCollection.get(this),t=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linked");t.length&&ExecutedRelationCollection.push(this,t),r.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n)}),(0,_common.isFunction)(i)&&(e.linkChanged=function(e){i.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n);var t=ExecutedRelationCollection.get(this),t=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linkChanged");t.length&&ExecutedRelationCollection.push(this,t)}),(0,_common.isFunction)(o)&&(e.unlinked=function(e){o.call(a.getRuntimeContextSingleton(this).get(),a.getRuntimeContextSingleton(e).get(),n);var t=ExecutedRelationCollection.get(this),t=RelationshipManager.callOnce(t,this,e,"descendant","ancestor","linkChanged");t.length&&ExecutedRelationCollection.push(this,t)})}),t.set("relations",Object.assign(r,i?_Stream.Stream.of(i).collect(_Stream.Collectors.toMap()):null,e?_Stream.Stream.of(e).collect(_Stream.Collectors.toMap()):null,(_defineProperty(i={},PARENT_TAG_OBS,{type:"parent",target:ParentBehavior,linked:function(e){var t=this,n=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.removeChild(n,this),RelationInjection.injectParent(this,a.getRuntimeContextSingleton(e).get()),RelationshipManager.call(this,e,"child","parent","linked")},linkChanged:function(e){RelationshipManager.call(this,e,"child","parent","linkChanged")},unlinked:function(e){RelationshipManager.call(this,e,"child","parent","unlinked"),RelationInjection.deleteParent(this)}}),_defineProperty(i,CHILD_TAG_OBS,{type:"child",target:ChildBehavior,linked:function(e){var t=this,n=getCurrentPages().find(function(e){return Reflect.get(e,"__wxWebviewId__")===Reflect.get(t,"__wxWebviewId__")});RelationInjection.appendChild(this,a.getRuntimeContextSingleton(e).get()),RelationInjection.removeChild(n,e),RelationshipManager.call(this,e,"parent","child","linked")},linkChanged:function(e){RelationshipManager.call(this,e,"parent","child","linkChanged")},unlinked:function(e){RelationshipManager.call(this,e,"parent","child","unlinked"),RelationInjection.removeChild(this,e)}}),i)))}},{key:"build",value:function(e,t,n){if("string"==typeof __wxAppCurrentFile__&&__wxConfig){var r=__wxAppCurrentFile__.replace(/.js$/,"");if(0<=__wxConfig.pages.indexOf(r))return null}return{relations:t.get("relations")}}}]),t}();exports.default=RelationsInstaller; |
@@ -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")),_Stream=require("../libs/Stream"),_common=require("../utils/common");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 _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 _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(o=r.next()).done)&&(a.push(o.value),!e||a.length!==e);i=!0);}catch(t){u=!0,n=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return a}}function _arrayWithHoles(t){if(Array.isArray(t))return t}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 StateInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"attemptToInstantiateProps",value:function(t,r,e,o){return t.createPropertiesCompatibleContext(r,e,o),_Stream.Stream.of(Object.entries(e)).map(function(t){var e=_slicedToArray(t,2),t=e[0],e=e[1];return[t,{type:e.type,optionalTypes:e.optionalTypes,observer:e.observer,value:r[t]}]}).collect(_Stream.Collectors.toMap())}},{key:"attemptToInstantiateData",value:function(t,e,r,o,n,a){return t.createDataCompatibleContext(e,r,o,null,n,a)}},{key:"definitionFilter",value:function(t,e,r,o,n){var a,i=e.get("state"),u=_Stream.Stream.of(Object.entries(e.get("properties"))).map(function(t){var e=_slicedToArray(t,2),t=e[0],e=e[1];return[t,Object.assign((0,_common.removeEmpty)({type:e.type,optionalTypes:e.optionalTypes,observer:e.observer}),{value:i[t]})]}).collect(_Stream.Collectors.toMap());for(a in i)u[a]&&delete i[a];o.behaviors=(o.behaviors||[]).concat([Behavior({properties:u,data:i})])}},{key:"install",value:function(t,e,r){var o={},n=e.get("methods"),a=e.has("constants")?e.get("constants"):t.createConstantsContext(r),r=this.attemptToInstantiateProps(t,o,e.get("properties")||{},a);this.attemptToInstantiateData(t,o,r,e.get("data")||{},n,a),e.set("state",o)}}]),e}();exports.default=StateInstaller; | ||
"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")),_Stream=require("../libs/Stream"),_common=require("../utils/common");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 _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 _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,n,a=[],i=!0,u=!1;try{for(r=r.call(t);!(i=(o=r.next()).done)&&(a.push(o.value),!e||a.length!==e);i=!0);}catch(t){u=!0,n=t}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return a}}function _arrayWithHoles(t){if(Array.isArray(t))return t}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),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 StateInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"attemptToInstantiateProps",value:function(t,r,e,o){return t.createPropertiesCompatibleContext(r,e,o),_Stream.Stream.of(Object.entries(e)).map(function(t){var t=_slicedToArray(t,2),e=t[0],t=t[1];return[e,{type:t.type,optionalTypes:t.optionalTypes,observer:t.observer,value:r[e]}]}).collect(_Stream.Collectors.toMap())}},{key:"attemptToInstantiateData",value:function(t,e,r,o,n,a){return t.createDataCompatibleContext(e,r,o,null,n,a)}},{key:"definitionFilter",value:function(t,e,r,o,n){var a,i=e.get("state"),u=_Stream.Stream.of(Object.entries(e.get("properties"))).map(function(t){var t=_slicedToArray(t,2),e=t[0],t=t[1];return[e,Object.assign((0,_common.removeEmpty)({type:t.type,optionalTypes:t.optionalTypes,observer:t.observer}),{value:i[e]})]}).collect(_Stream.Collectors.toMap());for(a in i)u[a]&&delete i[a];o.behaviors=(o.behaviors||[]).concat([Behavior({properties:u,data:i})])}},{key:"install",value:function(t,e,r){var o={},n=e.get("methods"),r=e.has("constants")?e.get("constants"):t.createConstantsContext(r),a=this.attemptToInstantiateProps(t,o,e.get("properties")||{},r);this.attemptToInstantiateData(t,o,a,e.get("data")||{},n,r),e.set("state",o)}}]),e}();exports.default=StateInstaller; |
@@ -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")),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 SetDataSign=Symbol("__wxSetData__"),UpdateInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(o,i,u,t,e){var a=i.get("beforeUpdate"),c=i.get("updated");t.behaviors=[Behavior({lifetimes:{created:function(){var r=this,n=this.setData;i.set("originalSetData",function(t,e){n.call(r,t,e)}),Object.defineProperty(this,SetDataSign,{get:function(){return n},enumerable:!1,configurable:!0}),this.setData=function(t,e){return a(o,i,u,r,t),Reflect.get(r,SetDataSign).call(r,t,function(){c(o,i,u,this,t),(0,_common.isFunction)(e)&&e.call(this)})}},detached:function(){this.setData=Reflect.get(this,SetDataSign),Reflect.deleteProperty(this,SetDataSign),i.delete("originalSetData")}}})].concat(t.behaviors||[])}},{key:"install",value:function(t,e,r){var u=t.installers.map(function(t){return t.beforeUpdate.bind(t)}).filter(function(t){return!!t}),a=t.installers.map(function(t){return t.updated.bind(t)}).filter(function(t){return!!t});e.set("beforeUpdate",function(e,r,n,o,i){u.forEach(function(t){return t(e,r,n,o,i)})}),e.set("updated",function(e,r,n,o,i){a.forEach(function(t){return t(e,r,n,o,i)})})}}]),e}();exports.default=UpdateInstaller; | ||
"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")),_common=require("../utils/common");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),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}}),Object.defineProperty(t,"prototype",{writable:!1}),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 n=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(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 SetDataSign=Symbol("__wxSetData__"),UpdateInstaller=function(){_inherits(e,_OptionInstaller2["default"]);var t=_createSuper(e);function e(){return _classCallCheck(this,e),t.apply(this,arguments)}return _createClass(e,[{key:"definitionFilter",value:function(o,i,u,t,e){var a=i.get("beforeUpdate"),c=i.get("updated");t.behaviors=[Behavior({lifetimes:{created:function(){var r=this,n=this.setData;i.set("originalSetData",function(t,e){n.call(r,t,e)}),Object.defineProperty(this,SetDataSign,{get:function(){return n},enumerable:!1,configurable:!0}),this.setData=function(t,e){return a(o,i,u,r,t),Reflect.get(r,SetDataSign).call(r,t,function(){c(o,i,u,this,t),(0,_common.isFunction)(e)&&e.call(this)})}},detached:function(){this.setData=Reflect.get(this,SetDataSign),Reflect.deleteProperty(this,SetDataSign),i.delete("originalSetData")}}})].concat(t.behaviors||[])}},{key:"install",value:function(t,e,r){var u=t.installers.map(function(t){return t.beforeUpdate.bind(t)}).filter(function(t){return!!t}),a=t.installers.map(function(t){return t.updated.bind(t)}).filter(function(t){return!!t});e.set("beforeUpdate",function(e,r,n,o,i){u.forEach(function(t){return t(e,r,n,o,i)})}),e.set("updated",function(e,r,n,o,i){a.forEach(function(t){return t(e,r,n,o,i)})})}}]),e}();exports.default=UpdateInstaller; |
@@ -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"),_Stream=require("../libs/Stream"),_CompatibleWatcher=_interopRequireDefault(require("../libs/CompatibleWatcher")),_index=_interopRequireDefault(require("../libs/fast-deep-equal/index")),_Invocation=require("../libs/Invocation"),_object=require("../utils/object"),_default=_interopRequireDefault(require("../libs/rfdc/default"));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 _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 _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,t=function(){};return{s:t,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t}}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 o,a=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}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,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}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 SWATSign=Symbol("__wxSWAT__"),DWATSign=Symbol("__wxDWAT__"),WatcherInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"selectData",value:function(e,t){if(t){if(!/[\w\.]+/.test(t))throw new Error('Failed watching path: "'.concat(t,'" Watcher only accepts simple dot-delimited paths. For full control, use a function instead.'));if(null!=e&&!(0,_common.isPrimitive)(e)||!t){var r=t.indexOf("."),r=t.substring(0,r<0?t.length:r),t=t.substring(r.length+1);return t?this.selectData(Reflect.get(e,r),t):Reflect.get(e,r)}}}},{key:"transformToObserverField",value:function(e){return e.replace(/\.(\d+)/g,function(){return"[".concat(arguments[1],"]")})}},{key:"getStaticWatcher",value:function(e,t){return Reflect.get(e,SWATSign).get(t)}},{key:"getDynamicWatchers",value:function(e){return Reflect.get(e,DWATSign)}},{key:"dynamicWatchersDefinition",value:function(c){var e,r=this,l=function(e,t){return r.selectData(e,t)};Object.hasOwnProperty.call(c,"$watch")||(e=function(e,r,t){if((0,_common.isFunction)(e)){var n=new _CompatibleWatcher.default(void 0,function(e,t){(0,_index.default)(e,t)||r.call(this,e,t)},function(e,t){n.immediate&&r.call(this,e,t)},t&&!0===t.immediate,!0,void 0,function(){return e.call(this)});n.once(c,[e.call(c)]);var o=Symbol("expOrFn");return Reflect.get(c,DWATSign).set(o,n),function(){Reflect.get(c,DWATSign).delete(o)}}if((0,_common.isString)(e)){var a=new _CompatibleWatcher.default(e,function(e,t){(0,_index.default)(e,t)||r.call(this,e,t)},function(e,t){a.immediate&&r.call(this,e,t)},t&&!0===t.immediate,!0,void 0);a.once(c,[l(c.data,e)]);var i=Symbol("expOrFn");return Reflect.get(c,DWATSign).set(i,a),function(){Reflect.get(c,DWATSign).delete(i)}}throw new Error('"'.concat(e,'" is neither a string nor a function.'))},Object.defineProperty(c,"$watch",{configurable:!1,enumerable:!1,get:function(){return e}}))}},{key:"staticWatchersDefinition",value:function(e,t,r,n){function c(e,t){return l.getStaticWatcher(e,t)}var l=this,o=t.get("watch"),a=t.get("observers");n.behaviors=[Behavior({lifetimes:{created:function(){var n,e=(n=new Map,Object.entries(o).forEach(function(e){var t=_slicedToArray(e,2),r=t[0],e=t[1],t=l.transformToObserverField(r),o=e.filter(function(e){return!0===e.deep}),a=e.filter(function(e){return!0!==e.deep});o.length&&n.set("".concat(t,".**"),new _CompatibleWatcher.default(r,function(t,r){var n=this;(0,_index.default)(t,r)||o.forEach(function(e){e.handler.call(n,t,r)})},function(t,r){var n=this;o.forEach(function(e){!0===e.immediate&&e.handler.call(n,t,r)})},!0,!0,void 0)),a.length&&n.set(t,new _CompatibleWatcher.default(r,function(t,r){var n=this;(0,_index.default)(t,r)||a.forEach(function(e){e.handler.call(n,t,r)})},function(t,r){var n=this;a.forEach(function(e){!0===e.immediate&&e.handler.call(n,t,r)})},!0,!1,void 0))}),n);Object.defineProperty(this,SWATSign,{configurable:!1,enumerable:!1,value:e,writable:!1}),Object.defineProperty(this,DWATSign,{configurable:!1,enumerable:!1,value:new Map,writable:!1})},detached:function(){Reflect.deleteProperty(this,SWATSign),Reflect.deleteProperty(this,DWATSign)}}})].concat(n.behaviors||[]),n.behaviors.push(Behavior({created:function(){var e,t,r,n=_createForOfIteratorHelper(Reflect.get(this,SWATSign).keys());try{for(n.s();!(e=n.n()).done;){var o,a=e.value,i=c(this,a);i&&(t=this.data,r=i.path,o=l.selectData(t,r),i.once(this,[o]))}}catch(e){n.e(e)}finally{n.f()}},observers:_Stream.Stream.of(_toConsumableArray(new Set([].concat(_toConsumableArray(Object.keys(a)),_toConsumableArray(_Stream.Stream.of(Object.entries(o)).flatMap(function(e){var t=_slicedToArray(e,2),r=t[0],n=t[1],e=n.filter(function(e){return!0===e.deep}),t=n.filter(function(e){return!0!==e.deep}),n=l.transformToObserverField(r),r=[];return e.length&&r.push("".concat(n,".**")),t.length&&r.push("".concat(n)),r}))))).map(function(r){return[r,(0,_Invocation.Invocation)(a[r],null,function(e){var t=c(this,r);t&&t.call(this,[e])})]})).collect(_Stream.Collectors.toMap())}))}},{key:"updateDeepWatcherRef",value:function(e,t){var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var o,a=_slicedToArray(r.value,2)[1];a.deep&&(a.path?(o=(0,_object.traceObject)(e.data,a.path,!0,!1,void 0),a.oldValue=[this.selectData(o,a.path)]):a.oldValue=(0,_default.default)(a.oldValue))}}catch(e){n.e(e)}finally{n.f()}}},{key:"beforeUpdate",value:function(e,t,r,n,o){var a=Reflect.get(n,SWATSign);this.updateDeepWatcherRef(n,a,o);a=Reflect.get(n,DWATSign);this.updateDeepWatcherRef(n,a,o)}},{key:"definitionFilter",value:function(e,t,r,n,o){var a=t.get("watch"),i=t.get("state"),c=t.get("observers");i&&a&&(Object.keys(a).length||Object.keys(c).length)&&this.staticWatchersDefinition(e,t,r,n)}},{key:"lifetimes",value:function(e,t,r){var n=this;return{created:function(){var e;e=this,n.dynamicWatchersDefinition(e)}}}},{key:"install",value:function(t,r,n){var c=this,e=_Stream.Stream.of(Object.entries(Object.assign.apply(void 0,[{}].concat(_toConsumableArray(t.installers.map(function(e){return e.watch()})),[n.watch])))).map(function(e){var t=_slicedToArray(e,2),e=t[0],t=t[1];return[e,[].concat(t).map(function(t){var e,r,n,o={handler:null,deep:!1,immediate:!1};return(0,_common.isString)(t)?o.handler=function(){var e=this[t];(0,_common.isFunction)(e)&&e.apply(this,arguments)}:(0,_common.isFunction)(t)?o.handler=t:(0,_common.isPlainObject)(t)&&(e=t.immediate,r=t.deep,n=t.handler,o.immediate=!0===e,o.deep=!0===r,o.handler=(0,_common.isFunction)(n)?n:function(){var e=this[n];(0,_common.isFunction)(e)&&e.apply(this,arguments)}),o}).filter(function(e){return(0,_common.isFunction)(e.handler)})]}).filter(function(e){return 0<_slicedToArray(e,2)[1].length}).collect(_Stream.Collectors.toMap()),o=Object.assign.apply(void 0,[{}].concat(_toConsumableArray(t.installers.map(function(e){return e.observers(t,r,n)})),[n.observers]));Object.assign(o,{"**":(0,_Invocation.Invocation)(o["**"],null,function(){var e,t,r,e=(e=this,c.getDynamicWatchers(e));if(e&&e.size){var n,o=_createForOfIteratorHelper(e);try{for(o.s();!(n=o.n()).done;){var a,i=_slicedToArray(n.value,2)[1];i.path?(t=this.data,r=i.path,a=c.selectData(t,r),i.call(this,[a])):i.update(this)}}catch(e){o.e(e)}finally{o.f()}}})}),r.set("watch",e),r.set("observers",o)}}]),t}();exports.default=WatcherInstaller; | ||
"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"),_CompatibleWatcher=_interopRequireDefault(require("../libs/CompatibleWatcher")),_index=_interopRequireDefault(require("../libs/fast-deep-equal/index")),_Invocation=require("../libs/Invocation"),_default=_interopRequireDefault(require("../libs/rfdc/default"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}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 _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 _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 _createForOfIteratorHelper(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};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 o,a=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(i)throw o}}}}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,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}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),Object.defineProperty(e,"prototype",{writable:!1}),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}}),Object.defineProperty(e,"prototype",{writable:!1}),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 SWATSign=Symbol("__wxSWAT__"),DWATSign=Symbol("__wxDWAT__"),WatcherInstaller=function(){_inherits(t,_OptionInstaller2["default"]);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"selectData",value:function(e,t){if(t){if(!/[\w\.]+/.test(t))throw new Error('Failed watching path: "'.concat(t,'" Watcher only accepts simple dot-delimited paths. For full control, use a function instead.'));var r;if(null!=e&&!(0,_common.isPrimitive)(e)||!t)return r=t.indexOf("."),r=t.substring(0,r<0?t.length:r),(t=t.substring(r.length+1))?this.selectData(Reflect.get(e,r),t):Reflect.get(e,r)}}},{key:"transformToObserverField",value:function(e){return e.replace(/\.(\d+)/g,function(){return"[".concat(arguments[1],"]")})}},{key:"getStaticWatcher",value:function(e,t){return Reflect.get(e,SWATSign).get(t)}},{key:"getDynamicWatchers",value:function(e){return Reflect.get(e,DWATSign)}},{key:"dynamicWatchersDefinition",value:function(c){var e,r=this,l=function(e,t){return r.selectData(e,t)};Object.hasOwnProperty.call(c,"$watch")||(e=function(e,r,t){var n,o,a,i;if((0,_common.isFunction)(e))return(n=new _CompatibleWatcher.default(void 0,function(e,t){(0,_index.default)(e,t)||r.call(this,e,t)},function(e,t){n.immediate&&r.call(this,e,t)},t&&!0===t.immediate,!0,void 0,function(){return e.call(this)})).once(c,[e.call(c)]),o=Symbol("expOrFn"),Reflect.get(c,DWATSign).set(o,n),function(){Reflect.get(c,DWATSign).delete(o)};if((0,_common.isString)(e))return(a=new _CompatibleWatcher.default(e,function(e,t){(0,_index.default)(e,t)||r.call(this,e,t)},function(e,t){a.immediate&&r.call(this,e,t)},t&&!0===t.immediate,!0,void 0)).once(c,[l(c.data,e)]),i=Symbol("expOrFn"),Reflect.get(c,DWATSign).set(i,a),function(){Reflect.get(c,DWATSign).delete(i)};throw new Error('"'.concat(e,'" is neither a string nor a function.'))},Object.defineProperty(c,"$watch",{configurable:!1,enumerable:!1,get:function(){return e}}))}},{key:"staticWatchersDefinition",value:function(e,t,r,n){function c(e,t){return l.getStaticWatcher(e,t)}var l=this,o=t.get("watch"),a=t.get("observers"),u=t.get("computed");n.behaviors=[Behavior({lifetimes:{created:function(){n=new Map,Object.entries(o).forEach(function(e){var o,a,e=_slicedToArray(e,2),t=e[0],e=e[1],r=l.transformToObserverField(t),i=e.filter(function(e){return!0===e.deep}),c=e.filter(function(e){return!0!==e.deep});i.length&&((o=new _CompatibleWatcher.default(t,function(t,r){var n=this;(0,_index.default)(t,r)||i.forEach(function(e){e.handler.call(n,t,r)})},function(t,r){var n=this;i.forEach(function(e){e.enabled?!0===e.immediate&&e.handler.call(n,t,r):e.enabled=!0}),o.enabled=!0},!0,!0,void 0)).enabled=!Reflect.has(u,o.path),n.set("".concat(r,".**"),o)),c.length&&((a=new _CompatibleWatcher.default(t,function(t,r){var n=this;t!==r&&c.forEach(function(e){e.handler.call(n,t,r)})},function(t,r){var n=this;c.forEach(function(e){e.enabled?!0===e.immediate&&e.handler.call(n,t,r):e.enabled=!0}),a.enabled=!0},!0,!1,void 0)).enabled=!Reflect.has(u,a.path),n.set(r,a))});var n,e=n;Object.defineProperty(this,SWATSign,{configurable:!1,enumerable:!1,value:e,writable:!1}),Object.defineProperty(this,DWATSign,{configurable:!1,enumerable:!1,value:new Map,writable:!1})},detached:function(){Reflect.deleteProperty(this,SWATSign),Reflect.deleteProperty(this,DWATSign)}}})].concat(n.behaviors||[]),n.behaviors.push(Behavior({created:function(){var e,t,r,n=_createForOfIteratorHelper(Reflect.get(this,SWATSign).keys());try{for(n.s();!(e=n.n()).done;){var o,a=e.value,i=c(this,a);i&&i.enabled&&(t=this.data,r=i.path,o=l.selectData(t,r),i.once(this,[o]))}}catch(e){n.e(e)}finally{n.f()}},observers:_Stream.Stream.of(_toConsumableArray(new Set([].concat(_toConsumableArray(Object.keys(a)),_toConsumableArray(_Stream.Stream.of(Object.entries(o)).flatMap(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1],r=e.filter(function(e){return!0===e.deep}),e=e.filter(function(e){return!0!==e.deep}),t=l.transformToObserverField(t),n=[];return r.length&&n.push("".concat(t,".**")),e.length&&n.push("".concat(t)),n}))))).map(function(r){return[r,(0,_Invocation.Invocation)(a[r],null,function(e){var t=c(this,r);t&&(t.enabled?t.call(this,[e]):t.once(this,[e]))})]})).collect(_Stream.Collectors.toMap())}))}},{key:"updateDeepWatcherRef",value:function(e,t){var r,n=_createForOfIteratorHelper(t);try{for(n.s();!(r=n.n()).done;){var o=_slicedToArray(r.value,2)[1];o.deep&&(o.oldValue=(0,_default.default)(o.oldValue))}}catch(e){n.e(e)}finally{n.f()}}},{key:"beforeUpdate",value:function(e,t,r,n,o){var a=Reflect.get(n,SWATSign),a=(this.updateDeepWatcherRef(n,a,o),Reflect.get(n,DWATSign));this.updateDeepWatcherRef(n,a,o)}},{key:"definitionFilter",value:function(e,t,r,n,o){var a=t.get("watch"),i=t.get("state"),c=t.get("observers");i&&a&&(Object.keys(a).length||Object.keys(c).length)&&this.staticWatchersDefinition(e,t,r,n)}},{key:"lifetimes",value:function(e,t,r){var n=this;return{created:function(){var e;e=this,n.dynamicWatchersDefinition(e)}}}},{key:"install",value:function(t,r,n){var e,c=this,f=r.get("computed"),o=_objectSpread({},n.watch),a=_createForOfIteratorHelper(t.installers.map(function(e){return e.watch()}));try{for(a.s();!(e=a.n()).done;){var i=e.value;if(i)for(var l in i){var s=i[l];s&&(o[l]=[s].concat(o[l]||[]))}}}catch(e){a.e(e)}finally{a.f()}var p=_Stream.Stream.of(Object.entries(o)).map(function(e){var e=_slicedToArray(e,2),a=e[0],e=e[1];return[a,[].concat(e).map(function(t){var e,r,n,o={handler:null,deep:!1,immediate:!1,enabled:!f||!Reflect.has(f,a)||!0===t.immediate};return(0,_common.isString)(t)?o.handler=function(){var e=this[t];(0,_common.isFunction)(e)&&e.apply(this,arguments)}:(0,_common.isFunction)(t)?o.handler=t:(0,_common.isPlainObject)(t)&&(e=t.immediate,r=t.deep,n=t.handler,o.immediate=!0===e,o.deep=!0===r,o.handler=(0,_common.isFunction)(n)?n:function(){var e=this[n];(0,_common.isFunction)(e)&&e.apply(this,arguments)}),o}).filter(function(e){return(0,_common.isFunction)(e.handler)})]}).filter(function(e){return 0<_slicedToArray(e,2)[1].length}).collect(_Stream.Collectors.toMap()),u=Object.assign.apply(void 0,[{}].concat(_toConsumableArray(t.installers.map(function(e){return e.observers(t,r,n)})),[n.observers]));Object.assign(u,{"**":(0,_Invocation.Invocation)(u["**"],null,function(){r=this;var e,t,r=c.getDynamicWatchers(r);if(r&&r.size){var n,o=_createForOfIteratorHelper(r);try{for(o.s();!(n=o.n()).done;){var a,i=_slicedToArray(n.value,2)[1];i.path?(e=this.data,t=i.path,a=c.selectData(e,t),i.call(this,[a])):i.update(this)}}catch(e){o.e(e)}finally{o.f()}}})}),r.set("watch",p),r.set("observers",u)}}]),t}();exports.default=WatcherInstaller; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComponentEx=ComponentEx,exports.OptionInstaller=exports.MPExtender=exports.Extension=void 0,exports.PageEx=PageEx;var _MPExtender2=_interopRequireDefault(require("./core/MPExtender")),_OptionInstaller2=_interopRequireDefault(require("./core/OptionInstaller")),_MixinInstaller=_interopRequireDefault(require("./core/MixinInstaller"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_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(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(n=t.next()).done)&&(a.push(n.value),!r||a.length!==r);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,a=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(i)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var Extension={_installerClasses:new Map,use:function(e){this._installerClasses.set(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100)},mixin:function(e){_MixinInstaller.default.addGlobalMixin(e)}};function PageEx(e){var r=new _MPExtender2.default;if(Extension._installerClasses.size){var t,n=_createForOfIteratorHelper(Extension._installerClasses);try{for(n.s();!(t=n.n()).done;){var o=_slicedToArray(t.value,2),a=o[0],i=o[1];r.use(new a,i)}}catch(e){n.e(e)}finally{n.f()}}Page(r.extends(e))}function ComponentEx(e){var r=new _MPExtender2.default;if(Extension._installerClasses.size){var t,n=_createForOfIteratorHelper(Extension._installerClasses);try{for(n.s();!(t=n.n()).done;){var o=_slicedToArray(t.value,2),a=o[0],i=o[1];r.use(new a,i)}}catch(e){n.e(e)}finally{n.f()}}Component(r.extends(e))}exports.Extension=Extension;var MPExtender=_MPExtender2.default;exports.MPExtender=MPExtender;var OptionInstaller=_OptionInstaller2.default;exports.OptionInstaller=OptionInstaller; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComponentEx=ComponentEx,exports.OptionInstaller=exports.MPExtender=exports.Extension=void 0,exports.PageEx=PageEx;var _MPExtender2=_interopRequireDefault(require("./core/MPExtender")),_OptionInstaller2=_interopRequireDefault(require("./core/OptionInstaller")),_MixinInstaller=_interopRequireDefault(require("./core/MixinInstaller"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_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(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a=[],l=!0,i=!1;try{for(t=t.call(e);!(l=(n=t.next()).done)&&(a.push(n.value),!r||a.length!==r);l=!0);}catch(e){i=!0,o=e}finally{try{l||null==t.return||t.return()}finally{if(i)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,r){var t,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length)return n&&(e=n),t=0,{s:r=function(){},n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r};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 o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var Extension={_installerClasses:new Map,_globalStore:null,use:function(e){this._installerClasses.set(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100)},mixin:function(e){_MixinInstaller.default.addGlobalMixin(e)}};function PageEx(e){var r=new _MPExtender2.default;if(Extension._installerClasses.size){var t,n=_createForOfIteratorHelper(Extension._installerClasses);try{for(n.s();!(t=n.n()).done;){var o=_slicedToArray(t.value,2),a=o[0],l=o[1];r.use(new a,l)}}catch(e){n.e(e)}finally{n.f()}}Page(r.extends(e))}function ComponentEx(e){var r=new _MPExtender2.default;if(Extension._installerClasses.size){var t,n=_createForOfIteratorHelper(Extension._installerClasses);try{for(n.s();!(t=n.n()).done;){var o=_slicedToArray(t.value,2),a=o[0],l=o[1];r.use(new a,l)}}catch(e){n.e(e)}finally{n.f()}}Component(r.extends(e))}exports.Extension=Extension;var MPExtender=_MPExtender2.default,OptionInstaller=(exports.MPExtender=MPExtender,_OptionInstaller2.default);exports.OptionInstaller=OptionInstaller; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var CompatibleWatcher=function(){function l(e,t,i,n,r){var a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:[],o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null;_classCallCheck(this,l),_defineProperty(this,"_oldValue",[]),_defineProperty(this,"_callback",void 0),_defineProperty(this,"_once",void 0),_defineProperty(this,"_immediate",!1),_defineProperty(this,"_deep",!1),_defineProperty(this,"_path",""),_defineProperty(this,"_getter",void 0),this._callback=t,this._immediate=n,this._once=i,this._deep=r,this._path=e,this._oldValue=a,this._getter=o}return _createClass(l,[{key:"call",value:function(e,t){this._callback&&this._callback.apply(e,t.concat(this.oldValue)),this.oldValue=t}},{key:"once",value:function(e,t){this._once&&(this._once.apply(e,t.concat(this.oldValue)),this.oldValue=t,this._once=void 0)}},{key:"update",value:function(e,t){this._getter&&this.call(e,[this._getter.apply(e,t)])}},{key:"immediate",get:function(){return this._immediate},set:function(e){this._immediate=e}},{key:"deep",get:function(){return this._deep},set:function(e){this._deep=e}},{key:"path",get:function(){return this._path},set:function(e){this._path=e}},{key:"oldValue",get:function(){return this._oldValue},set:function(e){this._oldValue=e}},{key:"getter",get:function(){return this._getter},set:function(e){this._getter=e}}]),l}();exports.default=CompatibleWatcher; | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var CompatibleWatcher=function(){function l(e,t,i,n,r){var a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:[],o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null;_classCallCheck(this,l),_defineProperty(this,"_oldValue",[]),_defineProperty(this,"_callback",void 0),_defineProperty(this,"_once",void 0),_defineProperty(this,"_immediate",!1),_defineProperty(this,"_deep",!1),_defineProperty(this,"_path",""),_defineProperty(this,"_getter",void 0),_defineProperty(this,"_enabled",!0),this._callback=t,this._immediate=n,this._once=i,this._deep=r,this._path=e,this._oldValue=a,this._getter=o}return _createClass(l,[{key:"call",value:function(e,t){this._callback&&this._enabled&&this._callback.apply(e,t.concat(this.oldValue)),this.oldValue=t}},{key:"once",value:function(e,t){this._once&&(this._once.apply(e,t.concat(this.oldValue)),this.oldValue=t,this._once=void 0)}},{key:"update",value:function(e,t){this._getter&&this.call(e,[this._getter.apply(e,t)])}},{key:"immediate",get:function(){return this._immediate},set:function(e){this._immediate=e}},{key:"deep",get:function(){return this._deep},set:function(e){this._deep=e}},{key:"path",get:function(){return this._path},set:function(e){this._path=e}},{key:"oldValue",get:function(){return this._oldValue},set:function(e){this._oldValue=e}},{key:"getter",get:function(){return this._getter},set:function(e){this._getter=e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}}]),l}();exports.default=CompatibleWatcher; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _common=require("../utils/common");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}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var EventHandler=function(){function i(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,i),_defineProperty(this,"_callback",null),_defineProperty(this,"_count",-1),_defineProperty(this,"_release",null),_defineProperty(this,"_name",""),this._name=e,this._callback=t,this._count=n,this._release=r}return _createClass(i,[{key:"apply",value:function(e){(0,_common.isFunction)(this._callback)&&(-1===this._count?this._callback.apply(void 0,e):0<this._count&&(this._callback.apply(void 0,e),--this._count||(0,_common.isFunction)(this._release)&&(this._release.call(void 0,this._name,this._callback),this._release=null,this._callback=null)))}},{key:"equal",value:function(e){return this._callback===e}}]),i}(),EventEmitter=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_listeners",null)}return _createClass(e,[{key:"listeners",get:function(){return this._listeners||(this._listeners=new Map),this._listeners}},{key:"on",value:function(e,n){var r=this;(Array.isArray(e)?e:[e]).forEach(function(e){var t;r.listeners.has(e)?t=r.listeners.get(e):r.listeners.set(e,t=[]),t.some(function(e){return e.equal(n)})||t.push(new EventHandler(e,n))})}},{key:"once",value:function(e,t){var n,r=this;this.listeners.has(e)?n=this.listeners.get(e):this.listeners.set(e,n=[]),n.some(function(e){return e.equal(t)})||n.push(new EventHandler(e,t,1,function(e,t){r.off(e,t)}))}},{key:"off",value:function(e,t){var n,r;e?t?(n=this.listeners.get(e),!Array.isArray(n)||0<=(r=n.findIndex(function(e){return e.equal(t)}))&&n.splice(r,1)):(e=this.listeners.get(e),Array.isArray(e)&&e.splice(0)):this.listeners.clear()}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e=this.listeners.get(e);Array.isArray(e)&&e.forEach(function(e){e.apply(n)})}},{key:"$on",value:function(e,t){return this.on(e,t)}},{key:"$once",value:function(e,t){return this.once(e,t)}},{key:"$off",value:function(e,t){return this.off(e,t)}},{key:"$emit",value:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return this.emit.apply(this,[e].concat(n))}}]),e}();exports.default=EventEmitter; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _common=require("../utils/common");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),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var EventHandler=function(){function i(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,i),_defineProperty(this,"_callback",null),_defineProperty(this,"_count",-1),_defineProperty(this,"_release",null),_defineProperty(this,"_name",""),this._name=e,this._callback=t,this._count=n,this._release=r}return _createClass(i,[{key:"apply",value:function(e){(0,_common.isFunction)(this._callback)&&(-1===this._count?this._callback.apply(void 0,e):0<this._count&&(this._callback.apply(void 0,e),--this._count||(0,_common.isFunction)(this._release)&&(this._release.call(void 0,this._name,this._callback),this._release=null,this._callback=null)))}},{key:"equal",value:function(e){return this._callback===e}}]),i}(),EventEmitter=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"_listeners",null)}return _createClass(e,[{key:"listeners",get:function(){return this._listeners||(this._listeners=new Map),this._listeners}},{key:"on",value:function(e,n){var r=this;(Array.isArray(e)?e:[e]).forEach(function(e){var t;r.listeners.has(e)?t=r.listeners.get(e):r.listeners.set(e,t=[]),t.some(function(e){return e.equal(n)})||t.push(new EventHandler(e,n))})}},{key:"once",value:function(e,t){var n,r=this;this.listeners.has(e)?n=this.listeners.get(e):this.listeners.set(e,n=[]),n.some(function(e){return e.equal(t)})||n.push(new EventHandler(e,t,1,function(e,t){r.off(e,t)}))}},{key:"off",value:function(e,t){var n,r;e?t?(r=this.listeners.get(e),!Array.isArray(r)||0<=(n=r.findIndex(function(e){return e.equal(t)}))&&r.splice(n,1)):(r=this.listeners.get(e),Array.isArray(r)&&r.splice(0)):this.listeners.clear()}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e=this.listeners.get(e);Array.isArray(e)&&e.forEach(function(e){e.apply(n)})}},{key:"$on",value:function(e,t){return this.on(e,t)}},{key:"$once",value:function(e,t){return this.once(e,t)}},{key:"$off",value:function(e,t){return this.off(e,t)}},{key:"$emit",value:function(e){for(var t=arguments.length,n=new Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return this.emit.apply(this,[e].concat(n))}}]),e}();exports.default=EventEmitter; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Optional=void 0;var _common=require("../utils/common");function _classCallCheck(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,n.key,n)}}function _createClass(i,t,e){return t&&_defineProperties(i.prototype,t),e&&_defineProperties(i,e),i}var Optional=function(){function e(i,t){_classCallCheck(this,e),this._value=i,this.isNull=_common.isNull,t&&(0,_common.isFunction)(t.isNull)&&(this.isNull=t.isNull),this.o=t}return _createClass(e,[{key:"get",value:function(){if(this.isNull(this._value))throw new Error("optional is empty");return this._value}},{key:"isPresent",value:function(){return!this.isNull(this._value)}},{key:"ifPresent",value:function(i){if(!this.isNull(this._value)){if(!(0,_common.isFunction)(i))throw new Error("consumer is not a function");i(this._value)}}},{key:"filter",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("predicate is not a function");return!this.isNull(this._value)&&i(this._value)?e.of(this._value,this.o):e.of(void 0,this.o)}},{key:"map",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("mapper is not a function");if(this.isNull(this._value))return e.of(void 0,this.o);i=i(this._value);return this.isNull(i)?e.of(void 0,this.o):e.of(i,this.o)}},{key:"peek",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("peeker is not a function");return this.isNull(this._value)?e.of(void 0,this.o):(i(this._value),e.of(this._value,this.o))}},{key:"orElse",value:function(i){return this.isNull(this._value)?i:this._value}},{key:"orElseGet",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("supplier is not a function");return this.isNull(this._value)?i():this._value}},{key:"ifPresentOrElse",value:function(i,t){if(this.isNull(this._value)){if(!(0,_common.isFunction)(t))throw new Error("emptyAction is not a function");t()}else{if(!(0,_common.isFunction)(i))throw new Error("action is not a function");i(this._value)}}},{key:"or",value:function(i){if(this.isNull(this._value)){if(!(0,_common.isFunction)(i))throw new Error("optionalSupplier is not a function");return i()}return this}}],[{key:"of",value:function(i,t){return new e(i,t)}}]),e}();exports.Optional=Optional; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Optional=void 0;var _common=require("../utils/common");function _classCallCheck(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,n.key,n)}}function _createClass(i,t,e){return t&&_defineProperties(i.prototype,t),e&&_defineProperties(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}var Optional=function(){function e(i,t){_classCallCheck(this,e),this._value=i,this.isNull=_common.isNull,t&&(0,_common.isFunction)(t.isNull)&&(this.isNull=t.isNull),this.o=t}return _createClass(e,[{key:"get",value:function(){if(this.isNull(this._value))throw new Error("optional is empty");return this._value}},{key:"isPresent",value:function(){return!this.isNull(this._value)}},{key:"ifPresent",value:function(i){if(!this.isNull(this._value)){if(!(0,_common.isFunction)(i))throw new Error("consumer is not a function");i(this._value)}}},{key:"filter",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("predicate is not a function");return!this.isNull(this._value)&&i(this._value)?e.of(this._value,this.o):e.of(void 0,this.o)}},{key:"map",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("mapper is not a function");if(this.isNull(this._value))return e.of(void 0,this.o);i=i(this._value);return this.isNull(i)?e.of(void 0,this.o):e.of(i,this.o)}},{key:"peek",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("peeker is not a function");return this.isNull(this._value)?e.of(void 0,this.o):(i(this._value),e.of(this._value,this.o))}},{key:"orElse",value:function(i){return this.isNull(this._value)?i:this._value}},{key:"orElseGet",value:function(i){if(!(0,_common.isFunction)(i))throw new Error("supplier is not a function");return this.isNull(this._value)?i():this._value}},{key:"ifPresentOrElse",value:function(i,t){if(this.isNull(this._value)){if(!(0,_common.isFunction)(t))throw new Error("emptyAction is not a function");t()}else{if(!(0,_common.isFunction)(i))throw new Error("action is not a function");i(this._value)}}},{key:"or",value:function(i){if(this.isNull(this._value)){if(!(0,_common.isFunction)(i))throw new Error("optionalSupplier is not a function");return i()}return this}}],[{key:"of",value:function(i,t){return new e(i,t)}}]),e}();exports.Optional=Optional; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,n,t){return n&&_defineProperties(e.prototype,n),t&&_defineProperties(e,t),e}function _defineProperty(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Singleton=void 0;var Singleton=function(){function n(e){_classCallCheck(this,n),_defineProperty(this,"_instance",void 0),_defineProperty(this,"_constructor",function(){return null}),this._constructor=e}return _createClass(n,[{key:"get",value:function(){return void 0===this._instance&&(this._instance=this._constructor.apply(void 0,arguments)),this._instance}},{key:"release",value:function(){this._instance=void 0}}]),n}();exports.Singleton=Singleton; | ||
"use strict";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),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Singleton=void 0;var Singleton=function(){function t(e){_classCallCheck(this,t),_defineProperty(this,"_instance",void 0),_defineProperty(this,"_constructor",function(){return null}),this._constructor=e}return _createClass(t,[{key:"get",value:function(){return void 0===this._instance&&(this._instance=this._constructor.apply(void 0,arguments)),this._instance}},{key:"release",value:function(){this._instance=void 0}}]),t}();exports.Singleton=Singleton; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _classCallCheck(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,n){for(var t=0;t<n.length;t++){var e=n[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,e.key,e)}}function _createClass(r,n,t){return n&&_defineProperties(r.prototype,n),t&&_defineProperties(r,t),r}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_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(r,n){if(r){if("string"==typeof r)return _arrayLikeToArray(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(t="Object"===t&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,n):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t<n;t++)e[t]=r[t];return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stream=exports.Collectors=void 0;var Collectors={toList:function(){return function(r){return _toConsumableArray(r)}},toMap:function(){var t=function(r){return r[0]},e=function(r){return r[1]},o=!1;return 1===arguments.length&&!0===(arguments.length<=0?void 0:arguments[0])?o=!0:3<=arguments.length&&(t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],o=Boolean(arguments.length<=2?void 0:arguments[2])),function(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return o?(n=new Map,r.forEach(function(r){return n.set(t(r),e(r))})):(n={},r.forEach(function(r){return n[t(r)]=e(r)})),n}},toSet:function(){return function(r){return new Set(r)}},reducing:function(n,t){return function(r){return r.reduce(n,t)}},counting:function(){return function(r){return r.length}},maxBy:function(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return 0};return function(t){var e=t[0];return t.forEach(function(r,n){0<n&&0<o(t[n-1],t[n])&&(e=r)}),e}},minBy:function(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return 0};return function(t){var e=t[0];return t.forEach(function(r,n){0<n&&o(t[n-1],t[n])<0&&(e=r)}),e}},joining:function(n){return function(r){return r.join(n)}},groupingBy:function(e){var n=this,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return function(r){return n.reducing(function(r,n){var t=e(n);return o?r.has(t)?r.get(t).push(n):r.set(t,[n]):Object.hasOwnProperty.call(r,t)?r[t].push(n):r[t]=[n],r},o?new Map:{})(r)}}};exports.Collectors=Collectors;var Stream=function(){function n(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,n),this.arr=r}return _createClass(n,[{key:"flat",value:function(){return this.arr.reduce(function(r,n){return Array.isArray(n)?r.concat(n):(r.push(n),r)},[])}},{key:"flatMap",value:function(){return n.of(this.arr.map(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(r){return r})).flat()}},{key:"map",value:function(){return n.of(this.arr.map(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(r){return r}))}},{key:"collect",value:function(r){return"function"==typeof r?r(this.arr):null}},{key:"distinct",value:function(){return n.of(_toConsumableArray(new Set(_toConsumableArray(this.arr))))}},{key:"filter",value:function(){return n.of(this.arr.filter(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return!0}))}}],[{key:"of",value:function(){return new n(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}}]),n}();exports.Stream=Stream; | ||
"use strict";function _classCallCheck(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,t){for(var n=0;n<t.length;n++){var e=t[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,e.key,e)}}function _createClass(r,t,n){return t&&_defineProperties(r.prototype,t),n&&_defineProperties(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_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(r,t){if(r){if("string"==typeof r)return _arrayLikeToArray(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(n="Object"===n&&r.constructor?r.constructor.name:n)||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(r,t):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n<t;n++)e[n]=r[n];return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stream=exports.Collectors=void 0;var Collectors={toList:function(){return function(r){return _toConsumableArray(r)}},toMap:function(){var n=function(r){return r[0]},e=function(r){return r[1]},o=!1;return 1===arguments.length&&!0===(arguments.length<=0?void 0:arguments[0])?o=!0:3<=arguments.length&&(n=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],o=Boolean(arguments.length<=2?void 0:arguments[2])),function(){var t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return o?(t=new Map,r.forEach(function(r){return t.set(n(r),e(r))})):(t={},r.forEach(function(r){return t[n(r)]=e(r)})),t}},toSet:function(){return function(r){return new Set(r)}},reducing:function(t,n){return function(r){return r.reduce(t,n)}},counting:function(){return function(r){return r.length}},maxBy:function(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return 0};return function(n){var e=n[0];return n.forEach(function(r,t){0<t&&0<o(n[t-1],n[t])&&(e=r)}),e}},minBy:function(){var o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return 0};return function(n){var e=n[0];return n.forEach(function(r,t){0<t&&o(n[t-1],n[t])<0&&(e=r)}),e}},joining:function(t){return function(r){return r.join(t)}},groupingBy:function(e){var t=this,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return function(r){return t.reducing(function(r,t){var n=e(t);return o?r.has(n)?r.get(n).push(t):r.set(n,[t]):Object.hasOwnProperty.call(r,n)?r[n].push(t):r[n]=[t],r},o?new Map:{})(r)}}},Stream=(exports.Collectors=Collectors,function(){function t(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,t),this.arr=r}return _createClass(t,[{key:"flat",value:function(){return this.arr.reduce(function(r,t){return Array.isArray(t)?r.concat(t):(r.push(t),r)},[])}},{key:"flatMap",value:function(){return t.of(this.arr.map(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(r){return r})).flat()}},{key:"map",value:function(){return t.of(this.arr.map(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(r){return r}))}},{key:"collect",value:function(r){return"function"==typeof r?r(this.arr):null}},{key:"distinct",value:function(){return t.of(_toConsumableArray(new Set(_toConsumableArray(this.arr))))}},{key:"filter",value:function(){return t.of(this.arr.filter(0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return!0}))}}],[{key:"of",value:function(){return new t(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}}]),t}());exports.Stream=Stream; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Watcher=void 0;var _index=_interopRequireDefault(require("./fast-deep-equal/index")),_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,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):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,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var ValueWatcher=function(){function r(e){_classCallCheck(this,r),_defineProperty(this,"name",null),_defineProperty(this,"watching",void 0),_defineProperty(this,"current",void 0),_defineProperty(this,"prev",void 0),this.name=e}return _createClass(r,[{key:"prepare",value:function(e){this.watching=e}},{key:"accept",value:function(){return this.prev=this.current,this.current=this.watching,!(this.watching=void 0,_index.default)(this.current,this.prev)}},{key:"value",get:function(){return this.current}},{key:"previous",get:function(){return this.prev}}]),r}(),Watcher=function(){function t(e){var r=this;if(_classCallCheck(this,t),_defineProperty(this,"watchers",new Map),!(0,_common.isString)(e))throw new Error("Try subscribe invalid fields: ".concat(e.toString()));e.split(",").forEach(function(e){e=e.trim();return r.watchers.set(e,new ValueWatcher(e))})}return _createClass(t,[{key:"prepare",value:function(){var t,e,r,n=this;1===arguments.length?(t=arguments.length<=0?void 0:arguments[0])&&Object.keys(t).forEach(function(e){var r=n.watchers.get(e);r&&r.prepare(t[e])}):(r=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],(r=this.watchers.get(r))&&r.prepare(e))}},{key:"accept",value:function(r){var e=_toConsumableArray(this.watchers.values());return!!e.some(function(e){return e.accept()})&&((0,_common.isFunction)(r)&&(1<e.length?e.map(function(e){return[e.value,e.previous]}):[[e[0].value,e[0].previous]]).forEach(function(e){r.apply(void 0,_toConsumableArray(e))}),!0)}},{key:"names",get:function(){return _toConsumableArray(this.watchers.keys())}},{key:"values",get:function(){return _toConsumableArray(this.watchers.values()).map(function(e){return e.value})}}]),t}();exports.Watcher=Watcher; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Watcher=void 0;var _index=_interopRequireDefault(require("./fast-deep-equal/index")),_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,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):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,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var ValueWatcher=function(){function r(e){_classCallCheck(this,r),_defineProperty(this,"name",null),_defineProperty(this,"watching",void 0),_defineProperty(this,"current",void 0),_defineProperty(this,"prev",void 0),this.name=e}return _createClass(r,[{key:"prepare",value:function(e){this.watching=e}},{key:"accept",value:function(){return this.prev=this.current,this.current=this.watching,!(this.watching=void 0,_index.default)(this.current,this.prev)}},{key:"value",get:function(){return this.current}},{key:"previous",get:function(){return this.prev}}]),r}(),Watcher=function(){function t(e){var r=this;if(_classCallCheck(this,t),_defineProperty(this,"watchers",new Map),!(0,_common.isString)(e))throw new Error("Try subscribe invalid fields: ".concat(e.toString()));e.split(",").forEach(function(e){e=e.trim();return r.watchers.set(e,new ValueWatcher(e))})}return _createClass(t,[{key:"prepare",value:function(){var t,e,r,n=this;1===arguments.length?(t=arguments.length<=0?void 0:arguments[0])&&Object.keys(t).forEach(function(e){var r=n.watchers.get(e);r&&r.prepare(t[e])}):(r=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],(r=this.watchers.get(r))&&r.prepare(e))}},{key:"accept",value:function(r){var e=_toConsumableArray(this.watchers.values());return!!e.some(function(e){return e.accept()})&&((0,_common.isFunction)(r)&&(1<e.length?e.map(function(e){return[e.value,e.previous]}):[[e[0].value,e[0].previous]]).forEach(function(e){r.apply(void 0,_toConsumableArray(e))}),!0)}},{key:"names",get:function(){return _toConsumableArray(this.watchers.keys())}},{key:"values",get:function(){return _toConsumableArray(this.watchers.values()).map(function(e){return e.value})}}]),t}();exports.Watcher=Watcher; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createReactiveObject=createReactiveObject,exports.getData=getData,exports.selectPathRoot=selectPathRoot,exports.setData=setData,exports.splitPath=splitPath,exports.traceObject=traceObject;var _common=require("./common");function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}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 _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 selectPathRoot(e){var t=/^\$?[\w]+/.exec(e);if(t)return t[0];t=/^\[(\d+)\]+/.exec(e);if(t)return t[1];e=/^\.(\d+)/.exec(e);return e?e[1]:null}function splitPath(e){for(var t=[],r=e;r;){var n=selectPathRoot(r),o=Number.parseInt(n),r=(Number.isSafeInteger(o)?"."===r[0]?r.substring(n.length+1):r.substring(n.length+2):r.substring(n.length)).replace(/^\./,"");t.push(n)}return t}function traceObject(e,t,r,n,o){if(!e||(0,_common.isPrimitive)(e))return e;for(var c=splitPath(t),t={},i=e,a=t,s=0;s<c.length;++s){var u=c[s],i=Reflect.get(i,u),l=!r||!i||(0,_common.isPrimitive)(i)?i:Array.isArray(i)?_toConsumableArray(i):_objectSpread({},i);if(Reflect.set(a,u,s===c.length-1&&n?o:l),a=Reflect.get(a,u),!i||(0,_common.isPrimitive)(i))break}return t}function createReactiveObject(a,e){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"",o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,c=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null,i=7<arguments.length&&void 0!==arguments[7]?arguments[7]:null,f=8<arguments.length&&void 0!==arguments[8]?arguments[8]:0;return new Proxy(e,{get:function(n,e,t){var r=Reflect.get(n,e,t);if((0,_common.isFunction)(r)||(0,_common.isPrimitive)(r)||!r||(0,_common.isSymbol)(e))return(0,_common.isFunction)(o)&&(o("".concat(u?u+".":"").concat(e),r,f,n),"constructor"!==e&&Array.isArray(n)&&(0,_common.isFunction)(r))?new Proxy(r,{apply:function(e,t,r){(0,_common.isFunction)(c)&&c(u,e,t,r,f,n);r=e.apply(t,r);return(0,_common.isFunction)(i)&&i(u,r,f,n),r}}):r;if(Number.isSafeInteger(Number.parseInt(e))){t="".concat(u,"[").concat(e,"]");return(0,_common.isFunction)(o)&&o(t,r,f,n),createReactiveObject(a,r,s,t,o,l,c,i,f+1)}e="".concat(u?u+".":"").concat(e);return(0,_common.isFunction)(o)&&o(e,r,f,n),createReactiveObject(a,r,s,e,o,l,c,i,f+1)},set:function(e,t,r,n){if((0,_common.isSymbol)(t))return Reflect.set(e,t,r,n);var o=Number.parseInt(t);if(Number.isSafeInteger(o)){if(Array.isArray(e)){if((0,_common.isFunction)(s)){var c,i=Reflect.set(e,t,r,n);return i&&(c=selectPathRoot(u),o=Reflect.get(a,c),(0,_common.isFunction)(l)&&l(c,o,f,e),s(c,o)),i}return Reflect.set(e,t,r,n)}if(!(0,_common.isFunction)(s))return Reflect.set(e,t,r,n);i="".concat(u,"[").concat(t,"]");(0,_common.isFunction)(l)&&l(i,r,f,e),s(i,r)}else{if(Array.isArray(e)&&"length"===t)return Reflect.set(e,t,r,n);if(!(0,_common.isFunction)(s))return Reflect.set(e,t,r,n);t="".concat(u?u+".":"").concat(t);(0,_common.isFunction)(l)&&l(t,r,f,e),s(t,r)}return!0},deleteProperty:function(e,t){if(Array.isArray(e)){var r=Number.parseInt(t);if(Number.isSafeInteger(r))return Array.prototype.splice.call(e,r,1),(0,_common.isFunction)(s)&&(r="".concat(u),(0,_common.isFunction)(l)&&l(r,e,f,e),s(r,e)),!0}return!!Reflect.deleteProperty(e,t)&&((0,_common.isFunction)(s)&&(t="".concat(u),(0,_common.isFunction)(l)&&l(t,e,f,e),s(t,e)),!0)}})}function getData(e,t){var t=splitPath(t),r=e,n=void 0;return t.forEach(function(e){if(/\d+/.test(e))if(Array.isArray(r)){var t=parseInt(e);if(!Number.isSafeInteger(t))throw new Error('Unexpected range index "'.concat(t,'".'));n=r[t]}else n=r[e];else n=r[e];r=n}),n}function setData(t,c){Object.keys(c).forEach(function(e){var r=splitPath(e),n=c[e],o=t;r.forEach(function(e,t){if(t===r.length-1)o[e]=n;else if(/\d+/.test(e))if(Array.isArray(o)){t=parseInt(e);if(!Number.isSafeInteger(t))throw new Error('Unexpected range index "'.concat(t,'".'));o=o[t]}else o=o[e];else o=o[e]})})} | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createReactiveObject=createReactiveObject,exports.getData=getData,exports.selectPathParent=selectPathParent,exports.selectPathRoot=selectPathRoot,exports.setData=setData,exports.splitPath=splitPath,exports.traceObject=traceObject;var _common=require("./common");function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}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 _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 selectPathRoot(e){var t=/^\$?[\w]+/.exec(e);if(t)return t[0];t=/^\[(\d+)\]+/.exec(e);if(t)return t[1];t=/^\.(\d+)/.exec(e);return t?t[1]:null}function selectPathParent(e){var t=e.lastIndexOf("[");return 0<=(t=t<0?e.lastIndexOf("."):t)?e.substring(0,t):e}function splitPath(e){for(var t=[],r=e;r;){var n=selectPathRoot(r),o=Number.parseInt(n),r=(Number.isSafeInteger(o)?"."===r[0]?r.substring(n.length+1):r.substring(n.length+2):r.substring(n.length)).replace(/^\./,"");t.push(n)}return t}function traceObject(e,t,r,n,o){if(!e||(0,_common.isPrimitive)(e))return e;for(var c=splitPath(t),t={},a=e,i=t,s=0;s<c.length;++s){var u=c[s],a=Reflect.get(a,u),l=!r||!a||(0,_common.isPrimitive)(a)?a:Array.isArray(a)?_toConsumableArray(a):_objectSpread({},a);if(Reflect.set(i,u,s===c.length-1&&n?o:l),i=Reflect.get(i,u),!a||(0,_common.isPrimitive)(a))break}return t}function createReactiveObject(i,e){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"",r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,c=6<arguments.length&&void 0!==arguments[6]?arguments[6]:null,a=7<arguments.length&&void 0!==arguments[7]?arguments[7]:null,f=8<arguments.length&&void 0!==arguments[8]?arguments[8]:null,m=9<arguments.length&&void 0!==arguments[9]?arguments[9]:0;return new Proxy(e,{get:function(n,o,e){var t,e=Reflect.get(n,o,e);return(0,_common.isFunction)(e)||(0,_common.isPrimitive)(e)||!e||(0,_common.isSymbol)(o)?(0,_common.isFunction)(r)&&(r("".concat(u?u+".":"").concat(o),e,m,n),"constructor"!==o&&Array.isArray(n)&&(0,_common.isFunction)(e))?new Proxy(e,{apply:function(e,t,r){(0,_common.isFunction)(a)&&a(u,o,e,t,r,m,n);e=e.apply(t,r);return(0,_common.isFunction)(f)&&f(u,e,m,n),e}}):e:Number.isSafeInteger(Number.parseInt(o))?(t="".concat(u,"[").concat(o,"]"),(0,_common.isFunction)(r)&&r(t,e,m,n),createReactiveObject(i,e,s,t,r,l,c,a,f,m+1)):(t="".concat(u?u+".":"").concat(o),(0,_common.isFunction)(r)&&r(t,e,m,n),createReactiveObject(i,e,s,t,r,l,c,a,f,m+1))},set:function(e,t,r,n){if((0,_common.isSymbol)(t))return Reflect.set(e,t,r,n);var o=Number.parseInt(t);if(Number.isSafeInteger(o)){if(Array.isArray(e))return(0,_common.isFunction)(s)?((o=Reflect.set(e,t,r,n))&&(c=selectPathRoot(u),a=Reflect.get(i,c),(0,_common.isFunction)(l)&&l(c,a,m,e),s(c,a)),o):Reflect.set(e,t,r,n);if(!(0,_common.isFunction)(s))return Reflect.set(e,t,r,n);var c="".concat(u,"[").concat(t,"]");(0,_common.isFunction)(l)&&l(c,r,m,e),s(c,r)}else{if(Array.isArray(e)&&"length"===t)return Reflect.set(e,t,r,n);if(!(0,_common.isFunction)(s))return Reflect.set(e,t,r,n);var a="".concat(u?u+".":"").concat(t);(0,_common.isFunction)(l)&&l(a,r,m,e),s(a,r)}return!0},deleteProperty:function(e,t){var r;if(/^\d+$/.test(t)&&Array.isArray(e))return r=Number.parseInt(t),!!Reflect.deleteProperty(e,r)&&(r="".concat(u,"[").concat(r,"]"),(0,_common.isFunction)(c)&&c(r,m,e),!0);return!!Reflect.deleteProperty(e,t)&&(r="".concat(u?u+".":"").concat(t),(0,_common.isFunction)(c)&&c(r,m,e),!0)}})}function getData(e,t){var t=splitPath(t),r=e,n=void 0;return t.forEach(function(e){if(/\d+/.test(e))if(Array.isArray(r)){var t=parseInt(e);if(!Number.isSafeInteger(t))throw new Error('Unexpected range index "'.concat(t,'".'));n=r[t]}else n=r[e];else n=r[e];r=n}),n}function setData(t,c){Object.keys(c).forEach(function(e){var r=splitPath(e),n=c[e],o=t;r.forEach(function(e,t){if(t===r.length-1)o[e]=n;else if(/\d+/.test(e))if(Array.isArray(o)){t=parseInt(e);if(!Number.isSafeInteger(t))throw new Error('Unexpected range index "'.concat(t,'".'));o=o[t]}else o=o[e];else o=o[e]})})} |
{ | ||
"name": "wechat-mini-program-extend", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"repository": "git@github.com:sitorhy/wechat-mini-program-extend.git", | ||
@@ -5,0 +5,0 @@ "author": "sitorhy <sitorhy>", |
112
README.md
@@ -82,14 +82,14 @@ # 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.created > Page.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> | ||
+ 组件树内`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` 互斥,不要同时配置。 | ||
@@ -721,1 +721,91 @@ + 如果关闭掉开发工具的模拟器,`Page.onReady`不会触发,但`Page.onShow`会触发,再次打开模拟器,`Page.onReady`触发。 | ||
## 状态管理模式 | ||
接口标准移植自`Vuex`,可参考`Vuex`文档。 | ||
### **基本使用** | ||
🔴 `state`一般建议使用函数定义,如果多个状态管理共用一套配置会产生不可预料的冲突。 | ||
```javascript | ||
import { createStore } from "wechat-mini-program-extend/store"; | ||
const store = createStore({ | ||
state() { | ||
return { | ||
count: 0 | ||
}; | ||
}, | ||
mutations: { | ||
increment(state) { | ||
state.count++; | ||
} | ||
}, | ||
actions: { | ||
increment({commit}) { | ||
commit('increment'); | ||
} | ||
} | ||
}); | ||
export default store; // 导出 src/store/index.js | ||
``` | ||
```javascript | ||
import { ComponentEx } from "wechat-mini-program-extend"; | ||
import store from "path/store"; // 引入 store | ||
ComponentEx({ | ||
computed: { | ||
count: () => store.state.count; | ||
}, | ||
increment() { | ||
store.state.count++; | ||
} | ||
}); | ||
``` | ||
```xml | ||
<view> | ||
<text>{{ count }}</text> | ||
<view> | ||
<button bind:tap="increment">increment</button> | ||
</view> | ||
</view> | ||
``` | ||
### **组件绑定辅助函数** | ||
在`App`对象中配置全局容器`store`,全局容器会挂载到组件的`$store`属性。 | ||
```javascript | ||
// app.js | ||
import store from "path/store"; | ||
App({ | ||
store, | ||
onLaunch() { | ||
// ... | ||
}, | ||
globalData: { | ||
// ... | ||
} | ||
}); | ||
``` | ||
```javascript | ||
import {mapActions} from "wechat-mini-program-extend/store"; | ||
ComponentEx({ | ||
methods: { | ||
...mapActions(["increment"]) | ||
} | ||
}) | ||
``` | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
232821
52
385
810
31