From 26b46352dca531e4b0632df5f02cd47db3c38d19 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 9 Nov 2021 16:09:17 +0800 Subject: [PATCH] chore: build --- packages/uni-app-plus/dist/index.v3.js | 147 +- packages/uni-app-plus/dist/view.umd.js | 32142 +++++++++++++++-------- packages/uni-h5/dist/index.umd.min.js | 2 +- packages/uni-mp-alipay/dist/index.js | 4 +- packages/uni-mp-baidu/dist/index.js | 4 +- packages/uni-mp-kuaishou/dist/index.js | 4 +- packages/uni-mp-lark/dist/index.js | 4 +- packages/uni-mp-qq/dist/index.js | 4 +- packages/uni-mp-toutiao/dist/index.js | 4 +- packages/uni-mp-weixin/dist/index.js | 4 +- 10 files changed, 21161 insertions(+), 11158 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index bc6d879ff..7279af70f 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -234,6 +234,7 @@ var serviceContext = (function () { 'preLogin', 'closeAuthView', 'getCheckBoxState', + 'getUniverifyManager', 'share', 'shareWithSystem', 'showShareMenu', @@ -1534,7 +1535,7 @@ var serviceContext = (function () { "uni.chooseVideo.cancel": "Cancel", "uni.chooseVideo.sourceType.album": "Album", "uni.chooseVideo.sourceType.camera": "Camera", - "uni.previewImage.cancel": "Cancel", + "uni.chooseFile.notUserActivation": "File chooser dialog can only be shown with a user activation", "uni.previewImage.button.save": "Save Image", "uni.previewImage.save.success": "Saved successfully", "uni.previewImage.save.fail": "Save failed", @@ -1569,6 +1570,7 @@ var serviceContext = (function () { "uni.chooseVideo.cancel": "Cancelar", "uni.chooseVideo.sourceType.album": "Álbum", "uni.chooseVideo.sourceType.camera": "Cámara", + "uni.chooseFile.notUserActivation": "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario", "uni.previewImage.cancel": "Cancelar", "uni.previewImage.button.save": "Guardar imagen", "uni.previewImage.save.success": "Guardado exitosamente", @@ -1604,6 +1606,7 @@ var serviceContext = (function () { "uni.chooseVideo.cancel": "Annuler", "uni.chooseVideo.sourceType.album": "Album", "uni.chooseVideo.sourceType.camera": "Caméra", + "uni.chooseFile.notUserActivation": "La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur", "uni.previewImage.cancel": "Annuler", "uni.previewImage.button.save": "Guardar imagen", "uni.previewImage.save.success": "Enregistré avec succès", @@ -1639,6 +1642,7 @@ var serviceContext = (function () { "uni.chooseVideo.cancel": "取消", "uni.chooseVideo.sourceType.album": "从相册选择", "uni.chooseVideo.sourceType.camera": "拍摄", + "uni.chooseFile.notUserActivation": "文件选择器对话框只能在用户激活时显示", "uni.previewImage.cancel": "取消", "uni.previewImage.button.save": "保存图像", "uni.previewImage.save.success": "保存图像到相册成功", @@ -1674,6 +1678,7 @@ var serviceContext = (function () { "uni.chooseVideo.cancel": "取消", "uni.chooseVideo.sourceType.album": "從相冊選擇", "uni.chooseVideo.sourceType.camera": "拍攝", + "uni.chooseFile.notUserActivation": "文件選擇器對話框只能在用戶激活時顯示", "uni.previewImage.cancel": "取消", "uni.previewImage.button.save": "保存圖像", "uni.previewImage.save.success": "保存圖像到相冊成功", @@ -1830,11 +1835,20 @@ var serviceContext = (function () { } const setClipboardData = { - beforeSuccess () { + data: { + type: String, + required: true + }, + showToast: { + type: Boolean, + default: true + }, + beforeSuccess (res, params) { + if (!params.showToast) return const title = t('uni.setClipboardData.success'); if (title) { uni.showToast({ - title: t('uni.setClipboardData.success'), + title, icon: 'success', mask: false, style: { @@ -3604,7 +3618,7 @@ var serviceContext = (function () { const errMsg = res.errMsg; if (errMsg.indexOf(apiName + ':ok') === 0) { - isFn(beforeSuccess) && beforeSuccess(res); + isFn(beforeSuccess) && beforeSuccess(res, params); hasSuccess && success(res); @@ -6293,7 +6307,7 @@ var serviceContext = (function () { let deviceId; function deviceId$1 () { - deviceId = deviceId || plus.runtime.getDCloudId(); + deviceId = deviceId || plus.device.uuid; return deviceId } @@ -6710,7 +6724,8 @@ var serviceContext = (function () { function getLocation$1 ({ type = 'wgs84', geocode = false, - altitude = false + altitude = false, + highAccuracyExpireTime } = {}, callbackId) { const errorCallback = warpPlusErrorCallback(callbackId, 'getLocation'); plus.geolocation.getCurrentPosition( @@ -6726,7 +6741,8 @@ var serviceContext = (function () { errorCallback(e); }, { geocode: geocode, - enableHighAccuracy: altitude + enableHighAccuracy: altitude, + timeout: highAccuracyExpireTime } ); } @@ -7876,6 +7892,8 @@ var serviceContext = (function () { } } + let univerifyManager; + function getService (provider) { return new Promise((resolve, reject) => { plus.oauth.getServices(services => { @@ -7888,20 +7906,21 @@ var serviceContext = (function () { /** * 微信登录 */ - function login (params, callbackId) { + function login (params, callbackId, plus = true) { const provider = params.provider || 'weixin'; - const errorCallback = warpPlusErrorCallback(callbackId, 'login'); + const errorCallback = warpErrorCallback(callbackId, 'login', plus); const authOptions = provider === 'apple' ? { scope: 'email' } : params.univerifyStyle ? { univerifyStyle: univerifyButtonsClickHandling(params.univerifyStyle, errorCallback) } : {}; + const _invoke = plus ? invoke$1 : callback.invoke; getService(provider).then(service => { function login () { if (params.onlyAuthorize && provider === 'weixin') { service.authorize(({ code }) => { - invoke$1(callbackId, { + _invoke(callbackId, { code, authResult: '', errMsg: 'login:ok' @@ -7911,7 +7930,7 @@ var serviceContext = (function () { } service.login(res => { const authResult = res.target.authResult; - invoke$1(callbackId, { + _invoke(callbackId, { code: authResult.code, authResult: authResult, errMsg: 'login:ok' @@ -8006,9 +8025,9 @@ var serviceContext = (function () { } } - function preLogin$1 (params, callbackId) { - const successCallback = warpPlusSuccessCallback(callbackId, 'preLogin'); - const errorCallback = warpPlusErrorCallback(callbackId, 'preLogin'); + function preLogin$1 (params, callbackId, plus) { + const successCallback = warpSuccessCallback(callbackId, 'preLogin', plus); + const errorCallback = warpErrorCallback(callbackId, 'preLogin', plus); getService(params.provider).then(service => service.preLogin(successCallback, errorCallback)).catch(errorCallback); } @@ -8016,9 +8035,9 @@ var serviceContext = (function () { return getService('univerify').then(service => service.closeAuthView()) } - function getCheckBoxState (params, callbackId) { - const successCallback = warpPlusSuccessCallback(callbackId, 'getCheckBoxState'); - const errorCallback = warpPlusErrorCallback(callbackId, 'getCheckBoxState'); + function getCheckBoxState (params, callbackId, plus) { + const successCallback = warpSuccessCallback(callbackId, 'getCheckBoxState', plus); + const errorCallback = warpErrorCallback(callbackId, 'getCheckBoxState', plus); try { getService('univerify').then(service => { const state = service.getCheckBoxState(); @@ -8033,24 +8052,94 @@ var serviceContext = (function () { * 一键登录自定义登陆按钮点击处理 */ function univerifyButtonsClickHandling (univerifyStyle, errorCallback) { - if (univerifyStyle && isPlainObject(univerifyStyle) && univerifyStyle.buttons && - Object.prototype.toString.call(univerifyStyle.buttons.list) === '[object Array]' && - univerifyStyle.buttons.list.length > 0 - ) { + if (isPlainObject(univerifyStyle) && isPlainObject(univerifyStyle.buttons) && toRawType(univerifyStyle.buttons.list) === 'Array') { univerifyStyle.buttons.list.forEach((button, index) => { univerifyStyle.buttons.list[index].onclick = function () { - closeAuthView().then(() => { - errorCallback({ - code: '30008', - message: '用户点击了自定义按钮', - index, - provider: button.provider + const res = { + code: '30008', + message: '用户点击了自定义按钮', + index, + provider: button.provider + }; + isPlainObject(univerifyManager) + ? univerifyManager._triggerUniverifyButtonsClick(res) + : closeAuthView().then(() => { + errorCallback(res); }); - }); }; }); } return univerifyStyle + } + + class UniverifyManager { + constructor () { + this.provider = 'univerify'; + this.eventName = 'api.univerifyButtonsClick'; + } + + close () { + closeAuthView(); + } + + login (options) { + this._warp((data, callbackId) => login(data, callbackId, false), this._getOptions(options)); + } + + getCheckBoxState (options) { + this._warp((_, callbackId) => getCheckBoxState(_, callbackId, false), options); + } + + preLogin (options) { + this._warp((data, callbackId) => preLogin$1(data, callbackId, false), this._getOptions(options)); + } + + onButtonsClick (callback) { + UniServiceJSBridge.on(this.eventName, callback); + } + + offButtonsClick (callback) { + UniServiceJSBridge.off(this.eventName, callback); + } + + _triggerUniverifyButtonsClick (res) { + UniServiceJSBridge.emit(this.eventName, res); + } + + _warp (fn, options) { + return callback.warp(fn)(this._getOptions(options)) + } + + _getOptions (options = {}) { + return Object.assign({}, options, { provider: this.provider }) + } + } + + function getUniverifyManager () { + return univerifyManager || (univerifyManager = new UniverifyManager()) + } + + function warpSuccessCallback (callbackId, name, plus = true) { + return plus + ? warpPlusSuccessCallback(callbackId, name) + : (options) => { + callback.invoke(callbackId, Object.assign({}, options, { + errMsg: `${name}:ok` + })); + } + } + + function warpErrorCallback (callbackId, name, plus = true) { + return plus + ? warpPlusErrorCallback(callbackId, name) + : (error) => { + const { code = 0, message: errorMessage } = error; + callback.invoke(callbackId, { + errMsg: `${name}:fail ${errorMessage || ''}`, + errCode: code, + code + }); + } } function requestPayment (params, callbackId) { @@ -10630,7 +10719,6 @@ var serviceContext = (function () { editable = false, placeholderText = '' } = {}, callbackId) { - // TODO 在 editable 为 true 时,content 应该是输入框中可修改内容。后续找客户端商量。 const buttons = showCancel ? [cancelText, confirmText] : [confirmText]; const tip = editable ? placeholderText : buttons; @@ -11675,6 +11763,7 @@ var serviceContext = (function () { preLogin: preLogin$1, closeAuthView: closeAuthView, getCheckBoxState: getCheckBoxState, + getUniverifyManager: getUniverifyManager, requestPayment: requestPayment, subscribePush: subscribePush, unsubscribePush: unsubscribePush, diff --git a/packages/uni-app-plus/dist/view.umd.js b/packages/uni-app-plus/dist/view.umd.js index b7800ba14..e1fd4cf44 100644 --- a/packages/uni-app-plus/dist/view.umd.js +++ b/packages/uni-app-plus/dist/view.umd.js @@ -91,127 +91,31 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 161); +/******/ return __webpack_require__(__webpack_require__.s = 199); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); -/* globals __VUE_SSR_CONTEXT__ */ - -// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). -// This module is a runtime utility for cleaner component module output and will -// be included in the final webpack user bundle. - -function normalizeComponent ( - scriptExports, - render, - staticRenderFns, - functionalTemplate, - injectStyles, - scopeId, - moduleIdentifier, /* server only */ - shadowMode /* vue-cli only */ -) { - // Vue.extend constructor export interop - var options = typeof scriptExports === 'function' - ? scriptExports.options - : scriptExports - - // render functions - if (render) { - options.render = render - options.staticRenderFns = staticRenderFns - options._compiled = true - } - - // functional template - if (functionalTemplate) { - options.functional = true - } - - // scopedId - if (scopeId) { - options._scopeId = 'data-v-' + scopeId - } - - var hook - if (moduleIdentifier) { // server build - hook = function (context) { - // 2.3 injection - context = - context || // cached call - (this.$vnode && this.$vnode.ssrContext) || // stateful - (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional - // 2.2 with runInNewContext: true - if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { - context = __VUE_SSR_CONTEXT__ - } - // inject component styles - if (injectStyles) { - injectStyles.call(this, context) - } - // register component module identifier for async chunk inferrence - if (context && context._registeredComponents) { - context._registeredComponents.add(moduleIdentifier) - } - } - // used by ssr in case component is cached and beforeCreate - // never gets called - options._ssrRegister = hook - } else if (injectStyles) { - hook = shadowMode - ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } - : injectStyles - } - - if (hook) { - if (options.functional) { - // for template-only hot-reload because in that case the render fn doesn't - // go through the normalizer - options._injectStyles = hook - // register for functional component in vue file - var originalRender = options.render - options.render = function renderWithStyleInjection (h, context) { - hook.call(context) - return originalRender(h, context) - } - } else { - // inject component registration as beforeCreate hook - var existing = options.beforeCreate - options.beforeCreate = existing - ? [].concat(existing, hook) - : [hook] - } - } - - return { - exports: scriptExports, - options: options - } -} - - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - "use strict"; // EXPORTS -__webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ supportsPassive; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ isFn; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ isPlainObject; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ hasOwn; }); +__webpack_require__.d(__webpack_exports__, "k", function() { return /* reexport */ supportsPassive; }); +__webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ isFn; }); +__webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ isStr; }); +__webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ isPlainObject; }); +__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ hasOwn; }); +__webpack_require__.d(__webpack_exports__, "m", function() { return /* reexport */ toRawType; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ cached; }); -__webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ kebabCase; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ disableScrollBounce; }); -__webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ plusReady; }); +__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ camelize; }); +__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ debounce; }); +__webpack_require__.d(__webpack_exports__, "l", function() { return /* reexport */ throttle; }); +__webpack_require__.d(__webpack_exports__, "i", function() { return /* reexport */ kebabCase; }); +__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ deepClone; }); +__webpack_require__.d(__webpack_exports__, "j", function() { return /* reexport */ plusReady; }); -// UNUSED EXPORTS: isStr, isObject, noop, toRawType, camelize, setProperties, getLen, formatDateTime, updateElementStyle, guid, debounce, looseEqual, hexToRgba, parseQuery, stringifyQuery, callback +// UNUSED EXPORTS: isObject, noop, capitalize, setProperties, getLen, formatDateTime, updateElementStyle, guid, looseEqual, uniIdMixin, hexToRgba, parseQuery, stringifyQuery, decodedQuery, callback // CONCATENATED MODULE: ./src/shared/env.js var supportsPassive = false; @@ -227,6 +131,94 @@ try { window.addEventListener('test-passive', null, opts); } catch (e) {} +// CONCATENATED MODULE: ./src/shared/uni-id-mixin.js +var realAtob; +var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/; + +if (typeof atob !== 'function') { + realAtob = function realAtob(str) { + str = String(str).replace(/[\t\n\f\r ]+/g, ''); + + if (!b64re.test(str)) { + throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."); + } // Adding the padding if missing, for semplicity + + + str += '=='.slice(2 - (str.length & 3)); + var bitmap; + var result = ''; + var r1; + var r2; + var i = 0; + + for (; i < str.length;) { + bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++))); + result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); + } + + return result; + }; +} else { + // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法 + realAtob = atob; +} + +function b64DecodeUnicode(str) { + return decodeURIComponent(realAtob(str).split('').map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }).join('')); +} + +function getCurrentUserInfo() { + var token = ( true ? uni : undefined).getStorageSync('uni_id_token') || ''; + var tokenArr = token.split('.'); + + if (!token || tokenArr.length !== 3) { + return { + uid: null, + role: [], + permission: [], + tokenExpired: 0 + }; + } + + var userInfo; + + try { + userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1])); + } catch (error) { + throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message); + } + + userInfo.tokenExpired = userInfo.exp * 1000; + delete userInfo.exp; + delete userInfo.iat; + return userInfo; +} + +function uniIdMixin(Vue) { + Vue.prototype.uniIDHasRole = function (roleId) { + var _getCurrentUserInfo = getCurrentUserInfo(), + role = _getCurrentUserInfo.role; + + return role.indexOf(roleId) > -1; + }; + + Vue.prototype.uniIDHasPermission = function (permissionId) { + var _getCurrentUserInfo2 = getCurrentUserInfo(), + permission = _getCurrentUserInfo2.permission; + + return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1; + }; + + Vue.prototype.uniIDTokenValid = function () { + var _getCurrentUserInfo3 = getCurrentUserInfo(), + tokenExpired = _getCurrentUserInfo3.tokenExpired; + + return tokenExpired > Date.now(); + }; +} // CONCATENATED MODULE: ./src/shared/util.js function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -277,6 +269,13 @@ var camelize = cached(function (str) { return c ? c.toUpperCase() : ''; }); }); +/** + * Capitalize a string. + */ + +var capitalize = cached(function (str) { + return str.charAt(0).toUpperCase() + str.slice(1); +}); function setProperties(item, props, propsData) { props.forEach(function (name) { if (hasOwn(propsData, name)) { @@ -312,7 +311,8 @@ function guid() { } function debounce(fn, delay) { var timeout; - return function () { + + var newFn = function newFn() { var _arguments = arguments, _this = this; @@ -324,15 +324,63 @@ function debounce(fn, delay) { timeout = setTimeout(timerFn, delay); }; + + newFn.cancel = function () { + clearTimeout(timeout); + }; + + return newFn; +} +function throttle(fn, wait) { + var last = 0; + var timeout; + + var _waitCallback; + + var newFn = function newFn() { + var _this2 = this; + + for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) { + arg[_key] = arguments[_key]; + } + + var now = Date.now(); + clearTimeout(timeout); + + _waitCallback = function waitCallback() { + _waitCallback = null; + last = now; + fn.apply(_this2, arg); + }; + + if (now - last < wait) { + timeout = setTimeout(_waitCallback, wait - (now - last)); + return; + } + + _waitCallback(); + }; + + newFn.cancel = function () { + clearTimeout(timeout); + _waitCallback = null; + }; + + newFn.flush = function () { + clearTimeout(timeout); + _waitCallback && _waitCallback(); + }; + + return newFn; } function kebabCase(string) { return string.replace(/[A-Z]/g, function (str) { return '-' + str.toLowerCase(); }); } -/** - * Check if two values are loosely equal - that is, - * if they are plain objects, do they have the same shape? +/** + * Check if two values are loosely equal - that is, + * if they are plain objects, do they have the same shape? */ function looseEqual(a, b) { @@ -371,6 +419,24 @@ function looseEqual(a, b) { return false; } } +function deepClone(vnodes, createElement) { + function cloneVNode(vnode) { + var clonedChildren = vnode.children && vnode.children.map(cloneVNode); + var cloned = createElement(vnode.tag, vnode.data, clonedChildren); + cloned.text = vnode.text; + cloned.isComment = vnode.isComment; + cloned.componentOptions = vnode.componentOptions; + cloned.elm = vnode.elm; + cloned.context = vnode.context; + cloned.ns = vnode.ns; + cloned.isStatic = vnode.isStatic; + cloned.key = vnode.key; + return cloned; + } + + return vnodes.map(cloneVNode); +} + // CONCATENATED MODULE: ./src/shared/color.js function hexToRgba(hex) { var r; @@ -485,6 +551,18 @@ function stringifyQuery(obj) { }).join('&') : null; return res ? "?".concat(res) : ''; } +function decodedQuery() { + var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var decodedQuery = {}; + Object.keys(query).forEach(function (name) { + try { + decodedQuery[name] = decode(query[name]); + } catch (e) { + decodedQuery[name] = query[name]; + } + }); + return decodedQuery; +} // CONCATENATED MODULE: ./src/shared/platform.js function plusReady(callback) { if (typeof callback !== 'function') { @@ -497,50 +575,6 @@ function plusReady(callback) { document.addEventListener('plusready', callback); } -// CONCATENATED MODULE: ./src/shared/scroll.js - -var view; -var pullToRefreshStyle; -var disabled; -var lastAction = {}; -function disableScrollBounce(_ref) { - var disable = _ref.disable; - - function exec() { - if (!view) { - view = plus.webview.currentWebview(); - } - - if (!disabled) { - pullToRefreshStyle = (view.getStyle() || {}).pullToRefresh || {}; - } - - disabled = disable; - - if (pullToRefreshStyle.support) { - view.setPullToRefresh(Object.assign({}, pullToRefreshStyle, { - support: !disable - })); - } - } - - var time = Date.now(); - - if (disable === lastAction.disable && time - lastAction.time < 20) { - return; - } - - lastAction.disable = disable; - lastAction.time = time; - plusReady(function () { - if (plus.os.name === 'iOS') { - // 延迟执行避免iOS13触摸卡死 - setTimeout(exec, 20); - } else { - exec(); - } - }); -} // CONCATENATED MODULE: ./src/shared/callback.js var id = 0; var callbacks = {}; @@ -593,169 +627,132 @@ var callback = { - /***/ }), -/* 2 */ +/* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); +/* globals __VUE_SSR_CONTEXT__ */ -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ emitter; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ listeners["a" /* default */]; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ hover["a" /* default */]; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ subscriber["a" /* default */]; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ keyboard["a" /* default */]; }); +// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). +// This module is a runtime utility for cleaner component module output and will +// be included in the final webpack user bundle. -// UNUSED EXPORTS: interact +function normalizeComponent ( + scriptExports, + render, + staticRenderFns, + functionalTemplate, + injectStyles, + scopeId, + moduleIdentifier, /* server only */ + shadowMode /* vue-cli only */ +) { + // Vue.extend constructor export interop + var options = typeof scriptExports === 'function' + ? scriptExports.options + : scriptExports -// CONCATENATED MODULE: ./src/core/view/mixins/emitter.js -// 暂不提供通知所有 -// function broadcast (componentName, eventName, ...params) { -// this.$children.forEach(child => { -// const name = child.$options.name && child.$options.name.substr(1) -// if (~componentName.indexOf(name)) { -// child.$emit.apply(child, [eventName].concat(params)) -// } else { -// broadcast.apply(child, [componentName, eventName].concat([params])) -// } -// }) -// } -function broadcast(componentName, eventName) { - var children = this.$children; - var len = children.length; - - for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - params[_key - 2] = arguments[_key]; + // render functions + if (render) { + options.render = render + options.staticRenderFns = staticRenderFns + options._compiled = true } - for (var i = 0; i < len; i++) { - var child = children[i]; - var name = child.$options.name && child.$options.name.substr(4); - - if (~componentName.indexOf(name)) { - child.$emit.apply(child, [eventName].concat(params)); - return false; - } else { - if (broadcast.apply(child, [componentName, eventName].concat([params])) === false) { - return false; - } - } + // functional template + if (functionalTemplate) { + options.functional = true } -} - -/* harmony default export */ var emitter = ({ - methods: { - $dispatch: function $dispatch(componentName, eventName) { - if (typeof componentName === 'string') { - componentName = [componentName]; - } - - var parent = this.$parent || this.$root; - var name = parent.$options.name && parent.$options.name.substr(4); - while (parent && (!name || !~componentName.indexOf(name))) { - parent = parent.$parent; + // scopedId + if (scopeId) { + options._scopeId = 'data-v-' + scopeId + } - if (parent) { - name = parent.$options.name && parent.$options.name.substr(4); - } + var hook + if (moduleIdentifier) { // server build + hook = function (context) { + // 2.3 injection + context = + context || // cached call + (this.$vnode && this.$vnode.ssrContext) || // stateful + (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional + // 2.2 with runInNewContext: true + if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { + context = __VUE_SSR_CONTEXT__ } - - if (parent) { - for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - params[_key2 - 2] = arguments[_key2]; - } - - parent.$emit.apply(parent, [eventName].concat(params)); + // inject component styles + if (injectStyles) { + injectStyles.call(this, context) } - }, - $broadcast: function $broadcast(componentName, eventName) { - if (typeof componentName === 'string') { - componentName = [componentName]; + // register component module identifier for async chunk inferrence + if (context && context._registeredComponents) { + context._registeredComponents.add(moduleIdentifier) } + } + // used by ssr in case component is cached and beforeCreate + // never gets called + options._ssrRegister = hook + } else if (injectStyles) { + hook = shadowMode + ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } + : injectStyles + } - for (var _len3 = arguments.length, params = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { - params[_key3 - 2] = arguments[_key3]; + if (hook) { + if (options.functional) { + // for template-only hot-reload because in that case the render fn doesn't + // go through the normalizer + options._injectStyles = hook + // register for functional component in vue file + var originalRender = options.render + options.render = function renderWithStyleInjection (h, context) { + hook.call(context) + return originalRender(h, context) } - - broadcast.apply(this, [componentName, eventName].concat(params)); + } else { + // inject component registration as beforeCreate hook + var existing = options.beforeCreate + options.beforeCreate = existing + ? [].concat(existing, hook) + : [hook] } } -}); -// EXTERNAL MODULE: ./src/core/view/mixins/listeners.js -var listeners = __webpack_require__(69); -// EXTERNAL MODULE: ./src/core/view/mixins/hover.js -var hover = __webpack_require__(17); + return { + exports: scriptExports, + options: options + } +} -// EXTERNAL MODULE: ./src/core/view/mixins/subscriber.js -var subscriber = __webpack_require__(70); -// EXTERNAL MODULE: ./src/core/view/mixins/keyboard.js -var keyboard = __webpack_require__(71); +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -// EXTERNAL MODULE: ./src/shared/index.js + 7 modules -var shared = __webpack_require__(1); +"use strict"; +/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _emitter__WEBPACK_IMPORTED_MODULE_0__["a"]; }); -// CONCATENATED MODULE: ./src/core/view/mixins/interact.js +/* harmony import */ var _listeners__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "e", function() { return _listeners__WEBPACK_IMPORTED_MODULE_1__["a"]; }); -var passiveOptions = shared["h" /* supportsPassive */] ? { - passive: true, - capture: true -} : true; -var vms = []; -var userInteract = 0; -var inited; +/* harmony import */ var _hover__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _hover__WEBPACK_IMPORTED_MODULE_2__["a"]; }); -function addInteractListener(vm) { - if (!inited) { - var eventNames = ['touchstart', 'touchmove', 'touchend', 'mousedown', 'mouseup']; - eventNames.forEach(function (eventName) { - document.addEventListener(eventName, function () { - vms.forEach(function (vm) { - vm.userInteract = true; - userInteract++; - setTimeout(function () { - userInteract--; - - if (!userInteract) { - vm.userInteract = false; - } - }, 0); - }); - }, passiveOptions); - }); - } +/* harmony import */ var _subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _subscriber__WEBPACK_IMPORTED_MODULE_3__["a"]; }); - vms.push(vm); -} +/* harmony import */ var _keyboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(25); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "d", function() { return _keyboard__WEBPACK_IMPORTED_MODULE_4__["a"]; }); -function removeInteractListener(vm) { - var index = vms.indexOf(vm); +/* harmony import */ var _field__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(86); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _field__WEBPACK_IMPORTED_MODULE_5__["a"]; }); - if (index >= 0) { - vms.splice(index, 1); - } -} +/* harmony import */ var _interact__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(26); -/* harmony default export */ var interact = ({ - data: function data() { - return { - /** - * 是否用户交互行为 - */ - userInteract: false - }; - }, - mounted: function mounted() { - addInteractListener(this); - }, - beforeDestroy: function beforeDestroy() { - removeInteractListener(this); - } -}); -// CONCATENATED MODULE: ./src/core/view/mixins/index.js @@ -768,21 +765,25 @@ function removeInteractListener(vm) { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* unused harmony export VD_SYNC_VERSION */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PAGE_CREATE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MOUNTED_DATA; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return UPDATED_DATA; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return UPDATED_DATA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return PAGE_CREATED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return UI_EVENT; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return UI_EVENT; }); /* unused harmony export LAYOUT_READY */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return VD_SYNC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return VD_SYNC; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return APP_SERVICE_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return WEBVIEW_READY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return WEBVIEW_READY; }); /* unused harmony export WEBVIEW_UI_EVENT */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return VD_SYNC_CALLBACK; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return VD_SYNC_CALLBACK; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return INVOKE_API; }); /* unused harmony export WEB_INVOKE_APPSERVICE */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return WEBVIEW_INSERTED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return WEBVIEW_REMOVED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return WEBVIEW_INSERTED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return WEBVIEW_REMOVED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return WEBVIEW_ID_PREFIX; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return SET_LOCALE; }); +var VD_SYNC_VERSION = 2; var PAGE_CREATE = 2; var MOUNTED_DATA = 4; var UPDATED_DATA = 6; @@ -798,6 +799,8 @@ var INVOKE_API = 'invokeApi'; var WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'; var WEBVIEW_INSERTED = 'webviewInserted'; var WEBVIEW_REMOVED = 'webviewRemoved'; +var WEBVIEW_ID_PREFIX = 'webviewId'; +var SET_LOCALE = 'setLocale'; /***/ }), /* 4 */ @@ -818,7 +821,7 @@ __webpack_require__.d(__webpack_exports__, "subscribeHandler", function() { retu __webpack_require__.d(__webpack_exports__, "publishHandler", function() { return /* reexport */ bridge["a" /* publishHandler */]; }); // EXTERNAL MODULE: ./packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js -var vue_runtime_esm = __webpack_require__(8); +var vue_runtime_esm = __webpack_require__(9); // CONCATENATED MODULE: ./src/core/view/bridge/subscribe/api/set-page-meta.js function setPageMeta(_ref) { @@ -832,29 +835,35 @@ function setPageMeta(_ref) { } } // EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-info.js -var request_component_info = __webpack_require__(75); +var request_component_info = __webpack_require__(96); // EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-component-observer.js -var request_component_observer = __webpack_require__(66); +var request_component_observer = __webpack_require__(78); + +// EXTERNAL MODULE: ./src/core/view/bridge/subscribe/api/request-media-query-observer.js +var request_media_query_observer = __webpack_require__(79); // CONCATENATED MODULE: ./src/core/view/bridge/subscribe/api/index.js + /* harmony default export */ var api = ({ setPageMeta: setPageMeta, requestComponentInfo: request_component_info["a" /* requestComponentInfo */], requestComponentObserver: request_component_observer["b" /* requestComponentObserver */], - destroyComponentObserver: request_component_observer["a" /* destroyComponentObserver */] + destroyComponentObserver: request_component_observer["a" /* destroyComponentObserver */], + requestMediaQueryObserver: request_media_query_observer["b" /* requestMediaQueryObserver */], + destroyMediaQueryObserver: request_media_query_observer["a" /* destroyMediaQueryObserver */] }); // EXTERNAL MODULE: ./src/core/view/bridge/subscribe/scroll.js -var subscribe_scroll = __webpack_require__(13); +var subscribe_scroll = __webpack_require__(22); // EXTERNAL MODULE: ./src/core/view/bridge/subscribe/font.js -var font = __webpack_require__(76); +var font = __webpack_require__(97); // EXTERNAL MODULE: ./src/platforms/app-plus/view/bridge/subscribe/index.js -var bridge_subscribe = __webpack_require__(77); +var bridge_subscribe = __webpack_require__(98); // CONCATENATED MODULE: ./src/core/view/bridge/subscribe/index.js @@ -870,7 +879,7 @@ function initSubscribe(subscribe) { Object(bridge_subscribe["a" /* default */])(subscribe); } // EXTERNAL MODULE: ./src/platforms/app-plus/view/bridge.js -var bridge = __webpack_require__(12); +var bridge = __webpack_require__(20); // CONCATENATED MODULE: ./src/core/view/bridge/index.js @@ -898,6 +907,38 @@ initSubscribe(view_bridge_subscribe); /***/ }), /* 5 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return initScrollBounce; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return disableScrollBounce; }); +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); + +var webview; +var pullToRefreshStyle; +function initScrollBounce() { + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + if (!webview) { + webview = plus.webview.currentWebview(); + } + + if (!pullToRefreshStyle) { + pullToRefreshStyle = (webview.getStyle() || {}).pullToRefresh || {}; + } + }); +} +function disableScrollBounce(_ref) { + var disable = _ref.disable; + + if (pullToRefreshStyle && pullToRefreshStyle.support) { + webview.setPullToRefresh(Object.assign({}, pullToRefreshStyle, { + support: !disable + })); + } +} + +/***/ }), +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1095,76 +1136,13 @@ var safeAreaInsets = { module.exports = safeAreaInsets; //# sourceMappingURL=index.js.map -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isPage; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasLifecycleHook; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return normalizeDataset; }); -/* unused harmony export upx2px */ -var components = ['SystemAsyncLoading', 'SystemAsyncError']; -function isPage(vm) { - if (vm.$parent && vm.$parent.$options.name === 'PageBody') { - if (components.indexOf(vm.$options.name) !== -1) { - return false; - } - - return true; - } - - return false; -} -function hasLifecycleHook() { - var vueOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var hook = arguments.length > 1 ? arguments[1] : undefined; - return Array.isArray(vueOptions[hook]) && vueOptions[hook].length; -} -function normalizeDataset() { - var dataset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - // ios8.x,9.x Object.assign({},dataset) 始终返回 {} - // http://ask.dcloud.net.cn/question/70246 - var result = JSON.parse(JSON.stringify(dataset)); - - if (false) { var _len, key, i, len, keys; } - - return result; -} -function upx2px(str) { - str = str + ''; - - if (str.indexOf('upx') !== -1) { - // upx转换 - return uni.upx2px(parseInt(str) || 0); - } - - return parseInt(str) || 0; -} - /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -var TITLEBAR_HEIGHT = 44; - -function getStatusbarHeight() { - // 横屏时 iOS 获取的状态栏高度错误,进行纠正 - return plus.navigator.isImmersedStatusbar() ? Math.round(plus.os.name === 'iOS' ? plus.navigator.getSafeAreaInsets().top : plus.navigator.getStatusbarHeight()) : 0; -} - -function getNavigationBarHeight() { - var webview = plus.webview.currentWebview(); - var style = webview.getStyle(); - style = style && style.titleNView; - - if (style && style.type === 'default') { - return TITLEBAR_HEIGHT + getStatusbarHeight(); - } +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75); - return 0; -} function getFixed($el) { var fixed; @@ -1194,20 +1172,28 @@ function getFixed($el) { hidden: false }; }, + provide: function provide() { + return { + parentOnDraw: this._onDraw + }; + }, + inject: { + parentOnDraw: { + default: null + } + }, created: function created() { this.isNative = true; this.onCanInsertCallbacks = []; + this.onDrawCallbacks = []; }, mounted: function mounted() { - var _this = this; - this._updatePosition(); - this.$nextTick(function () { - _this.onCanInsertCallbacks.forEach(function (callback) { - return callback(); - }); + this.onCanInsertCallbacks.forEach(function (callback) { + return callback(); }); + this.onCanInsertCallbacks = null; this.$on('uni-view-update', this._requestPositionUpdate); }, methods: { @@ -1221,39 +1207,181 @@ function getFixed($el) { var keys = ['top', 'left', 'width', 'height']; keys.forEach(function (key) { var val = rect[key]; - val = key === 'top' ? val + (position.position === 'static' ? document.documentElement.scrollTop || document.body.scrollTop || 0 : getNavigationBarHeight()) : val; + val = key === 'top' ? val + (position.position === 'static' ? document.documentElement.scrollTop || document.body.scrollTop || 0 : Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getNavigationBarHeight */ "a"])()) : val; position[key] = val + 'px'; }); } }, _requestPositionUpdate: function _requestPositionUpdate() { - var _this2 = this; + var _this = this; if (this._positionUpdateRequest) { cancelAnimationFrame(this._positionUpdateRequest); } this._positionUpdateRequest = requestAnimationFrame(function () { - delete _this2._positionUpdateRequest; + delete _this._positionUpdateRequest; - _this2._updatePosition(); + _this._updatePosition(); }); - } - } -}); + }, + _onParentReady: function _onParentReady(parentReadyCallback) { + var _this2 = this; -/***/ }), -/* 8 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var callback = function callback(parentPosition) { + parentReadyCallback(parentPosition); -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + _this2.onDrawCallbacks.forEach(function (callback) { + return callback(_this2.position); + }); -/*! - * Vue.js v2.6.11 - * (c) 2014-2020 Evan You - * Released under the MIT License. - */ + _this2.onDrawCallbacks = null; + }; + + this._onSelfReady(function () { + if (_this2.parentOnDraw) { + _this2.parentOnDraw(callback); + } else { + callback({ + top: '0px', + left: '0px', + width: Number.MAX_SAFE_INTEGER + 'px', + height: Number.MAX_SAFE_INTEGER + 'px', + position: 'static' + }); + } + }); + }, + _onSelfReady: function _onSelfReady(callback) { + if (this.onCanInsertCallbacks) { + this.onCanInsertCallbacks.push(callback); + } else { + callback(); + } + }, + _onDraw: function _onDraw(callback) { + if (this.onDrawCallbacks) { + this.onDrawCallbacks.push(callback); + } else { + callback(this.position); + } + } + } +}); + +/***/ }), +/* 8 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export isPage */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasLifecycleHook; }); +/* unused harmony export normalizeDataset */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getTargetDataset; }); +/* unused harmony export upx2px */ +/* unused harmony export findExistsPageIndex */ +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); + +var components = ['SystemAsyncLoading', 'SystemAsyncError']; +function isPage(vm) { + if (vm.$parent && vm.$parent.$options.name === 'PageBody') { + if (components.indexOf(vm.$options.name) !== -1) { + return false; + } + + return true; + } + + return false; +} +function hasLifecycleHook() { + var vueOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var hook = arguments.length > 1 ? arguments[1] : undefined; + return Array.isArray(vueOptions[hook]) && vueOptions[hook].length; +} +function normalizeDataset() { + var dataset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + // ios8.x,9.x Object.assign({},dataset) 始终返回 {} + // http://ask.dcloud.net.cn/question/70246 + var result = JSON.parse(JSON.stringify(dataset)); + + if (false) { var _len, key, i, len, keys; } + + return result; +} +function getTargetDataset(target) { + var dataset = {}; + var vm = target.__vue__; + + function updateDataset(vm, force) { + var $attrs = vm.$attrs; + + for (var key in $attrs) { + if (key.startsWith('data-')) { + var newKey = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* camelize */ "b"])(key.substr(5).toLowerCase()); + var value = $attrs[key]; + dataset[newKey] = force ? value : dataset[newKey] || value; + } + } + } + + if (vm) { + var $child = vm; + + while ($child && $child.$el === target) { + updateDataset($child); + $child = $child.$children[0]; + } + + var $parent = vm.$parent; + + while ($parent && $parent.$el === target) { + updateDataset($parent, true); + $parent = $parent.$parent; + } + } else { + dataset = target.dataset || {}; + } + + return normalizeDataset(dataset); +} +function upx2px(str) { + str = str + ''; + + if (str.indexOf('upx') !== -1) { + // upx转换 + return uni.upx2px(parseInt(str) || 0); + } + + return parseInt(str) || 0; +} +function findExistsPageIndex(url) { + var pages = getCurrentPages(); + var len = pages.length; + + while (len--) { + var page = pages[len]; + + if (page.$page && page.$page.fullPath === url) { + return len; + } + } + + return -1; +} + +/***/ }), +/* 9 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/*! + * Vue.js v2.6.11 + * (c) 2014-2021 Evan You + * Released under the MIT License. + */ /* */ var emptyObject = Object.freeze({}); // These helpers produce better VM code in JS engines due to their @@ -1896,6 +2024,11 @@ if (true) { formatComponentName = function formatComponentName(vm, includeFile) { if (vm.$root === vm) { + if (vm.$options && vm.$options.__file) { + // fixed by xxxxxx + return 'at ' + vm.$options.__file; + } + return ''; } @@ -1934,7 +2067,7 @@ if (true) { var tree = []; var currentRecursiveSequence = 0; - while (vm) { + while (vm && vm.$options.name !== 'PageBody') { if (tree.length > 0) { var last = tree[tree.length - 1]; @@ -1948,7 +2081,7 @@ if (true) { } } - tree.push(vm); + !vm.$options.isReserved && tree.push(vm); vm = vm.$parent; } @@ -1970,15 +2103,7 @@ var uid = 0; */ var Dep = function Dep() { - // fixed by xxxxxx (nvue vuex) - - /* eslint-disable no-undef */ - if (typeof SharedObject !== 'undefined') { - this.id = SharedObject.uid++; - } else { - this.id = uid++; - } - + this.id = uid++; this.subs = []; }; @@ -2020,18 +2145,20 @@ Dep.prototype.notify = function notify() { /* eslint-disable no-undef */ -Dep.SharedObject = typeof SharedObject !== 'undefined' ? SharedObject : {}; +Dep.SharedObject = {}; Dep.SharedObject.target = null; Dep.SharedObject.targetStack = []; function pushTarget(target) { Dep.SharedObject.targetStack.push(target); Dep.SharedObject.target = target; + Dep.target = target; } function popTarget() { Dep.SharedObject.targetStack.pop(); Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1]; + Dep.target = Dep.SharedObject.target; } /* */ @@ -3962,7 +4089,7 @@ function renderList(val, render) { var result = iterator.next(); while (!result.done) { - ret.push(render(result.value, ret.length, i++, i)); // fixed by xxxxxx + ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx result = iterator.next(); } @@ -6301,12 +6428,12 @@ function initMixin(Vue) { initEvents(vm); initRender(vm); callHook(vm, 'beforeCreate'); - vm.mpHost !== 'mp-toutiao' && initInjections(vm); // resolve injections before data/props + !vm._$fallback && initInjections(vm); // resolve injections before data/props initState(vm); - vm.mpHost !== 'mp-toutiao' && initProvide(vm); // resolve provide after data/props + !vm._$fallback && initProvide(vm); // resolve provide after data/props - vm.mpHost !== 'mp-toutiao' && callHook(vm, 'created'); + !vm._$fallback && callHook(vm, 'created'); /* istanbul ignore if */ if ( true && config.performance && mark) { @@ -8555,7 +8682,7 @@ function getStyle(vnode, checkChild) { var cssVarRE = /^--/; var importantRE = /\s*!important$/; // upx,rpx 正则匹配 -var unitRE = /([+-]?\d+(\.\d+)?)[r|u]px/g; +var unitRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g; var transformUnit = function transformUnit(val) { if (typeof val === 'string') { @@ -8568,11 +8695,12 @@ var transformUnit = function transformUnit(val) { return val; }; -var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/; +var urlRE1 = /url\(\s*['"](.+?\.(jpg|gif|png))['"]\s*\)/; +var urlRE2 = /url\(\s*([a-zA-Z0-9\.\-\_\/]+?\.(jpg|gif|png))\s*\)/; var transformUrl = function transformUrl(val, ctx) { if (typeof val === 'string' && val.indexOf('url(') !== -1) { - var matches = val.match(urlRE); + var matches = val.match(urlRE1) || val.match(urlRE2); if (matches && matches.length === 3) { val = val.replace(matches[1], ctx._$getRealPath(matches[1])); @@ -9885,10 +10013,316 @@ if (inBrowser) { /* harmony default export */ __webpack_exports__["a"] = (Vue); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(16))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(19))) /***/ }), -/* 9 */ +/* 10 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export i18n */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return t; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return i18nMixin; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setLocale; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getLocale; }); +/* unused harmony export initAppLocale */ +/* unused harmony export I18N_JSON_DELIMITERS */ +/* unused harmony export formatI18n */ +/* unused harmony export defineI18nProperties */ +/* unused harmony export defineI18nProperty */ +/* unused harmony export initNavigationBarI18n */ +/* unused harmony export initPullToRefreshI18n */ +/* unused harmony export initTabBarI18n */ +/* unused harmony export initI18n */ +/* harmony import */ var _dcloudio_uni_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(76); +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17); +/* harmony import */ var _en_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99); +var _en_json__WEBPACK_IMPORTED_MODULE_3___namespace = /*#__PURE__*/__webpack_require__.t(99, 1); +/* harmony import */ var _es_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(100); +var _es_json__WEBPACK_IMPORTED_MODULE_4___namespace = /*#__PURE__*/__webpack_require__.t(100, 1); +/* harmony import */ var _fr_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(101); +var _fr_json__WEBPACK_IMPORTED_MODULE_5___namespace = /*#__PURE__*/__webpack_require__.t(101, 1); +/* harmony import */ var _zh_Hans_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(102); +var _zh_Hans_json__WEBPACK_IMPORTED_MODULE_6___namespace = /*#__PURE__*/__webpack_require__.t(102, 1); +/* harmony import */ var _zh_Hant_json__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(103); +var _zh_Hant_json__WEBPACK_IMPORTED_MODULE_7___namespace = /*#__PURE__*/__webpack_require__.t(103, 1); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + + + + + + + + +var messages = { + en: _en_json__WEBPACK_IMPORTED_MODULE_3__, + es: _es_json__WEBPACK_IMPORTED_MODULE_4__, + fr: _fr_json__WEBPACK_IMPORTED_MODULE_5__, + 'zh-Hans': _zh_Hans_json__WEBPACK_IMPORTED_MODULE_6__, + 'zh-Hant': _zh_Hant_json__WEBPACK_IMPORTED_MODULE_7__ +}; +var locale; + +if (false) {} else if (true) { + if ((typeof weex === "undefined" ? "undefined" : _typeof(weex)) === 'object') { + locale = weex.requireModule('plus').getLanguage(); + } else { + locale = ''; + } +} else {} + +var i18n = Object(_dcloudio_uni_i18n__WEBPACK_IMPORTED_MODULE_0__[/* initVueI18n */ "a"])(locale, true ? messages : undefined); +var t = i18n.t; +var i18nMixin = i18n.mixin = { + beforeCreate: function beforeCreate() { + var _this = this; + + var unwatch = i18n.i18n.watchLocale(function () { + _this.$forceUpdate(); + }); + this.$once('hook:beforeDestroy', function () { + unwatch(); + }); + }, + methods: { + $$t: function $$t(key, values) { + return t(key, values); + } + } +}; +var setLocale = i18n.setLocale; +var getLocale = i18n.getLocale; +function initAppLocale(Vue, appVm, locale) { + var state = Vue.observable({ + locale: locale || i18n.getLocale() + }); + var localeWatchers = []; + + appVm.$watchLocale = function (fn) { + localeWatchers.push(fn); + }; + + Object.defineProperty(appVm, '$locale', { + get: function get() { + return state.locale; + }, + set: function set(v) { + state.locale = v; + localeWatchers.forEach(function (watch) { + return watch(v); + }); + } + }); +} +var I18N_JSON_DELIMITERS = ['%', '%']; + +function getLocaleMessage() { + var locale = uni.getLocale(); + var locales = __uniConfig.locales; + return locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {}; +} + +function formatI18n(message) { + if (Object(_dcloudio_uni_i18n__WEBPACK_IMPORTED_MODULE_0__[/* isI18nStr */ "b"])(message, I18N_JSON_DELIMITERS)) { + return i18n.f(message, getLocaleMessage(), I18N_JSON_DELIMITERS); + } + + return message; +} + +function resolveJsonObj(jsonObj, names) { + if (names.length === 1) { + if (jsonObj) { + var value = jsonObj[names[0]]; + + if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* isStr */ "h"])(value) && Object(_dcloudio_uni_i18n__WEBPACK_IMPORTED_MODULE_0__[/* isI18nStr */ "b"])(value, I18N_JSON_DELIMITERS)) { + return jsonObj; + } + } + + return; + } + + var name = names.shift(); + return resolveJsonObj(jsonObj && jsonObj[name], names); +} + +function defineI18nProperties(obj, names) { + return names.map(function (name) { + return defineI18nProperty(obj, name); + }); +} +function defineI18nProperty(obj, names) { + var jsonObj = resolveJsonObj(obj, names); + + if (!jsonObj) { + return false; + } + + var prop = names[names.length - 1]; + var value = jsonObj[prop]; + Object.defineProperty(jsonObj, prop, { + get: function get() { + return formatI18n(value); + }, + set: function set(v) { + value = v; + } + }); + return true; +} + +function isEnableLocale() { + return __uniConfig.locales && !!Object.keys(__uniConfig.locales).length; +} + +function initNavigationBarI18n(navigationBar) { + if (isEnableLocale()) { + return defineI18nProperties(navigationBar, [['titleText'], ['searchInput', 'placeholder']]); + } +} +function initPullToRefreshI18n(pullToRefresh) { + if (isEnableLocale()) { + var CAPTION = 'caption'; + return defineI18nProperties(pullToRefresh, [['contentdown', CAPTION], ['contentover', CAPTION], ['contentrefresh', CAPTION]]); + } +} +function initTabBarI18n(tabBar) { + if (isEnableLocale()) { + tabBar.list.forEach(function (item) { + defineI18nProperty(item, ['text']); + }); + } + + return tabBar; +} +function initI18n() { + var localeKeys = Object.keys(__uniConfig.locales || {}); + + if (localeKeys.length) { + localeKeys.forEach(function (locale) { + return i18n.add(locale, __uniConfig.locales[locale]); + }); + } +} + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + + +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + +function _has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof source !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (_has(source, p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + // Fallback to ordinary array + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + var i, l, len, pos, chunk, result; + + // calculate data length + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + + // join chunks + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + + return result; + } +}; + +var fnUntyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + return [].concat.apply([], chunks); + } +}; + + +// Enable/Disable typed arrays use, for testing +// +exports.setTyped = function (on) { + if (on) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } +}; + +exports.setTyped(TYPED_OK); + + +/***/ }), +/* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -9902,6 +10336,7 @@ var addListenerToElement = function addListenerToElement(element, type, callback } } }, { + capture: capture, passive: false }); }; @@ -9913,6 +10348,8 @@ var addListenerToElement = function addListenerToElement(element, type, callback }, methods: { touchtrack: function touchtrack(element, method, useCancel) { + var _this = this; + var self = this; var x0 = 0; var y0 = 0; @@ -9929,8 +10366,8 @@ var addListenerToElement = function addListenerToElement(element, type, callback changedTouches: $event.changedTouches, detail: { state: state, - x0: x, - y0: y, + x: x, + y: y, dx: x - x0, dy: y - y0, ddx: x - x1, @@ -9943,6 +10380,7 @@ var addListenerToElement = function addListenerToElement(element, type, callback }; var $eventOld = null; + var hasClickListenerOld; var hasTouchStart; var hasMouseDown; addListenerToElement(element, 'touchstart', function ($event) { @@ -9973,11 +10411,22 @@ var addListenerToElement = function addListenerToElement(element, type, callback y1 = $event.touches[0].pageY; return res; } - }); + }); // 阻止点击事件传播,处理拖拽和点击冲突,鼠标移动则添加监听,停止移动则移除监听 + + var clickEventListener = this.__clickEventListener = function ($event) { + $event.preventDefault(); + $event.stopPropagation(); + }; var mouseMoveEventListener = this.__mouseMoveEventListener = function ($event) { if (!hasTouchStart && hasMouseDown && $eventOld) { - // TODO target currentTarget touches changedTouches + // 存在鼠标移动,则在 document 上添加点击监听(好处是不用管具体使用拖拽的是什么元素) + if (!hasClickListenerOld && (Math.abs(x1 - x0) > 2 || Math.abs(y1 - y0) > 2)) { + document.addEventListener('click', clickEventListener, true); + hasClickListenerOld = true; + } // TODO target currentTarget touches changedTouches + + var res = fn($event, 'move', $event.pageX, $event.pageY); x1 = $event.pageX; y1 = $event.pageY; @@ -9998,7 +10447,15 @@ var addListenerToElement = function addListenerToElement(element, type, callback hasMouseDown = false; if (!hasTouchStart && $eventOld) { - // TODO target currentTarget touches changedTouches + // 鼠标抬起,存在监听,则 mouseup 结束后移除就监听事件 + if (hasClickListenerOld) { + setTimeout(function () { + document.removeEventListener('click', _this.__clickEventListener, true); + hasClickListenerOld = false; + }, 0); + } // TODO target currentTarget touches changedTouches + + $eventOld = null; return fn($event, 'end', $event.pageX, $event.pageY); } @@ -10018,798 +10475,647 @@ var addListenerToElement = function addListenerToElement(element, type, callback }); /***/ }), -/* 10 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindowOffset; }); -function getWindowOffset() { - return { - top: 0, - bottom: 0 - }; -} - -/***/ }), -/* 11 */ +/* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ processEvent; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ initEvents; }); - -// EXTERNAL MODULE: ./src/shared/index.js + 7 modules -var shared = __webpack_require__(1); - -// EXTERNAL MODULE: ./src/core/helpers/index.js -var helpers = __webpack_require__(6); - -// CONCATENATED MODULE: ./src/core/helpers/patch.js -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - -/** - * mpvue event - */ +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ getRealPath; }); -function wrapperMPEvent(event) { - return Object.assign({ - mp: event, - _processed: true - }, event); -} -/** - * app-plus titleNView - */ +// CONCATENATED MODULE: ./src/core/helpers/get-real-route.js +function getRealRoute(fromRoute, toRoute) { + if (!toRoute) { + toRoute = fromRoute; -function mergeTitleNView(navigationBar, titleNView) { - if (Object(shared["e" /* isPlainObject */])(titleNView)) { - if (Object(shared["c" /* hasOwn */])(titleNView, 'backgroundColor')) { - navigationBar.backgroundColor = titleNView.backgroundColor; + if (toRoute.indexOf('/') === 0) { + return toRoute; } - if (Object(shared["c" /* hasOwn */])(titleNView, 'buttons')) { - navigationBar.buttons = titleNView.buttons; - } + var pages = getCurrentPages(); - if (Object(shared["c" /* hasOwn */])(titleNView, 'titleColor')) { - navigationBar.textColor = titleNView.titleColor; + if (pages.length) { + fromRoute = pages[pages.length - 1].$page.route; + } else { + fromRoute = ''; } - - if (Object(shared["c" /* hasOwn */])(titleNView, 'titleText')) { - navigationBar.titleText = titleNView.titleText; + } else { + if (toRoute.indexOf('/') === 0) { + return toRoute; } + } - if (Object(shared["c" /* hasOwn */])(titleNView, 'titleSize')) { - navigationBar.titleSize = titleNView.titleSize; - } + if (toRoute.indexOf('./') === 0) { + return getRealRoute(fromRoute, toRoute.substr(2)); + } - if (Object(shared["c" /* hasOwn */])(titleNView, 'type')) { - navigationBar.type = titleNView.type; - } + var toRouteArray = toRoute.split('/'); + var toRouteLength = toRouteArray.length; + var i = 0; - if (Object(shared["c" /* hasOwn */])(titleNView, 'searchInput') && _typeof(titleNView.searchInput) === 'object') { - navigationBar.searchInput = Object.assign({ - autoFocus: false, - align: 'center', - color: '#000000', - backgroundColor: 'rgba(255,255,255,0.5)', - borderRadius: '0px', - placeholder: '', - placeholderColor: '#CCCCCC', - disabled: false - }, titleNView.searchInput); - } + for (; i < toRouteLength && toRouteArray[i] === '..'; i++) {// noop } - return navigationBar; + toRouteArray.splice(0, i); + toRoute = toRouteArray.join('/'); + var fromRouteArray = fromRoute.length > 0 ? fromRoute.split('/') : []; + fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1); + return '/' + fromRouteArray.concat(toRouteArray).join('/'); } -// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-window-offset.js -var get_window_offset = __webpack_require__(10); - -// CONCATENATED MODULE: ./src/core/view/plugins/events.js - - +// CONCATENATED MODULE: ./src/platforms/app-plus/helpers/get-real-path.js +var SCHEME_RE = /^([a-z-]+:)?\/\//i; +var DATA_RE = /^data:.*,.*/; // 处理 Android 平台解压与非解压模式下获取的路径不一致的情况 +function handleLocalPath(filePath) { + return plus.io.convertLocalFileSystemURL(filePath).replace(/^\/?apps\//, '/android_asset/apps/').replace(/\/$/, ''); +} -function processTarget(target, detail) { - var checkShadowRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var res = { - id: target.id, - offsetLeft: target.offsetLeft, - offsetTop: target.offsetTop, - dataset: Object(helpers["c" /* normalizeDataset */])(target.dataset) - }; +var wwwPath; - if (detail) { - Object.assign(res, detail); +function addBase(filePath) { + if (!wwwPath) { + // 需要时,初始化一次,外部直接初始化,需要等 plusready + wwwPath = 'file://' + handleLocalPath('_www') + '/'; } - return res; + return wwwPath + filePath; } -function processTouches(touches) { - if (touches) { - var res = []; +function getRealPath(filePath) { + if (filePath.indexOf('/') === 0) { + if (filePath.indexOf('//') === 0) { + return 'https:' + filePath; + } // 平台绝对路径 安卓、iOS - var _getWindowOffset = Object(get_window_offset["a" /* default */])(), - top = _getWindowOffset.top; - for (var i = 0; i < touches.length; i++) { - var touch = touches[i]; - res.push({ - identifier: touch.identifier, - pageX: touch.pageX, - pageY: touch.pageY - top, - clientX: touch.clientX, - clientY: touch.clientY - top, - force: touch.force || 0 - }); + if (filePath.startsWith('/storage/') || filePath.startsWith('/sdcard/') || filePath.includes('/Containers/Data/Application/')) { + return 'file://' + filePath; } - return res; - } - - return []; -} - -function processEvent(name) { - var $event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var currentTarget = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; - - if ($event._processed) { - $event.type = detail.type || name; - return $event; - } // fixed 针对小程序 click(tap)事件,补充事件详情 - + return addBase(filePath.substr(1)); + } // 网络资源或base64 - if (name === 'click') { - var _getWindowOffset2 = Object(get_window_offset["a" /* default */])(), - top = _getWindowOffset2.top; - detail = { - x: $event.x, - y: $event.y - top - }; - $event.touches = $event.changedTouches = [{ - force: 1, - identifier: 0, - clientX: $event.clientX, - clientY: $event.clientY, - pageX: $event.pageX, - pageY: $event.pageY - }]; - } // fixed mp-vue + if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath) || filePath.indexOf('blob:') === 0) { + return filePath; + } // _do=>_doc,_documents,_downloads - var ret = wrapperMPEvent({ - type: detail.type || name, - timeStamp: $event.timeStamp || 0, - detail: detail, - target: processTarget(target, detail), - currentTarget: processTarget(currentTarget, false, true), - // 只处理系统事件 - touches: $event instanceof Event || $event instanceof CustomEvent ? processTouches($event.touches) : $event.touches, - changedTouches: $event instanceof Event || $event instanceof CustomEvent ? processTouches($event.changedTouches) : $event.changedTouches, - preventDefault: function preventDefault() {}, - stopPropagation: function stopPropagation() {} - }); + if (filePath.indexOf('_www') === 0 || filePath.indexOf('_do') === 0) { + return 'file://' + handleLocalPath(filePath); + } - if (true) { - var nid = currentTarget.getAttribute('_i'); - ret.options = { - nid: nid - }; // 保留原始 currentTarget 方便后续对比 + var pages = getCurrentPages(); - ret.$origCurrentTarget = currentTarget; + if (pages.length) { + return addBase(getRealRoute(pages[pages.length - 1].$page.route, filePath).substr(1)); } - return ret; + return filePath; } -var LONGPRESS_TIMEOUT = 350; -var LONGPRESS_THRESHOLD = 10; -var passiveOptions = shared["h" /* supportsPassive */] ? { - passive: true -} : false; -var longPressTimer = false; -function clearLongPressTimer() { - if (longPressTimer) { - clearTimeout(longPressTimer); - longPressTimer = false; - } +/***/ }), +/* 14 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindowOffset; }); +function getWindowOffset() { + return { + top: 0, + bottom: 0, + left: 0, + right: 0 + }; } -var startPageX = 0; -var startPageY = 0; +/***/ }), +/* 15 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -function touchstart(evt) { - clearLongPressTimer(); +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return pixelRatio; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wrapper; }); +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - if (evt.touches.length !== 1) { - return; - } +var pixelRatio = function () { + var canvas = document.createElement('canvas'); + canvas.height = canvas.width = 0; + var context = canvas.getContext('2d'); + var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; + return (window.devicePixelRatio || 1) / backingStore; +}(); - var _evt$touches$ = evt.touches[0], - pageX = _evt$touches$.pageX, - pageY = _evt$touches$.pageY; - startPageX = pageX; - startPageY = pageY; - longPressTimer = setTimeout(function () { - var customEvent = new CustomEvent('longpress', { - bubbles: true, - cancelable: true, - target: evt.target, - currentTarget: evt.currentTarget - }); - customEvent.touches = evt.touches; - customEvent.changedTouches = evt.changedTouches; - evt.target.dispatchEvent(customEvent); - }, LONGPRESS_TIMEOUT); -} +var forEach = function forEach(obj, func) { + for (var key in obj) { + if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "e"])(obj, key)) { + func(obj[key], key); + } + } +}; -function touchmove(evt) { - if (!longPressTimer) { - return; - } - - if (evt.touches.length !== 1) { - return clearLongPressTimer(); - } - - var _evt$touches$2 = evt.touches[0], - pageX = _evt$touches$2.pageX, - pageY = _evt$touches$2.pageY; +var ratioArgs = { + fillRect: 'all', + clearRect: 'all', + strokeRect: 'all', + moveTo: 'all', + lineTo: 'all', + arc: [0, 1, 2], + arcTo: 'all', + bezierCurveTo: 'all', + isPointinPath: 'all', + isPointinStroke: 'all', + quadraticCurveTo: 'all', + rect: 'all', + translate: 'all', + createRadialGradient: 'all', + createLinearGradient: 'all', + setTransform: [4, 5] +}; +var proto = CanvasRenderingContext2D.prototype; - if (Math.abs(pageX - startPageX) > LONGPRESS_THRESHOLD || Math.abs(pageY - startPageY) > LONGPRESS_THRESHOLD) { - return clearLongPressTimer(); - } -} +proto.drawImageByCanvas = function (_super) { + return function (canvas, srcx, srcy, srcw, srch, desx, desy, desw, desh, isScale) { + if (!this.__hidpi__) { + return _super.apply(this, arguments); + } -function initEvents() { - window.addEventListener('touchstart', touchstart, passiveOptions); - window.addEventListener('touchmove', touchmove, passiveOptions); - window.addEventListener('touchend', clearLongPressTimer, passiveOptions); - window.addEventListener('touchcancel', clearLongPressTimer, passiveOptions); -} + srcx *= pixelRatio; + srcy *= pixelRatio; + srcw *= pixelRatio; + srch *= pixelRatio; + desx *= pixelRatio; + desy *= pixelRatio; + desw = isScale ? desw * pixelRatio : desw; + desh = isScale ? desh * pixelRatio : desh; -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + _super.call(this, canvas, srcx, srcy, srcw, srch, desx, desy, desw, desh); + }; +}(proto.drawImage); -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return publishHandler; }); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); -/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); +if (pixelRatio !== 1) { + forEach(ratioArgs, function (value, key) { + proto[key] = function (_super) { + return function () { + if (!this.__hidpi__) { + return _super.apply(this, arguments); + } + var args = Array.prototype.slice.call(arguments); -function publishHandler(event) { - var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - Object(uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* plusReady */ "g"])(function () { - var pageId = plus.webview.currentWebview().id; + if (value === 'all') { + args = args.map(function (a) { + return a * pixelRatio; + }); + } else if (Array.isArray(value)) { + for (var i = 0; i < value.length; i++) { + args[value[i]] *= pixelRatio; + } + } - if (true) { - console.log("[VIEW][".concat(Date.now(), "]:"), event, args, pageId); - } + return _super.apply(this, args); + }; + }(proto[key]); + }); - plus.webview.postMessageToUniNView({ - type: 'subscribeHandler', - args: { - type: event, - data: args, - pageId: pageId + proto.stroke = function (_super) { + return function () { + if (!this.__hidpi__) { + return _super.apply(this, arguments); } - }, _constants__WEBPACK_IMPORTED_MODULE_0__[/* APP_SERVICE_ID */ "a"]); - }); -} -/***/ }), -/* 13 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + this.lineWidth *= pixelRatio; -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return disableScroll; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return pageScrollTo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createScrollListener; }); -/* harmony import */ var uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); + _super.apply(this, arguments); -function disableScroll(evt) { - evt.preventDefault(); -} -function pageScrollTo(_ref) { - var scrollTop = _ref.scrollTop, - duration = _ref.duration; - var documentElement = document.documentElement; - var clientHeight = documentElement.clientHeight, - scrollHeight = documentElement.scrollHeight; - scrollTop = Math.min(scrollTop, scrollHeight - clientHeight); + this.lineWidth /= pixelRatio; + }; + }(proto.stroke); - if (duration === 0) { - // 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制 - documentElement.scrollTop = document.body.scrollTop = scrollTop; - return; - } + proto.fillText = function (_super) { + return function () { + if (!this.__hidpi__) { + return _super.apply(this, arguments); + } - if (window.scrollY === scrollTop) { - return; - } + var args = Array.prototype.slice.call(arguments); + args[1] *= pixelRatio; + args[2] *= pixelRatio; // Safari 重新设置部分属性会导致其他值恢复默认,需获取原始值 - function scrollTo(duration) { - if (duration <= 0) { - window.scrollTo(0, scrollTop); - return; - } + var font = this.__font__ || this.font; + this.font = font.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function (w, m, u) { + return m * pixelRatio + u; + }); - var distaince = scrollTop - window.scrollY; - requestAnimationFrame(function () { - window.scrollTo(0, window.scrollY + distaince / duration * 10); - scrollTo(duration - 10); - }); - } + _super.apply(this, args); - scrollTo(duration); // TODO 暂不使用 transform 会导致 fixed 元素不可见 - // const body = document.body - // const bodyStyle = body.style - // - // function webkitTransitionEnd() { - // bodyStyle.webkitTransition = '' - // bodyStyle.webkitTransform = '' - // documentElement.scrollTop = scrollTop - // body.removeEventListener('webkitTransitionEnd', webkitTransitionEnd) - // } - // - // body.addEventListener('webkitTransitionEnd', webkitTransitionEnd) - // bodyStyle.webkitTransition = `-webkit-transform ${duration}ms ease-out` - // bodyStyle.webkitTransform = `translateY(${documentElement.scrollTop}px) translateZ(0)` -} -var testReachBottomTimer; -var lastScrollHeight = 0; -function createScrollListener(pageId, _ref2) { - var enablePageScroll = _ref2.enablePageScroll, - enablePageReachBottom = _ref2.enablePageReachBottom, - onReachBottomDistance = _ref2.onReachBottomDistance, - enableTransparentTitleNView = _ref2.enableTransparentTitleNView; - var ticking = false; - var hasReachBottom = false; - var onReachBottom = true; + this.font = font; + }; + }(proto.fillText); - function isReachBottom() { - var scrollHeight = document.documentElement.scrollHeight; // 部分浏览器窗口高度变化后document.documentelement.clientheight不会变化,采用window.innerHeight + proto.strokeText = function (_super) { + return function () { + if (!this.__hidpi__) { + return _super.apply(this, arguments); + } - var windowHeight = window.innerHeight; - var scrollY = window.scrollY; - var isBottom = scrollY > 0 && scrollHeight > windowHeight && scrollY + windowHeight + onReachBottomDistance >= scrollHeight; // 兼容部分浏览器滚动时scroll事件不触发 + var args = Array.prototype.slice.call(arguments); + args[1] *= pixelRatio; // x - var heightChanged = Math.abs(scrollHeight - lastScrollHeight) > onReachBottomDistance; + args[2] *= pixelRatio; // y + // Safari 重新设置部分属性会导致其他值恢复默认,需获取原始值 - if (isBottom && (!hasReachBottom || heightChanged)) { - lastScrollHeight = scrollHeight; - hasReachBottom = true; - return true; - } + var font = this.__font__ || this.font; + this.font = font.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function (w, m, u) { + return m * pixelRatio + u; + }); - if (!isBottom && hasReachBottom) { - hasReachBottom = false; - } + _super.apply(this, args); - return false; - } + this.font = font; + }; + }(proto.strokeText); - function trigger() { - var pages = getCurrentPages(); + proto.drawImage = function (_super) { + return function () { + if (!this.__hidpi__) { + return _super.apply(this, arguments); + } - if (!pages.length || pages[pages.length - 1].$page.id !== pageId) { - return; - } // publish + this.scale(pixelRatio, pixelRatio); + _super.apply(this, arguments); - var scrollTop = window.pageYOffset; + this.scale(1 / pixelRatio, 1 / pixelRatio); + }; + }(proto.drawImage); +} - if (enablePageScroll) { - // 向 Service 发送 onPageScroll 事件 - Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onPageScroll', { - scrollTop: scrollTop - }, pageId); - } +function wrapper(canvas) { + canvas.width = canvas.offsetWidth * pixelRatio; + canvas.height = canvas.offsetHeight * pixelRatio; + canvas.__hidpi__ = true; // 避免低版本安卓上 context 实例被回收 - if (enableTransparentTitleNView) { - UniViewJSBridge.emit('onPageScroll', { - scrollTop: scrollTop - }); - } + canvas.__context2d__ = canvas.getContext('2d'); + canvas.__context2d__.__hidpi__ = true; +} - function testReachBottom() { - if (isReachBottom()) { - Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onReachBottom', {}, pageId); - onReachBottom = false; - setTimeout(function () { - onReachBottom = true; - }, 350); - return true; - } - } +/***/ }), +/* 16 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (enablePageReachBottom && onReachBottom) { - if (testReachBottom()) {} else { - // 解决部分浏览器滚动中js获取窗口高度不准确导致的问题 - testReachBottomTimer = setTimeout(testReachBottom, 300); - } - } +"use strict"; +// 暂不提供通知所有 +// function broadcast (componentName, eventName, ...params) { +// this.$children.forEach(child => { +// const name = child.$options.name && child.$options.name.substr(1) +// if (~componentName.indexOf(name)) { +// child.$emit.apply(child, [eventName].concat(params)) +// } else { +// broadcast.apply(child, [componentName, eventName].concat([params])) +// } +// }) +// } +function broadcast(componentName, eventName) { + var children = this.$children; + var len = children.length; - ticking = false; + for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + params[_key - 2] = arguments[_key]; } - return function onScroll() { - clearTimeout(testReachBottomTimer); + for (var i = 0; i < len; i++) { + var child = children[i]; + var name = child.$options.name && child.$options.name.substr(4); - if (!ticking) { - requestAnimationFrame(trigger); + if (~componentName.indexOf(name)) { + child.$emit.apply(child, [eventName].concat(params)); + return false; + } else { + if (broadcast.apply(child, [componentName, eventName].concat([params])) === false) { + return false; + } } - - ticking = true; - }; + } } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* harmony default export */ __webpack_exports__["a"] = ({ + methods: { + $dispatch: function $dispatch(componentName, eventName) { + if (typeof componentName === 'string') { + componentName = [componentName]; + } -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return vd; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initData; }); -/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57); -/* harmony import */ var _vdom_sync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80); -/* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(59); -/* harmony import */ var _page_factory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(58); -var _handleData; + var parent = this.$parent || this.$root; + var name = parent.$options.name && parent.$options.name.substr(4); -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + while (parent && (!name || !~componentName.indexOf(name))) { + parent = parent.$parent; -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + if (parent) { + name = parent.$options.name && parent.$options.name.substr(4); + } + } -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."); } + if (parent) { + for (var _len2 = arguments.length, params = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + params[_key2 - 2] = arguments[_key2]; + } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + parent.$emit.apply(parent, [eventName].concat(params)); + } + }, + $broadcast: function $broadcast(componentName, eventName) { + if (typeof componentName === 'string') { + componentName = [componentName]; + } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + for (var _len3 = arguments.length, params = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { + params[_key3 - 2] = arguments[_key3]; + } -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + broadcast.apply(this, [componentName, eventName].concat(params)); + } + } +}); -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +/***/ }), +/* 17 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NAVBAR_HEIGHT; }); +/* unused harmony export TABBAR_HEIGHT */ +/* unused harmony export RESPONSIVE_MIN_WIDTH */ +/* unused harmony export DC_LOCALE */ +var NAVBAR_HEIGHT = 44; +var TABBAR_HEIGHT = 50; // 576:landscape phones,768:tablets,992:desktops,1200:large desktops +var RESPONSIVE_MIN_WIDTH = 768; +var DC_LOCALE = '__DC_LOCALE'; +/***/ }), +/* 18 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +// EXPORTS +__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ processEvent; }); +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ initEvents; }); +// EXTERNAL MODULE: ./src/shared/index.js + 7 modules +var shared = __webpack_require__(0); -var vd; -var PageVueComponent; -var handleData = (_handleData = {}, _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATE */ "d"], function onPageCreate(data) { - var _data = _slicedToArray(data, 3), - pageId = _data[0], - pagePath = _data[1], - pageOptions = _data[2]; +// EXTERNAL MODULE: ./src/core/helpers/index.js +var helpers = __webpack_require__(8); - document.title = "".concat(pagePath, "[").concat(pageId, "]"); - updateRootFontSize(); // 设置当前页面伪对象,方便其他地方使用 getCurrentPages 获取当前页面 id,route +// CONCATENATED MODULE: ./src/core/helpers/patch.js +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - Object(_page__WEBPACK_IMPORTED_MODULE_4__[/* setCurrentPage */ "b"])(pageId, pagePath); // 通知页面创建,根据当前页面配置信息,初始化部分事件 - UniViewJSBridge.subscribeHandler(_constants__WEBPACK_IMPORTED_MODULE_2__[/* ON_PAGE_CREATE */ "a"], pageOptions, pageId); // 初始化当前页面 VueComponent(生成页面样式代码) +/** + * mpvue event + */ - PageVueComponent = Object(_page_factory__WEBPACK_IMPORTED_MODULE_5__[/* getPageVueComponent */ "b"])(pagePath); // 生成当前页面 vd +function wrapperMPEvent(event) { + event.mp = Object.assign({ + '@warning': 'mp is deprecated' + }, event); + event._processed = true; + return event; +} +/** + * app-plus titleNView + */ - vd = new _vdom_sync__WEBPACK_IMPORTED_MODULE_3__[/* VDomSync */ "a"](pageId); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* MOUNTED_DATA */ "c"], function onMounted(data) { - vd.addVData.apply(vd, data); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* UPDATED_DATA */ "g"], function onUpdated(data) { - vd.updateVData.apply(vd, data); -}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATED */ "e"], function onPageCreated(data) { - var _data2 = _slicedToArray(data, 2), - pageId = _data2[0], - pagePath = _data2[1]; +function mergeTitleNView(navigationBar, titleNView) { + if (Object(shared["g" /* isPlainObject */])(titleNView)) { + if (Object(shared["e" /* hasOwn */])(titleNView, 'backgroundColor')) { + navigationBar.backgroundColor = titleNView.backgroundColor; + } - var page = getCurrentPages()[0]; - page.$vm = new PageVueComponent({ - mpType: 'page', - pageId: pageId, - pagePath: pagePath - }).$mount('#app'); -}), _handleData); + if (Object(shared["e" /* hasOwn */])(titleNView, 'buttons')) { + navigationBar.buttons = titleNView.buttons; + } -function broadcast(vm, componentName, eventName) { - for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - params[_key - 3] = arguments[_key]; - } + if (Object(shared["e" /* hasOwn */])(titleNView, 'titleColor')) { + navigationBar.textColor = titleNView.titleColor; + } - vm.$children.forEach(function (child) { - var name = child.$options.name && child.$options.name.replace(/^VUni/, ''); + if (Object(shared["e" /* hasOwn */])(titleNView, 'titleText')) { + navigationBar.titleText = titleNView.titleText; + } - if (~componentName.indexOf(name)) { - child.$emit.apply(child, [eventName].concat(params)); + if (Object(shared["e" /* hasOwn */])(titleNView, 'titleSize')) { + navigationBar.titleSize = titleNView.titleSize; } - broadcast.apply(void 0, [child, componentName, eventName].concat(params)); - }); -} + if (Object(shared["e" /* hasOwn */])(titleNView, 'type')) { + navigationBar.type = titleNView.type; + } -var NATIVE_COMPONENTS = ['Camera', 'LivePlayer', 'LivePusher', 'Map', 'Video', 'CoverView', 'CoverImage', 'Ad']; + if (Object(shared["e" /* hasOwn */])(titleNView, 'searchInput') && _typeof(titleNView.searchInput) === 'object') { + navigationBar.searchInput = Object.assign({ + autoFocus: false, + align: 'center', + color: '#000000', + backgroundColor: 'rgba(255,255,255,0.5)', + borderRadius: '0px', + placeholder: '', + placeholderColor: '#CCCCCC', + disabled: false + }, titleNView.searchInput); + } + } -function updateView() { - var pages = getCurrentPages(); - var pageVm = pages[0] && pages[0].$vm; - pageVm && broadcast(pageVm, NATIVE_COMPONENTS, 'uni-view-update'); + return navigationBar; } +// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-window-offset.js +var get_window_offset = __webpack_require__(14); -function updateRootFontSize() { - // 页面存在横竖屏切换时,预加载的 webview 的 fontSize 需要再次校正一下 - var oldFontSize = document.documentElement.style.fontSize; - var newFontSize = document.documentElement.clientWidth / 20 + 'px'; +// CONCATENATED MODULE: ./src/core/view/plugins/events.js - if (oldFontSize !== newFontSize) { - document.documentElement.style.fontSize = newFontSize; - } -} -window.addEventListener('resize', function () { - // TODO 与之前逻辑保持一致,仅当前 webview 未被使用时,校准 fontSize,后续考虑动态旋转,调整rootfontSize - if (!getCurrentPages().length) { - updateRootFontSize(); - } - updateView(); -}); -window.addEventListener('updateview', updateView); -function vdSync(_ref) { - var data = _ref.data, - options = _ref.options; - var isVdCallback = true; - data.forEach(function (data) { - if (data[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATE */ "d"]) { - // 页面创建无需触发 callback - isVdCallback = false; - } - handleData[data[0]](data[1]); - }); - vd.flush(); - vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].nextTick(function () { - // 清空本次 addBatchData - vd.clearAddBatchVData(); - updateView(); - isVdCallback && UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_1__[/* VD_SYNC_CALLBACK */ "i"]); - }); -} +function processTarget(target, detail) { + var checkShadowRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var res = { + id: target.id, + offsetLeft: target.offsetLeft, + offsetTop: target.offsetTop, + dataset: Object(helpers["a" /* getTargetDataset */])(target) + }; -function getData(id, name) { - try { - return this.$r[id][name]; - } catch (e) { - console.error(this.$options.__file + ":[".concat(this._$id, "]$r[").concat(id, "][").concat(name, "] is undefined")); + if (detail) { + Object.assign(res, detail); } + + return res; } -/** - * wxs change:prop - * @param {Object} id - * @param {Object} name - */ +function processTouches(touches) { + if (touches) { + var res = []; + + var _getWindowOffset = Object(get_window_offset["a" /* default */])(), + top = _getWindowOffset.top; -function getChangeData(id, name) { - try { - var value = this.$r[id][name]; - var wxsPropName = name.replace('change:', ''); - this[wxsPropName] = value; - this.$set(this.wxsProps, wxsPropName, value); - return value; - } catch (e) { - console.error(this.$options.__file + ":[".concat(this._$id, "]$r[").concat(id, "][").concat(name, "] is undefined")); + for (var i = 0; i < touches.length; i++) { + var touch = touches[i]; + res.push({ + identifier: touch.identifier, + pageX: touch.pageX, + pageY: touch.pageY - top, + clientX: touch.clientX, + clientY: touch.clientY - top, + force: touch.force || 0 + }); + } + + return res; } + + return []; } -function initData(Vue) { - Vue.prototype._$g = getData; - Vue.prototype._$gc = getChangeData; - UniViewJSBridge.subscribe(_constants__WEBPACK_IMPORTED_MODULE_1__[/* VD_SYNC */ "h"], vdSync); - Object.defineProperty(Vue.prototype, '_$vd', { - get: function get() { - return !this.$options.isReserved && vd; - } - }); - Vue.mixin({ - beforeCreate: function beforeCreate() { - if (this.$options.mpType) { - this.mpType = this.$options.mpType; - } - - if (this._$vd) { - this._$vd.initVm(this); - } - } - }); -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - -/***/ }), -/* 15 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return pixelRatio; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wrapper; }); -/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); - -var pixelRatio = function () { - var canvas = document.createElement('canvas'); - canvas.height = canvas.width = 0; - var context = canvas.getContext('2d'); - var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; - return (window.devicePixelRatio || 1) / backingStore; -}(); - -var forEach = function forEach(obj, func) { - for (var key in obj) { - if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "c"])(obj, key)) { - func(obj[key], key); - } - } -}; - -var ratioArgs = { - fillRect: 'all', - clearRect: 'all', - strokeRect: 'all', - moveTo: 'all', - lineTo: 'all', - arc: [0, 1, 2], - arcTo: 'all', - bezierCurveTo: 'all', - isPointinPath: 'all', - isPointinStroke: 'all', - quadraticCurveTo: 'all', - rect: 'all', - translate: 'all', - createRadialGradient: 'all', - createLinearGradient: 'all', - setTransform: [4, 5] -}; -var proto = CanvasRenderingContext2D.prototype; - -proto.drawImageByCanvas = function (_super) { - return function (canvas, srcx, srcy, srcw, srch, desx, desy, desw, desh, isScale) { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } +function processEvent(name) { + var $event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var currentTarget = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; - srcx *= pixelRatio; - srcy *= pixelRatio; - srcw *= pixelRatio; - srch *= pixelRatio; - desx *= pixelRatio; - desy *= pixelRatio; - desw = isScale ? desw * pixelRatio : desw; - desh = isScale ? desh * pixelRatio : desh; + if ($event._processed) { + $event.type = detail.type || name; + return $event; + } // fixed 针对小程序 click(tap)事件,补充事件详情 - _super.call(this, canvas, srcx, srcy, srcw, srch, desx, desy, desw, desh); - }; -}(proto.drawImage); -if (pixelRatio !== 1) { - forEach(ratioArgs, function (value, key) { - proto[key] = function (_super) { - return function () { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } + if (name === 'click') { + var _getWindowOffset2 = Object(get_window_offset["a" /* default */])(), + top = _getWindowOffset2.top; - var args = Array.prototype.slice.call(arguments); + detail = { + x: $event.x, + y: $event.y - top + }; + $event.touches = $event.changedTouches = [{ + force: 1, + identifier: 0, + clientX: $event.clientX, + clientY: $event.clientY, + pageX: $event.pageX, + pageY: $event.pageY + }]; + } // fixed mp-vue - if (value === 'all') { - args = args.map(function (a) { - return a * pixelRatio; - }); - } else if (Array.isArray(value)) { - for (var i = 0; i < value.length; i++) { - args[value[i]] *= pixelRatio; - } - } - return _super.apply(this, args); - }; - }(proto[key]); + var ret = wrapperMPEvent({ + type: detail.type || name, + timeStamp: $event.timeStamp || 0, + detail: detail, + target: processTarget(target, detail), + currentTarget: processTarget(currentTarget, false, true), + // 只处理系统事件 + touches: $event instanceof Event || $event instanceof CustomEvent ? processTouches($event.touches) : $event.touches, + changedTouches: $event instanceof Event || $event instanceof CustomEvent ? processTouches($event.changedTouches) : $event.changedTouches, + preventDefault: function preventDefault() {}, + stopPropagation: function stopPropagation() {} }); - proto.stroke = function (_super) { - return function () { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } - - this.lineWidth *= pixelRatio; - - _super.apply(this, arguments); - - this.lineWidth /= pixelRatio; - }; - }(proto.stroke); - - proto.fillText = function (_super) { - return function () { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } + if (name.startsWith('mouse')) { + var _getWindowOffset3 = Object(get_window_offset["a" /* default */])(), + _top = _getWindowOffset3.top; - var args = Array.prototype.slice.call(arguments); - args[1] *= pixelRatio; - args[2] *= pixelRatio; - this.font = this.font.replace(/(\d+)(px|em|rem|pt)/g, function (w, m, u) { - return m * pixelRatio + u; - }); + ret.pageX = $event.pageX; + ret.pageY = $event.pageY - _top; + ret.clientX = $event.clientX; + ret.clientY = $event.clientY - _top; + } - _super.apply(this, args); + if (true) { + var nid = currentTarget.getAttribute('_i'); + ret.options = { + nid: nid + }; // 保留原始 currentTarget 方便后续对比 - this.font = this.font.replace(/(\d+)(px|em|rem|pt)/g, function (w, m, u) { - return m / pixelRatio + u; - }); - }; - }(proto.fillText); + ret.$origCurrentTarget = currentTarget; + } - proto.strokeText = function (_super) { - return function () { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } + return ret; +} +var LONGPRESS_TIMEOUT = 350; +var LONGPRESS_THRESHOLD = 10; +var passiveOptions = shared["k" /* supportsPassive */] ? { + passive: true +} : false; +var longPressTimer = false; - var args = Array.prototype.slice.call(arguments); - args[1] *= pixelRatio; // x +function clearLongPressTimer() { + if (longPressTimer) { + clearTimeout(longPressTimer); + longPressTimer = false; + } +} - args[2] *= pixelRatio; // y +var startPageX = 0; +var startPageY = 0; - this.font = this.font.replace(/(\d+)(px|em|rem|pt)/g, function (w, m, u) { - return m * pixelRatio + u; - }); +function touchstart(evt) { + clearLongPressTimer(); - _super.apply(this, args); + if (evt.touches.length !== 1) { + return; + } - this.font = this.font.replace(/(\d+)(px|em|rem|pt)/g, function (w, m, u) { - return m / pixelRatio + u; - }); - }; - }(proto.strokeText); + var _evt$touches$ = evt.touches[0], + pageX = _evt$touches$.pageX, + pageY = _evt$touches$.pageY; + startPageX = pageX; + startPageY = pageY; + longPressTimer = setTimeout(function () { + var customEvent = new CustomEvent('longpress', { + bubbles: true, + cancelable: true, + target: evt.target, + currentTarget: evt.currentTarget + }); + customEvent.touches = evt.touches; + customEvent.changedTouches = evt.changedTouches; + evt.target.dispatchEvent(customEvent); + }, LONGPRESS_TIMEOUT); +} - proto.drawImage = function (_super) { - return function () { - if (!this.__hidpi__) { - return _super.apply(this, arguments); - } +function touchmove(evt) { + if (!longPressTimer) { + return; + } - this.scale(pixelRatio, pixelRatio); + if (evt.touches.length !== 1) { + return clearLongPressTimer(); + } - _super.apply(this, arguments); + var _evt$touches$2 = evt.touches[0], + pageX = _evt$touches$2.pageX, + pageY = _evt$touches$2.pageY; - this.scale(1 / pixelRatio, 1 / pixelRatio); - }; - }(proto.drawImage); + if (Math.abs(pageX - startPageX) > LONGPRESS_THRESHOLD || Math.abs(pageY - startPageY) > LONGPRESS_THRESHOLD) { + return clearLongPressTimer(); + } } -function wrapper(canvas) { - canvas.width = canvas.offsetWidth * pixelRatio; - canvas.height = canvas.offsetHeight * pixelRatio; - canvas.getContext('2d').__hidpi__ = true; +function initEvents() { + window.addEventListener('touchstart', touchstart, passiveOptions); + window.addEventListener('touchmove', touchmove, passiveOptions); + window.addEventListener('touchend', clearLongPressTimer, passiveOptions); + window.addEventListener('touchcancel', clearLongPressTimer, passiveOptions); } /***/ }), -/* 16 */ +/* 19 */ /***/ (function(module, exports) { var g; @@ -10835,1247 +11141,847 @@ module.exports = g; /***/ }), -/* 17 */ +/* 20 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - data: function data() { - return { - hovering: false - }; - }, - props: { - hoverClass: { - type: String, - default: 'none' - }, - hoverStopPropagation: { - type: Boolean, - default: false - }, - hoverStartTime: { - type: [Number, String], - default: 50 - }, - hoverStayTime: { - type: [Number, String], - default: 400 +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return publishHandler; }); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); + + +function publishHandler(event) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + Object(uni_shared__WEBPACK_IMPORTED_MODULE_1__[/* plusReady */ "j"])(function () { + var pageId = plus.webview.currentWebview().id; + + if (true) { + console.log("[VIEW][".concat(Date.now(), "]:"), event, args, pageId); } - }, - methods: { - _hoverTouchStart: function _hoverTouchStart(evt) { - var _this = this; - // TODO detect scrolling - if (evt._hoverPropagationStopped) { - return; + plus.webview.postMessageToUniNView({ + type: 'subscribeHandler', + args: { + type: event, + data: args, + pageId: pageId } + }, _constants__WEBPACK_IMPORTED_MODULE_0__[/* APP_SERVICE_ID */ "a"]); + }); +} - if (!this.hoverClass || this.hoverClass === 'none' || this.disabled) { - return; - } +/***/ }), +/* 21 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (evt.touches.length > 1) { - return; - } +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return findElm; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return elementMatchesPolyfill; }); +function findVmById(id, vm) { + if (id === vm._$id) { + return vm; + } - if (this.hoverStopPropagation) { - evt._hoverPropagationStopped = true; - } + var childVms = vm.$children; + var len = childVms.length; - this._hoverTouch = true; - this._hoverStartTimer = setTimeout(function () { - _this.hovering = true; + for (var i = 0; i < len; i++) { + var childVm = findVmById(id, childVms[i]); - if (!_this._hoverTouch) { - // 防止在hoverStartTime时间内触发了 touchend 或 touchcancel - _this._hoverReset(); - } - }, this.hoverStartTime); - }, - _hoverTouchEnd: function _hoverTouchEnd(evt) { - this._hoverTouch = false; + if (childVm) { + return childVm; + } + } +} - if (this.hovering) { - this._hoverReset(); +function findElm(component, pageVm) { + if (!pageVm) { + return console.error('page is not ready'); + } + + if (!component) { + return pageVm.$el; + } + + if (true) { + if (typeof component === 'string') { + var componentVm = findVmById(component, pageVm); + + if (!componentVm) { + throw new Error("Not Found\uFF1APage[".concat(pageVm.$page.id, "][").concat(component, "]")); } - }, - _hoverReset: function _hoverReset() { - var _this2 = this; - requestAnimationFrame(function () { - clearTimeout(_this2._hoverStayTimer); - _this2._hoverStayTimer = setTimeout(function () { - _this2.hovering = false; - }, _this2.hoverStayTime); - }); - }, - _hoverTouchCancel: function _hoverTouchCancel(evt) { - this._hoverTouch = false; - this.hovering = false; - clearTimeout(this._hoverStartTimer); + return componentVm.$el; } } -}); -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { + return component.$el; +} +function elementMatchesPolyfill(Element) { + if (!Element.matches) { + Element.matches = Element.matchesSelector || Element.mozMatchesSelector || Element.msMatchesSelector || Element.oMatchesSelector || Element.webkitMatchesSelector || function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s); + var i = matches.length; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + while (--i >= 0 && matches.item(i) !== this) {} + + return i > -1; + }; + } + + return Element; +} /***/ }), -/* 19 */ +/* 22 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15); -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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."); } +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return disableScroll; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return pageScrollTo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createScrollListener; }); +/* harmony import */ var uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20); -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function disableScroll(evt) { + evt.preventDefault(); +} +function pageScrollTo(_ref) { + var scrollTop = _ref.scrollTop, + duration = _ref.duration; + var documentElement = document.documentElement; + var clientHeight = documentElement.clientHeight, + scrollHeight = documentElement.scrollHeight; + scrollTop = Math.min(scrollTop, scrollHeight - clientHeight); -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + if (duration === 0) { + // 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制 + documentElement.scrollTop = document.body.scrollTop = scrollTop; + return; + } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + if (window.scrollY === scrollTop) { + return; + } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + function scrollTo(duration) { + if (duration <= 0) { + window.scrollTo(0, scrollTop); + return; + } -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// + var distaince = scrollTop - window.scrollY; + requestAnimationFrame(function () { + window.scrollTo(0, window.scrollY + distaince / duration * 10); + scrollTo(duration - 10); + }); + } + scrollTo(duration); // TODO 暂不使用 transform 会导致 fixed 元素不可见 + // const body = document.body + // const bodyStyle = body.style + // + // function webkitTransitionEnd() { + // bodyStyle.webkitTransition = '' + // bodyStyle.webkitTransform = '' + // documentElement.scrollTop = scrollTop + // body.removeEventListener('webkitTransitionEnd', webkitTransitionEnd) + // } + // + // body.addEventListener('webkitTransitionEnd', webkitTransitionEnd) + // bodyStyle.webkitTransition = `-webkit-transform ${duration}ms ease-out` + // bodyStyle.webkitTransform = `translateY(${documentElement.scrollTop}px) translateZ(0)` +} +var testReachBottomTimer; +var lastScrollHeight = 0; +function createScrollListener(pageId, _ref2) { + var enablePageScroll = _ref2.enablePageScroll, + enablePageReachBottom = _ref2.enablePageReachBottom, + onReachBottomDistance = _ref2.onReachBottomDistance, + enableTransparentTitleNView = _ref2.enableTransparentTitleNView; + var ticking = false; + var hasReachBottom = false; + var onReachBottom = true; + function isReachBottom() { + var scrollHeight = document.documentElement.scrollHeight; // 部分浏览器窗口高度变化后document.documentelement.clientheight不会变化,采用window.innerHeight -function resolveColor(color) { - color = color.slice(0); - color[3] = color[3] / 255; - return 'rgba(' + color.join(',') + ')'; -} + var windowHeight = window.innerHeight; + var scrollY = window.scrollY; + var isBottom = scrollY > 0 && scrollHeight > windowHeight && scrollY + windowHeight + onReachBottomDistance >= scrollHeight; // 兼容部分浏览器滚动时scroll事件不触发 -function processTouches(target, touches) { - return [].map.call(touches, function (touch) { - var boundingClientRect = target.getBoundingClientRect(); - return { - identifier: touch.identifier, - x: touch.clientX - boundingClientRect.left, - y: touch.clientY - boundingClientRect.top - }; - }); -} + var heightChanged = Math.abs(scrollHeight - lastScrollHeight) > onReachBottomDistance; -var tempCanvas; + if (isBottom && (!hasReachBottom || heightChanged)) { + lastScrollHeight = scrollHeight; + hasReachBottom = true; + return true; + } -function getTempCanvas() { - var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + if (!isBottom && hasReachBottom) { + hasReachBottom = false; + } - if (!tempCanvas) { - tempCanvas = document.createElement('canvas'); + return false; } - tempCanvas.width = width; - tempCanvas.height = height; - return tempCanvas; -} + function trigger() { + var pages = getCurrentPages(); -/* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Canvas', - mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "e"]], - props: { - canvasId: { - type: String, - default: '' - }, - disableScroll: { - type: [Boolean, String], - default: false - } - }, - data: function data() { - return { - actionsWaiting: false - }; - }, - computed: { - id: function id() { - return this.canvasId; - }, - _listeners: function _listeners() { - var _this = this; + if (!pages.length || pages[pages.length - 1].$page.id !== pageId) { + return; + } // publish - var $listeners = Object.assign({}, this.$listeners); - var events = ['touchstart', 'touchmove', 'touchend']; - events.forEach(function (event) { - var existing = $listeners[event]; - var eventHandler = []; - if (existing) { - eventHandler.push(function ($event) { - _this.$trigger(event, Object.assign({}, $event, { - touches: processTouches($event.currentTarget, $event.touches), - changedTouches: processTouches($event.currentTarget, $event.changedTouches) - })); - }); - } + var scrollTop = window.pageYOffset; - if (_this.disableScroll && event === 'touchmove') { - eventHandler.push(_this._touchmove); - } + if (enablePageScroll) { + // 向 Service 发送 onPageScroll 事件 + Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onPageScroll', { + scrollTop: scrollTop + }, pageId); + } - $listeners[event] = eventHandler; + if (enableTransparentTitleNView) { + UniViewJSBridge.emit('onPageScroll', { + scrollTop: scrollTop }); - return $listeners; } - }, - created: function created() { - this._actionsDefer = []; - this._images = {}; - }, - mounted: function mounted() { - this._resize({ - width: this.$refs.sensor.$el.offsetWidth, - height: this.$refs.sensor.$el.offsetHeight - }); - }, - beforeDestroy: function beforeDestroy() { - var canvas = this.$refs.canvas; - canvas.height = canvas.width = 0; - }, - methods: { - _handleSubscribe: function _handleSubscribe(_ref) { - var type = _ref.type, - _ref$data = _ref.data, - data = _ref$data === void 0 ? {} : _ref$data; - var method = this[type]; - if (type.indexOf('_') !== 0 && typeof method === 'function') { - method(data); + function testReachBottom() { + if (isReachBottom()) { + Object(uni_platform_view_bridge__WEBPACK_IMPORTED_MODULE_0__[/* publishHandler */ "a"])('onReachBottom', {}, pageId); + onReachBottom = false; + setTimeout(function () { + onReachBottom = true; + }, 350); + return true; } - }, - _resize: function _resize() { - var canvas = this.$refs.canvas; + } - if (canvas.width > 0 && canvas.height > 0) { - var context = canvas.getContext('2d'); - var imageData = context.getImageData(0, 0, canvas.width, canvas.height); - Object(uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* wrapper */ "b"])(this.$refs.canvas); - context.putImageData(imageData, 0, 0); - } else { - Object(uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* wrapper */ "b"])(this.$refs.canvas); + if (enablePageReachBottom && onReachBottom) { + if (testReachBottom()) {} else { + // 解决部分浏览器滚动中js获取窗口高度不准确导致的问题 + testReachBottomTimer = setTimeout(testReachBottom, 300); } - }, - _touchmove: function _touchmove(event) { - event.preventDefault(); - }, - actionsChanged: function actionsChanged(_ref2) { - var _this2 = this; + } - var actions = _ref2.actions, - reserve = _ref2.reserve, - callbackId = _ref2.callbackId; - var self = this; + ticking = false; + } - if (!actions) { - return; - } + return function onScroll() { + clearTimeout(testReachBottomTimer); - if (this.actionsWaiting) { - this._actionsDefer.push([actions, reserve, callbackId]); + if (!ticking) { + requestAnimationFrame(trigger); + } - return; - } + ticking = true; + }; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - var canvas = this.$refs.canvas; - var c2d = canvas.getContext('2d'); +/***/ }), +/* 23 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (!reserve) { - c2d.fillStyle = '#000000'; - c2d.strokeStyle = '#000000'; - c2d.shadowColor = '#000000'; - c2d.shadowBlur = 0; - c2d.shadowOffsetX = 0; - c2d.shadowOffsetY = 0; - c2d.setTransform(1, 0, 0, 1, 0, 0); - c2d.clearRect(0, 0, canvas.width, canvas.height); - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return vd; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initData; }); +/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67); +/* harmony import */ var _vdom_sync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(106); +/* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69); +/* harmony import */ var _page_factory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(68); +var _handleData; - this.preloadImage(actions); +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - var _loop2 = function _loop2(index) { - var action = actions[index]; - var method = action.method; - var data = action.data; +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - if (/^set/.test(method) && method !== 'setTransform') { - var method1 = method[3].toLowerCase() + method.slice(4); - var color; +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."); } - if (method1 === 'fillStyle' || method1 === 'strokeStyle') { - if (data[0] === 'normal') { - color = resolveColor(data[1]); - } else if (data[0] === 'linear') { - var LinearGradient = c2d.createLinearGradient.apply(c2d, _toConsumableArray(data[1])); - data[2].forEach(function (data2) { - var offset = data2[0]; - var color = resolveColor(data2[1]); - LinearGradient.addColorStop(offset, color); - }); - color = LinearGradient; - } else if (data[0] === 'radial') { - var x = data[1][0]; - var y = data[1][1]; - var r = data[1][2]; +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - var _LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r); +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - data[2].forEach(function (data2) { - var offset = data2[0]; - var color = resolveColor(data2[1]); +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - _LinearGradient.addColorStop(offset, color); - }); - color = _LinearGradient; - } else if (data[0] === 'pattern') { - var loaded = _this2.checkImageLoaded(data[1], actions.slice(index + 1), callbackId, function (image) { - if (image) { - c2d[method1] = c2d.createPattern(image, data[2]); - } - }); +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - if (!loaded) { - return "break"; - } - return "continue"; - } - c2d[method1] = color; - } else if (method1 === 'globalAlpha') { - c2d[method1] = data[0] / 255; - } else if (method1 === 'shadow') { - _ = ['shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'shadowColor']; - data.forEach(function (color_, method_) { - c2d[_[method_]] = _[method_] === 'shadowColor' ? resolveColor(color_) : color_; - }); - } else { - if (method1 === 'fontSize') { - c2d.font = c2d.font.replace(/\d+\.?\d*px/, data[0] + 'px'); - } else { - if (method1 === 'lineDash') { - c2d.setLineDash(data[0]); - c2d.lineDashOffset = data[1] || 0; - } else { - if (method1 === 'textBaseline') { - if (data[0] === 'normal') { - data[0] = 'alphabetic'; - } - c2d[method1] = data[0]; - } else { - c2d[method1] = data[0]; - } - } - } - } - } else if (method === 'fillPath' || method === 'strokePath') { - method = method.replace(/Path/, ''); - c2d.beginPath(); - data.forEach(function (data_) { - c2d[data_.method].apply(c2d, data_.data); - }); - c2d[method](); - } else if (method === 'fillText') { - c2d.fillText.apply(c2d, data); - } else if (method === 'drawImage') { - A = function () { - var dataArray = _toConsumableArray(data); - var url = dataArray[0]; - var otherData = dataArray.slice(1); - self._images = self._images || {}; - if (!self.checkImageLoaded(url, actions.slice(index + 1), callbackId, function (image) { - if (image) { - c2d.drawImage.apply(c2d, [image].concat(_toConsumableArray(otherData.slice(4, 8)), _toConsumableArray(otherData.slice(0, 4)))); - } - })) return 'break'; - }(); - if (A === 'break') { - return "break"; - } - } else { - if (method === 'clip') { - data.forEach(function (data_) { - c2d[data_.method].apply(c2d, data_.data); - }); - c2d.clip(); - } else { - c2d[method].apply(c2d, data); - } - } - }; - _loop: for (var index = 0; index < actions.length; index++) { - var _; +var vd; +var PageVueComponent; +var handleData = (_handleData = {}, _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATE */ "d"], function onPageCreate(data) { + var _data = _slicedToArray(data, 3), + pageId = _data[0], + pagePath = _data[1], + pageOptions = _data[2]; - var A; - - var _ret = _loop2(index); - - switch (_ret) { - case "break": - break _loop; - - case "continue": - continue; - } - } + document.title = "".concat(pagePath, "[").concat(pageId, "]"); // 设置当前页面伪对象,方便其他地方使用 getCurrentPages 获取当前页面 id,route - if (!this.actionsWaiting && callbackId) { - UniViewJSBridge.publishHandler('onDrawCanvas', { - callbackId: callbackId, - data: { - errMsg: 'drawCanvas:ok' - } - }, this.$page.id); - } - }, - preloadImage: function preloadImage(actions) { - var sefl = this; - actions.forEach(function (action) { - var method = action.method; - var data = action.data; - var src = ''; + Object(_page__WEBPACK_IMPORTED_MODULE_4__[/* setCurrentPage */ "b"])(pageId, pagePath); // 通知页面创建,根据当前页面配置信息,初始化部分事件 - if (method === 'drawImage') { - src = data[0]; - src = sefl.$getRealPath(src); - data[0] = src; - } else if (method === 'setFillStyle' && data[0] === 'pattern') { - src = data[1]; - src = sefl.$getRealPath(src); - data[1] = src; - } + UniViewJSBridge.subscribeHandler(_constants__WEBPACK_IMPORTED_MODULE_2__[/* ON_PAGE_CREATE */ "a"], pageOptions, pageId); // 初始化当前页面 VueComponent(生成页面样式代码) - if (src && !sefl._images[src]) { - loadImage(); - } - /** - * 加载图像 - */ + PageVueComponent = Object(_page_factory__WEBPACK_IMPORTED_MODULE_5__[/* getPageVueComponent */ "b"])(pagePath); // 生成当前页面 vd + vd = new _vdom_sync__WEBPACK_IMPORTED_MODULE_3__[/* VDomSync */ "a"](pageId, { + version: pageOptions.version + }); +}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* MOUNTED_DATA */ "c"], function onMounted(data) { + vd.addVData.apply(vd, data); +}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* UPDATED_DATA */ "h"], function onUpdated(data) { + vd.updateVData.apply(vd, data); +}), _defineProperty(_handleData, _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATED */ "e"], function onPageCreated(data) { + var _data2 = _slicedToArray(data, 3), + pageId = _data2[0], + pagePath = _data2[1], + pageQuery = _data2[2]; - function loadImage() { - sefl._images[src] = new Image(); + var page = getCurrentPages()[0]; + page.options = pageQuery || {}; + page.$vm = new PageVueComponent({ + mpType: 'page', + pageId: pageId, + pagePath: pagePath, + pageQuery: pageQuery + }).$mount('#app'); +}), _handleData); - sefl._images[src].onload = function () { - sefl._images[src].ready = true; - }; - /** - * 从Blob加载 - * @param {Blob} blob - */ +function broadcast(vm, componentName, eventName) { + for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + params[_key - 3] = arguments[_key]; + } + vm.$children.forEach(function (child) { + var name = child.$options.name && child.$options.name.replace(/^VUni/, ''); - function loadBlob(blob) { - sefl._images[src].src = (window.URL || window.webkitURL).createObjectURL(blob); - } - /** - * 从本地文件加载 - * @param {string} path 文件路径 - */ + if (~componentName.indexOf(name)) { + child.$emit.apply(child, [eventName].concat(params)); + } + broadcast.apply(void 0, [child, componentName, eventName].concat(params)); + }); +} - function loadFile(path) { - var bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now()); - bitmap.load(path, function () { - sefl._images[src].src = bitmap.toBase64Data(); - bitmap.clear(); - }, function () { - bitmap.clear(); - console.error('preloadImage error'); - }); - } - /** - * 从网络加载 - * @param {string} url 文件地址 - */ +var NATIVE_COMPONENTS = ['Camera', 'LivePlayer', 'LivePusher', 'Map', 'Video', 'CoverView', 'CoverImage', 'Ad']; +function updateView() { + var pages = getCurrentPages(); + var pageVm = pages[0] && pages[0].$vm; + pageVm && broadcast(pageVm, NATIVE_COMPONENTS, 'uni-view-update'); +} - function loadUrl(url) { - function plusDownload() { - plus.downloader.createDownload(url, { - filename: '_doc/uniapp_temp/download/' - }, function (d, status) { - if (status === 200) { - loadFile(d.filename); - } else { - sefl._images[src].src = src; - } - }).start(); - } +window.addEventListener('resize', function () { + updateView(); +}); +window.addEventListener('updateview', updateView); - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.responseType = 'blob'; +function vdSync(_ref) { + var data = _ref.data, + options = _ref.options; + var isVdCallback = true; + data.forEach(function (data) { + if (data[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[/* PAGE_CREATE */ "d"]) { + // 页面创建无需触发 callback + isVdCallback = false; + } - xhr.onload = function () { - if (this.status === 200) { - loadBlob(this.response); - } - }; + handleData[data[0]](data[1]); + }); + vd.flush(); + vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].nextTick(function () { + // 清空本次 addBatchData + vd.clearAddBatchVData(); + updateView(); + isVdCallback && UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_1__[/* VD_SYNC_CALLBACK */ "j"]); + }); +} - xhr.onerror = window.plus ? plusDownload : function () { - sefl._images[src].src = src; - }; - xhr.send(); - } +function getData(id, name) { + try { + return this.$r[id][name]; + } catch (e) {// console.error(this.$options.__file + `:[${this._$id}]$r[${id}][${name}] is undefined`) + } +} +/** + * wxs change:prop + * @param {Object} id + * @param {Object} name + */ - if (window.plus && (!window.webkit || !window.webkit.messageHandlers)) { - sefl._images[src].src = src; - } else { - // 解决 PLUS-APP(wkwebview)以及 H5 图像跨域问题(H5图像响应头需包含access-control-allow-origin) - if (window.plus && src.indexOf('http://') !== 0 && src.indexOf('https://') !== 0) { - loadFile(src); - } else if (/^data:.*,.*/.test(src)) { - sefl._images[src].src = src; - } else { - loadUrl(src); - } - } - } - }); - }, - checkImageLoaded: function checkImageLoaded(src, actions, callbackId, fn) { - var self = this; - var image = this._images[src]; - if (image.ready) { - fn(image); - return true; - } else { - this._actionsDefer.unshift([actions, true]); +function getChangeData(id, name) { + try { + var value = this.$r[id][name]; + var wxsPropName = name.replace('change:', ''); + this[wxsPropName] = value; + this.$set(this.wxsProps, wxsPropName, value); + return value; + } catch (e) {// console.error(this.$options.__file + `:[${this._$id}]$r[${id}][${name}] is undefined`) + } +} - this.actionsWaiting = true; +function initData(Vue) { + Vue.prototype._$g = getData; + Vue.prototype._$gc = getChangeData; + UniViewJSBridge.subscribe(_constants__WEBPACK_IMPORTED_MODULE_1__[/* VD_SYNC */ "i"], vdSync); + Object.defineProperty(Vue.prototype, '_$vd', { + get: function get() { + return !this.$options.isReserved && vd; + } + }); + Vue.mixin({ + beforeCreate: function beforeCreate() { + if (this.$options.mpType) { + this.mpType = this.$options.mpType; + } - image.onload = function () { - image.ready = true; - fn(image); - self.actionsWaiting = false; + if (this._$vd) { + this._$vd.initVm(this); + } + } + }); +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - var actions = self._actionsDefer.slice(0); +/***/ }), +/* 24 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - self._actionsDefer = []; +"use strict"; +/* harmony default export */ __webpack_exports__["a"] = ({ + data: function data() { + return { + hovering: false + }; + }, + props: { + hoverClass: { + type: String, + default: 'none' + }, + hoverStopPropagation: { + type: Boolean, + default: false + }, + hoverStartTime: { + type: [Number, String], + default: 50 + }, + hoverStayTime: { + type: [Number, String], + default: 400 + } + }, + methods: { + _hoverTouchStart: function _hoverTouchStart(evt) { + var _this = this; - for (var action = actions.shift(); action;) { - self.actionsChanged({ - actions: action[0], - reserve: action[1], - callbackId: callbackId - }); - action = actions.shift(); - } - }; + // TODO detect scrolling + if (evt._hoverPropagationStopped) { + return; + } - return false; + if (!this.hoverClass || this.hoverClass === 'none' || this.disabled) { + return; } - }, - getImageData: function getImageData(_ref3) { - var _ref3$x = _ref3.x, - x = _ref3$x === void 0 ? 0 : _ref3$x, - _ref3$y = _ref3.y, - y = _ref3$y === void 0 ? 0 : _ref3$y, - width = _ref3.width, - height = _ref3.height, - destWidth = _ref3.destWidth, - destHeight = _ref3.destHeight, - _ref3$hidpi = _ref3.hidpi, - hidpi = _ref3$hidpi === void 0 ? true : _ref3$hidpi, - callbackId = _ref3.callbackId; - var imgData; - var canvas = this.$refs.canvas; - if (!width) { - width = canvas.offsetWidth - x; + if (evt.touches.length > 1) { + return; } - if (!height) { - height = canvas.offsetHeight - y; + if (this.hoverStopPropagation) { + evt._hoverPropagationStopped = true; } - try { - if (!hidpi) { - if (!destWidth && !destHeight) { - destWidth = Math.round(width * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]); - destHeight = Math.round(height * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]); - } else if (!destWidth) { - destWidth = Math.round(width / height * destHeight); - } else if (!destHeight) { - destHeight = Math.round(height / width * destWidth); - } - } else { - destWidth = width; - destHeight = height; - } + this._hoverTouch = true; + this._hoverStartTimer = setTimeout(function () { + _this.hovering = true; - var newCanvas = getTempCanvas(destWidth, destHeight); - var context = newCanvas.getContext('2d'); - context.__hidpi__ = true; - context.drawImageByCanvas(canvas, x, y, width, height, 0, 0, destWidth, destHeight, false); - imgData = context.getImageData(0, 0, destWidth, destHeight); - newCanvas.height = newCanvas.width = 0; - context.__hidpi__ = false; - } catch (error) { - if (!callbackId) { - return; + if (!_this._hoverTouch) { + // 防止在hoverStartTime时间内触发了 touchend 或 touchcancel + _this._hoverReset(); } + }, this.hoverStartTime); + }, + _hoverTouchEnd: function _hoverTouchEnd(evt) { + this._hoverTouch = false; - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasGetImageData:fail' - } - }, this.$page.id); - return; - } - - if (!callbackId) { - // fix [...]展开TypedArray在低版本手机报错的问题,使用Array.prototype.slice - return { - data: Array.prototype.slice.call(imgData.data), - width: destWidth, - height: destHeight - }; - } else { - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasGetImageData:ok', - data: _toConsumableArray(imgData.data), - width: destWidth, - height: destHeight - } - }, this.$page.id); - } - }, - putImageData: function putImageData(_ref4) { - var data = _ref4.data, - x = _ref4.x, - y = _ref4.y, - width = _ref4.width, - height = _ref4.height, - callbackId = _ref4.callbackId; - - try { - if (!height) { - height = Math.round(data.length / 4 / width); - } - - var canvas = getTempCanvas(width, height); - var context = canvas.getContext('2d'); - context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0); - this.$refs.canvas.getContext('2d').drawImage(canvas, x, y, width, height); - canvas.height = canvas.width = 0; - } catch (error) { - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasPutImageData:fail' - } - }, this.$page.id); - return; + if (this.hovering) { + this._hoverReset(); } - - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasPutImageData:ok' - } - }, this.$page.id); }, - getDataUrl: function getDataUrl(_ref5) { - var _this3 = this; + _hoverReset: function _hoverReset() { + var _this2 = this; - var _ref5$x = _ref5.x, - x = _ref5$x === void 0 ? 0 : _ref5$x, - _ref5$y = _ref5.y, - y = _ref5$y === void 0 ? 0 : _ref5$y, - width = _ref5.width, - height = _ref5.height, - destWidth = _ref5.destWidth, - destHeight = _ref5.destHeight, - _ref5$hidpi = _ref5.hidpi, - hidpi = _ref5$hidpi === void 0 ? true : _ref5$hidpi, - fileType = _ref5.fileType, - qualit = _ref5.qualit, - callbackId = _ref5.callbackId; - var res = this.getImageData({ - x: x, - y: y, - width: width, - height: height, - destWidth: destWidth, - destHeight: destHeight, - hidpi: hidpi + requestAnimationFrame(function () { + clearTimeout(_this2._hoverStayTimer); + _this2._hoverStayTimer = setTimeout(function () { + _this2.hovering = false; + }, _this2.hoverStayTime); }); + }, + _hoverTouchCancel: function _hoverTouchCancel(evt) { + this._hoverTouch = false; + this.hovering = false; + clearTimeout(this._hoverStartTimer); + } + } +}); - if (!res.data || !res.data.length) { - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasGetDataUrl:fail' - } - }, this.$page.id); - return; - } - - var imgData; +/***/ }), +/* 25 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - try { - imgData = new ImageData(new Uint8ClampedArray(res.data), res.width, res.height); - } catch (error) { - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasGetDataUrl:fail' - } - }, this.$page.id); - return; - } +"use strict"; +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); - destWidth = res.width; - destHeight = res.height; - var canvas = getTempCanvas(destWidth, destHeight); - var c2d = canvas.getContext('2d'); - c2d.putImageData(imgData, 0, 0); - var base64 = canvas.toDataURL('image/png'); - canvas.height = canvas.width = 0; - var img = new Image(); - img.onload = function () { - var canvas = getTempCanvas(destWidth, destHeight); +var resetTimer; +var isAndroid; +var osVersion; +var keyboardHeight; +var keyboardChangeCallback; +var webviewStyle; - if (fileType === 'jpeg' || fileType === 'jpg') { - fileType = 'jpeg'; - c2d.fillStyle = '#fff'; - c2d.fillRect(0, 0, destWidth, destHeight); - } +if (true) { + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + isAndroid = plus.os.name.toLowerCase() === 'android'; + osVersion = plus.os.version; + }); + document.addEventListener('keyboardchange', function (event) { + keyboardHeight = event.height; + keyboardChangeCallback && keyboardChangeCallback(); + }, false); +} +/** + * 保证iOS点击输入框外隐藏键盘 + */ - c2d.drawImage(img, 0, 0); - base64 = canvas.toDataURL("image/".concat(fileType), qualit); - canvas.height = canvas.width = 0; - UniViewJSBridge.publishHandler('onCanvasMethodCallback', { - callbackId: callbackId, - data: { - errMsg: 'canvasGetDataUrl:ok', - base64: base64 - } - }, _this3.$page.id); - }; - img.src = base64; - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) +function iosHideKeyboard() {} -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { +function setSoftinputTemporary(vm, reset) { + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + var MODE_ADJUSTRESIZE = 'adjustResize'; + var MODE_ADJUSTPAN = 'adjustPan'; + var MODE_NOTHING = 'nothing'; + var currentWebview = plus.webview.currentWebview(); // iOS 14.6 调用同步方法导致键盘弹卡顿 -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + var style = webviewStyle || currentWebview.getStyle() || {}; + var options = { + mode: reset || style.softinputMode === MODE_ADJUSTRESIZE ? MODE_ADJUSTRESIZE : vm.adjustPosition ? MODE_ADJUSTPAN : MODE_NOTHING, + position: { + top: 0, + height: 0 + } + }; -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { + if (options.mode === MODE_ADJUSTPAN) { + var rect = vm.$el.getBoundingClientRect(); + options.position.top = rect.top; + options.position.height = rect.height + (Number(vm.cursorSpacing) || 0); + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + currentWebview.setSoftinputTemporary(options); + }); +} -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { +function setSoftinputNavBar(vm) { + if (vm.showConfirmBar === 'auto') { + delete vm.__softinputNavBar; + return; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + var currentWebview = plus.webview.currentWebview(); -/***/ }), -/* 23 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var _ref = currentWebview.getStyle() || {}, + softinputNavBar = _ref.softinputNavBar; -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var uni_helpers_html_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60); -/* harmony import */ var _formats__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(83); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + var showConfirmBar = softinputNavBar !== 'none'; -// -// -// -// -// -// -// -// + if (showConfirmBar !== vm.showConfirmBar) { + vm.__softinputNavBar = softinputNavBar || 'auto'; + currentWebview.setStyle({ + softinputNavBar: vm.showConfirmBar ? 'auto' : 'none' + }); + } else { + delete vm.__softinputNavBar; + } + }); +} +function resetSoftinputNavBar(vm) { + var softinputNavBar = vm.__softinputNavBar; + if (softinputNavBar) { + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + var currentWebview = plus.webview.currentWebview(); + currentWebview.setStyle({ + softinputNavBar: softinputNavBar + }); + }); + } +} /* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Editor', - mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "e"], uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* emitter */ "a"], uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* keyboard */ "c"]], + name: 'Keyboard', + mixins: [_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]], props: { - id: { - type: String, - default: '' - }, - readOnly: { - type: [Boolean, String], - default: false - }, - placeholder: { - type: String, - default: '' + cursorSpacing: { + type: [Number, String], + default: 0 }, - showImgSize: { + showConfirmBar: { type: [Boolean, String], - default: false + default: 'auto' }, - showImgToolbar: { + adjustPosition: { type: [Boolean, String], - default: false + default: true }, - showImgResize: { + autoBlur: { type: [Boolean, String], default: false } }, - data: function data() { - return { - quillReady: false - }; - }, - computed: {}, - watch: { - readOnly: function readOnly(value) { - if (this.quillReady) { - var quill = this.quill; - quill.enable(!value); - - if (!value) { - quill.blur(); - } - } - }, - placeholder: function placeholder(value) { - if (this.quillReady) { - this.quill.root.setAttribute('data-placeholder', value); + directives: { + keyboard: { + inserted: function inserted(el, binding, vnode) { + vnode.context.initKeyboard(el); } } }, - mounted: function mounted() { - var _this = this; + methods: { + initKeyboard: function initKeyboard(el) { + var _this = this; - var imageResizeModules = []; + var focus; - if (this.showImgSize) { - imageResizeModules.push('DisplaySize'); - } + var keyboardChange = function keyboardChange() { + _this.$trigger('keyboardheightchange', {}, { + height: keyboardHeight, + duration: 0.25 + }); // 安卓切换不同键盘类型时会导致键盘收回,需重新设置 - if (this.showImgToolbar) { - imageResizeModules.push('Toolbar'); - } - if (this.showImgResize) { - imageResizeModules.push('Resize'); - } + if (focus && keyboardHeight === 0) { + setSoftinputTemporary(_this); + } // 安卓/iOS13收起键盘时主动失去焦点 - this.loadQuill(function () { - if (imageResizeModules.length) { - _this.loadImageResizeModule(function () { - _this.initQuill(imageResizeModules); - }); - } else { - _this.initQuill(imageResizeModules); - } - }); - }, - methods: { - _handleSubscribe: function _handleSubscribe(_ref) { - var type = _ref.type, - data = _ref.data; - var options = data.options, - callbackId = data.callbackId; - var quill = this.quill; - var Quill = window.Quill; - var res; - var range; - var errMsg; - if (this.quillReady) { - switch (type) { - case 'format': - { - var _options$name = options.name, - name = _options$name === void 0 ? '' : _options$name, - _options$value = options.value, - value = _options$value === void 0 ? false : _options$value; - range = quill.getSelection(true); - var format = quill.getFormat(range)[name] || false; + if (_this.autoBlur && focus && keyboardHeight === 0 && (isAndroid || parseInt(osVersion) >= 13)) { + document.activeElement.blur(); + } + }; - if (['bold', 'italic', 'underline', 'strike', 'ins'].includes(name)) { - value = !format; - } else if (name === 'direction') { - value = value === 'rtl' && format ? false : value; - var align = quill.getFormat(range).align; + el.addEventListener('focus', function () { + focus = true; + clearTimeout(resetTimer); + document.addEventListener('click', iosHideKeyboard, false); - if (value === 'rtl' && !align) { - quill.format('align', 'right', Quill.sources.USER); - } else if (!value && align === 'right') { - quill.format('align', false, Quill.sources.USER); - } - } else if (name === 'indent') { - var rtl = quill.getFormat(range).direction === 'rtl'; - value = value === '+1'; + if (true) { + keyboardChangeCallback = keyboardChange; - if (rtl) { - value = !value; - } + if (keyboardHeight) { + _this.$trigger('keyboardheightchange', {}, { + height: keyboardHeight, + duration: 0 + }); + } - value = value ? '+1' : '-1'; - } else { - if (name === 'list') { - value = value === 'check' ? 'unchecked' : value; - format = format === 'checked' ? 'unchecked' : format; - } + setSoftinputNavBar(_this); + setSoftinputTemporary(_this); + } + }); - value = format && format !== (value || false) || !format && value ? value : !format; + if (true) { + // 安卓单独隐藏键盘后点击输入框不会触发 focus 事件 + if (isAndroid) { + el.addEventListener('click', function () { + if (!_this.disabled && focus && keyboardHeight === 0) { + setSoftinputTemporary(_this); + } + }); + } + + if (!isAndroid) { + // iOS12 以下系统 focus 事件设置较迟,改在 touchstart 设置 + if (parseInt(osVersion) < 12) { + el.addEventListener('touchstart', function () { + if (!_this.disabled && !focus) { + setSoftinputTemporary(_this); } + }); + } // iOS 14.6 调用同步方法导致键盘弹卡顿 - quill.format(name, value, Quill.sources.USER); - } - break; - case 'insertDivider': - range = quill.getSelection(true); - quill.insertText(range.index, '\n', Quill.sources.USER); - quill.insertEmbed(range.index + 1, 'divider', true, Quill.sources.USER); - quill.setSelection(range.index + 2, Quill.sources.SILENT); - break; + if (parseFloat(osVersion) >= 14.6 && !webviewStyle) { + Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "j"])(function () { + var currentWebview = plus.webview.currentWebview(); + webviewStyle = currentWebview.getStyle() || {}; + }); + } + } + } - case 'insertImage': - { - range = quill.getSelection(true); + var onKeyboardHide = function onKeyboardHide() { + document.removeEventListener('click', iosHideKeyboard, false); - var _options$src = options.src, - src = _options$src === void 0 ? '' : _options$src, - _options$alt = options.alt, - alt = _options$alt === void 0 ? '' : _options$alt, - _options$data = options.data, - _data = _options$data === void 0 ? {} : _options$data; + if (true) { + keyboardChangeCallback = null; - quill.insertEmbed(range.index, 'image', this.$getRealPath(src), Quill.sources.USER); - quill.formatText(range.index, 1, 'alt', alt); - quill.formatText(range.index, 1, 'data-custom', Object.keys(_data).map(function (key) { - return "".concat(key, "=").concat(_data[key]); - }).join('&')); - quill.setSelection(range.index + 1, Quill.sources.SILENT); - } - break; + if (keyboardHeight) { + _this.$trigger('keyboardheightchange', {}, { + height: 0, + duration: 0 + }); + } - case 'insertText': - { - range = quill.getSelection(true); - var _options$text = options.text, - text = _options$text === void 0 ? '' : _options$text; - quill.insertText(range.index, text, Quill.sources.USER); - quill.setSelection(range.index + text.length, 0, Quill.sources.SILENT); - } - break; + resetSoftinputNavBar(_this); - case 'setContents': - { - var delta = options.delta, - html = options.html; + if (isAndroid) { + // 还原安卓软键盘配置,避免影响 web-view 组件 + resetTimer = setTimeout(function () { + setSoftinputTemporary(_this, true); + }, 300); + } + } // 修复ios端显示与点击位置错位的Bug by:wyq - if (_typeof(delta) === 'object') { - quill.setContents(delta, Quill.sources.SILENT); - } else if (typeof html === 'string') { - quill.setContents(this.html2delta(html), Quill.sources.SILENT); - } else { - errMsg = 'contents is missing'; - } - } - break; - case 'getContents': - res = this.getContents(); - break; + if (String(navigator.vendor).indexOf('Apple') === 0) { + document.documentElement.scrollTo(document.documentElement.scrollLeft, document.documentElement.scrollTop); + } + }; - case 'clear': - quill.setContents([]); - break; + el.addEventListener('blur', function () { + // 在iOS设备上,手动调用uni.hideKeyboard(),键盘收起并且触发blur,但实际并没有blur。 + // 此时如果再点击页面其他地方会重新聚焦,此处做处理 + el.blur(); + focus = false; + onKeyboardHide(); + }); + } + } +}); - case 'removeFormat': - { - range = quill.getSelection(true); - var parchment = Quill.import('parchment'); +/***/ }), +/* 26 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (range.length) { - quill.removeFormat(range, Quill.sources.USER); - } else { - Object.keys(quill.getFormat(range)).forEach(function (key) { - if (parchment.query(key, parchment.Scope.INLINE)) { - quill.format(key, false); - } - }); - } - } - break; +"use strict"; +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - case 'undo': - quill.history.undo(); - break; +var passiveOptions = uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* supportsPassive */ "k"] ? { + passive: true, + capture: true +} : true; +var vms = []; +var userInteract = 0; +var inited; - case 'redo': - quill.history.redo(); - break; +function setInteract(interact) { + vms.forEach(function (vm) { + return vm.userInteract = interact; + }); +} - default: - break; - } +function addInteractListener() { + var vm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - this.updateStatus(range); - } else { - errMsg = 'not ready'; - } + if (!inited) { + var eventNames = ['touchstart', 'touchmove', 'touchend', 'mousedown', 'mouseup']; + eventNames.forEach(function (eventName) { + document.addEventListener(eventName, function () { + !userInteract && setInteract(true); + userInteract++; + setTimeout(function () { + ! --userInteract && setInteract(false); + }, 0); + }, passiveOptions); + }); + inited = true; + } - if (callbackId) { - UniViewJSBridge.publishHandler('onEditorMethodCallback', { - callbackId: callbackId, - data: Object.assign({}, res, { - errMsg: "".concat(type, ":").concat(errMsg ? 'fail ' + errMsg : 'ok') - }) - }, this.$page.id); - } - }, - loadQuill: function loadQuill(callback) { - if (typeof window.Quill === 'function') { - if (typeof callback === 'function') { - callback(); - } + vms.push(vm); +} - return; - } +function removeInteractListener(vm) { + var index = vms.indexOf(vm); - var script = document.createElement('script'); - script.src = window.plus ? './__uniappquill.js' : 'https://unpkg.com/quill@1.3.7/dist/quill.min.js'; - document.body.appendChild(script); - script.onload = callback; - }, - loadImageResizeModule: function loadImageResizeModule(callback) { - if (typeof window.ImageResize === 'function') { - if (typeof callback === 'function') { - callback(); - } + if (index >= 0) { + vms.splice(index, 1); + } +} - return; - } +/* harmony default export */ __webpack_exports__["a"] = ({ + data: function data() { + return { + /** + * 是否用户交互行为 + */ + userInteract: false + }; + }, + mounted: function mounted() { + addInteractListener(this); + }, + beforeDestroy: function beforeDestroy() { + removeInteractListener(this); + }, + addInteractListener: addInteractListener, + // true -> interact + getStatus: function getStatus() { + return !!userInteract; + } +}); - var script = document.createElement('script'); - script.src = window.plus ? './__uniappquillimageresize.js' : 'https://unpkg.com/quill-image-resize-mp@3.0.1/image-resize.min.js'; - document.body.appendChild(script); - script.onload = callback; - }, - initQuill: function initQuill(imageResizeModules) { - var _this2 = this; +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { - var Quill = window.Quill; - _formats__WEBPACK_IMPORTED_MODULE_2__[/* register */ "a"](Quill); - var options = { - toolbar: false, - readOnly: this.readOnly, - placeholder: this.placeholder, - modules: {} - }; +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - if (imageResizeModules.length) { - Quill.register('modules/ImageResize', window.ImageResize.default); - options.modules.ImageResize = { - modules: imageResizeModules - }; - } +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { - var quill = this.quill = new Quill(this.$el, options); - var $el = quill.root; - var events = ['focus', 'blur', 'input']; - events.forEach(function (name) { - $el.addEventListener(name, function ($event) { - if (name === 'input') { - $event.stopPropagation(); - } else { - _this2.$trigger(name, $event, _this2.getContents()); - } - }); - }); - quill.on(Quill.events.TEXT_CHANGE, function () { - _this2.$trigger('input', {}, _this2.getContents()); - }); - quill.on(Quill.events.SELECTION_CHANGE, this.updateStatus.bind(this)); - quill.on(Quill.events.SCROLL_OPTIMIZE, function () { - var range = quill.selection.getRange()[0]; +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - _this2.updateStatus(range); - }); - quill.clipboard.addMatcher(Node.ELEMENT_NODE, function (node, delta) { - if (_this2.skipMatcher) { - return delta; - } +/***/ }), +/* 29 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - return { - ops: delta.ops.filter(function (_ref2) { - var insert = _ref2.insert; - return typeof insert === 'string'; - }).map(function (_ref3) { - var insert = _ref3.insert; - return { - insert: insert - }; - }) - }; - }); - this.initKeyboard($el); - this.quillReady = true; - this.$trigger('ready', event, {}); - }, - getContents: function getContents() { - var quill = this.quill; - var html = quill.root.innerHTML; - var text = quill.getText(); - var delta = quill.getContents(); - return { - html: html, - text: text, - delta: delta - }; - }, - html2delta: function html2delta(html) { - var tags = ['span', 'strong', 'b', 'ins', 'em', 'i', 'u', 'a', 'del', 's', 'sub', 'sup', 'img', 'div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'ol', 'ul', 'li']; - var content = ''; - var disable; - Object(uni_helpers_html_parser__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(html, { - start: function start(tag, attrs, unary) { - if (!tags.includes(tag)) { - disable = !unary; - return; - } - - disable = false; - var arrts = attrs.map(function (_ref4) { - var name = _ref4.name, - value = _ref4.value; - return "".concat(name, "=\"").concat(value, "\""); - }).join(' '); - var start = "<".concat(tag, " ").concat(arrts, " ").concat(unary ? '/' : '', ">"); - content += start; - }, - end: function end(tag) { - if (!disable) { - content += ""); - } - }, - chars: function chars(text) { - if (!disable) { - content += text; - } - } - }); - this.skipMatcher = true; - var delta = this.quill.clipboard.convert(content); - this.skipMatcher = false; - return delta; - }, - updateStatus: function updateStatus(range) { - var _this3 = this; - - var status = range ? this.quill.getFormat(range) : {}; - var keys = Object.keys(status); - - if (keys.length !== Object.keys(this.__status || {}).length || keys.find(function (key) { - return status[key] !== _this3.__status[key]; - })) { - this.__status = status; - this.$trigger('statuschange', {}, status); - } - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +/* harmony import */ var uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15); +/* harmony import */ var uni_platform_helpers_save_image__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(107); +/* harmony import */ var uni_platform_helpers_file__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(108); +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { +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."); } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -/***/ }), -/* 28 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); // // // @@ -12085,189 +11991,602 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // // // +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + + + + + +function resolveColor(color) { + color = color.slice(0); + color[3] = color[3] / 255; + return 'rgba(' + color.join(',') + ')'; +} + +function processTouches(target, touches) { + return [].map.call(touches, function (touch) { + var boundingClientRect = target.getBoundingClientRect(); + return { + identifier: touch.identifier, + x: touch.clientX - boundingClientRect.left, + y: touch.clientY - boundingClientRect.top + }; + }); +} + +var tempCanvas; + +function getTempCanvas() { + var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + if (!tempCanvas) { + tempCanvas = document.createElement('canvas'); + } + + tempCanvas.width = width; + tempCanvas.height = height; + return tempCanvas; +} /* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Label', - mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* emitter */ "a"]], + name: 'Canvas', + mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "f"]], props: { - for: { + canvasId: { type: String, default: '' + }, + disableScroll: { + type: [Boolean, String], + default: false } }, + data: function data() { + return { + actionsWaiting: false + }; + }, computed: { - pointer: function pointer() { - return this.for || this.$slots.default && this.$slots.default.length; + id: function id() { + return this.canvasId; + }, + _listeners: function _listeners() { + var _this = this; + + var $listeners = Object.assign({}, this.$listeners); + var events = ['touchstart', 'touchmove', 'touchend']; + events.forEach(function (event) { + var existing = $listeners[event]; + var eventHandler = []; + + if (existing) { + eventHandler.push(function ($event) { + _this.$trigger(event, Object.assign({}, $event, { + touches: processTouches($event.currentTarget, $event.touches), + changedTouches: processTouches($event.currentTarget, $event.changedTouches) + })); + }); + } + + if (_this.disableScroll && event === 'touchmove') { + eventHandler.push(_this._touchmove); + } + + $listeners[event] = eventHandler; + }); + return $listeners; } }, + created: function created() { + this._actionsDefer = []; + this._images = {}; + }, + mounted: function mounted() { + this._resize(); + }, + beforeDestroy: function beforeDestroy() { + var canvas = this.$refs.canvas; + canvas.height = canvas.width = 0; + }, methods: { - _onClick: function _onClick($event) { - var stopPropagation = /^uni-(checkbox|radio|switch)-/.test($event.target.className); - - if (!stopPropagation) { - stopPropagation = /^uni-(checkbox|radio|switch|button)$/i.test($event.target.tagName); - } + _handleSubscribe: function _handleSubscribe(_ref) { + var type = _ref.type, + _ref$data = _ref.data, + data = _ref$data === void 0 ? {} : _ref$data; + var method = this[type]; - if (stopPropagation) { - return; + if (type.indexOf('_') !== 0 && typeof method === 'function') { + method(data); } + }, + _resize: function _resize(size) { + var canvas = this.$refs.canvas; + var hasChanged = !size || canvas.width !== Math.floor(size.width * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]) || canvas.height !== Math.floor(size.height * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]); + if (!hasChanged) return; - if (this.for) { - UniViewJSBridge.emit('uni-label-click-' + this.$page.id + '-' + this.for, $event, true); + if (canvas.width > 0 && canvas.height > 0) { + var context = canvas.getContext('2d'); + var imageData = context.getImageData(0, 0, canvas.width, canvas.height); + Object(uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* wrapper */ "b"])(canvas); + context.putImageData(imageData, 0, 0); } else { - this.$broadcast(['Checkbox', 'Radio', 'Switch', 'Button'], 'uni-label-click', $event, true); + Object(uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* wrapper */ "b"])(canvas); } - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { + }, + _touchmove: function _touchmove(event) { + event.preventDefault(); + }, + actionsChanged: function actionsChanged(_ref2) { + var _this2 = this; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + var actions = _ref2.actions, + reserve = _ref2.reserve, + callbackId = _ref2.callbackId; + var self = this; -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { + if (!actions) { + return; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (this.actionsWaiting) { + this._actionsDefer.push([actions, reserve, callbackId]); -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { + return; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + var canvas = this.$refs.canvas; + var c2d = canvas.getContext('2d'); -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { + if (!reserve) { + c2d.fillStyle = '#000000'; + c2d.strokeStyle = '#000000'; + c2d.shadowColor = '#000000'; + c2d.shadowBlur = 0; + c2d.shadowOffsetX = 0; + c2d.shadowOffsetY = 0; + c2d.setTransform(1, 0, 0, 1, 0, 0); + c2d.clearRect(0, 0, canvas.width, canvas.height); + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + this.preloadImage(actions); -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { + var _loop2 = function _loop2(index) { + var action = actions[index]; + var method = action.method; + var data = action.data; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (/^set/.test(method) && method !== 'setTransform') { + var method1 = method[3].toLowerCase() + method.slice(4); + var color; -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { + if (method1 === 'fillStyle' || method1 === 'strokeStyle') { + if (data[0] === 'normal') { + color = resolveColor(data[1]); + } else if (data[0] === 'linear') { + var LinearGradient = c2d.createLinearGradient.apply(c2d, _toConsumableArray(data[1])); + data[2].forEach(function (data2) { + var offset = data2[0]; + var color = resolveColor(data2[1]); + LinearGradient.addColorStop(offset, color); + }); + color = LinearGradient; + } else if (data[0] === 'radial') { + var x = data[1][0]; + var y = data[1][1]; + var r = data[1][2]; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + var _LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r); -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { + data[2].forEach(function (data2) { + var offset = data2[0]; + var color = resolveColor(data2[1]); -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + _LinearGradient.addColorStop(offset, color); + }); + color = _LinearGradient; + } else if (data[0] === 'pattern') { + var loaded = _this2.checkImageLoaded(data[1], actions.slice(index + 1), callbackId, function (image) { + if (image) { + c2d[method1] = c2d.createPattern(image, data[2]); + } + }); -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { + if (!loaded) { + return "break"; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + return "continue"; + } -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { + c2d[method1] = color; + } else if (method1 === 'globalAlpha') { + c2d[method1] = data[0] / 255; + } else if (method1 === 'shadow') { + _ = ['shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'shadowColor']; + data.forEach(function (color_, method_) { + c2d[_[method_]] = _[method_] === 'shadowColor' ? resolveColor(color_) : color_; + }); + } else if (method1 === 'fontSize') { + var font = c2d.__font__ || c2d.font; + c2d.__font__ = c2d.font = font.replace(/\d+\.?\d*px/, data[0] + 'px'); + } else if (method1 === 'lineDash') { + c2d.setLineDash(data[0]); + c2d.lineDashOffset = data[1] || 0; + } else if (method1 === 'textBaseline') { + if (data[0] === 'normal') { + data[0] = 'alphabetic'; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + c2d[method1] = data[0]; + } else if (method1 === 'font') { + c2d.__font__ = c2d.font = data[0]; + } else { + c2d[method1] = data[0]; + } + } else if (method === 'fillPath' || method === 'strokePath') { + method = method.replace(/Path/, ''); + c2d.beginPath(); + data.forEach(function (data_) { + c2d[data_.method].apply(c2d, data_.data); + }); + c2d[method](); + } else if (method === 'fillText') { + c2d.fillText.apply(c2d, data); + } else if (method === 'drawImage') { + A = function () { + var dataArray = _toConsumableArray(data); -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { + var url = dataArray[0]; + var otherData = dataArray.slice(1); + self._images = self._images || {}; + if (!self.checkImageLoaded(url, actions.slice(index + 1), callbackId, function (image) { + if (image) { + c2d.drawImage.apply(c2d, [image].concat(_toConsumableArray(otherData.slice(4, 8)), _toConsumableArray(otherData.slice(0, 4)))); + } + })) return 'break'; + }(); -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (A === 'break') { + return "break"; + } + } else { + if (method === 'clip') { + data.forEach(function (data_) { + c2d[data_.method].apply(c2d, data_.data); + }); + c2d.clip(); + } else { + c2d[method].apply(c2d, data); + } + } + }; -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { + _loop: for (var index = 0; index < actions.length; index++) { + var _; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + var A; -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { + var _ret = _loop2(index); -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + switch (_ret) { + case "break": + break _loop; -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { + case "continue": + continue; + } + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (!this.actionsWaiting && callbackId) { + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: { + errMsg: 'drawCanvas:ok' + } + }, this.$page.id); + } + }, + preloadImage: function preloadImage(actions) { + var self = this; + actions.forEach(function (action) { + var method = action.method; + var data = action.data; + var src = ''; -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { + if (method === 'drawImage') { + src = data[0]; + src = self.$getRealPath(src); + data[0] = src; + } else if (method === 'setFillStyle' && data[0] === 'pattern') { + src = data[1]; + src = self.$getRealPath(src); + data[1] = src; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (src && !self._images[src]) { + loadImage(); + } + /** + * 加载图像 + */ -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + function loadImage() { + var image = self._images[src] = new Image(); -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { + image.onload = function () { + image.ready = true; + }; // 安卓 WebView 除本地路径无跨域问题 -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { + if ( true && navigator.vendor === 'Google Inc.') { + if (src.indexOf('file://') === 0) { + image.crossOrigin = 'anonymous'; + } -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + image.src = src; + return; + } -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { + Object(uni_platform_helpers_file__WEBPACK_IMPORTED_MODULE_3__[/* getSameOriginUrl */ "a"])(src).then(function (src) { + image.src = src; + }).catch(function () { + image.src = src; + }); + } + }); + }, + checkImageLoaded: function checkImageLoaded(src, actions, callbackId, fn) { + var self = this; + var image = this._images[src]; -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + if (image.ready) { + fn(image); + return true; + } else { + this._actionsDefer.unshift([actions, true]); + + this.actionsWaiting = true; + + image.onload = function () { + image.ready = true; + fn(image); + self.actionsWaiting = false; + + var actions = self._actionsDefer.slice(0); + + self._actionsDefer = []; + + for (var action = actions.shift(); action;) { + self.actionsChanged({ + actions: action[0], + reserve: action[1], + callbackId: callbackId + }); + action = actions.shift(); + } + }; + + return false; + } + }, + getImageData: function getImageData(_ref3) { + var _ref3$x = _ref3.x, + x = _ref3$x === void 0 ? 0 : _ref3$x, + _ref3$y = _ref3.y, + y = _ref3$y === void 0 ? 0 : _ref3$y, + width = _ref3.width, + height = _ref3.height, + destWidth = _ref3.destWidth, + destHeight = _ref3.destHeight, + _ref3$hidpi = _ref3.hidpi, + hidpi = _ref3$hidpi === void 0 ? true : _ref3$hidpi, + dataType = _ref3.dataType, + _ref3$quality = _ref3.quality, + quality = _ref3$quality === void 0 ? 1 : _ref3$quality, + _ref3$type = _ref3.type, + type = _ref3$type === void 0 ? 'png' : _ref3$type, + callbackId = _ref3.callbackId; + var canvas = this.$refs.canvas; + var data; + var maxWidth = canvas.offsetWidth - x; + width = width ? Math.min(width, maxWidth) : maxWidth; + var maxHeight = canvas.offsetHeight - y; + height = height ? Math.min(height, maxHeight) : maxHeight; + + if (!hidpi) { + if (!destWidth && !destHeight) { + destWidth = Math.round(width * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]); + destHeight = Math.round(height * uni_helpers_hidpi__WEBPACK_IMPORTED_MODULE_1__[/* pixelRatio */ "a"]); + } else if (!destWidth) { + destWidth = Math.round(width / height * destHeight); + } else if (!destHeight) { + destHeight = Math.round(height / width * destWidth); + } + } else { + destWidth = width; + destHeight = height; + } + + var newCanvas = getTempCanvas(destWidth, destHeight); + var context = newCanvas.getContext('2d'); + + if (type === 'jpeg' || type === 'jpg') { + type = 'jpeg'; + context.fillStyle = '#fff'; + context.fillRect(0, 0, destWidth, destHeight); + } + + context.__hidpi__ = true; + context.drawImageByCanvas(canvas, x, y, width, height, 0, 0, destWidth, destHeight, false); + var result; + + try { + var compressed; + + if (dataType === 'base64') { + data = newCanvas.toDataURL("image/".concat(type), quality); + } else { + var imgData = context.getImageData(0, 0, destWidth, destHeight); + + if (true) { + var pako = __webpack_require__(87); + + data = pako.deflateRaw(imgData.data, { + to: 'string' + }); + compressed = true; + } else {} + } + + result = { + errMsg: 'canvasGetImageData:ok', + data: data, + compressed: compressed, + width: destWidth, + height: destHeight + }; + } catch (error) { + result = { + errMsg: "canvasGetImageData:fail ".concat(error) + }; + } + + newCanvas.height = newCanvas.width = 0; + context.__hidpi__ = false; + + if (!callbackId) { + return result; + } else { + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: result + }, this.$page.id); + } + }, + putImageData: function putImageData(_ref4) { + var data = _ref4.data, + x = _ref4.x, + y = _ref4.y, + width = _ref4.width, + height = _ref4.height, + compressed = _ref4.compressed, + callbackId = _ref4.callbackId; + + try { + if (!height) { + height = Math.round(data.length / 4 / width); + } + + var canvas = getTempCanvas(width, height); + var context = canvas.getContext('2d'); + + if ( true && compressed) { + var pako = __webpack_require__(87); + + data = pako.inflateRaw(data); + } + + context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0); + this.$refs.canvas.getContext('2d').drawImage(canvas, x, y, width, height); + canvas.height = canvas.width = 0; + } catch (error) { + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: { + errMsg: 'canvasPutImageData:fail' + } + }, this.$page.id); + return; + } + + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: { + errMsg: 'canvasPutImageData:ok' + } + }, this.$page.id); + }, + toTempFilePath: function toTempFilePath(_ref5) { + var _this3 = this; + + var _ref5$x = _ref5.x, + x = _ref5$x === void 0 ? 0 : _ref5$x, + _ref5$y = _ref5.y, + y = _ref5$y === void 0 ? 0 : _ref5$y, + width = _ref5.width, + height = _ref5.height, + destWidth = _ref5.destWidth, + destHeight = _ref5.destHeight, + fileType = _ref5.fileType, + quality = _ref5.quality, + dirname = _ref5.dirname, + callbackId = _ref5.callbackId; + var res = this.getImageData({ + x: x, + y: y, + width: width, + height: height, + destWidth: destWidth, + destHeight: destHeight, + hidpi: false, + dataType: 'base64', + type: fileType, + quality: quality + }); + + if (!res.data || !res.data.length) { + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: { + errMsg: res.errMsg.replace('canvasPutImageData', 'toTempFilePath') + } + }, this.$page.id); + return; + } + + Object(uni_platform_helpers_save_image__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(res.data, dirname, function (error, tempFilePath) { + var errMsg = "toTempFilePath:".concat(error ? 'fail' : 'ok'); + + if (error) { + errMsg += " ".concat(error.message); + } + + UniViewJSBridge.publishHandler('onCanvasMethodCallback', { + callbackId: callbackId, + data: { + errMsg: errMsg, + tempFilePath: tempFilePath + } + }, _this3.$page.id); + }); + } + } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), -/* 47 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin @@ -12275,7 +12594,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi /***/ }), -/* 48 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin @@ -12283,7 +12602,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi /***/ }), -/* 49 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin @@ -12291,23 +12610,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi /***/ }), -/* 50 */ +/* 33 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var _mixins_native__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); -// -// -// -// -// -// -// -// -// -// -// +/* harmony import */ var uni_helpers_html_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(70); +/* harmony import */ var _formats__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(110); +/* harmony import */ var _load_script__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + // // // @@ -12318,479 +12630,443 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi // -var methods = ['getCenterLocation', 'moveToLocation', 'getRegion', 'getScale', '$getAppMap']; // const events = [ -// 'markertap', -// 'callouttap', -// 'controltap', -// 'regionchange', -// 'tap', -// 'updated' -// ] -var _attrs = ['latitude', 'longitude', 'scale', 'markers', 'polyline', 'circles', 'controls', 'show-location']; -var convertCoordinates = function convertCoordinates(lng, lat, callback) { - // plus.maps.Map.convertCoordinates(new plus.maps.Point(lng, lat), { - // coordType: 'gcj02' - // }, callback) - callback({ - coord: { - latitude: lat, - longitude: lng - } - }); -}; -function parseHex(color) { - if (color.indexOf('#') !== 0) { - return { - color: color, - opacity: 1 - }; - } +function isiOS() { + if (true) { + return plus.os.name.toLowerCase() === 'ios'; + } else { var isIPadOS, isMac, isIOS, ua; } - var opacity = color.substr(7, 2); - return { - color: color.substr(0, 7), - opacity: opacity ? Number('0x' + opacity) / 255 : 1 - }; + return false; } +var textChanging = false; /* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Map', - mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "e"], _mixins_native__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]], + name: 'Editor', + mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "f"], uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* emitter */ "a"], uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* keyboard */ "d"]], props: { id: { type: String, default: '' }, - latitude: { - type: [Number, String], - default: '' + readOnly: { + type: [Boolean, String], + default: false }, - longitude: { - type: [Number, String], + placeholder: { + type: String, default: '' }, - scale: { - type: [String, Number], - default: 16 + showImgSize: { + type: [Boolean, String], + default: false }, - markers: { - type: Array, - default: function _default() { - return []; - } + showImgToolbar: { + type: [Boolean, String], + default: false }, - polyline: { - type: Array, - default: function _default() { - return []; - } - }, - circles: { - type: Array, - default: function _default() { - return []; - } - }, - controls: { - type: Array, - default: function _default() { - return []; - } + showImgResize: { + type: [Boolean, String], + default: false } }, data: function data() { return { - style: { - top: '0px', - left: '0px', - width: '0px', - height: '0px', - position: 'static' - }, - hidden: false + quillReady: false }; }, - computed: { - attrs: function attrs() { - var _this = this; - - var obj = {}; - - _attrs.forEach(function (key) { - var val = _this.$props[key]; - val = key === 'src' ? _this.$getRealPath(val) : val; - obj[key.replace(/[A-Z]/g, function (str) { - return '-' + str.toLowerCase(); - })] = val; - }); - - return obj; - }, - mapControls: function mapControls() { - var _this2 = this; - - var list = this.controls.map(function (control) { - var position = { - position: 'absolute' - }; - ['top', 'left', 'width', 'height'].forEach(function (key) { - if (control.position[key]) { - position[key] = control.position[key] + 'px'; - } - }); - return { - id: control.id, - iconPath: _this2.$getRealPath(control.iconPath), - position: position - }; - }); - return list; - } - }, + computed: {}, watch: { - hidden: function hidden(val) { - this.map && this.map[val ? 'hide' : 'show'](); - }, - scale: function scale(val) { - this.map && this.map.setZoom(val); - }, - latitude: function latitude(val) { - this.map && this.map.setStyles({ - center: new plus.maps.Point(this.longitude, this.latitude) - }); - }, - longitude: function longitude(val) { - this.map && this.map.setStyles({ - center: new plus.maps.Point(this.longitude, this.latitude) - }); - }, - markers: function markers(val) { - this.map && this._addMarkers(val, true); - }, - polyline: function polyline(val) { - this.map && this._addMapLines(val); + readOnly: function readOnly(value) { + if (this.quillReady) { + var quill = this.quill; + quill.enable(!value); + + if (!value) { + quill.blur(); + } + } }, - circles: function circles(val) { - this.map && this._addMapCircles(val); + placeholder: function placeholder(value) { + if (this.quillReady) { + this.setPlaceHolder(value); + } } }, mounted: function mounted() { - var _this3 = this; + var _this = this; - var mapStyle = Object.assign({}, this.attrs, this.position); + var imageResizeModules = []; - if (this.latitude && this.longitude) { - mapStyle.center = new plus.maps.Point(this.longitude, this.latitude); + if (this.showImgSize) { + imageResizeModules.push('DisplaySize'); } - var map = this.map = plus.maps.create(this.$page.id + '-map-' + (this.id || Date.now()), mapStyle); - map.__markers__ = {}; - map.__lines__ = []; - map.__circles__ = []; - map.setZoom(this.scale); - plus.webview.currentWebview().append(map); + if (this.showImgToolbar) { + imageResizeModules.push('Toolbar'); + } - if (this.hidden) { - map.hide(); + if (this.showImgResize) { + imageResizeModules.push('Resize'); } - this.$watch('position', function () { - _this3.map && _this3.map.setStyles(_this3.position); - }, { - deep: true + var quillSrc = true ? './__uniappquill.js' : undefined; + Object(_load_script__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(window.Quill, quillSrc, function () { + if (imageResizeModules.length) { + var imageResizeSrc = true ? './__uniappquillimageresize.js' : undefined; + Object(_load_script__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(window.ImageResize, imageResizeSrc, function () { + _this.initQuill(imageResizeModules); + }); + } else { + _this.initQuill(imageResizeModules); + } }); - - map.onclick = function (e) { - _this3.$trigger('click', {}, e); - }; - - map.onstatuschanged = function (e) { - _this3.$trigger('regionchange', {}, e); - }; - - this._addMarkers(this.markers); - - this._addMapLines(this.polyline); - - this._addMapCircles(this.circles); - }, - beforeDestroy: function beforeDestroy() { - this.map && this.map.close(); - delete this.map; }, methods: { _handleSubscribe: function _handleSubscribe(_ref) { var type = _ref.type, - _ref$data = _ref.data, - data = _ref$data === void 0 ? {} : _ref$data; + data = _ref.data; + var options = data.options, + callbackId = data.callbackId; + var quill = this.quill; + var Quill = window.Quill; + var res; + var range; + var errMsg; - if (!methods.includes(type)) { - return; - } + if (this.quillReady) { + switch (type) { + case 'format': + { + var _options$name = options.name, + name = _options$name === void 0 ? '' : _options$name, + _options$value = options.value, + value = _options$value === void 0 ? false : _options$value; + range = quill.getSelection(true); + var format = quill.getFormat(range)[name] || false; - this.map && this[type](data); - }, - moveToLocation: function moveToLocation(_ref2) { - var callbackId = _ref2.callbackId, - longitude = _ref2.longitude, - latitude = _ref2.latitude; - this.map.setCenter(new plus.maps.Point(longitude || this.longitude, latitude || this.latitude)); + if (['bold', 'italic', 'underline', 'strike', 'ins'].includes(name)) { + value = !format; + } else if (name === 'direction') { + value = value === 'rtl' && format ? false : value; + var align = quill.getFormat(range).align; - this._publishHandler(callbackId, { - errMsg: 'moveToLocation:ok' - }); - }, - getCenterLocation: function getCenterLocation(_ref3) { - var callbackId = _ref3.callbackId; - var center = this.map.getCenter(); + if (value === 'rtl' && !align) { + quill.format('align', 'right', Quill.sources.USER); + } else if (!value && align === 'right') { + quill.format('align', false, Quill.sources.USER); + } + } else if (name === 'indent') { + var rtl = quill.getFormat(range).direction === 'rtl'; + value = value === '+1'; - this._publishHandler(callbackId, { - longitude: center.longitude, - latitude: center.latitude, - errMsg: 'getCenterLocation:ok' - }); - }, - getRegion: function getRegion(_ref4) { - var callbackId = _ref4.callbackId; - var rect = this.map.getBounds(); + if (rtl) { + value = !value; + } - this._publishHandler(callbackId, { - southwest: rect.southwest, - northeast: rect.northeast || rect.northease, - // 5plus API 名字写错了 - errMsg: 'getRegion:ok' - }); - }, - getScale: function getScale(_ref5) { - var callbackId = _ref5.callbackId; + value = value ? '+1' : '-1'; + } else { + if (name === 'list') { + value = value === 'check' ? 'unchecked' : value; + format = format === 'checked' ? 'unchecked' : format; + } - this._publishHandler(callbackId, { - scale: this.map.getZoom(), - errMsg: 'getScale:ok' - }); - }, - controlclick: function controlclick(e) { - this.$trigger('controltap', {}, { - controlId: e.id - }); - }, - _publishHandler: function _publishHandler(callbackId, data) { - UniViewJSBridge.publishHandler('onMapMethodCallback', { - callbackId: callbackId, - data: data - }, this.$page.id); - }, - _addMarker: function _addMarker(nativeMap, marker) { - var _this4 = this; + value = format && format !== (value || false) || !format && value ? value : !format; + } - var id = marker.id, - latitude = marker.latitude, - longitude = marker.longitude, - iconPath = marker.iconPath, - callout = marker.callout, - label = marker.label; - convertCoordinates(longitude, latitude, function (res) { - var _res$coord = res.coord, - latitude = _res$coord.latitude, - longitude = _res$coord.longitude; - var nativeMarker = new plus.maps.Marker(new plus.maps.Point(longitude, latitude)); + quill.format(name, value, Quill.sources.USER); + } + break; - if (iconPath) { - nativeMarker.setIcon(_this4.$getRealPath(iconPath)); - } + case 'insertDivider': + range = quill.getSelection(true); + quill.insertText(range.index, '\n', Quill.sources.USER); + quill.insertEmbed(range.index + 1, 'divider', true, Quill.sources.USER); + quill.setSelection(range.index + 2, Quill.sources.SILENT); + break; - if (label && label.content) { - nativeMarker.setLabel(label.content); - } + case 'insertImage': + { + range = quill.getSelection(true); - var nativeBubble = false; + var _options$src = options.src, + src = _options$src === void 0 ? '' : _options$src, + _options$alt = options.alt, + alt = _options$alt === void 0 ? '' : _options$alt, + _options$width = options.width, + width = _options$width === void 0 ? '' : _options$width, + _options$height = options.height, + height = _options$height === void 0 ? '' : _options$height, + _options$extClass = options.extClass, + extClass = _options$extClass === void 0 ? '' : _options$extClass, + _options$data = options.data, + _data = _options$data === void 0 ? {} : _options$data; - if (callout && callout.content) { - nativeBubble = new plus.maps.Bubble(callout.content); - } + var path = this.$getRealPath(src); + quill.insertEmbed(range.index, 'image', path, Quill.sources.USER); + var local = /^(file|blob):/.test(path) ? path : false; // 防止 formatText 多次触发 Quill.events.TEXT_CHANGE 事件 - if (nativeBubble) { - nativeMarker.setBubble(nativeBubble); - } + textChanging = true; + quill.formatText(range.index, 1, 'data-local', local); + quill.formatText(range.index, 1, 'alt', alt); + quill.formatText(range.index, 1, 'width', width); + quill.formatText(range.index, 1, 'height', height); + quill.formatText(range.index, 1, 'class', extClass); + textChanging = false; + quill.formatText(range.index, 1, 'data-custom', Object.keys(_data).map(function (key) { + return "".concat(key, "=").concat(_data[key]); + }).join('&')); + quill.setSelection(range.index + 1, Quill.sources.SILENT); + } + break; - if (id || id === 0) { - nativeMarker.onclick = function (e) { - _this4.$trigger('markertap', {}, { - markerId: id - }); - }; + case 'insertText': + { + range = quill.getSelection(true); + var _options$text = options.text, + text = _options$text === void 0 ? '' : _options$text; + quill.insertText(range.index, text, Quill.sources.USER); + quill.setSelection(range.index + text.length, 0, Quill.sources.SILENT); + } + break; - if (nativeBubble) { - nativeBubble.onclick = function () { - _this4.$trigger('callouttap', {}, { - markerId: id - }); - }; - } - } + case 'setContents': + { + var delta = options.delta, + html = options.html; - nativeMap.addOverlay(nativeMarker); - nativeMap.__markers__[id + ''] = nativeMarker; - }); - }, - _addMarkers: function _addMarkers(markers, clear) { - var _this5 = this; + if (_typeof(delta) === 'object') { + quill.setContents(delta, Quill.sources.SILENT); + } else if (typeof html === 'string') { + quill.setContents(this.html2delta(html), Quill.sources.SILENT); + } else { + errMsg = 'contents is missing'; + } + } + break; - if (this.map) { - if (clear) { - this.map.clearOverlays(); - this.map.__markers__ = {}; - } + case 'getContents': + res = this.getContents(); + break; - markers.forEach(function (marker) { - _this5._addMarker(_this5.map, marker); - }); - return { - errMsg: 'addMapMarkers:ok' - }; - } + case 'clear': + quill.setContents([]); + break; - return { - errMsg: 'addMapMarkers:fail:请先创建地图元素' - }; - }, - _translateMapMarker: function _translateMapMarker(_ref6) { - var autoRotate = _ref6.autoRotate, - callbackId = _ref6.callbackId, - destination = _ref6.destination, - duration = _ref6.duration, - markerId = _ref6.markerId; + case 'removeFormat': + { + range = quill.getSelection(true); + var parchment = Quill.import('parchment'); - if (this.map) { - var nativeMarker = this.map.__markers__[markerId + '']; + if (range.length) { + quill.removeFormat(range, Quill.sources.USER); + } else { + Object.keys(quill.getFormat(range)).forEach(function (key) { + if (parchment.query(key, parchment.Scope.INLINE)) { + quill.format(key, false); + } + }); + } + } + break; - if (nativeMarker) { - nativeMarker.setPoint(new plus.maps.Point(destination.longitude, destination.latitude)); - } - } + case 'undo': + quill.history.undo(); + break; - return { - errMsg: 'translateMapMarker:ok' - }; - }, - _addMapLines: function _addMapLines(lines) { - var nativeMap = this.map; + case 'redo': + quill.history.redo(); + break; - if (!nativeMap) { - return { - errMsg: 'addMapLines:fail:请先创建地图元素' - }; - } + case 'blur': + quill.blur(); + break; - if (nativeMap.__lines__.length > 0) { - nativeMap.__lines__.forEach(function (circle) { - nativeMap.removeOverlay(circle); - }); + case 'getSelectionText': + range = quill.selection.savedRange; + res = { + text: '' + }; - nativeMap.__lines__ = []; - } + if (range && range.length !== 0) { + res.text = quill.getText(range.index, range.length); + } - lines.forEach(function (line) { - var color = line.color, - width = line.width; - var points = line.points.map(function (point) { - return new plus.maps.Point(point.longitude, point.latitude); - }); - var polyline = new plus.maps.Polyline(points); + break; - if (color) { - var strokeStyle = parseHex(color); - polyline.setStrokeColor(strokeStyle.color); - polyline.setStrokeOpacity(strokeStyle.opacity); - } + case 'scrollIntoView': + quill.scrollIntoView(); + break; - if (width) { - polyline.setLineWidth(width); + default: + break; } - nativeMap.addOverlay(polyline); + this.updateStatus(range); + } else { + errMsg = 'not ready'; + } - nativeMap.__lines__.push(polyline); - }); - return { - errMsg: 'addMapLines:ok' - }; + if (callbackId) { + UniViewJSBridge.publishHandler('onEditorMethodCallback', { + callbackId: callbackId, + data: Object.assign({}, res, { + errMsg: "".concat(type, ":").concat(errMsg ? 'fail ' + errMsg : 'ok') + }) + }, this.$page.id); + } }, - _addMapCircles: function _addMapCircles(circles) { - var nativeMap = this.map; + setPlaceHolder: function setPlaceHolder(value) { + var placeHolderAttrName = 'data-placeholder'; + var QuillRoot = this.quill.root; + QuillRoot.getAttribute(placeHolderAttrName) !== value && QuillRoot.setAttribute(placeHolderAttrName, value); + }, + initQuill: function initQuill(imageResizeModules) { + var _this2 = this; - if (!nativeMap) { - return { - errMsg: 'addMapCircles:fail:请先创建地图元素' + var Quill = window.Quill; + _formats__WEBPACK_IMPORTED_MODULE_2__[/* register */ "a"](Quill); + var options = { + toolbar: false, + readOnly: this.readOnly, + placeholder: this.placeholder, + modules: {} + }; + + if (imageResizeModules.length) { + Quill.register('modules/ImageResize', window.ImageResize.default); + options.modules.ImageResize = { + modules: imageResizeModules }; } - if (nativeMap.__circles__.length > 0) { - nativeMap.__circles__.forEach(function (circle) { - nativeMap.removeOverlay(circle); - }); - - nativeMap.__circles__ = []; - } + var quill = this.quill = new Quill(this.$el, options); + var $el = quill.root; + var events = ['focus', 'blur', 'input']; + events.forEach(function (name) { + $el.addEventListener(name, function ($event) { + var contents = _this2.getContents(); - circles.forEach(function (circle) { - var latitude = circle.latitude, - longitude = circle.longitude, - color = circle.color, - fillColor = circle.fillColor, - radius = circle.radius, - strokeWidth = circle.strokeWidth; - var nativeCircle = new plus.maps.Circle(new plus.maps.Point(longitude, latitude), radius); + if (name === 'input') { + if (isiOS()) { + var regExpContent = (contents.html.match(/([\s\S]*)<\/span>/) || [])[1]; + var placeholder = regExpContent && regExpContent.replace(/\s/g, '') ? '' : _this2.placeholder; - if (color) { - var strokeStyle = parseHex(color); - nativeCircle.setStrokeColor(strokeStyle.color); - nativeCircle.setStrokeOpacity(strokeStyle.opacity); - } + _this2.setPlaceHolder(placeholder); + } - if (fillColor) { - var fillStyle = parseHex(fillColor); - nativeCircle.setFillColor(fillStyle.color); - nativeCircle.setFillOpacity(fillStyle.opacity); + $event.stopPropagation(); + } else { + _this2.$trigger(name, $event, contents); + } + }); + }); + quill.on(Quill.events.TEXT_CHANGE, function () { + if (!textChanging) { + _this2.$trigger('input', {}, _this2.getContents()); } + }); + quill.on(Quill.events.SELECTION_CHANGE, this.updateStatus.bind(this)); + quill.on(Quill.events.SCROLL_OPTIMIZE, function () { + var range = quill.selection.getRange()[0]; - if (strokeWidth) { - nativeCircle.setLineWidth(strokeWidth); + _this2.updateStatus(range); + }); + quill.clipboard.addMatcher(Node.ELEMENT_NODE, function (node, delta) { + if (_this2.skipMatcher) { + return delta; } - nativeMap.addOverlay(nativeCircle); - - nativeMap.__circles__.push(nativeCircle); + delta.ops = delta.ops.filter(function (_ref2) { + var insert = _ref2.insert; + return typeof insert === 'string'; + }).map(function (_ref3) { + var insert = _ref3.insert; + return { + insert: insert + }; + }); + return delta; }); + this.initKeyboard($el); + this.quillReady = true; + this.$trigger('ready', event, {}); + }, + getContents: function getContents() { + var quill = this.quill; + var html = quill.root.innerHTML; + var text = quill.getText(); + var delta = quill.getContents(); return { - errMsg: 'addMapCircles:ok' + html: html, + text: text, + delta: delta }; - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - if(false) { var cssReload; } - + }, + html2delta: function html2delta(html) { + var tags = ['span', 'strong', 'b', 'ins', 'em', 'i', 'u', 'a', 'del', 's', 'sub', 'sup', 'img', 'div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'ol', 'ul', 'li', 'br']; + var content = ''; + var disable; + Object(uni_helpers_html_parser__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(html, { + start: function start(tag, attrs, unary) { + if (!tags.includes(tag)) { + disable = !unary; + return; + } -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { + disable = false; + var arrts = attrs.map(function (_ref4) { + var name = _ref4.name, + value = _ref4.value; + return "".concat(name, "=\"").concat(value, "\""); + }).join(' '); + var start = "<".concat(tag, " ").concat(arrts, " ").concat(unary ? '/' : '', ">"); + content += start; + }, + end: function end(tag) { + if (!disable) { + content += ""); + } + }, + chars: function chars(text) { + if (!disable) { + content += text; + } + } + }); + this.skipMatcher = true; + var delta = this.quill.clipboard.convert(content); + this.skipMatcher = false; + return delta; + }, + updateStatus: function updateStatus(range) { + var _this3 = this; + + var status = range ? this.quill.getFormat(range) : {}; + var keys = Object.keys(status); + + if (keys.length !== Object.keys(this.__status || {}).length || keys.find(function (key) { + return status[key] !== _this3.__status[key]; + })) { + this.__status = status; + this.$trigger('statuschange', {}, status); + } + } + } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin if(false) { var cssReload; } /***/ }), -/* 53 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin @@ -12798,122 +13074,75 @@ function parseHex(color) { /***/ }), -/* 54 */ +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + + +/***/ }), +/* 38 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +// +// +// +// +// +// // // // - -var webview = false; - -var insertHTMLWebView = function insertHTMLWebView(_ref) { - var htmlId = _ref.htmlId; - var parentWebview = plus.webview.currentWebview(); // fixed by hxy web-view 组件所在的 webview 不注入 uni-app 框架 - - var styles = { - 'uni-app': 'none' - }; - var parentTitleNView = parentWebview.getTitleNView(); - - if (parentTitleNView) { - if (plus.navigator.isImmersedStatusbar()) { - styles.top = 44 + plus.navigator.getStatusbarHeight(); - } else { - styles.top = 44; - } - - styles.bottom = 0; - } - - webview = plus.webview.create('', htmlId, styles); - - if (parentTitleNView) { - webview.addEventListener('titleUpdate', function () { - var title = webview.getTitle(); - parentWebview.setStyle({ - titleNView: { - titleText: !title || title === 'null' ? '' : title - } - }); - }); - } - - plus.webview.currentWebview().append(webview); -}; - -var updateHTMLWebView = function updateHTMLWebView(_ref2) { - var htmlId = _ref2.htmlId, - src = _ref2.src, - webviewStyles = _ref2.webviewStyles; - // fixed by xxx 非空时才执行更新操作 - var realPath = src || ''; - - if (!realPath) { - return; - } - - if (/^(http|https):\/\//.test(realPath) && webviewStyles.progress) { - webview.setStyle({ - progress: { - color: webviewStyles.progress.color - } - }); - } - - webview.loadURL(realPath); -}; - -var removeHTMLWebView = function removeHTMLWebView() { - plus.webview.currentWebview().remove(webview); - webview.close('none'); - webview = false; -}; /* harmony default export */ __webpack_exports__["a"] = ({ - name: 'WebView', + name: 'Label', + mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* emitter */ "a"]], props: { - src: { + for: { type: String, default: '' - }, - webviewStyles: { - type: Object, - default: function _default() { - return {}; - } } }, - watch: { - src: function src(val, oldVal) { - webview && updateHTMLWebView({ - src: this.$getRealPath(val), - webviewStyles: this.webviewStyles - }); + computed: { + pointer: function pointer() { + return this.for || this.$slots.default && this.$slots.default.length; } }, - mounted: function mounted() { - this.htmlId = 'webviewId' + this.$page.id; - insertHTMLWebView({ - htmlId: this.htmlId - }); - updateHTMLWebView({ - src: this.$getRealPath(this.src), - webviewStyles: this.webviewStyles - }); - UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_INSERTED */ "j"], {}, this.$page.id); - }, - beforeDestroy: function beforeDestroy() { - removeHTMLWebView(); - UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_REMOVED */ "l"], {}, this.$page.id); + methods: { + _onClick: function _onClick($event) { + var stopPropagation = /^uni-(checkbox|radio|switch)-/.test($event.target.className); + + if (!stopPropagation) { + stopPropagation = /^uni-(checkbox|radio|switch|button)$/i.test($event.target.tagName); + } + + if (stopPropagation) { + return; + } + + if (this.for) { + UniViewJSBridge.emit('uni-label-click-' + this.$page.id + '-' + this.for, $event, true); + } else { + this.$broadcast(['Checkbox', 'Radio', 'Switch', 'Button'], 'uni-label-click', $event, true); + } + } } }); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), -/* 55 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin @@ -12921,2691 +13150,3210 @@ var removeHTMLWebView = function removeHTMLWebView() { /***/ }), -/* 56 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return findElm; }); -function findVmById(id, vm) { - if (id === vm._$id) { - return vm; - } +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { - var childVms = vm.$children; - var len = childVms.length; +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - for (var i = 0; i < len; i++) { - var childVm = findVmById(id, childVms[i]); +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - if (childVm) { - return childVm; - } - } -} +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + -function findElm(component, pageVm) { - if (!pageVm) { - return console.error('page is not ready'); - } +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { - if (!component) { - return pageVm.$el; - } +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - if (true) { - if (typeof component === 'string') { - var componentVm = findVmById(component, pageVm); +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { - if (!componentVm) { - throw new Error("Not Found\uFF1APage[".concat(pageVm.$page.id, "][").concat(component, "]")); - } +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - return componentVm.$el; - } - } +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { - return component.$el; -} +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), -/* 57 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ON_PAGE_CREATE; }); -var ON_PAGE_CREATE = 'onPageCreate'; +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), -/* 58 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return definePage; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPageVueComponent; }); -/* unused harmony export createPage */ -/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + -var pageFactory = Object.create(null); -function definePage(name, createPageVueComponent) { - pageFactory[name] = createPageVueComponent; -} -var getPageVueComponent = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* cached */ "a"])(function (pagePath) { - return pageFactory[pagePath](); -}); -function createPage(pagePath, pageId, pageQuery, pageInstance) { - if (!pageFactory[pagePath]) { - console.error("".concat(pagePath, " not found")); - } +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { - var startTime = Date.now(); - var pageVm = new (getPageVueComponent(pagePath))({ - mpType: 'page', - pageId: pageId, - pagePath: pagePath, - pageQuery: pageQuery, - pageInstance: pageInstance - }); +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - if (true) { - console.log("new ".concat(pagePath), Date.now() - startTime); - } +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { - return pageVm; -} +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), -/* 59 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCurrentPages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setCurrentPage; }); -var pages = []; -function getCurrentPages() { - return pages; -} -function setCurrentPage(pageId, pagePath) { - pages.length = 0; - pages.push({ - $page: { - id: pageId, - route: pagePath - } - }); -} +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), -/* 60 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HTMLParser; }); -/* - * HTML5 Parser By Sam Blowes - * - * Designed for HTML5 documents - * - * Original code by John Resig (ejohn.org) - * http://ejohn.org/blog/pure-javascript-html-parser/ - * Original code by Erik Arvidsson, Mozilla Public License - * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - * - * ---------------------------------------------------------------------------- - * License - * ---------------------------------------------------------------------------- - * - * This code is triple licensed using Apache Software License 2.0, - * Mozilla Public License or GNU Public License - * - * //////////////////////////////////////////////////////////////////////////// - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * //////////////////////////////////////////////////////////////////////////// - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is Simple HTML Parser. - * - * The Initial Developer of the Original Code is Erik Arvidsson. - * Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights - * Reserved. - * - * //////////////////////////////////////////////////////////////////////////// - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * ---------------------------------------------------------------------------- - * Usage - * ---------------------------------------------------------------------------- - * - * // Use like so: - * HTMLParser(htmlString, { - * start: function(tag, attrs, unary) {}, - * end: function(tag) {}, - * chars: function(text) {}, - * comment: function(text) {} - * }); - * - * // or to get an XML string: - * HTMLtoXML(htmlString); - * - * // or to get an XML DOM Document - * HTMLtoDOM(htmlString); - * - * // or to inject into an existing document/DOM node - * HTMLtoDOM(htmlString, document); - * HTMLtoDOM(htmlString, document.body); - * - */ -// Regular Expressions for parsing tags and attributes -var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/; -var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/; -var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + -var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5 -// fixed by xxx 将 ins 标签从块级名单中移除 +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { -var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5 +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + -var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open -// (and which close themselves) +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { -var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled" +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + -var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything) +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { -var special = makeMap('script,style'); -function HTMLParser(html, handler) { - var index; - var chars; - var match; - var stack = []; - var last = html; +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - stack.last = function () { - return this[this.length - 1]; - }; +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { - while (html) { - chars = true; // Make sure we're not in a script or style element +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - if (!stack.last() || !special[stack.last()]) { - // Comment - if (html.indexOf(''); +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { - if (index >= 0) { - if (handler.comment) { - handler.comment(html.substring(4, index)); - } +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - html = html.substring(index + 3); - chars = false; - } // end tag +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { - } else if (html.indexOf(']*>'), function (all, text) { - text = text.replace(/|/g, '$1$2'); +var _attrs = ['adpid', 'data']; +/* harmony default export */ __webpack_exports__["a"] = ({ + name: 'Ad', + mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "f"], _mixins_native__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]], + props: { + adpid: { + type: [Number, String], + default: '' + }, + data: { + type: Object, + default: null + }, + dataCount: { + type: Number, + default: 5 + }, + channel: { + type: String, + default: '' + } + }, + data: function data() { + return { + hidden: false + }; + }, + computed: { + attrs: function attrs() { + var _this = this; - if (handler.chars) { - handler.chars(text); - } + var obj = {}; - return ''; + _attrs.forEach(function (key) { + var val = _this.$props[key]; + val = key === 'src' ? _this.$getRealPath(val) : val; + obj[key.replace(/[A-Z]/g, function (str) { + return '-' + str.toLowerCase(); + })] = val; }); - parseEndTag('', stack.last()); - } - if (html == last) { - throw 'Parse Error: ' + html; + return obj; } + }, + watch: { + hidden: function hidden(val) { + this.adView && this.adView[val ? 'hide' : 'show'](); + }, + adpid: function adpid(val) { + if (val) { + this._loadData(val); + } + }, + data: function data(val) { + if (val) { + this._fillData(val); + } + } + }, + mounted: function mounted() { + var _this2 = this; - last = html; - } // Clean up any remaining tags - + this._onParentReady(function () { + _this2._adId = 'AdView-' + _this2._newGUID(); + var adStyle = Object.assign({ + id: _this2._adId + }, _this2.position); + var adView = _this2.adView = plus.ad.createAdView(adStyle); + adView.interceptTouchEvent(false); + plus.webview.currentWebview().append(adView); - parseEndTag(); + if (_this2.hidden) { + adView.hide(); + } - function parseStartTag(tag, tagName, rest, unary) { - tagName = tagName.toLowerCase(); + _this2.$watch('attrs', function () { + _this2._request(); + }, { + deep: true + }); - if (block[tagName]) { - while (stack.last() && inline[stack.last()]) { - parseEndTag('', stack.last()); - } - } + _this2.$watch('position', function () { + _this2.adView && _this2.adView.setStyle(_this2.position); + }, { + deep: true + }); // 模板渲染有效 - if (closeSelf[tagName] && stack.last() == tagName) { - parseEndTag('', tagName); - } - unary = empty[tagName] || !!unary; + adView.setDislikeListener && adView.setDislikeListener(function (data) { + _this2.adView && _this2.adView.close(); + _this2.$refs.container.style.height = '0px'; - if (!unary) { - stack.push(tagName); - } + _this2._updateView(); - if (handler.start) { - var attrs = []; - rest.replace(attr, function (match, name) { - var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; - attrs.push({ - name: name, - value: value, - escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // " + _this2.$trigger('close', {}, data); + }); + adView.setRenderingListener && adView.setRenderingListener(function (data) { + if (data.result === 0) { + _this2.$refs.container.style.height = data.height + 'px'; - }); + _this2._updateView(); + } else { + _this2.$trigger('error', {}, { + errCode: data.result + }); + } }); + adView.setAdClickedListener(function (data) { + _this2.$trigger('adclicked', {}, data); + }); + _this2._callbackId = _this2.$page.id + _this2._adId; + UniViewJSBridge.subscribe(_this2._callbackId, _this2._handleAdData.bind(_this2)); - if (handler.start) { - handler.start(tagName, attrs, unary); - } - } - } + _this2._request(); + }); + }, + beforeDestroy: function beforeDestroy() { + this.adView && this.adView.close(); + delete this.adView; + }, + methods: { + _handleAdData: function _handleAdData(_ref) { + var type = _ref.type, + _ref$data = _ref.data, + data = _ref$data === void 0 ? {} : _ref$data; - function parseEndTag(tag, tagName) { - // If no tag name is provided, clean shop - if (!tagName) { - var pos = 0; - } // Find the closest opened tag of the same type - else { - for (var pos = stack.length - 1; pos >= 0; pos--) { - if (stack[pos] == tagName) { - break; - } - } + switch (type) { + case 'success': + this._fillData(data); + + break; + + case 'fail': + this.$trigger('error', {}, data); + break; + } + }, + _request: function _request() { + if (!this.adView) { + return; } - if (pos >= 0) { - // Close all the open elements, up the stack - for (var i = stack.length - 1; i >= pos; i--) { - if (handler.end) { - handler.end(stack[i]); + if (this.data) { + this._fillData(this.data); + } else if (this.adpid) { + this._loadData(); + } + }, + _loadData: function _loadData(adpid) { + var data = { + adpid: adpid || this.adpid, + width: this.position.width, + count: this.dataCount, + ext: { + channel: this.channel } - } // Remove the open elements from the stack + }; + UniViewJSBridge.publishHandler('onAdMethodCallback', { + callbackId: this._callbackId, + data: data + }, this.$page.id); + }, + _fillData: function _fillData(data) { + this.adView.renderingBind(data); + this.$trigger('load', {}, {}); + }, + _updateView: function _updateView() { + window.dispatchEvent(new CustomEvent('updateview')); + }, + _newGUID: function _newGUID() { + var guid = ''; + var format = 'xxxxxxxx-xxxx'; + for (var i = 0; i < format.length; i++) { + if (format[i] === 'x') { + guid += (Math.random() * 16 | 0).toString(16); + } else { + guid += format[i]; + } + } - stack.length = pos; + return guid.toUpperCase(); } } -} -; +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -function makeMap(str) { - var obj = {}; - var items = str.split(','); +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { - for (var i = 0; i < items.length; i++) { - obj[items[i]] = true; - } +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - return obj; -} +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), /* 61 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Friction; }); -function Friction(e) { - this._drag = e; - this._dragLog = Math.log(e); - this._x = 0; - this._v = 0; - this._startTime = 0; -} +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_mixins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +/* harmony import */ var _mixins_native__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// -Friction.prototype.set = function (e, t) { - this._x = e; - this._v = t; - this._startTime = new Date().getTime(); -}; -Friction.prototype.setVelocityByEnd = function (e) { - this._v = (e - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1); -}; +var methods = ['getCenterLocation', 'moveToLocation', 'getRegion', 'getScale', '$getAppMap']; // const events = [ +// 'markertap', +// 'callouttap', +// 'controltap', +// 'regionchange', +// 'tap', +// 'updated' +// ] -Friction.prototype.x = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; - } +var _attrs = ['latitude', 'longitude', 'scale', 'markers', 'polyline', 'circles', 'controls', 'show-location']; - var t; - t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); - this._dt = e; - return this._x + this._v * t / this._dragLog - this._v / this._dragLog; +var convertCoordinates = function convertCoordinates(lng, lat, callback) { + // plus.maps.Map.convertCoordinates(new plus.maps.Point(lng, lat), { + // coordType: 'gcj02' + // }, callback) + callback({ + coord: { + latitude: lat, + longitude: lng + } + }); }; -Friction.prototype.dx = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; +function parseHex(color) { + if (color.indexOf('#') !== 0) { + return { + color: color, + opacity: 1 + }; } - var t; - t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); - this._dt = e; - return this._v * t; -}; - -Friction.prototype.done = function () { - return Math.abs(this.dx()) < 3; -}; - -Friction.prototype.reconfigure = function (e) { - var t = this.x(); - var n = this.dx(); - this._drag = e; - this._dragLog = Math.log(e); - this.set(t, n); -}; + var opacity = color.substr(7, 2); + return { + color: color.substr(0, 7), + opacity: opacity ? Number('0x' + opacity) / 255 : 1 + }; +} -Friction.prototype.configuration = function () { - var e = this; - return [{ - label: 'Friction', - read: function read() { - return e._drag; +/* harmony default export */ __webpack_exports__["a"] = ({ + name: 'Map', + mixins: [uni_mixins__WEBPACK_IMPORTED_MODULE_0__[/* subscriber */ "f"], _mixins_native__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]], + props: { + id: { + type: String, + default: '' }, - write: function write(t) { - e.reconfigure(t); + latitude: { + type: [Number, String], + default: '' }, - min: 0.001, - max: 0.1, - step: 0.001 - }]; -}; - -/***/ }), -/* 62 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + longitude: { + type: [Number, String], + default: '' + }, + scale: { + type: [String, Number], + default: 16 + }, + markers: { + type: Array, + default: function _default() { + return []; + } + }, + polyline: { + type: Array, + default: function _default() { + return []; + } + }, + circles: { + type: Array, + default: function _default() { + return []; + } + }, + controls: { + type: Array, + default: function _default() { + return []; + } + } + }, + data: function data() { + return { + style: { + top: '0px', + left: '0px', + width: '0px', + height: '0px', + position: 'static' + }, + hidden: false + }; + }, + computed: { + attrs: function attrs() { + var _this = this; -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Spring; }); -function o(e, t, n) { - return e > t - n && e < t + n; -} + var obj = {}; -function a(e, t) { - return o(e, 0, t); -} + _attrs.forEach(function (key) { + var val = _this.$props[key]; + val = key === 'src' ? _this.$getRealPath(val) : val; + obj[key.replace(/[A-Z]/g, function (str) { + return '-' + str.toLowerCase(); + })] = val; + }); -function Spring(e, t, n) { - this._m = e; - this._k = t; - this._c = n; - this._solution = null; - this._endPosition = 0; - this._startTime = 0; -} + return obj; + }, + mapControls: function mapControls() { + var _this2 = this; -Spring.prototype._solve = function (e, t) { - var n = this._c; - var i = this._m; - var r = this._k; - var o = n * n - 4 * i * r; + var list = this.controls.map(function (control) { + var position = { + position: 'absolute' + }; + ['top', 'left', 'width', 'height'].forEach(function (key) { + if (control.position[key]) { + position[key] = control.position[key] + 'px'; + } + }); + return { + id: control.id, + iconPath: _this2.$getRealPath(control.iconPath), + position: position + }; + }); + return list; + } + }, + watch: { + hidden: function hidden(val) { + this.map && this.map[val ? 'hide' : 'show'](); + }, + scale: function scale(val) { + this.map && this.map.setZoom(parseInt(val)); + }, + latitude: function latitude(val) { + this.map && this.map.setStyles({ + center: new plus.maps.Point(this.longitude, this.latitude) + }); + }, + longitude: function longitude(val) { + this.map && this.map.setStyles({ + center: new plus.maps.Point(this.longitude, this.latitude) + }); + }, + markers: function markers(val) { + this.map && this._addMarkers(val, true); + }, + polyline: function polyline(val) { + this.map && this._addMapLines(val); + }, + circles: function circles(val) { + this.map && this._addMapCircles(val); + } + }, + mounted: function mounted() { + var _this3 = this; - if (o === 0) { - var _a = -n / (2 * i); + this._onParentReady(function () { + var mapStyle = Object.assign({}, _this3.attrs, _this3.position); - var _s = e; + if (_this3.latitude && _this3.longitude) { + mapStyle.center = new plus.maps.Point(_this3.longitude, _this3.latitude); + } - var _l = t / (_a * e); + var map = _this3.map = plus.maps.create(_this3.$page.id + '-map-' + (_this3.id || Date.now()), mapStyle); + map.__markers__ = []; + map.__markers_map__ = {}; + map.__lines__ = []; + map.__circles__ = []; + map.setZoom(parseInt(_this3.scale)); + plus.webview.currentWebview().append(map); - return { - x: function x(e) { - return (_s + _l * e) * Math.pow(Math.E, _a * e); - }, - dx: function dx(e) { - var t = Math.pow(Math.E, _a * e); - return _a * (_s + _l * e) * t + _l * t; + if (_this3.hidden) { + map.hide(); } - }; - } - if (o > 0) { - var c = (-n - Math.sqrt(o)) / (2 * i); - var u = (-n + Math.sqrt(o)) / (2 * i); - - var _l2 = (t - c * e) / (u - c); + _this3.$watch('position', function () { + _this3.map && _this3.map.setStyles(_this3.position); + }, { + deep: true + }); - var _s2 = e - _l2; + map.onclick = function (e) { + _this3.$trigger('click', {}, e); + }; - return { - x: function x(e) { - var t; - var n; + map.onstatuschanged = function (e) { + _this3.$trigger('regionchange', {}, {}); + }; - if (e === this._t) { - t = this._powER1T; - n = this._powER2T; - } + _this3._addMarkers(_this3.markers); - this._t = e; + _this3._addMapLines(_this3.polyline); - if (!t) { - t = this._powER1T = Math.pow(Math.E, c * e); - } + _this3._addMapCircles(_this3.circles); + }); + }, + beforeDestroy: function beforeDestroy() { + this.map && this.map.close(); + delete this.map; + }, + methods: { + _handleSubscribe: function _handleSubscribe(_ref) { + var type = _ref.type, + _ref$data = _ref.data, + data = _ref$data === void 0 ? {} : _ref$data; - if (!n) { - n = this._powER2T = Math.pow(Math.E, u * e); - } + if (!methods.includes(type)) { + return; + } - return _s2 * t + _l2 * n; - }, - dx: function dx(e) { - var t; - var n; + this.map && this[type](data); + }, + moveToLocation: function moveToLocation(_ref2) { + var callbackId = _ref2.callbackId, + longitude = _ref2.longitude, + latitude = _ref2.latitude; + this.map.setCenter(new plus.maps.Point(longitude || this.longitude, latitude || this.latitude)); - if (e === this._t) { - t = this._powER1T; - n = this._powER2T; - } + this._publishHandler(callbackId, { + errMsg: 'moveToLocation:ok' + }); + }, + getCenterLocation: function getCenterLocation(_ref3) { + var _this4 = this; - this._t = e; + var callbackId = _ref3.callbackId; + this.map.getCurrentCenter(function (state, point) { + _this4._publishHandler(callbackId, { + longitude: point.longitude, + latitude: point.latitude, + errMsg: 'getCenterLocation:ok' + }); + }); + }, + getRegion: function getRegion(_ref4) { + var callbackId = _ref4.callbackId; + var rect = this.map.getBounds(); - if (!t) { - t = this._powER1T = Math.pow(Math.E, c * e); + this._publishHandler(callbackId, { + southwest: rect.southwest, + northeast: rect.northeast || rect.northease, + // 5plus API 名字写错了 + errMsg: 'getRegion:ok' + }); + }, + getScale: function getScale(_ref5) { + var callbackId = _ref5.callbackId; + + this._publishHandler(callbackId, { + scale: this.map.getZoom(), + errMsg: 'getScale:ok' + }); + }, + controlclick: function controlclick(e) { + this.$trigger('controltap', {}, { + controlId: e.id + }); + }, + _publishHandler: function _publishHandler(callbackId, data) { + UniViewJSBridge.publishHandler('onMapMethodCallback', { + callbackId: callbackId, + data: data + }, this.$page.id); + }, + _addMarker: function _addMarker(nativeMap, marker) { + var _this5 = this; + + var id = marker.id, + latitude = marker.latitude, + longitude = marker.longitude, + iconPath = marker.iconPath, + callout = marker.callout, + label = marker.label; + convertCoordinates(longitude, latitude, function (res) { + var _res$coord = res.coord, + latitude = _res$coord.latitude, + longitude = _res$coord.longitude; + var nativeMarker = new plus.maps.Marker(new plus.maps.Point(longitude, latitude)); + + if (iconPath) { + nativeMarker.setIcon(_this5.$getRealPath(iconPath)); } - if (!n) { - n = this._powER2T = Math.pow(Math.E, u * e); + if (label && label.content) { + nativeMarker.setLabel(label.content); } - return _s2 * c * t + _l2 * u * n; - } - }; - } + var nativeBubble = false; - var d = Math.sqrt(4 * i * r - n * n) / (2 * i); - var a = -n / 2 * i; - var s = e; - var l = (t - a * e) / d; - return { - x: function x(e) { - return Math.pow(Math.E, a * e) * (s * Math.cos(d * e) + l * Math.sin(d * e)); - }, - dx: function dx(e) { - var t = Math.pow(Math.E, a * e); - var n = Math.cos(d * e); - var i = Math.sin(d * e); - return t * (l * d * n - s * d * i) + a * t * (l * i + s * n); - } - }; -}; + if (callout && callout.content) { + nativeBubble = new plus.maps.Bubble(callout.content); + } -Spring.prototype.x = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; - } + if (nativeBubble) { + nativeMarker.setBubble(nativeBubble); + } - return this._solution ? this._endPosition + this._solution.x(e) : 0; -}; + if (id || id === 0) { + nativeMarker.onclick = function (e) { + _this5.$trigger('markertap', {}, { + markerId: id + }); + }; -Spring.prototype.dx = function (e) { - if (e === undefined) { - e = (new Date().getTime() - this._startTime) / 1e3; - } + if (nativeBubble) { + nativeBubble.onclick = function () { + _this5.$trigger('callouttap', {}, { + markerId: id + }); + }; + } + } - return this._solution ? this._solution.dx(e) : 0; -}; + nativeMap.addOverlay(nativeMarker); -Spring.prototype.setEnd = function (e, t, n) { - if (!n) { - n = new Date().getTime(); - } + nativeMap.__markers__.push(nativeMarker); - if (e !== this._endPosition || !a(t, 0.4)) { - t = t || 0; - var i = this._endPosition; + nativeMap.__markers_map__[id + ''] = nativeMarker; + }); + }, + _clearMarkers: function _clearMarkers() { + var map = this.map; + var markers = map.__markers__; + markers.forEach(function (marker) { + map.removeOverlay(marker); + }); + map.__markers__ = []; + map.__markers_map__ = {}; + }, + _addMarkers: function _addMarkers(markers, clear) { + var _this6 = this; - if (this._solution) { - if (a(t, 0.4)) { - t = this._solution.dx((n - this._startTime) / 1e3); + if (clear) { + this._clearMarkers(); } - i = this._solution.x((n - this._startTime) / 1e3); + markers.forEach(function (marker) { + _this6._addMarker(_this6.map, marker); + }); + }, + _translateMapMarker: function _translateMapMarker(_ref6) { + var autoRotate = _ref6.autoRotate, + callbackId = _ref6.callbackId, + destination = _ref6.destination, + duration = _ref6.duration, + markerId = _ref6.markerId; + var nativeMarker = this.map.__markers_map__[markerId + '']; - if (a(t, 0.4)) { - t = 0; + if (nativeMarker) { + nativeMarker.setPoint(new plus.maps.Point(destination.longitude, destination.latitude)); } + }, + _addMapLines: function _addMapLines(lines) { + var nativeMap = this.map; - if (a(i, 0.4)) { - i = 0; - } + if (nativeMap.__lines__.length > 0) { + nativeMap.__lines__.forEach(function (circle) { + nativeMap.removeOverlay(circle); + }); - i += this._endPosition; - } + nativeMap.__lines__ = []; + } - if (!(this._solution && a(i - e, 0.4) && a(t, 0.4))) { - this._endPosition = e; - this._solution = this._solve(i - this._endPosition, t); - this._startTime = n; - } - } -}; + lines.forEach(function (line) { + var color = line.color, + width = line.width; + var points = line.points.map(function (point) { + return new plus.maps.Point(point.longitude, point.latitude); + }); + var polyline = new plus.maps.Polyline(points); -Spring.prototype.snap = function (e) { - this._startTime = new Date().getTime(); - this._endPosition = e; - this._solution = { - x: function x() { - return 0; - }, - dx: function dx() { - return 0; - } - }; -}; + if (color) { + var strokeStyle = parseHex(color); + polyline.setStrokeColor(strokeStyle.color); + polyline.setStrokeOpacity(strokeStyle.opacity); + } -Spring.prototype.done = function (e) { - if (!e) { - e = new Date().getTime(); - } + if (width) { + polyline.setLineWidth(width); + } - return o(this.x(), this._endPosition, 0.4) && a(this.dx(), 0.4); -}; + nativeMap.addOverlay(polyline); -Spring.prototype.reconfigure = function (e, t, n) { - this._m = e; - this._k = t; - this._c = n; + nativeMap.__lines__.push(polyline); + }); + }, + _addMapCircles: function _addMapCircles(circles) { + var nativeMap = this.map; - if (!this.done()) { - this._solution = this._solve(this.x() - this._endPosition, this.dx()); - this._startTime = new Date().getTime(); - } -}; + if (nativeMap.__circles__.length > 0) { + nativeMap.__circles__.forEach(function (circle) { + nativeMap.removeOverlay(circle); + }); -Spring.prototype.springConstant = function () { - return this._k; -}; + nativeMap.__circles__ = []; + } -Spring.prototype.damping = function () { - return this._c; -}; + circles.forEach(function (circle) { + var latitude = circle.latitude, + longitude = circle.longitude, + color = circle.color, + fillColor = circle.fillColor, + radius = circle.radius, + strokeWidth = circle.strokeWidth; + var nativeCircle = new plus.maps.Circle(new plus.maps.Point(longitude, latitude), radius); -Spring.prototype.configuration = function () { - function e(e, t) { - e.reconfigure(1, t, e.damping()); - } + if (color) { + var strokeStyle = parseHex(color); + nativeCircle.setStrokeColor(strokeStyle.color); + nativeCircle.setStrokeOpacity(strokeStyle.opacity); + } - function t(e, t) { - e.reconfigure(1, e.springConstant(), t); + if (fillColor) { + var fillStyle = parseHex(fillColor); + nativeCircle.setFillColor(fillStyle.color); + nativeCircle.setFillOpacity(fillStyle.opacity); + } + + if (strokeWidth) { + nativeCircle.setLineWidth(strokeWidth); + } + + nativeMap.addOverlay(nativeCircle); + + nativeMap.__circles__.push(nativeCircle); + }); + } } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - return [{ - label: 'Spring Constant', - read: this.springConstant.bind(this), - write: e.bind(this, this), - min: 100, - max: 1e3 - }, { - label: 'Damping', - read: this.damping.bind(this), - write: t.bind(this, this), - min: 1, - max: 500 - }]; -}; +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + /***/ }), /* 63 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + + +/***/ }), +/* 65 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -var base = ['borderRadius', 'borderColor', 'borderWidth', 'backgroundColor']; -var text = ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'color', 'textAlign', 'lineHeight', 'fontSize', 'fontWeight', 'textOverflow', 'whiteSpace']; -var image = []; -var textAlign = { - start: 'left', - end: 'right' -}; -var index = 0; -/* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Cover', - data: function data() { - return { - style: {} - }; - }, - computed: { - viewPosition: function viewPosition() { - var position = {}; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +/* harmony import */ var uni_helpers_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17); +// +// +// - for (var key in this.position) { - var val = this.position[key]; - var valNumber = parseFloat(val); - var parentValNumber = parseFloat(this._nativeParent.position[key]); - if (key === 'top' || key === 'left') { - val = Math.max(valNumber, parentValNumber) + 'px'; - } else if (key === 'width' || key === 'height') { - var _base = key === 'width' ? 'left' : 'left'; +var webview = false; - var parentStart = parseFloat(this._nativeParent.position[_base]); - var viewStart = parseFloat(this.position[_base]); - var diff1 = Math.max(parentStart - viewStart, 0); - var diff2 = Math.max(viewStart + valNumber - (parentStart + parentValNumber), 0); - val = Math.max(valNumber - diff1 - diff2, 0) + 'px'; - } +var insertHTMLWebView = function insertHTMLWebView(_ref) { + var htmlId = _ref.htmlId; + var parentWebview = plus.webview.currentWebview(); // fixed by hxy web-view 组件所在的 webview 不注入 uni-app 框架 - position[key] = val; - } + var styles = { + 'uni-app': 'none', + isUniH5: true + }; + var parentTitleNView = parentWebview.getTitleNView(); - return position; - }, - tags: function tags() { - var position = this._getTagPosition(); + if (parentTitleNView) { + if (plus.navigator.isImmersedStatusbar()) { + styles.top = uni_helpers_constants__WEBPACK_IMPORTED_MODULE_1__[/* NAVBAR_HEIGHT */ "a"] + plus.navigator.getStatusbarHeight(); + } else { + styles.top = uni_helpers_constants__WEBPACK_IMPORTED_MODULE_1__[/* NAVBAR_HEIGHT */ "a"]; + } - var style = this.style; - var tags = [{ - tag: 'rect', - position: position, - rectStyles: { - color: style.backgroundColor, - radius: style.borderRadius, - borderColor: style.borderColor, - borderWidth: style.borderWidth + styles.bottom = 0; + } + + webview = plus.webview.create('', htmlId, styles); + + if (parentTitleNView) { + webview.addEventListener('titleUpdate', function () { + var title = webview.getTitle(); + parentWebview.setStyle({ + titleNView: { + // iOS titleText 为空字符串时 按钮会隐藏 + titleText: !title || title === 'null' ? ' ' : title } - }]; + }); + }); + } - if (this.coverType === 'image') { - tags.push({ - tag: 'img', - position: position, - src: this.coverContent - }); - } else { - var lineSpacing = parseFloat(style.lineHeight) - parseFloat(style.fontSize); - var width = parseFloat(position.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight); - width = width < 0 ? 0 : width; - var height = parseFloat(position.height) - parseFloat(style.paddingTop) - lineSpacing / 2 - parseFloat(style.paddingBottom); - height = height < 0 ? 0 : height; - tags.push({ - tag: 'font', - position: { - top: "".concat(parseFloat(position.top) + parseFloat(style.paddingTop) + lineSpacing / 2, "px"), - left: "".concat(parseFloat(position.left) + parseFloat(style.paddingLeft), "px"), - width: "".concat(width, "px"), - height: "".concat(height, "px") - }, - textStyles: { - align: textAlign[style.textAlign] || style.textAlign, - color: style.color, - decoration: 'none', - lineSpacing: "".concat(lineSpacing, "px"), - margin: '0px', - overflow: style.textOverflow, - size: style.fontSize, - verticalAlign: 'top', - weight: style.fontWeight, - whiteSpace: style.whiteSpace - }, - text: this.coverContent - }); + plus.webview.currentWebview().append(webview); +}; + +var updateHTMLWebView = function updateHTMLWebView(_ref2) { + var htmlId = _ref2.htmlId, + src = _ref2.src, + webviewStyles = _ref2.webviewStyles; + // fixed by xxx 非空时才执行更新操作 + var realPath = src || ''; + + if (!realPath) { + return; + } + + if (/^(http|https):\/\//.test(realPath) && webviewStyles.progress) { + webview.setStyle({ + progress: { + color: webviewStyles.progress.color } + }); + } - return tags; + webview.loadURL(realPath); +}; + +var removeHTMLWebView = function removeHTMLWebView() { + plus.webview.currentWebview().remove(webview); + webview.close('none'); + webview = false; +}; + +/* harmony default export */ __webpack_exports__["a"] = ({ + name: 'WebView', + props: { + src: { + type: String, + default: '' + }, + webviewStyles: { + type: Object, + default: function _default() { + return {}; + } } }, - created: function created() { - var $parent = this.$parent; - - while (!$parent.isNative && $parent !== this.$root) { - $parent = $parent.$parent; + watch: { + src: function src(val, oldVal) { + webview && updateHTMLWebView({ + src: this.$getRealPath(val), + webviewStyles: this.webviewStyles + }); } - - this._nativeParent = $parent; }, mounted: function mounted() { var _this = this; - this._updateStyle(); - - var $nativeParent = this._nativeParent; - - if ($nativeParent.isNative) { - if ($nativeParent._isMounted) { - this._onCanInsert(); - } else { - $nativeParent.onCanInsertCallbacks.push(function () { - _this._onCanInsert(); - }); - } - - this.$watch('hidden', function (val) { - _this.cover && _this.cover[val ? 'hide' : 'show'](); - }); - this.$watch('viewPosition', function (val) { - _this.cover && _this.cover.setStyle(val); - }, { - deep: true + this._onParentReady(function () { + _this.htmlId = _constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_ID_PREFIX */ "k"] + _this.$page.id; + insertHTMLWebView({ + htmlId: _this.htmlId }); - this.$watch('tags', function () { - var cover = _this.cover; - - if (cover) { - cover.reset(); - cover.draw(_this.tags); - } - }, { - deep: true + updateHTMLWebView({ + src: _this.$getRealPath(_this.src), + webviewStyles: _this.webviewStyles }); - this.$on('uni-view-update', this._requestStyleUpdate); - } + UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_INSERTED */ "l"], {}, _this.$page.id); + }); }, beforeDestroy: function beforeDestroy() { - if (this._nativeParent.isNative) { - this.cover && this.cover.close(); - delete this.cover; - } - }, - methods: { - _onCanInsert: function _onCanInsert() { - var _this2 = this; + removeHTMLWebView(); + UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* WEBVIEW_REMOVED */ "n"], {}, this.$page.id); + } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - var cover = this.cover = new plus.nativeObj.View("cover-".concat(Date.now(), "-").concat(index++), this.viewPosition, this.tags); - plus.webview.currentWebview().append(cover); +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.hidden) { - cover.hide(); - } +// extracted by mini-css-extract-plugin + if(false) { var cssReload; } + - cover.addEventListener('click', function () { - _this2.$trigger('click', {}, {}); - }); - }, - _getTagPosition: function _getTagPosition() { - var position = {}; +/***/ }), +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - for (var key in this.position) { - var val = this.position[key]; +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ON_PAGE_CREATE; }); +var ON_PAGE_CREATE = 'onPageCreate'; - if (key === 'top' || key === 'left') { - val = Math.min(parseFloat(val) - parseFloat(this._nativeParent.position[key]), 0) + 'px'; - } +/***/ }), +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - position[key] = val; - } +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return definePage; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPageVueComponent; }); +/* unused harmony export createPage */ +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - return position; - }, - _updateStyle: function _updateStyle() { - var _this3 = this; +var pageFactory = Object.create(null); +function definePage(name, createPageVueComponent) { + pageFactory[name] = createPageVueComponent; +} +var getPageVueComponent = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* cached */ "a"])(function (pagePath) { + return pageFactory[pagePath](); +}); +function createPage(pagePath, pageId, pageQuery, pageInstance) { + if (!pageFactory[pagePath]) { + console.error("".concat(pagePath, " not found")); + } - var style = getComputedStyle(this.$el); - base.concat(text, image).forEach(function (key) { - _this3.style[key] = style[key]; - }); - }, - _requestStyleUpdate: function _requestStyleUpdate() { - var _this4 = this; + var startTime = Date.now(); + var pageVm = new (getPageVueComponent(pagePath))({ + mpType: 'page', + pageId: pageId, + pagePath: pagePath, + pageQuery: pageQuery, + pageInstance: pageInstance + }); - if (this._styleUpdateRequest) { - cancelAnimationFrame(this._styleUpdateRequest); - } + if (true) { + console.log("new ".concat(pagePath, "[").concat(pageId, "]:time(").concat(Date.now() - startTime, ")")); + } - this._styleUpdateRequest = requestAnimationFrame(function () { - delete _this4._styleUpdateRequest; + return pageVm; +} - _this4._updateStyle(); - }); +/***/ }), +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCurrentPages; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setCurrentPage; }); +var pages = []; +function getCurrentPages() { + return pages; +} +function setCurrentPage(pageId, pagePath) { + pages.length = 0; + pages.push({ + $page: { + id: pageId, + route: pagePath } - } -}); + }); +} /***/ }), -/* 64 */ +/* 70 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HTMLParser; }); +/* + * HTML5 Parser By Sam Blowes + * + * Designed for HTML5 documents + * + * Original code by John Resig (ejohn.org) + * http://ejohn.org/blog/pure-javascript-html-parser/ + * Original code by Erik Arvidsson, Mozilla Public License + * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js + * + * ---------------------------------------------------------------------------- + * License + * ---------------------------------------------------------------------------- + * + * This code is triple licensed using Apache Software License 2.0, + * Mozilla Public License or GNU Public License + * + * //////////////////////////////////////////////////////////////////////////// + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * //////////////////////////////////////////////////////////////////////////// + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Simple HTML Parser. + * + * The Initial Developer of the Original Code is Erik Arvidsson. + * Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights + * Reserved. + * + * //////////////////////////////////////////////////////////////////////////// + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ---------------------------------------------------------------------------- + * Usage + * ---------------------------------------------------------------------------- + * + * // Use like so: + * HTMLParser(htmlString, { + * start: function(tag, attrs, unary) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + * // or to get an XML string: + * HTMLtoXML(htmlString); + * + * // or to get an XML DOM Document + * HTMLtoDOM(htmlString); + * + * // or to inject into an existing document/DOM node + * HTMLtoDOM(htmlString, document); + * HTMLtoDOM(htmlString, document.body); + * + */ +// Regular Expressions for parsing tags and attributes +var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/; +var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/; +var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 -// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Friction.js -var Friction = __webpack_require__(61); - -// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Spring.js -var Spring = __webpack_require__(62); +var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5 +// fixed by xxx 将 ins 标签从块级名单中移除 -// CONCATENATED MODULE: ./src/core/view/mixins/scroller/Scroll.js +var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5 +var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open +// (and which close themselves) -function Scroll(extent, friction, spring) { - this._extent = extent; - this._friction = friction || new Friction["a" /* Friction */](0.01); - this._spring = spring || new Spring["a" /* Spring */](1, 90, 20); - this._startTime = 0; - this._springing = false; - this._springOffset = 0; -} +var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled" -Scroll.prototype.snap = function (e, t) { - this._springOffset = 0; - this._springing = true; +var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything) - this._spring.snap(e); +var special = makeMap('script,style'); +function HTMLParser(html, handler) { + var index; + var chars; + var match; + var stack = []; + var last = html; - this._spring.setEnd(t); -}; + stack.last = function () { + return this[this.length - 1]; + }; -Scroll.prototype.set = function (e, t) { - this._friction.set(e, t); + while (html) { + chars = true; // Make sure we're not in a script or style element - if (e > 0 && t >= 0) { - this._springOffset = 0; - this._springing = true; + if (!stack.last() || !special[stack.last()]) { + // Comment + if (html.indexOf(''); - this._spring.snap(e); + if (index >= 0) { + if (handler.comment) { + handler.comment(html.substring(4, index)); + } - this._spring.setEnd(0); - } else { - if (e < -this._extent && t <= 0) { - this._springOffset = 0; - this._springing = true; + html = html.substring(index + 3); + chars = false; + } // end tag - this._spring.snap(e); + } else if (html.indexOf(']*>'), function (all, text) { + text = text.replace(/|/g, '$1$2'); - if (t > 0 && n >= 0 || t < -this._extent && n <= 0) { - this._springing = true; + if (handler.chars) { + handler.chars(text); + } - this._spring.setEnd(0, n); + return ''; + }); + parseEndTag('', stack.last()); + } - if (t < -this._extent) { - this._springOffset = -this._extent; - } else { - this._springOffset = 0; + if (html == last) { + throw 'Parse Error: ' + html; } - t = this._spring.x() + this._springOffset; - } + last = html; + } // Clean up any remaining tags - return t; -}; -Scroll.prototype.dx = function (e) { - var t = 0; - t = this._lastTime === e ? this._lastDx : this._springing ? this._spring.dx(e) : this._friction.dx(e); - this._lastTime = e; - this._lastDx = t; - return t; -}; + parseEndTag(); -Scroll.prototype.done = function () { - return this._springing ? this._spring.done() : this._friction.done(); -}; + function parseStartTag(tag, tagName, rest, unary) { + tagName = tagName.toLowerCase(); -Scroll.prototype.setVelocityByEnd = function (e) { - this._friction.setVelocityByEnd(e); -}; + if (block[tagName]) { + while (stack.last() && inline[stack.last()]) { + parseEndTag('', stack.last()); + } + } -Scroll.prototype.configuration = function () { - var e = this._friction.configuration(); + if (closeSelf[tagName] && stack.last() == tagName) { + parseEndTag('', tagName); + } - e.push.apply(e, this._spring.configuration()); - return e; -}; -// CONCATENATED MODULE: ./src/core/view/mixins/scroller/Scroller.js + unary = empty[tagName] || !!unary; + if (!unary) { + stack.push(tagName); + } -function i(scroll, t, n) { - function i(t, scroll, r, o) { - if (!t || !t.cancelled) { - r(scroll); - var a = scroll.done(); + if (handler.start) { + var attrs = []; + rest.replace(attr, function (match, name) { + var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; + attrs.push({ + name: name, + value: value, + escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // " - if (!a) { - if (!t.cancelled) { - t.id = requestAnimationFrame(i.bind(null, t, scroll, r, o)); - } - } + }); + }); - if (a && o) { - o(scroll); + if (handler.start) { + handler.start(tagName, attrs, unary); } } } - function r(scroll) { - if (scroll && scroll.id) { - cancelAnimationFrame(scroll.id); - } + function parseEndTag(tag, tagName) { + // If no tag name is provided, clean shop + if (!tagName) { + var pos = 0; + } // Find the closest opened tag of the same type + else { + for (var pos = stack.length - 1; pos >= 0; pos--) { + if (stack[pos] == tagName) { + break; + } + } + } - if (scroll) { - scroll.cancelled = true; + if (pos >= 0) { + // Close all the open elements, up the stack + for (var i = stack.length - 1; i >= pos; i--) { + if (handler.end) { + handler.end(stack[i]); + } + } // Remove the open elements from the stack + + + stack.length = pos; } } - - var o = { - id: 0, - cancelled: false - }; - i(o, scroll, t, n); - return { - cancel: r.bind(null, o), - model: scroll - }; } +; -function Scroller(element, options) { - options = options || {}; - this._element = element; - this._options = options; - this._enableSnap = options.enableSnap || false; - this._itemSize = options.itemSize || 0; - this._enableX = options.enableX || false; - this._enableY = options.enableY || false; - this._shouldDispatchScrollEvent = !!options.onScroll; +function makeMap(str) { + var obj = {}; + var items = str.split(','); - if (this._enableX) { - this._extent = (options.scrollWidth || this._element.offsetWidth) - this._element.parentElement.offsetWidth; - this._scrollWidth = options.scrollWidth; - } else { - this._extent = (options.scrollHeight || this._element.offsetHeight) - this._element.parentElement.offsetHeight; - this._scrollHeight = options.scrollHeight; + for (var i = 0; i < items.length; i++) { + obj[items[i]] = true; } - this._position = 0; - this._scroll = new Scroll(this._extent, options.friction, options.spring); - this._onTransitionEnd = this.onTransitionEnd.bind(this); - this.updatePosition(); + return obj; } -Scroller.prototype.onTouchStart = function () { - this._startPosition = this._position; - this._lastChangePos = this._startPosition; - - if (this._startPosition > 0) { - this._startPosition /= 0.5; - } else { - if (this._startPosition < -this._extent) { - this._startPosition = (this._startPosition + this._extent) / 0.5 - this._extent; - } - } - - if (this._animation) { - this._animation.cancel(); +/***/ }), +/* 71 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - this._scrolling = false; - } +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Friction; }); +function Friction(e) { + this._drag = e; + this._dragLog = Math.log(e); + this._x = 0; + this._v = 0; + this._startTime = 0; +} - this.updatePosition(); +Friction.prototype.set = function (e, t) { + this._x = e; + this._v = t; + this._startTime = new Date().getTime(); }; -Scroller.prototype.onTouchMove = function (x, y) { - var startPosition = this._startPosition; +Friction.prototype.setVelocityByEnd = function (e) { + this._v = (e - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1); +}; - if (this._enableX) { - startPosition += x; - } else if (this._enableY) { - startPosition += y; +Friction.prototype.x = function (e) { + if (e === undefined) { + e = (new Date().getTime() - this._startTime) / 1e3; } - if (startPosition > 0) { - startPosition *= 0.5; - } else if (startPosition < -this._extent) { - startPosition = 0.5 * (startPosition + this._extent) - this._extent; + var t; + t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); + this._dt = e; + return this._x + this._v * t / this._dragLog - this._v / this._dragLog; +}; + +Friction.prototype.dx = function (e) { + if (e === undefined) { + e = (new Date().getTime() - this._startTime) / 1e3; } - this._position = startPosition; - this.updatePosition(); - this.dispatchScroll(); + var t; + t = e === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e); + this._dt = e; + return this._v * t; }; -Scroller.prototype.onTouchEnd = function (e, r, o) { - var _this = this; +Friction.prototype.done = function () { + return Math.abs(this.dx()) < 3; +}; - if (this._enableSnap && this._position > -this._extent && this._position < 0) { - if (this._enableY && (Math.abs(r) < this._itemSize && Math.abs(o.y) < 300 || Math.abs(o.y) < 150)) { - this.snap(); - return; - } +Friction.prototype.reconfigure = function (e) { + var t = this.x(); + var n = this.dx(); + this._drag = e; + this._dragLog = Math.log(e); + this.set(t, n); +}; - if (this._enableX && (Math.abs(e) < this._itemSize && Math.abs(o.x) < 300 || Math.abs(o.x) < 150)) { - this.snap(); - return; - } - } +Friction.prototype.configuration = function () { + var e = this; + return [{ + label: 'Friction', + read: function read() { + return e._drag; + }, + write: function write(t) { + e.reconfigure(t); + }, + min: 0.001, + max: 0.1, + step: 0.001 + }]; +}; - if (this._enableX) { - this._scroll.set(this._position, o.x); - } else if (this._enableY) { - this._scroll.set(this._position, o.y); - } +/***/ }), +/* 72 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (this._enableSnap) { - var s = this._scroll._friction.x(100); +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Spring; }); +function o(e, t, n) { + return e > t - n && e < t + n; +} - var l = s % this._itemSize; - var c = Math.abs(l) > this._itemSize / 2 ? s - (this._itemSize - Math.abs(l)) : s - l; +function a(e, t) { + return o(e, 0, t); +} - if (c <= 0 && c >= -this._extent) { - this._scroll.setVelocityByEnd(c); - } - } +function Spring(e, t, n) { + this._m = e; + this._k = t; + this._c = n; + this._solution = null; + this._endPosition = 0; + this._startTime = 0; +} - this._lastTime = Date.now(); - this._lastDelay = 0; - this._scrolling = true; - this._lastChangePos = this._position; - this._lastIdx = Math.floor(Math.abs(this._position / this._itemSize)); - this._animation = i(this._scroll, function () { - var e = Date.now(); - var i = (e - _this._scroll._startTime) / 1e3; +Spring.prototype._solve = function (e, t) { + var n = this._c; + var i = this._m; + var r = this._k; + var o = n * n - 4 * i * r; - var r = _this._scroll.x(i); + if (o === 0) { + var _a = -n / (2 * i); - _this._position = r; + var _s = e; - _this.updatePosition(); + var _l = t / (_a * e); - var o = _this._scroll.dx(i); + return { + x: function x(e) { + return (_s + _l * e) * Math.pow(Math.E, _a * e); + }, + dx: function dx(e) { + var t = Math.pow(Math.E, _a * e); + return _a * (_s + _l * e) * t + _l * t; + } + }; + } - if (_this._shouldDispatchScrollEvent && e - _this._lastTime > _this._lastDelay) { - _this.dispatchScroll(); + if (o > 0) { + var c = (-n - Math.sqrt(o)) / (2 * i); + var u = (-n + Math.sqrt(o)) / (2 * i); - _this._lastDelay = Math.abs(2e3 / o); - _this._lastTime = e; - } - }, function () { - if (_this._enableSnap) { - if (c <= 0 && c >= -_this._extent) { - _this._position = c; + var _l2 = (t - c * e) / (u - c); - _this.updatePosition(); - } + var _s2 = e - _l2; - if (typeof _this._options.onSnap === 'function') { - _this._options.onSnap(Math.floor(Math.abs(_this._position) / _this._itemSize)); - } - } + return { + x: function x(e) { + var t; + var n; - if (_this._shouldDispatchScrollEvent) { - _this.dispatchScroll(); - } + if (e === this._t) { + t = this._powER1T; + n = this._powER2T; + } - _this._scrolling = false; - }); -}; + this._t = e; -Scroller.prototype.onTransitionEnd = function () { - this._element.style.transition = ''; - this._element.style.webkitTransition = ''; + if (!t) { + t = this._powER1T = Math.pow(Math.E, c * e); + } - this._element.removeEventListener('transitionend', this._onTransitionEnd); + if (!n) { + n = this._powER2T = Math.pow(Math.E, u * e); + } - this._element.removeEventListener('webkitTransitionEnd', this._onTransitionEnd); + return _s2 * t + _l2 * n; + }, + dx: function dx(e) { + var t; + var n; - if (this._snapping) { - this._snapping = false; - } + if (e === this._t) { + t = this._powER1T; + n = this._powER2T; + } - this.dispatchScroll(); -}; + this._t = e; -Scroller.prototype.snap = function () { - var e = this._itemSize; - var t = this._position % e; - var i = Math.abs(t) > this._itemSize / 2 ? this._position - (e - Math.abs(t)) : this._position - t; + if (!t) { + t = this._powER1T = Math.pow(Math.E, c * e); + } - if (this._position !== i) { - this._snapping = true; - this.scrollTo(-i); + if (!n) { + n = this._powER2T = Math.pow(Math.E, u * e); + } - if (typeof this._options.onSnap === 'function') { - this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize)); - } + return _s2 * c * t + _l2 * u * n; + } + }; } -}; -Scroller.prototype.scrollTo = function (e, t) { - if (this._animation) { - this._animation.cancel(); + var d = Math.sqrt(4 * i * r - n * n) / (2 * i); + var a = -n / 2 * i; + var s = e; + var l = (t - a * e) / d; + return { + x: function x(e) { + return Math.pow(Math.E, a * e) * (s * Math.cos(d * e) + l * Math.sin(d * e)); + }, + dx: function dx(e) { + var t = Math.pow(Math.E, a * e); + var n = Math.cos(d * e); + var i = Math.sin(d * e); + return t * (l * d * n - s * d * i) + a * t * (l * i + s * n); + } + }; +}; - this._scrolling = false; +Spring.prototype.x = function (e) { + if (e === undefined) { + e = (new Date().getTime() - this._startTime) / 1e3; } - if (typeof e === 'number') { - this._position = -e; + return this._solution ? this._endPosition + this._solution.x(e) : 0; +}; + +Spring.prototype.dx = function (e) { + if (e === undefined) { + e = (new Date().getTime() - this._startTime) / 1e3; } - if (this._position < -this._extent) { - this._position = -this._extent; - } else { - if (this._position > 0) { - this._position = 0; - } + return this._solution ? this._solution.dx(e) : 0; +}; + +Spring.prototype.setEnd = function (e, t, n) { + if (!n) { + n = new Date().getTime(); } - this._element.style.transition = 'transform ' + (t || 0.2) + 's ease-out'; - this._element.style.webkitTransition = '-webkit-transform ' + (t || 0.2) + 's ease-out'; - this.updatePosition(); + if (e !== this._endPosition || !a(t, 0.4)) { + t = t || 0; + var i = this._endPosition; - this._element.addEventListener('transitionend', this._onTransitionEnd); + if (this._solution) { + if (a(t, 0.4)) { + t = this._solution.dx((n - this._startTime) / 1e3); + } - this._element.addEventListener('webkitTransitionEnd', this._onTransitionEnd); -}; + i = this._solution.x((n - this._startTime) / 1e3); -Scroller.prototype.dispatchScroll = function () { - if (typeof this._options.onScroll === 'function' && Math.round(this._lastPos) !== Math.round(this._position)) { - this._lastPos = this._position; - var e = { - target: { - scrollLeft: this._enableX ? -this._position : 0, - scrollTop: this._enableY ? -this._position : 0, - scrollHeight: this._scrollHeight || this._element.offsetHeight, - scrollWidth: this._scrollWidth || this._element.offsetWidth, - offsetHeight: this._element.parentElement.offsetHeight, - offsetWidth: this._element.parentElement.offsetWidth + if (a(t, 0.4)) { + t = 0; } - }; - this._options.onScroll(e); - } -}; + if (a(i, 0.4)) { + i = 0; + } -Scroller.prototype.update = function (e, t, n) { - var i = 0; - var r = this._position; + i += this._endPosition; + } - if (this._enableX) { - i = this._element.childNodes.length ? (t || this._element.offsetWidth) - this._element.parentElement.offsetWidth : 0; - this._scrollWidth = t; - } else { - i = this._element.childNodes.length ? (t || this._element.offsetHeight) - this._element.parentElement.offsetHeight : 0; - this._scrollHeight = t; + if (!(this._solution && a(i - e, 0.4) && a(t, 0.4))) { + this._endPosition = e; + this._solution = this._solve(i - this._endPosition, t); + this._startTime = n; + } } +}; - if (typeof e === 'number') { - this._position = -e; - } - - if (this._position < -i) { - this._position = -i; - } else { - if (this._position > 0) { - this._position = 0; +Spring.prototype.snap = function (e) { + this._startTime = new Date().getTime(); + this._endPosition = e; + this._solution = { + x: function x() { + return 0; + }, + dx: function dx() { + return 0; } + }; +}; + +Spring.prototype.done = function (e) { + if (!e) { + e = new Date().getTime(); } - this._itemSize = n || this._itemSize; - this.updatePosition(); + return o(this.x(), this._endPosition, 0.4) && a(this.dx(), 0.4); +}; - if (r !== this._position) { - this.dispatchScroll(); +Spring.prototype.reconfigure = function (e, t, n) { + this._m = e; + this._k = t; + this._c = n; - if (typeof this._options.onSnap === 'function') { - this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize)); - } + if (!this.done()) { + this._solution = this._solve(this.x() - this._endPosition, this.dx()); + this._startTime = new Date().getTime(); } +}; - this._extent = i; - this._scroll._extent = i; +Spring.prototype.springConstant = function () { + return this._k; }; -Scroller.prototype.updatePosition = function () { - var transform = ''; +Spring.prototype.damping = function () { + return this._c; +}; - if (this._enableX) { - transform = 'translateX(' + this._position + 'px) translateZ(0)'; - } else { - if (this._enableY) { - transform = 'translateY(' + this._position + 'px) translateZ(0)'; - } +Spring.prototype.configuration = function () { + function e(e, t) { + e.reconfigure(1, t, e.damping()); } - this._element.style.webkitTransform = transform; - this._element.style.transform = transform; + function t(e, t) { + e.reconfigure(1, e.springConstant(), t); + } + + return [{ + label: 'Spring Constant', + read: this.springConstant.bind(this), + write: e.bind(this, this), + min: 100, + max: 1e3 + }, { + label: 'Damping', + read: this.damping.bind(this), + write: t.bind(this, this), + min: 1, + max: 500 + }]; }; -Scroller.prototype.isScrolling = function () { - return this._scrolling || this._snapping; +/***/ }), +/* 73 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +var base = ['borderRadius', 'borderColor', 'borderWidth', 'backgroundColor']; +var text = ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'color', 'textAlign', 'lineHeight', 'fontSize', 'fontWeight', 'textOverflow', 'whiteSpace']; +var image = []; +var textAlign = { + start: 'left', + end: 'right' }; -// CONCATENATED MODULE: ./src/core/view/mixins/scroller/index.js +var index = 0; +/* harmony default export */ __webpack_exports__["a"] = ({ + name: 'Cover', + data: function data() { + return { + style: {}, + parentPosition: {} + }; + }, + computed: { + viewPosition: function viewPosition() { + var position = {}; -/* harmony default export */ var scroller = __webpack_exports__["a"] = ({ - methods: { - initScroller: function initScroller(element, options) { - this._touchInfo = { - trackingID: -1, - maxDy: 0, - maxDx: 0 - }; - this._scroller = new Scroller(element, options); - this.__handleTouchStart = this._handleTouchStart.bind(this); - this.__handleTouchMove = this._handleTouchMove.bind(this); - this.__handleTouchEnd = this._handleTouchEnd.bind(this); - this._initedScroller = true; - }, - _findDelta: function _findDelta(event) { - var touchInfo = this._touchInfo; - return event.detail.state === 'move' || event.detail.state === 'end' ? { - x: event.detail.dx, - y: event.detail.dy - } : { - x: event.screenX - touchInfo.x, - y: event.screenY - touchInfo.y - }; - }, - _handleTouchStart: function _handleTouchStart(e) { - var t = this._touchInfo; - var n = this._scroller; + for (var key in this.position) { + var val = this.position[key]; + var valNumber = parseFloat(val); + var parentValNumber = parseFloat(this.parentPosition[key]); - if (n) { - if (e.detail.state === 'start') { - t.trackingID = 'touch'; - t.x = e.detail.x; - t.y = e.detail.y; - } else { - t.trackingID = 'mouse'; - t.x = e.screenX; - t.y = e.screenY; + if (key === 'top' || key === 'left') { + val = Math.max(valNumber, parentValNumber) + 'px'; + } else if (key === 'width' || key === 'height') { + var _base = key === 'width' ? 'left' : 'top'; + + var parentStart = parseFloat(this.parentPosition[_base]); + var viewStart = parseFloat(this.position[_base]); + var diff1 = Math.max(parentStart - viewStart, 0); + var diff2 = Math.max(viewStart + valNumber - (parentStart + parentValNumber), 0); + val = Math.max(valNumber - diff1 - diff2, 0) + 'px'; } - t.maxDx = 0; - t.maxDy = 0; - t.historyX = [0]; - t.historyY = [0]; - t.historyTime = [e.detail.timeStamp]; - t.listener = n; + position[key] = val; + } - if (n.onTouchStart) { - n.onTouchStart(); + return position; + }, + tags: function tags() { + var position = this._getTagPosition(); + + var style = this.style; + var tags = [{ + tag: 'rect', + position: position, + rectStyles: { + color: style.backgroundColor, + radius: style.borderRadius, + borderColor: style.borderColor, + borderWidth: style.borderWidth } + }]; - event.preventDefault(); + if (this.coverType === 'image') { + tags.push({ + tag: 'img', + position: position, + src: this.coverContent + }); + } else { + var lineSpacing = parseFloat(style.lineHeight) - parseFloat(style.fontSize); + var width = parseFloat(position.width) - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight); + width = width < 0 ? 0 : width; + var height = parseFloat(position.height) - parseFloat(style.paddingTop) - lineSpacing / 2 - parseFloat(style.paddingBottom); + height = height < 0 ? 0 : height; + tags.push({ + tag: 'font', + position: { + top: "".concat(parseFloat(position.top) + parseFloat(style.paddingTop) + lineSpacing / 2, "px"), + left: "".concat(parseFloat(position.left) + parseFloat(style.paddingLeft), "px"), + width: "".concat(width, "px"), + height: "".concat(height, "px") + }, + textStyles: { + align: textAlign[style.textAlign] || style.textAlign, + color: style.color, + decoration: 'none', + lineSpacing: "".concat(lineSpacing, "px"), + margin: '0px', + overflow: style.textOverflow, + size: style.fontSize, + verticalAlign: 'top', + weight: style.fontWeight, + whiteSpace: style.whiteSpace + }, + text: this.coverContent + }); } - }, - _handleTouchMove: function _handleTouchMove(event) { - var touchInfo = this._touchInfo; - if (touchInfo.trackingID !== -1) { - event.preventDefault(); + return tags; + } + }, + created: function created() { + var $parent = this.$parent; - var delta = this._findDelta(event); + while (!$parent.isNative && $parent !== this.$root) { + $parent = $parent.$parent; + } - if (delta) { - for (touchInfo.maxDy = Math.max(touchInfo.maxDy, Math.abs(delta.y)), touchInfo.maxDx = Math.max(touchInfo.maxDx, Math.abs(delta.x)), touchInfo.historyX.push(delta.x), touchInfo.historyY.push(delta.y), touchInfo.historyTime.push(event.detail.timeStamp); touchInfo.historyTime.length > 10;) { - touchInfo.historyTime.shift(); - touchInfo.historyX.shift(); - touchInfo.historyY.shift(); - } + this._nativeParent = $parent; + }, + mounted: function mounted() { + var _this = this; - if (touchInfo.listener && touchInfo.listener.onTouchMove) { - touchInfo.listener.onTouchMove(delta.x, delta.y, event.detail.timeStamp); - } - } - } - }, - _handleTouchEnd: function _handleTouchEnd(event) { - var touchInfo = this._touchInfo; + this._onParentReady(function (parentPosition) { + _this.parentPosition = _this._nativeParent.position || parentPosition; - if (touchInfo.trackingID !== -1) { - event.preventDefault(); + _this._updateStyle(); - var delta = this._findDelta(event); + _this._onCanInsert(); - if (delta) { - var listener = touchInfo.listener; - touchInfo.trackingID = -1; - touchInfo.listener = null; - var r = touchInfo.historyTime.length; - var o = { - x: 0, - y: 0 - }; + _this.$watch('hidden', function (val) { + _this.cover && _this.cover[val ? 'hide' : 'show'](); + }); - if (r > 2) { - for (var a = touchInfo.historyTime.length - 1, s = touchInfo.historyTime[a], l = touchInfo.historyX[a], c = touchInfo.historyY[a]; a > 0;) { - a--; - var u = touchInfo.historyTime[a]; - var d = s - u; + _this.$watch('viewPosition', function (val) { + _this.cover && _this.cover.setStyle(val); + }, { + deep: true + }); - if (d > 30 && d < 50) { - o.x = (l - touchInfo.historyX[a]) / (d / 1e3); - o.y = (c - touchInfo.historyY[a]) / (d / 1e3); - break; - } - } - } + _this.$watch('tags', function () { + var cover = _this.cover; - touchInfo.historyTime = []; - touchInfo.historyX = []; - touchInfo.historyY = []; + if (cover) { + cover.reset(); + cover.draw(_this.tags); + } + }, { + deep: true + }); - if (listener && listener.onTouchEnd) { - listener.onTouchEnd(delta.x, delta.y, o); - } + _this.$on('uni-view-update', _this._requestStyleUpdate); + }); + }, + beforeDestroy: function beforeDestroy() { + if (this._nativeParent.isNative) { + this.cover && this.cover.close(); + delete this.cover; + } + }, + methods: { + _onCanInsert: function _onCanInsert() { + var _this2 = this; + + var cover = this.cover = new plus.nativeObj.View("cover-".concat(Date.now(), "-").concat(index++), this.viewPosition, this.tags); + plus.webview.currentWebview().append(cover); + + if (this.hidden) { + cover.hide(); + } + + cover.addEventListener('click', function () { + _this2.$trigger('click', {}, {}); + }); + }, + _getTagPosition: function _getTagPosition() { + var position = {}; + + for (var key in this.position) { + var val = this.position[key]; + + if (key === 'top' || key === 'left') { + val = Math.min(parseFloat(val) - parseFloat(this.parentPosition[key]), 0) + 'px'; } + + position[key] = val; + } + + return position; + }, + _updateStyle: function _updateStyle() { + var _this3 = this; + + var style = getComputedStyle(this.$el); + base.concat(text, image).forEach(function (key) { + _this3.$set(_this3.style, key, style[key]); + }); + }, + _requestStyleUpdate: function _requestStyleUpdate() { + var _this4 = this; + + if (this._styleUpdateRequest) { + cancelAnimationFrame(this._styleUpdateRequest); } + + this._styleUpdateRequest = requestAnimationFrame(function () { + delete _this4._styleUpdateRequest; + + _this4._updateStyle(); + }); } } }); /***/ }), -/* 65 */ +/* 74 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ getRealPath; }); - -// CONCATENATED MODULE: ./src/core/helpers/get-real-route.js -function getRealRoute(fromRoute, toRoute) { - if (!toRoute) { - toRoute = fromRoute; +// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Friction.js +var Friction = __webpack_require__(71); - if (toRoute.indexOf('/') === 0) { - return toRoute; - } +// EXTERNAL MODULE: ./src/core/view/mixins/scroller/Spring.js +var Spring = __webpack_require__(72); - var pages = getCurrentPages(); +// CONCATENATED MODULE: ./src/core/view/mixins/scroller/Scroll.js - if (pages.length) { - fromRoute = pages[pages.length - 1].$page.route; - } else { - fromRoute = ''; - } - } else { - if (toRoute.indexOf('/') === 0) { - return toRoute; - } - } - if (toRoute.indexOf('./') === 0) { - return getRealRoute(fromRoute, toRoute.substr(2)); - } +function Scroll(extent, friction, spring) { + this._extent = extent; + this._friction = friction || new Friction["a" /* Friction */](0.01); + this._spring = spring || new Spring["a" /* Spring */](1, 90, 20); + this._startTime = 0; + this._springing = false; + this._springOffset = 0; +} - var toRouteArray = toRoute.split('/'); - var toRouteLength = toRouteArray.length; - var i = 0; +Scroll.prototype.snap = function (e, t) { + this._springOffset = 0; + this._springing = true; - for (; i < toRouteLength && toRouteArray[i] === '..'; i++) {// noop - } + this._spring.snap(e); - toRouteArray.splice(0, i); - toRoute = toRouteArray.join('/'); - var fromRouteArray = fromRoute.length > 0 ? fromRoute.split('/') : []; - fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1); - return '/' + fromRouteArray.concat(toRouteArray).join('/'); -} -// CONCATENATED MODULE: ./src/platforms/app-plus/helpers/get-real-path.js + this._spring.setEnd(t); +}; -var SCHEME_RE = /^([a-z-]+:)?\/\//i; -var DATA_RE = /^data:.*,.*/; // 处理 Android 平台解压与非解压模式下获取的路径不一致的情况 +Scroll.prototype.set = function (e, t) { + this._friction.set(e, t); -function handleLocalPath(filePath) { - return plus.io.convertLocalFileSystemURL(filePath).replace(/^\/?apps\//, '/android_asset/apps/').replace(/\/$/, ''); -} + if (e > 0 && t >= 0) { + this._springOffset = 0; + this._springing = true; -var wwwPath; + this._spring.snap(e); -function addBase(filePath) { - if (!wwwPath) { - // 需要时,初始化一次,外部直接初始化,需要等 plusready - wwwPath = 'file://' + handleLocalPath('_www') + '/'; - } + this._spring.setEnd(0); + } else { + if (e < -this._extent && t <= 0) { + this._springOffset = 0; + this._springing = true; - return wwwPath + filePath; -} + this._spring.snap(e); -function getRealPath(filePath) { - if (filePath.indexOf('/') === 0) { - if (filePath.indexOf('//') === 0) { - filePath = 'https:' + filePath; + this._spring.setEnd(-this._extent); } else { - return addBase(filePath.substr(1)); + this._springing = false; } - } // 网络资源或base64 + } + this._startTime = new Date().getTime(); +}; - if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath) || filePath.indexOf('blob:') === 0) { - return filePath; - } // _do=>_doc,_documents,_downloads +Scroll.prototype.x = function (e) { + if (!this._startTime) { + return 0; + } + if (!e) { + e = (new Date().getTime() - this._startTime) / 1e3; + } - if (filePath.indexOf('_www') === 0 || filePath.indexOf('_do') === 0) { - return 'file://' + handleLocalPath(filePath); + if (this._springing) { + return this._spring.x() + this._springOffset; } - var pages = getCurrentPages(); + var t = this._friction.x(e); - if (pages.length) { - return addBase(getRealRoute(pages[pages.length - 1].$page.route, filePath).substr(1)); - } + var n = this.dx(e); - return filePath; -} + if (t > 0 && n >= 0 || t < -this._extent && n <= 0) { + this._springing = true; -/***/ }), -/* 66 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + this._spring.setEnd(0, n); -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return requestComponentObserver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return destroyComponentObserver; }); -/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87); -/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(intersection_observer__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56); + if (t < -this._extent) { + this._springOffset = -this._extent; + } else { + this._springOffset = 0; + } + t = this._spring.x() + this._springOffset; + } + return t; +}; +Scroll.prototype.dx = function (e) { + var t = 0; + t = this._lastTime === e ? this._lastDx : this._springing ? this._spring.dx(e) : this._friction.dx(e); + this._lastTime = e; + this._lastDx = t; + return t; +}; -function getRect(rect) { - return { - bottom: rect.bottom, - height: rect.height, - left: rect.left, - right: rect.right, - top: rect.top, - width: rect.width - }; -} +Scroll.prototype.done = function () { + return this._springing ? this._spring.done() : this._friction.done(); +}; -var intersectionObservers = {}; -function requestComponentObserver(_ref, pageId) { - var reqId = _ref.reqId, - component = _ref.component, - options = _ref.options; - var pages = getCurrentPages(); - var page = pages.find(function (page) { - return page.$page.id === pageId; - }); +Scroll.prototype.setVelocityByEnd = function (e) { + this._friction.setVelocityByEnd(e); +}; - if (!page) { - throw new Error("Not Found\uFF1APage[".concat(pageId, "]")); - } +Scroll.prototype.configuration = function () { + var e = this._friction.configuration(); - var pageVm = page.$vm; - var $el = Object(_util__WEBPACK_IMPORTED_MODULE_2__[/* findElm */ "a"])(component, pageVm); - var root = options.relativeToSelector ? $el.querySelector(options.relativeToSelector) : null; - var intersectionObserver = intersectionObservers[reqId] = new IntersectionObserver(function (entries, observer) { - entries.forEach(function (entrie) { - UniViewJSBridge.publishHandler('onRequestComponentObserver', { - reqId: reqId, - res: { - intersectionRatio: entrie.intersectionRatio, - intersectionRect: getRect(entrie.intersectionRect), - boundingClientRect: getRect(entrie.boundingClientRect), - relativeRect: getRect(entrie.rootBounds), - time: Date.now(), - dataset: Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__[/* normalizeDataset */ "c"])(entrie.target.dataset || {}), - id: entrie.target.id + e.push.apply(e, this._spring.configuration()); + return e; +}; +// CONCATENATED MODULE: ./src/core/view/mixins/scroller/Scroller.js + + +function i(scroll, t, n) { + function i(t, scroll, r, o) { + if (!t || !t.cancelled) { + r(scroll); + var a = scroll.done(); + + if (!a) { + if (!t.cancelled) { + t.id = requestAnimationFrame(i.bind(null, t, scroll, r, o)); } - }, pageVm.$page.id); - }); - }, { - root: root, - rootMargin: options.rootMargin, - threshold: options.thresholds - }); + } - if (options.observeAll) { - intersectionObserver.USE_MUTATION_OBSERVER = true; - Array.prototype.map.call($el.querySelectorAll(options.selector), function (el) { - intersectionObserver.observe(el); - }); - } else { - intersectionObserver.USE_MUTATION_OBSERVER = false; - intersectionObserver.observe($el.querySelector(options.selector)); + if (a && o) { + o(scroll); + } + } } -} -function destroyComponentObserver(_ref2) { - var reqId = _ref2.reqId; - var intersectionObserver = intersectionObservers[reqId]; - if (intersectionObserver) { - intersectionObserver.disconnect(); - UniViewJSBridge.publishHandler('onRequestComponentObserver', { - reqId: reqId, - reqEnd: true - }); + function r(scroll) { + if (scroll && scroll.id) { + cancelAnimationFrame(scroll.id); + } + + if (scroll) { + scroll.cancelled = true; + } } + + var o = { + id: 0, + cancelled: false + }; + i(o, scroll, t, n); + return { + cancel: r.bind(null, o), + model: scroll + }; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -/***/ }), -/* 67 */ -/***/ (function(module, exports) { +function Scroller(element, options) { + options = options || {}; + this._element = element; + this._options = options; + this._enableSnap = options.enableSnap || false; + this._itemSize = options.itemSize || 0; + this._enableX = options.enableX || false; + this._enableY = options.enableY || false; + this._shouldDispatchScrollEvent = !!options.onScroll; -module.exports = ['uni-app', 'uni-tabbar', 'uni-page', 'uni-page-head', 'uni-page-wrapper', 'uni-page-body', 'uni-page-refresh', 'uni-actionsheet', 'uni-modal', 'uni-toast', 'uni-resize-sensor', 'uni-shadow-root', 'uni-ad', 'uni-audio', 'uni-button', 'uni-camera', 'uni-canvas', 'uni-checkbox', 'uni-checkbox-group', 'uni-cover-image', 'uni-cover-view', 'uni-editor', 'uni-form', 'uni-functional-page-navigator', 'uni-icon', 'uni-image', 'uni-input', 'uni-label', 'uni-live-player', 'uni-live-pusher', 'uni-map', 'uni-movable-area', 'uni-movable-view', 'uni-navigator', 'uni-official-account', 'uni-open-data', 'uni-picker', 'uni-picker-view', 'uni-picker-view-column', 'uni-progress', 'uni-radio', 'uni-radio-group', 'uni-rich-text', 'uni-scroll-view', 'uni-slider', 'uni-swiper', 'uni-swiper-item', 'uni-switch', 'uni-text', 'uni-textarea', 'uni-video', 'uni-view', 'uni-web-view']; + if (this._enableX) { + this._extent = (options.scrollWidth || this._element.offsetWidth) - this._element.parentElement.offsetWidth; + this._scrollWidth = options.scrollWidth; + } else { + this._extent = (options.scrollHeight || this._element.offsetHeight) - this._element.parentElement.offsetHeight; + this._scrollHeight = options.scrollHeight; + } -/***/ }), -/* 68 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + this._position = 0; + this._scroll = new Scroll(this._extent, options.friction, options.spring); + this._onTransitionEnd = this.onTransitionEnd.bind(this); + this.updatePosition(); +} -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge, global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); -/* harmony import */ var uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(88); -/* harmony import */ var uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var uni_platform_page_factory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58); -/* harmony import */ var uni_platform_view_framework_page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59); -/* harmony import */ var uni_platform_view_framework_plugins_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84); -/* harmony import */ var _view_api_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["a"]; }); +Scroller.prototype.onTouchStart = function () { + this._startPosition = this._position; + this._lastChangePos = this._startPosition; -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["b"]; }); + if (this._startPosition > 0) { + this._startPosition /= 0.5; + } else { + if (this._startPosition < -this._extent) { + this._startPosition = (this._startPosition + this._extent) / 0.5 - this._extent; + } + } -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["c"]; }); + if (this._animation) { + this._animation.cancel(); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "d", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["d"]; }); + this._scrolling = false; + } -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "e", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["e"]; }); + this.updatePosition(); +}; -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["f"]; }); +Scroller.prototype.onTouchMove = function (x, y) { + var startPosition = this._startPosition; -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["g"]; }); + if (this._enableX) { + startPosition += x; + } else if (this._enableY) { + startPosition += y; + } -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "h", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["h"]; }); + if (startPosition > 0) { + startPosition *= 0.5; + } else if (startPosition < -this._extent) { + startPosition = 0.5 * (startPosition + this._extent) - this._extent; + } + this._position = startPosition; + this.updatePosition(); + this.dispatchScroll(); +}; +Scroller.prototype.onTouchEnd = function (e, r, o) { + var _this = this; + if (this._enableSnap && this._position > -this._extent && this._position < 0) { + if (this._enableY && (Math.abs(r) < this._itemSize && Math.abs(o.y) < 300 || Math.abs(o.y) < 150)) { + this.snap(); + return; + } + if (this._enableX && (Math.abs(e) < this._itemSize && Math.abs(o.x) < 300 || Math.abs(o.x) < 150)) { + this.snap(); + return; + } + } + if (this._enableX) { + this._scroll.set(this._position, o.x); + } else if (this._enableY) { + this._scroll.set(this._position, o.y); + } -global.UniViewJSBridge = { - publishHandler: UniViewJSBridge.publishHandler, - subscribeHandler: UniViewJSBridge.subscribeHandler -}; -global.getCurrentPages = uni_platform_view_framework_page__WEBPACK_IMPORTED_MODULE_3__[/* getCurrentPages */ "a"]; -global.__definePage = uni_platform_page_factory__WEBPACK_IMPORTED_MODULE_2__[/* definePage */ "a"]; -global.Vue = vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]; -vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].use(uni_platform_view_framework_plugins_index__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]); + if (this._enableSnap) { + var s = this._scroll._friction.x(100); -__webpack_require__(152); + var l = s % this._itemSize; + var c = Math.abs(l) > this._itemSize / 2 ? s - (this._itemSize - Math.abs(l)) : s - l; + if (c <= 0 && c >= -this._extent) { + this._scroll.setVelocityByEnd(c); + } + } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4), __webpack_require__(16))) + this._lastTime = Date.now(); + this._lastDelay = 0; + this._scrolling = true; + this._lastChangePos = this._position; + this._lastIdx = Math.floor(Math.abs(this._position / this._itemSize)); + this._animation = i(this._scroll, function () { + var e = Date.now(); + var i = (e - _this._scroll._startTime) / 1e3; -/***/ }), -/* 69 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var r = _this._scroll.x(i); -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); + _this._position = r; -/* harmony default export */ __webpack_exports__["a"] = ({ - props: { - id: { - type: String, - default: '' - } - }, - created: function created() { - var _this = this; + _this.updatePosition(); - this._addListeners(this.id); // 初始化监听 + var o = _this._scroll.dx(i); + if (_this._shouldDispatchScrollEvent && e - _this._lastTime > _this._lastDelay) { + _this.dispatchScroll(); - this.$watch('id', function (newId, oldId) { - // watch id - _this._removeListeners(oldId, true); + _this._lastDelay = Math.abs(2e3 / o); + _this._lastTime = e; + } + }, function () { + if (_this._enableSnap) { + if (c <= 0 && c >= -_this._extent) { + _this._position = c; - _this._addListeners(newId, true); - }); - }, - beforeDestroy: function beforeDestroy() { - // 销毁时移除 - this._removeListeners(this.id); - }, - methods: { - _addListeners: function _addListeners(id, watch) { - var _this2 = this; + _this.updatePosition(); + } - if (watch && !id) { - // id被置空 - return; + if (typeof _this._options.onSnap === 'function') { + _this._options.onSnap(Math.floor(Math.abs(_this._position) / _this._itemSize)); } + } - var listeners = this.$options.listeners; + if (_this._shouldDispatchScrollEvent) { + _this.dispatchScroll(); + } - if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "e"])(listeners)) { - return; - } + _this._scrolling = false; + }); +}; - Object.keys(listeners).forEach(function (name) { - if (watch) { - // watch id - if (name.indexOf('@') !== 0 && name.indexOf('uni-') !== 0) { - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.on("uni-".concat(name, "-").concat(_this2.$page.id, "-").concat(id), _this2[listeners[name]]); - } - } else { - if (name.indexOf('@') === 0) { - /* eslint-disable standard/computed-property-even-spacing */ - _this2.$on("uni-".concat(name.substr(1)), _this2[listeners[name]]); - } else if (name.indexOf('uni-') === 0) { - // 完全限定 +Scroller.prototype.onTransitionEnd = function () { + this._element.style.transition = ''; + this._element.style.webkitTransition = ''; - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.on(name, _this2[listeners[name]]); - } else if (id) { - // scoped + this._element.removeEventListener('transitionend', this._onTransitionEnd); - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.on("uni-".concat(name, "-").concat(_this2.$page.id, "-").concat(id), _this2[listeners[name]]); - } - } - }); - }, - _removeListeners: function _removeListeners(id, watch) { - var _this3 = this; - - if (watch && !id) { - // id之前不存在 - return; - } + this._element.removeEventListener('webkitTransitionEnd', this._onTransitionEnd); - var listeners = this.$options.listeners; + if (this._snapping) { + this._snapping = false; + } - if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "e"])(listeners)) { - return; - } + this.dispatchScroll(); +}; - Object.keys(listeners).forEach(function (name) { - if (watch) { - // watch id - if (name.indexOf('@') !== 0 && name.indexOf('uni-') !== 0) { - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.off("uni-".concat(name, "-").concat(_this3.$page.id, "-").concat(id), _this3[listeners[name]]); - } - } else { - if (name.indexOf('@') === 0) { - /* eslint-disable standard/computed-property-even-spacing */ - _this3.$off("uni-".concat(name.substr(1)), _this3[listeners[name]]); - } else if (name.indexOf('uni-') === 0) { - // 完全限定 +Scroller.prototype.snap = function () { + var e = this._itemSize; + var t = this._position % e; + var i = Math.abs(t) > this._itemSize / 2 ? this._position - (e - Math.abs(t)) : this._position - t; - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.off(name, _this3[listeners[name]]); - } else if (id) { - // scoped + if (this._position !== i) { + this._snapping = true; + this.scrollTo(-i); - /* eslint-disable standard/computed-property-even-spacing */ - UniViewJSBridge.off("uni-".concat(name, "-").concat(_this3.$page.id, "-").concat(id), _this3[listeners[name]]); - } - } - }); + if (typeof this._options.onSnap === 'function') { + this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize)); } } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) +}; -/***/ }), -/* 70 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +Scroller.prototype.scrollTo = function (e, t) { + if (this._animation) { + this._animation.cancel(); -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); + this._scrolling = false; + } -/* harmony default export */ __webpack_exports__["a"] = ({ - // 取消id的定义,某些组件(canvas)内不在props内定义id - // props: { - // id: { - // type: String, - // default: '' - // } - // }, - mounted: function mounted() { - var _this = this; + if (typeof e === 'number') { + this._position = -e; + } - this._toggleListeners('subscribe', this.id); // 初始化监听 + if (this._position < -this._extent) { + this._position = -this._extent; + } else { + if (this._position > 0) { + this._position = 0; + } + } + this._element.style.transition = 'transform ' + (t || 0.2) + 's ease-out'; + this._element.style.webkitTransition = '-webkit-transform ' + (t || 0.2) + 's ease-out'; + this.updatePosition(); - this.$watch('id', function (newId, oldId) { - // watch id - _this._toggleListeners('unsubscribe', oldId, true); + this._element.addEventListener('transitionend', this._onTransitionEnd); - _this._toggleListeners('subscribe', newId, true); - }); - }, - beforeDestroy: function beforeDestroy() { - // 销毁时移除 - this._toggleListeners('unsubscribe', this.id); + this._element.addEventListener('webkitTransitionEnd', this._onTransitionEnd); +}; - if (this._contextId) { - this._toggleListeners('unsubscribe', this._contextId); - } - }, - methods: { - _toggleListeners: function _toggleListeners(type, id, watch) { - if (watch && !id) { - // id被置空 - return; +Scroller.prototype.dispatchScroll = function () { + if (typeof this._options.onScroll === 'function' && Math.round(this._lastPos) !== Math.round(this._position)) { + this._lastPos = this._position; + var e = { + target: { + scrollLeft: this._enableX ? -this._position : 0, + scrollTop: this._enableY ? -this._position : 0, + scrollHeight: this._scrollHeight || this._element.offsetHeight, + scrollWidth: this._scrollWidth || this._element.offsetWidth, + offsetHeight: this._element.parentElement.offsetHeight, + offsetWidth: this._element.parentElement.offsetWidth } + }; - if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "d"])(this._handleSubscribe)) { - return; - } // 纠正VUniVideo等组件命名为Video - + this._options.onScroll(e); + } +}; - UniViewJSBridge[type](this.$page.id + '-' + this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase() + '-' + id, this._handleSubscribe); - }, - _getContextInfo: function _getContextInfo() { - var id = "context-".concat(this._uid); +Scroller.prototype.update = function (e, t, n) { + var i = 0; + var r = this._position; - if (!this._contextId) { - this._toggleListeners('subscribe', id); + if (this._enableX) { + i = this._element.childNodes.length ? (t || this._element.offsetWidth) - this._element.parentElement.offsetWidth : 0; + this._scrollWidth = t; + } else { + i = this._element.childNodes.length ? (t || this._element.offsetHeight) - this._element.parentElement.offsetHeight : 0; + this._scrollHeight = t; + } - this._contextId = id; - } + if (typeof e === 'number') { + this._position = -e; + } - return { - name: this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase(), - id: id, - page: this.$page.id - }; + if (this._position < -i) { + this._position = -i; + } else { + if (this._position > 0) { + this._position = 0; } } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - -/***/ }), -/* 71 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); + this._itemSize = n || this._itemSize; + this.updatePosition(); + if (r !== this._position) { + this.dispatchScroll(); -function hideKeyboard() { - document.activeElement.blur(); -} -/** - * 保证iOS点击输入框外隐藏键盘 - */ + if (typeof this._options.onSnap === 'function') { + this._options.onSnap(Math.floor(Math.abs(this._position) / this._itemSize)); + } + } + this._extent = i; + this._scroll._extent = i; +}; -function iosHideKeyboard() {} +Scroller.prototype.updatePosition = function () { + var transform = ''; -/* harmony default export */ __webpack_exports__["a"] = ({ - name: 'Keyboard', - props: { - cursorSpacing: { - type: [Number, String], - default: 0 - }, - showConfirmBar: { - type: [Boolean, String], - default: 'auto' - }, - adjustPosition: { - type: Boolean, - default: true - } - }, - watch: { - focus: function focus(val) { - if (val) { - this.showSoftKeybord(); - } - } - }, - mounted: function mounted() { - if (this.autoFocus || this.focus) { - this.showSoftKeybord(); + if (this._enableX) { + transform = 'translateX(' + this._position + 'px) translateZ(0)'; + } else { + if (this._enableY) { + transform = 'translateY(' + this._position + 'px) translateZ(0)'; } - }, - beforeDestroy: function beforeDestroy() { - this.onKeyboardHide(); - }, - methods: { - initKeyboard: function initKeyboard(el) { - var _this = this; - - el.addEventListener('focus', function () { - _this.hideKeyboardTemp = function () { - hideKeyboard(); - }; + } - UniViewJSBridge.subscribe('hideKeyboard', _this.hideKeyboardTemp); - document.addEventListener('click', iosHideKeyboard, false); + this._element.style.webkitTransform = transform; + this._element.style.transform = transform; +}; - _this.setSoftinputNavBar(); +Scroller.prototype.isScrolling = function () { + return this._scrolling || this._snapping; +}; +// CONCATENATED MODULE: ./src/core/view/mixins/scroller/index.js - _this.setSoftinputTemporary(); - }); - el.addEventListener('blur', this.onKeyboardHide.bind(this)); +/* harmony default export */ var scroller = __webpack_exports__["a"] = ({ + methods: { + initScroller: function initScroller(element, options) { + this._touchInfo = { + trackingID: -1, + maxDy: 0, + maxDx: 0 + }; + this._scroller = new Scroller(element, options); + this.__handleTouchStart = this._handleTouchStart.bind(this); + this.__handleTouchMove = this._handleTouchMove.bind(this); + this.__handleTouchEnd = this._handleTouchEnd.bind(this); + this._initedScroller = true; }, - showSoftKeybord: function showSoftKeybord() { - Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "g"])(function () { - plus.key.showSoftKeybord(); - }); + _findDelta: function _findDelta(event) { + var touchInfo = this._touchInfo; + return event.detail.state === 'move' || event.detail.state === 'end' ? { + x: event.detail.dx, + y: event.detail.dy + } : { + x: event.screenX - touchInfo.x, + y: event.screenY - touchInfo.y + }; }, - setSoftinputTemporary: function setSoftinputTemporary() { - var _this2 = this; - - Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "g"])(function () { - var currentWebview = plus.webview.currentWebview(); - var style = currentWebview.getStyle() || {}; - - var rect = _this2.$el.getBoundingClientRect(); + _handleTouchStart: function _handleTouchStart(e) { + var t = this._touchInfo; + var n = this._scroller; - currentWebview.setSoftinputTemporary && currentWebview.setSoftinputTemporary({ - mode: style.softinputMode === 'adjustResize' ? 'adjustResize' : _this2.adjustPosition ? 'adjustPan' : 'nothing', - position: { - top: rect.top, - height: rect.height + (Number(_this2.cursorSpacing) || 0) - } - }); - }); - }, - setSoftinputNavBar: function setSoftinputNavBar() { - var _this3 = this; + if (n) { + if (e.detail.state === 'start') { + t.trackingID = 'touch'; + t.x = e.detail.x; + t.y = e.detail.y; + } else { + t.trackingID = 'mouse'; + t.x = e.screenX; + t.y = e.screenY; + } - if (this.showConfirmBar === 'auto') { - delete this.__softinputNavBar; - return; + t.maxDx = 0; + t.maxDy = 0; + t.historyX = [0]; + t.historyY = [0]; + t.historyTime = [e.detail.timeStamp]; + t.listener = n; + + if (n.onTouchStart) { + n.onTouchStart(); + } + + e.preventDefault(); } + }, + _handleTouchMove: function _handleTouchMove(event) { + var touchInfo = this._touchInfo; - Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "g"])(function () { - var currentWebview = plus.webview.currentWebview(); + if (touchInfo.trackingID !== -1) { + event.preventDefault(); - var _ref = currentWebview.getStyle() || {}, - softinputNavBar = _ref.softinputNavBar; + var delta = this._findDelta(event); - var showConfirmBar = softinputNavBar !== 'none'; + if (delta) { + for (touchInfo.maxDy = Math.max(touchInfo.maxDy, Math.abs(delta.y)), touchInfo.maxDx = Math.max(touchInfo.maxDx, Math.abs(delta.x)), touchInfo.historyX.push(delta.x), touchInfo.historyY.push(delta.y), touchInfo.historyTime.push(event.detail.timeStamp); touchInfo.historyTime.length > 10;) { + touchInfo.historyTime.shift(); + touchInfo.historyX.shift(); + touchInfo.historyY.shift(); + } - if (showConfirmBar !== _this3.showConfirmBar) { - _this3.__softinputNavBar = softinputNavBar || 'auto'; - currentWebview.setStyle({ - softinputNavBar: _this3.showConfirmBar ? 'auto' : 'none' - }); - } else { - delete _this3.__softinputNavBar; + if (touchInfo.listener && touchInfo.listener.onTouchMove) { + touchInfo.listener.onTouchMove(delta.x, delta.y, event.detail.timeStamp); + } } - }); - }, - resetSoftinputNavBar: function resetSoftinputNavBar() { - var softinputNavBar = this.__softinputNavBar; - - if (softinputNavBar) { - Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* plusReady */ "g"])(function () { - var currentWebview = plus.webview.currentWebview(); - currentWebview.setStyle({ - softinputNavBar: softinputNavBar - }); - }); } }, - onKeyboardHide: function onKeyboardHide() { - UniViewJSBridge.unsubscribe('hideKeyboard', this.hideKeyboardTemp); - document.removeEventListener('click', iosHideKeyboard, false); - this.resetSoftinputNavBar(); - } - } -}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) + _handleTouchEnd: function _handleTouchEnd(event) { + var touchInfo = this._touchInfo; -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { + if (touchInfo.trackingID !== -1) { + event.preventDefault(); -exports.nextTick = function nextTick(fn) { - var args = Array.prototype.slice.call(arguments); - args.shift(); - setTimeout(function () { - fn.apply(null, args); - }, 0); -}; + var delta = this._findDelta(event); -exports.platform = exports.arch = -exports.execPath = exports.title = 'browser'; -exports.pid = 1; -exports.browser = true; -exports.env = {}; -exports.argv = []; + if (delta) { + var listener = touchInfo.listener; + touchInfo.trackingID = -1; + touchInfo.listener = null; + var r = touchInfo.historyTime.length; + var o = { + x: 0, + y: 0 + }; -exports.binding = function (name) { - throw new Error('No such module. (Possibly not yet loaded)') -}; + if (r > 2) { + for (var a = touchInfo.historyTime.length - 1, s = touchInfo.historyTime[a], l = touchInfo.historyX[a], c = touchInfo.historyY[a]; a > 0;) { + a--; + var u = touchInfo.historyTime[a]; + var d = s - u; -(function () { - var cwd = '/'; - var path; - exports.cwd = function () { return cwd }; - exports.chdir = function (dir) { - if (!path) path = __webpack_require__(121); - cwd = path.resolve(dir, cwd); - }; -})(); + if (d > 30 && d < 50) { + o.x = (l - touchInfo.historyX[a]) / (d / 1e3); + o.y = (c - touchInfo.historyY[a]) / (d / 1e3); + break; + } + } + } -exports.exit = exports.kill = -exports.umask = exports.dlopen = -exports.uptime = exports.memoryUsage = -exports.uvCounters = function() {}; -exports.features = {}; + touchInfo.historyTime = []; + touchInfo.historyX = []; + touchInfo.historyY = []; + if (listener && listener.onTouchEnd) { + listener.onTouchEnd(delta.x, delta.y, o); + } + } + } + } + } +}); /***/ }), -/* 73 */ +/* 75 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return navigateTo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return navigateBack; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return reLaunch; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return redirectTo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return switchTab; }); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ getNavigationBarHeight; }); -function invokeApi(method) { - var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* INVOKE_API */ "b"], { - data: { - method: method, - args: args - }, - options: { - timestamp: Date.now() - } - }); +// CONCATENATED MODULE: ./src/platforms/app-plus/helpers/status-bar.js +function getStatusbarHeight() { + // 横屏时 iOS 获取的状态栏高度错误,进行纠正 + return plus.navigator.isImmersedStatusbar() ? Math.round(plus.os.name === 'iOS' ? plus.navigator.getSafeAreaInsets().top : plus.navigator.getStatusbarHeight()) : 0; } +// EXTERNAL MODULE: ./src/core/helpers/constants.js +var constants = __webpack_require__(17); -function navigateTo(args) { - invokeApi('navigateTo', args); -} -function navigateBack(args) { - invokeApi('navigateBack', args); -} -function reLaunch(args) { - invokeApi('reLaunch', args); -} -function redirectTo(args) { - invokeApi('redirectTo', args); -} -function switchTab(args) { - invokeApi('switchTab', args); +// CONCATENATED MODULE: ./src/platforms/app-plus/view/utils.js + + +function getNavigationBarHeight() { + var webview = plus.webview.currentWebview(); + var style = webview.getStyle(); + style = style && style.titleNView; + + if (style && style.type === 'default') { + return constants["a" /* NAVBAR_HEIGHT */] + getStatusbarHeight(); + } + + return 0; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), -/* 74 */ +/* 76 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export Formatter */ +/* unused harmony export I18n */ +/* unused harmony export LOCALE_EN */ +/* unused harmony export LOCALE_ES */ +/* unused harmony export LOCALE_FR */ +/* unused harmony export LOCALE_ZH_HANS */ +/* unused harmony export LOCALE_ZH_HANT */ +/* unused harmony export compileI18nJsonStr */ +/* unused harmony export hasI18nJson */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initVueI18n; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isI18nStr; }); +/* unused harmony export isString */ +/* unused harmony export normalizeLocale */ +/* unused harmony export parseI18nJson */ +/* unused harmony export resolveLocale */ +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -// EXPORTS -__webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ upx2px; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ api["b" /* navigateTo */]; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ api["a" /* navigateBack */]; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ api["c" /* reLaunch */]; }); -__webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ api["d" /* redirectTo */]; }); -__webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ api["e" /* switchTab */]; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ getSystemInfoSync; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ canIUse; }); +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."); } -// CONCATENATED MODULE: ./src/core/service/api/base/upx2px.js -var EPS = 1e-4; -var BASE_DEVICE_WIDTH = 750; -var isIOS = false; -var deviceWidth = 0; -var deviceDPR = 0; +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function checkDeviceWidth() { - var _uni$getSystemInfoSyn = uni.getSystemInfoSync(), - platform = _uni$getSystemInfoSyn.platform, - pixelRatio = _uni$getSystemInfoSyn.pixelRatio, - windowWidth = _uni$getSystemInfoSyn.windowWidth; +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - deviceWidth = windowWidth; - deviceDPR = pixelRatio; - isIOS = platform === 'ios'; -} +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } -function upx2px(number, newDeviceWidth) { - if (deviceWidth === 0) { - checkDeviceWidth(); - } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - number = Number(number); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (number === 0) { - return 0; - } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - if (result < 0) { - result = -result; +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var isArray = Array.isArray; + +var isObject = function isObject(val) { + return val !== null && _typeof(val) === 'object'; +}; + +var defaultDelimiters = ['{', '}']; + +var BaseFormatter = /*#__PURE__*/function () { + function BaseFormatter() { + _classCallCheck(this, BaseFormatter); + + this._caches = Object.create(null); } - result = Math.floor(result + EPS); + _createClass(BaseFormatter, [{ + key: "interpolate", + value: function interpolate(message, values) { + var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters; - if (result === 0) { - if (deviceDPR === 1 || !isIOS) { - return 1; - } else { - return 0.5; + if (!values) { + return [message]; + } + + var tokens = this._caches[message]; + + if (!tokens) { + tokens = parse(message, delimiters); + this._caches[message] = tokens; + } + + return compile(tokens, values); } - } + }]); - return number < 0 ? -result : result; -} -// EXTERNAL MODULE: ./src/platforms/app-plus/view/api/index.js -var api = __webpack_require__(73); + return BaseFormatter; +}(); -// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-window-offset.js -var get_window_offset = __webpack_require__(10); +var RE_TOKEN_LIST_VALUE = /^(?:\d)+/; +var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; -// EXTERNAL MODULE: ./node_modules/safe-area-insets/out/index.js -var out = __webpack_require__(5); -var out_default = /*#__PURE__*/__webpack_require__.n(out); +function parse(format, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + startDelimiter = _ref2[0], + endDelimiter = _ref2[1]; -// CONCATENATED MODULE: ./src/platforms/h5/service/api/device/get-system-info.js + var tokens = []; + var position = 0; + var text = ''; + while (position < format.length) { + var _char = format[position++]; -var ua = navigator.userAgent; -/** - * 是否安卓设备 - */ + if (_char === startDelimiter) { + if (text) { + tokens.push({ + type: 'text', + value: text + }); + } -var isAndroid = /android/i.test(ua); -/** - * 是否iOS设备 - */ + text = ''; + var sub = ''; + _char = format[position++]; -var get_system_info_isIOS = /iphone|ipad|ipod/i.test(ua); -/** - * 获取系统信息-同步 - */ + while (_char !== undefined && _char !== endDelimiter) { + sub += _char; + _char = format[position++]; + } -function getSystemInfoSync() { - var screen = window.screen; - var pixelRatio = window.devicePixelRatio; - var screenWidth = screen.width; - var screenHeight = screen.height; - var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth); - var windowHeight = window.innerHeight; - var language = navigator.language; - var statusBarHeight = out_default.a.top; - var osname; - var osversion; - var model; - - if (get_system_info_isIOS) { - osname = 'iOS'; - var osversionFind = ua.match(/OS\s([\w_]+)\slike/); - - if (osversionFind) { - osversion = osversionFind[1].replace(/_/g, '.'); - } + var isClosed = _char === endDelimiter; + var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown'; + tokens.push({ + value: sub, + type: type + }); + } // else if (char === '%') { + // // when found rails i18n syntax, skip text capture + // if (format[position] !== '{') { + // text += char + // } + // } + else { + text += _char; + } + } - var modelFind = ua.match(/\(([a-zA-Z]+);/); + text && tokens.push({ + type: 'text', + value: text + }); + return tokens; +} - if (modelFind) { - model = modelFind[1]; - } - } else if (isAndroid) { - osname = 'Android'; // eslint-disable-next-line no-useless-escape +function compile(tokens, values) { + var compiled = []; + var index = 0; + var mode = isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown'; - var _osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/); + if (mode === 'unknown') { + return compiled; + } - if (_osversionFind) { - osversion = _osversionFind[1]; - } + while (index < tokens.length) { + var token = tokens[index]; - var infoFind = ua.match(/\((.+?)\)/); - var infos = infoFind ? infoFind[1].split(';') : ua.split(' '); // eslint-disable-next-line no-useless-escape + switch (token.type) { + case 'text': + compiled.push(token.value); + break; - var otherInfo = [/\bAndroid\b/i, /\bLinux\b/i, /\bU\b/i, /^\s?[a-z][a-z]$/i, /^\s?[a-z][a-z]-[a-z][a-z]$/i, /\bwv\b/i, /\/[\d\.,]+$/, /^\s?[\d\.,]+$/, /\bBrowser\b/i, /\bMobile\b/i]; + case 'list': + compiled.push(values[parseInt(token.value, 10)]); + break; - for (var i = 0; i < infos.length; i++) { - var info = infos[i]; + case 'named': + if (mode === 'named') { + compiled.push(values[token.value]); + } else { + if (true) { + console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!")); + } + } - if (info.indexOf('Build') > 0) { - model = info.split('Build')[0].trim(); break; - } - - var other = void 0; - for (var o = 0; o < otherInfo.length; o++) { - if (otherInfo[o].test(info)) { - other = true; - break; + case 'unknown': + if (true) { + console.warn("Detect 'unknown' type of token!"); } - } - if (!other) { - model = info.trim(); break; - } } - } else { - osname = 'Other'; - osversion = '0'; - } - - var system = "".concat(osname, " ").concat(osversion); - var platform = osname.toLocaleLowerCase(); - var safeArea = { - left: out_default.a.left, - right: windowWidth - out_default.a.right, - top: out_default.a.top, - bottom: windowHeight - out_default.a.bottom, - width: windowWidth - out_default.a.left - out_default.a.right, - height: windowHeight - out_default.a.top - out_default.a.bottom - }; - var _getWindowOffset = Object(get_window_offset["a" /* default */])(), - windowTop = _getWindowOffset.top, - windowBottom = _getWindowOffset.bottom; + index++; + } - windowHeight -= windowTop; - windowHeight -= windowBottom; - return { - windowTop: windowTop, - windowBottom: windowBottom, - windowWidth: windowWidth, - windowHeight: windowHeight, - pixelRatio: pixelRatio, - screenWidth: screenWidth, - screenHeight: screenHeight, - language: language, - statusBarHeight: statusBarHeight, - system: system, - platform: platform, - model: model, - safeArea: safeArea, - safeAreaInsets: { - top: out_default.a.top, - right: out_default.a.right, - bottom: out_default.a.bottom, - left: out_default.a.left - } - }; + return compiled; } -/** - * 获取系统信息-异步 - */ -function getSystemInfo() { - return getSystemInfoSync(); -} -// CONCATENATED MODULE: ./lib/app-plus/view-api.js +var LOCALE_ZH_HANS = 'zh-Hans'; +var LOCALE_ZH_HANT = 'zh-Hant'; +var LOCALE_EN = 'en'; +var LOCALE_FR = 'fr'; +var LOCALE_ES = 'es'; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var hasOwn = function hasOwn(val, key) { + return hasOwnProperty.call(val, key); +}; +var defaultFormatter = new BaseFormatter(); -function canIUse(schema) { - if (schema === 'css.var') { - return window.CSS && window.CSS.supports && window.CSS.supports('--a:0'); - } +function include(str, parts) { + return !!parts.find(function (part) { + return str.indexOf(part) !== -1; + }); +} - return true; +function startsWith(str, parts) { + return parts.find(function (part) { + return str.indexOf(part) === 0; + }); } -/***/ }), -/* 75 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function normalizeLocale(locale, messages) { + if (!locale) { + return; + } -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return requestComponentInfo; }); -/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var uni_platform_helpers_get_window_offset__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56); + locale = locale.trim().replace(/_/g, '-'); + if (messages && messages[locale]) { + return locale; + } + locale = locale.toLowerCase(); + if (locale.indexOf('zh') === 0) { + if (locale.indexOf('-hans') > -1) { + return LOCALE_ZH_HANS; + } -function getRootInfo(fields) { - var info = {}; + if (locale.indexOf('-hant') > -1) { + return LOCALE_ZH_HANT; + } - if (fields.id) { - info.id = ''; - } + if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) { + return LOCALE_ZH_HANT; + } - if (fields.dataset) { - info.dataset = {}; + return LOCALE_ZH_HANS; } - if (fields.rect) { - info.left = 0; - info.right = 0; - info.top = 0; - info.bottom = 0; - } + var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]); - if (fields.size) { - info.width = document.documentElement.clientWidth; - info.height = document.documentElement.clientHeight; + if (lang) { + return lang; } +} - if (fields.scrollOffset) { - info.scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft || 0; - info.scrollTop = document.documentElement.scrollTop || document.body.scrollTop || 0; - } +var I18n = /*#__PURE__*/function () { + function I18n(_ref3) { + var locale = _ref3.locale, + fallbackLocale = _ref3.fallbackLocale, + messages = _ref3.messages, + watcher = _ref3.watcher, + formater = _ref3.formater; - return info; -} + _classCallCheck(this, I18n); -function getNodeInfo(el, fields) { - var info = {}; + this.locale = LOCALE_EN; + this.fallbackLocale = LOCALE_EN; + this.message = {}; + this.messages = {}; + this.watchers = []; - var _getWindowOffset = Object(uni_platform_helpers_get_window_offset__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(), - top = _getWindowOffset.top; + if (fallbackLocale) { + this.fallbackLocale = fallbackLocale; + } - if (fields.id) { - info.id = el.id; - } + this.formater = formater || defaultFormatter; + this.messages = messages || {}; + this.setLocale(locale || LOCALE_EN); - if (fields.dataset) { - info.dataset = Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__[/* normalizeDataset */ "c"])(el.dataset || {}); + if (watcher) { + this.watchLocale(watcher); + } } - if (fields.rect || fields.size) { - var rect = el.getBoundingClientRect(); + _createClass(I18n, [{ + key: "setLocale", + value: function setLocale(locale) { + var _this = this; - if (fields.rect) { - info.left = rect.left; - info.right = rect.right; - info.top = rect.top - top; - info.bottom = rect.bottom - top; + var oldLocale = this.locale; + this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale; + + if (!this.messages[this.locale]) { + // 可能初始化时不存在 + this.messages[this.locale] = {}; + } + + this.message = this.messages[this.locale]; // 仅发生变化时,通知 + + if (oldLocale !== this.locale) { + this.watchers.forEach(function (watcher) { + watcher(_this.locale, oldLocale); + }); + } + } + }, { + key: "getLocale", + value: function getLocale() { + return this.locale; } + }, { + key: "watchLocale", + value: function watchLocale(fn) { + var _this2 = this; - if (fields.size) { - info.width = rect.width; - info.height = rect.height; + var index = this.watchers.push(fn) - 1; + return function () { + _this2.watchers.splice(index, 1); + }; } - } // TODO 组件 props + }, { + key: "add", + value: function add(locale, message) { + var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var curMessages = this.messages[locale]; + + if (curMessages) { + if (override) { + Object.assign(curMessages, message); + } else { + Object.keys(message).forEach(function (key) { + if (!hasOwn(curMessages, key)) { + curMessages[key] = message[key]; + } + }); + } + } else { + this.messages[locale] = message; + } + } + }, { + key: "f", + value: function f(message, values, delimiters) { + return this.formater.interpolate(message, values, delimiters).join(''); + } + }, { + key: "t", + value: function t(key, locale, values) { + var message = this.message; + if (typeof locale === 'string') { + locale = normalizeLocale(locale, this.messages); + locale && (message = this.messages[locale]); + } else { + values = locale; + } - if (fields.properties) { - fields.properties.forEach(function (prop) { - prop = prop.replace(/-([a-z])/g, function (e, t) { - return t.toUpperCase(); - }); // props - }); - } + if (!hasOwn(message, key)) { + console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default.")); + return key; + } - if (fields.scrollOffset) { - if (el.tagName === 'UNI-SCROLL-VIEW' && el.__vue__ && el.__vue__.getScrollPosition) { - Object.assign(info, el.__vue__.getScrollPosition()); - } else { - info.scrollLeft = 0; - info.scrollTop = 0; + return this.formater.interpolate(message[key], values).join(''); } - } + }]); - if (fields.context) { - if (el.__vue__ && el.__vue__._getContextInfo) { - info.context = el.__vue__._getContextInfo(); - } - } + return I18n; +}(); - return info; +function watchAppLocale(appVm, i18n) { + // 需要保证 watch 的触发在组件渲染之前 + if (appVm.$watchLocale) { + // vue2 + appVm.$watchLocale(function (newLocale) { + i18n.setLocale(newLocale); + }); + } else { + appVm.$watch(function () { + return appVm.$locale; + }, function (newLocale) { + i18n.setLocale(newLocale); + }); + } } -function getNodesInfo(pageVm, component, selector, single, fields) { - var $el = Object(_util__WEBPACK_IMPORTED_MODULE_2__[/* findElm */ "a"])(component, pageVm); - - if (!$el || $el && $el.nodeType === 8) { - // Comment - return single ? null : []; - } +function getDefaultLocale() { + if (typeof uni !== 'undefined' && uni.getLocale) { + return uni.getLocale(); + } // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale - if (single) { - var node = $el.matches(selector) ? $el : $el.querySelector(selector); - if (node) { - return getNodeInfo(node, fields); - } + if (typeof global !== 'undefined' && global.getLocale) { + return global.getLocale(); + } - return null; - } else { - var infos = []; - var nodeList = $el.querySelectorAll(selector); + return LOCALE_EN; +} - if (nodeList && nodeList.length) { - infos = [].map.call(nodeList, function (node) { - return getNodeInfo(node, fields); - }); - } +function initVueI18n(locale) { + var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined; + var watcher = arguments.length > 3 ? arguments[3] : undefined; - if ($el.matches(selector)) { - infos.unshift(getNodeInfo($el, fields)); - } + // 兼容旧版本入参 + if (typeof locale !== 'string') { + var _ref4 = [messages, locale]; + locale = _ref4[0]; + messages = _ref4[1]; + } - return infos; + if (typeof locale !== 'string') { + // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined + locale = getDefaultLocale(); } -} -function requestComponentInfo(_ref, pageId) { - var reqId = _ref.reqId, - reqs = _ref.reqs; - var pages = getCurrentPages(); // 跨平台时,View 层也应该实现该方法,举例 App 上,View 层的 getCurrentPages 返回长度为1的当前页面数组 + if (typeof fallbackLocale !== 'string') { + fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN; + } - var page = pages.find(function (page) { - return page.$page.id === pageId; + var i18n = new I18n({ + locale: locale, + fallbackLocale: fallbackLocale, + messages: messages, + watcher: watcher }); - if (!page) { - throw new Error("Not Found\uFF1APage[".concat(pageId, "]")); - } + var _t = function t(key, values) { + if (typeof getApp !== 'function') { + // app view - var pageVm = page.$vm; - var result = []; - reqs.forEach(function (_ref2) { - var component = _ref2.component, - selector = _ref2.selector, - single = _ref2.single, - fields = _ref2.fields; + /* eslint-disable no-func-assign */ + _t = function t(key, values) { + return i18n.t(key, values); + }; + } else { + var isWatchedAppLocale = false; + + _t = function t(key, values) { + var appVm = getApp().$vm; // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化 + // options: { + // type: Array, + // default () { + // return [{ + // icon: 'shop', + // text: t("uni-goods-nav.options.shop"), + // }, { + // icon: 'cart', + // text: t("uni-goods-nav.options.cart") + // }] + // } + // }, + + if (appVm) { + // 触发响应式 + appVm.$locale; + + if (!isWatchedAppLocale) { + isWatchedAppLocale = true; + watchAppLocale(appVm, i18n); + } + } - if (component === 0) { - result.push(getRootInfo(fields)); + return i18n.t(key, values); + }; + } + + return _t(key, values); + }; + + return { + i18n: i18n, + f: function f(message, values, delimiters) { + return i18n.f(message, values, delimiters); + }, + t: function t(key, values) { + return _t(key, values); + }, + add: function add(locale, message) { + var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + return i18n.add(locale, message, override); + }, + watch: function watch(fn) { + return i18n.watchLocale(fn); + }, + getLocale: function getLocale() { + return i18n.getLocale(); + }, + setLocale: function setLocale(newLocale) { + return i18n.setLocale(newLocale); + } + }; +} + +var isString = function isString(val) { + return typeof val === 'string'; +}; + +var formater; + +function hasI18nJson(jsonObj, delimiters) { + if (!formater) { + formater = new BaseFormatter(); + } + + return walkJsonObj(jsonObj, function (jsonObj, key) { + var value = jsonObj[key]; + + if (isString(value)) { + if (isI18nStr(value, delimiters)) { + return true; + } } else { - result.push(getNodesInfo(pageVm, component, selector, single, fields)); + return hasI18nJson(value, delimiters); } }); - UniViewJSBridge.publishHandler('onRequestComponentInfo', { - reqId: reqId, - res: result - }, pageVm.$page.id); } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -/***/ }), -/* 76 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function parseI18nJson(jsonObj, values, delimiters) { + if (!formater) { + formater = new BaseFormatter(); + } -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return loadFontFace; }); -function loadFontFace(_ref) { - var options = _ref.options, - callbackId = _ref.callbackId; - var family = options.family, - source = options.source, - _options$desc = options.desc, - desc = _options$desc === void 0 ? {} : _options$desc; - var fonts = document.fonts; + walkJsonObj(jsonObj, function (jsonObj, key) { + var value = jsonObj[key]; - if (fonts) { - var fontFace = new FontFace(family, source, desc); - fontFace.load().then(function () { - fonts.add(fontFace); - UniViewJSBridge.publishHandler('onLoadFontFaceCallback', { - callbackId: callbackId, - data: { - errMsg: 'loadFontFace:ok' - } - }); - }).catch(function (error) { - UniViewJSBridge.publishHandler('onLoadFontFaceCallback', { - callbackId: callbackId, - data: { - errMsg: "loadFontFace:fail ".concat(error) - } - }); - }); - } else { - var style = document.createElement('style'); - style.innerText = "@font-face{font-family:\"".concat(family, "\";src:").concat(source, ";font-style:").concat(desc.style, ";font-weight:").concat(desc.weight, ";font-stretch:").concat(desc.stretch, ";unicode-range:").concat(desc.unicodeRange, ";font-variant:").concat(desc.variant, ";font-feature-settings:").concat(desc.featureSettings, ";}"); - document.head.appendChild(style); - UniViewJSBridge.publishHandler('onLoadFontFaceCallback', { - callbackId: callbackId, - data: { - errMsg: 'loadFontFace:ok' + if (isString(value)) { + if (isI18nStr(value, delimiters)) { + jsonObj[key] = compileStr(value, values, delimiters); } - }); - } + } else { + parseI18nJson(value, values, delimiters); + } + }); + return jsonObj; } -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -/***/ }), -/* 77 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function compileI18nJsonStr(jsonStr, _ref5) { + var locale = _ref5.locale, + locales = _ref5.locales, + delimiters = _ref5.delimiters; -"use strict"; -/* WEBPACK VAR INJECTION */(function(global, UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initSubscribe; }); -/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); -/* harmony import */ var uni_core_view_bridge_subscribe_scroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3); + if (!isI18nStr(jsonStr, delimiters)) { + return jsonStr; + } + + if (!formater) { + formater = new BaseFormatter(); + } + + var localeValues = []; + Object.keys(locales).forEach(function (name) { + if (name !== locale) { + localeValues.push({ + locale: name, + values: locales[name] + }); + } + }); + localeValues.unshift({ + locale: locale, + values: locales[locale] + }); + try { + return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2); + } catch (e) {} + return jsonStr; +} +function isI18nStr(value, delimiters) { + return value.indexOf(delimiters[0]) > -1; +} -var passiveOptions = uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* supportsPassive */ "h"] ? { - passive: false -} : false; +function compileStr(value, values, delimiters) { + return formater.interpolate(value, values, delimiters).join(''); +} -function onCssVar(_ref) { - var statusbarHeight = _ref.statusbarHeight, - windowTop = _ref.windowTop, - windowBottom = _ref.windowBottom; - global.__WINDOW_TOP = windowTop; - global.__WINDOW_BOTTOM = windowBottom; +function compileValue(jsonObj, key, localeValues, delimiters) { + var value = jsonObj[key]; - if (uni.canIUse('css.var')) { - var style = document.documentElement.style; - style.setProperty('--window-top', windowTop + 'px'); - style.setProperty('--window-bottom', windowBottom + 'px'); - style.setProperty('--status-bar-height', statusbarHeight + 'px'); + if (isString(value)) { + // 存在国际化 + if (isI18nStr(value, delimiters)) { + jsonObj[key] = compileStr(value, localeValues[0].values, delimiters); - if (true) { - console.log("--status-bar-height=".concat(statusbarHeight)); - console.log("--window-top=".concat(windowTop)); - console.log("--window-bottom=".concat(windowBottom)); + if (localeValues.length > 1) { + // 格式化国际化语言 + var valueLocales = jsonObj[key + 'Locales'] = {}; + localeValues.forEach(function (localValue) { + valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters); + }); + } } + } else { + compileJsonObj(value, localeValues, delimiters); } } -function onPageCreate(_ref2, pageId) { - var statusbarHeight = _ref2.statusbarHeight, - windowTop = _ref2.windowTop, - windowBottom = _ref2.windowBottom, - disableScroll = _ref2.disableScroll, - onPageScroll = _ref2.onPageScroll, - onPageReachBottom = _ref2.onPageReachBottom, - onReachBottomDistance = _ref2.onReachBottomDistance; - onCssVar({ - statusbarHeight: statusbarHeight, - windowTop: windowTop, - windowBottom: windowBottom +function compileJsonObj(jsonObj, localeValues, delimiters) { + walkJsonObj(jsonObj, function (jsonObj, key) { + compileValue(jsonObj, key, localeValues, delimiters); }); + return jsonObj; +} - if (disableScroll) { - document.addEventListener('touchmove', uni_core_view_bridge_subscribe_scroll__WEBPACK_IMPORTED_MODULE_1__[/* disableScroll */ "b"], passiveOptions); - } else if (onPageScroll || onPageReachBottom) { - requestAnimationFrame(function () { - // 避免监听太早,直接触发了 scroll - document.addEventListener('scroll', Object(uni_core_view_bridge_subscribe_scroll__WEBPACK_IMPORTED_MODULE_1__[/* createScrollListener */ "a"])(pageId, { - enablePageScroll: onPageScroll, - enablePageReachBottom: onPageReachBottom, - onReachBottomDistance: onReachBottomDistance - })); - }); +function walkJsonObj(jsonObj, walk) { + if (isArray(jsonObj)) { + for (var i = 0; i < jsonObj.length; i++) { + if (walk(jsonObj, i)) { + return true; + } + } + } else if (isObject(jsonObj)) { + for (var key in jsonObj) { + if (walk(jsonObj, key)) { + return true; + } + } } -} -function onWebviewReady() { - // service 主动发起检测 - UniViewJSBridge.publishHandler('webviewReady'); + return false; } -function initSubscribe(subscribe) { - subscribe(_constants__WEBPACK_IMPORTED_MODULE_3__[/* WEBVIEW_READY */ "k"], onWebviewReady); - subscribe(_constants__WEBPACK_IMPORTED_MODULE_2__[/* ON_PAGE_CREATE */ "a"], onPageCreate); -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(16), __webpack_require__(4))) +function resolveLocale(locales) { + return function (locale) { + if (!locale) { + return locale; + } -/***/ }), -/* 78 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + locale = normalizeLocale(locale) || locale; + return resolveLocaleChain(locale).find(function (locale) { + return locales.indexOf(locale) > -1; + }); + }; +} -"use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); -/* harmony import */ var _behaviors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85); -/* harmony import */ var _wxs_component_descriptor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(79); +function resolveLocaleChain(locale) { + var chain = []; + var tokens = locale.split('-'); + while (tokens.length) { + chain.push(tokens.join('-')); + tokens.pop(); + } + return chain; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(19))) -function pageMounted() { - // 通知 Service,View 层已 ready - UniViewJSBridge.publishHandler('onPageReady', {}, this.$page.id); -} -/** - * View 层 Vue 插件 - * 1.init events - * 2.$trigger - * 3.$handleProxy - */ +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - install: function install(Vue) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - routes = _ref.routes; - Object(_events__WEBPACK_IMPORTED_MODULE_1__[/* initEvents */ "a"])(); +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + 2: 'need dictionary', /* Z_NEED_DICT 2 */ + 1: 'stream end', /* Z_STREAM_END 1 */ + 0: '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; - var findUniTarget = function findUniTarget($event, $el) { - var target = $event.target; - for (; target && target !== $el; target = target.parentNode) { - if (target.tagName && target.tagName.indexOf('UNI-') === 0) { - break; - } - } +/***/ }), +/* 78 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - return target; - }; +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return requestComponentObserver; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return destroyComponentObserver; }); +/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(114); +/* harmony import */ var intersection_observer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(intersection_observer__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8); +/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21); - Vue.prototype.$handleEvent = function ($event) { - if ($event instanceof Event) { - // 未处理的 event 对象 需要对 target 校正及包装 - // 查找 uniTarget - var target = findUniTarget($event, this.$el); - $event = _events__WEBPACK_IMPORTED_MODULE_1__[/* processEvent */ "b"].call(this, $event.type, $event, {}, target || $event.target, $event.currentTarget); - } - return $event; - }; - Vue.prototype.$getComponentDescriptor = function (vm, isOwnerInstance) { - return Object(_wxs_component_descriptor__WEBPACK_IMPORTED_MODULE_3__[/* createComponentDescriptor */ "a"])(vm || this, isOwnerInstance); - }; - Vue.prototype.$handleWxsEvent = function ($event) { - if ($event instanceof Event) { - // 未处理的 event 对象 需要对 target 校正及包装 - var currentTarget = $event.currentTarget; +function getRect(rect) { + return { + bottom: rect.bottom, + height: rect.height, + left: rect.left, + right: rect.right, + top: rect.top, + width: rect.width + }; +} // 在相交比很小的情况下,Chrome会返回相交为0 - var instance = currentTarget && currentTarget.__vue__ && currentTarget.__vue__.$getComponentDescriptor(currentTarget.__vue__, false); - $event = _events__WEBPACK_IMPORTED_MODULE_1__[/* processEvent */ "b"].call(this, $event.type, $event, {}, findUniTarget($event, this.$el) || $event.target, $event.currentTarget); - $event.instance = instance; - } +function rectifyIntersectionRatio(entrie) { + var intersectionRatio = entrie.intersectionRatio, + _entrie$boundingClien = entrie.boundingClientRect, + overAllHeight = _entrie$boundingClien.height, + overAllWidth = _entrie$boundingClien.width, + _entrie$intersectionR = entrie.intersectionRect, + intersectionHeight = _entrie$intersectionR.height, + intersectionWidth = _entrie$intersectionR.width; + if (intersectionRatio !== 0) return intersectionRatio; + return intersectionHeight === overAllHeight ? intersectionWidth / overAllWidth : intersectionHeight / overAllHeight; +} - return $event; - }; +var intersectionObservers = {}; +function requestComponentObserver(_ref, pageId) { + var reqId = _ref.reqId, + component = _ref.component, + options = _ref.options; + var pageVm; - Vue.mixin({ - beforeCreate: function beforeCreate() { - var _this = this; + if (pageId._isVue) { + pageVm = pageId; + } else { + var pages = getCurrentPages(); // 跨平台时,View 层也应该实现该方法,举例 App 上,View 层的 getCurrentPages 返回长度为1的当前页面数组 - var options = this.$options; - var wxs = options.wxs; + var page = pages.find(function (page) { + return page.$page.id === pageId; + }); - if (wxs) { - Object.keys(wxs).forEach(function (module) { - _this[module] = wxs[module]; - }); - } + if (!page) { + throw new Error("Not Found\uFF1APage[".concat(pageId, "]")); + } - if (options.behaviors && options.behaviors.length) { - Object(_behaviors__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(options, this); - } + pageVm = page.$vm; + } - if (Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_0__[/* isPage */ "b"])(this)) { - options.mounted = options.mounted ? [].concat(pageMounted, options.mounted) : [pageMounted]; + var $el = Object(_util__WEBPACK_IMPORTED_MODULE_2__[/* findElm */ "b"])(component, pageVm); + var root = options.relativeToSelector ? $el.querySelector(options.relativeToSelector) : null; + var intersectionObserver = intersectionObservers[reqId] = new IntersectionObserver(function (entries, observer) { + entries.forEach(function (entrie) { + UniViewJSBridge.publishHandler('onRequestComponentObserver', { + reqId: reqId, + res: { + intersectionRatio: rectifyIntersectionRatio(entrie), + intersectionRect: getRect(entrie.intersectionRect), + boundingClientRect: getRect(entrie.boundingClientRect), + relativeRect: getRect(entrie.rootBounds), + time: Date.now(), + dataset: Object(uni_helpers_index__WEBPACK_IMPORTED_MODULE_1__[/* getTargetDataset */ "a"])(entrie.target), + id: entrie.target.id } + }); + }); + }, { + root: root, + rootMargin: options.rootMargin, + threshold: options.thresholds + }); + + if (options.observeAll) { + intersectionObserver.USE_MUTATION_OBSERVER = true; + Array.prototype.map.call($el.querySelectorAll(options.selector), function (el) { + if (!el) { + console.warn("Node ".concat(options.selector, " is not found. Intersection observer will not trigger.")); + return; } - }); // TODO 跨平台时,View 层需要注入$page属性 + + intersectionObserver.observe(el); + }); + } else { + intersectionObserver.USE_MUTATION_OBSERVER = false; + var el = $el.querySelector(options.selector); + + if (!el) { + console.warn("Node ".concat(options.selector, " is not found. Intersection observer will not trigger.")); + return; + } + + intersectionObserver.observe(el); } -}); +} +function destroyComponentObserver(_ref2) { + var reqId = _ref2.reqId; + var intersectionObserver = intersectionObservers[reqId]; + + if (intersectionObserver) { + intersectionObserver.disconnect(); + delete intersectionObservers[reqId]; + UniViewJSBridge.publishHandler('onRequestComponentObserver', { + reqId: reqId, + reqEnd: true + }); + } +} /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), @@ -15613,3551 +16361,12085 @@ function pageMounted() { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createComponentDescriptor; }); -/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return requestMediaQueryObserver; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return destroyMediaQueryObserver; }); +var mediaQueryObservers = {}; +var listeners = {}; // 用公用对象存储监听器 +// 拼接媒体查询条件 -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +function handleMediaQueryStr($props) { + var mediaQueryStr = []; + var propsMenu = ['width', 'minWidth', 'maxWidth', 'height', 'minHeight', 'maxHeight', 'orientation']; -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + for (var _i = 0, _propsMenu = propsMenu; _i < _propsMenu.length; _i++) { + var item = _propsMenu[_i]; + if (item !== 'orientation' && $props[item] !== '' && Number($props[item]) >= 0) { + mediaQueryStr.push("(".concat(humpToLine(item), ": ").concat(Number($props[item]), "px)")); + } -var CLASS_RE = /^\s+|\s+$/g; -var WXS_CLASS_RE = /\s+/; + if (item === 'orientation' && $props[item]) { + mediaQueryStr.push("(".concat(humpToLine(item), ": ").concat($props[item], ")")); + } + } -function getWxsClsArr(clsArr, classList, isAdd) { - var wxsClsArr = []; + mediaQueryStr = mediaQueryStr.join(' and '); + return mediaQueryStr; +} - var _checkClassList = function checkClassList(cls) { - if (isAdd) { - _checkClassList = function checkClassList(cls) { - return !classList.contains(cls); - }; - } else { - _checkClassList = function checkClassList(cls) { - return classList.contains(cls); - }; - } +function humpToLine(name) { + return name.replace(/([A-Z])/g, '-$1').toLowerCase(); +} // 请求媒体查询对象 - return _checkClassList(cls); + +function requestMediaQueryObserver(_ref) { + var reqId = _ref.reqId, + options = _ref.options; + // 创建一个媒体查询对象 + var mediaQueryObserver = mediaQueryObservers[reqId] = window.matchMedia(handleMediaQueryStr(options)); // 创建一个监听器 + + var listener = listeners[reqId] = function (e) { + UniViewJSBridge.publishHandler('onRequestMediaQueryObserver', { + reqId: reqId, + res: e.matches + }); }; - clsArr.forEach(function (cls) { - cls = cls.replace(CLASS_RE, ''); - _checkClassList(cls) && wxsClsArr.push(cls); - }); - return wxsClsArr; + listener(mediaQueryObserver); // 监听前执行一次媒体查询 + + mediaQueryObserver.addListener(listener); +} // 销毁媒体查询对象 + +function destroyMediaQueryObserver(_ref2) { + var reqId = _ref2.reqId; + var listener = listeners[reqId]; // 需要移除的某个监听 + + var mediaQueryObserver = mediaQueryObservers[reqId]; + + if (mediaQueryObserver) { + mediaQueryObserver.removeListener(listener); // 移除监听 + + delete mediaQueryObservers[reqId]; + UniViewJSBridge.publishHandler('onRequestMediaQueryObserver', { + reqId: reqId, + reqEnd: true + }); + } } +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) -function parseStyleText(cssText) { - var res = {}; - var listDelimiter = /;(?![^(]*\))/g; - var propertyDelimiter = /:(.+)/; - cssText.split(listDelimiter).forEach(function (item) { - if (item) { - var tmp = item.split(propertyDelimiter); - tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); +/***/ }), +/* 80 */ +/***/ (function(module, exports) { + +module.exports = ['uni-app', 'uni-layout', 'uni-content', 'uni-main', 'uni-top-window', 'uni-left-window', 'uni-right-window', 'uni-tabbar', 'uni-page', 'uni-page-head', 'uni-page-wrapper', 'uni-page-body', 'uni-page-refresh', 'uni-actionsheet', 'uni-modal', 'uni-toast', 'uni-resize-sensor', 'uni-shadow-root', 'uni-ad', 'uni-audio', 'uni-button', 'uni-camera', 'uni-canvas', 'uni-checkbox', 'uni-checkbox-group', 'uni-cover-image', 'uni-cover-view', 'uni-editor', 'uni-form', 'uni-functional-page-navigator', 'uni-icon', 'uni-image', 'uni-input', 'uni-label', 'uni-live-player', 'uni-live-pusher', 'uni-map', 'uni-movable-area', 'uni-movable-view', 'uni-navigator', 'uni-official-account', 'uni-open-data', 'uni-picker', 'uni-picker-view', 'uni-picker-view-column', 'uni-progress', 'uni-radio', 'uni-radio-group', 'uni-rich-text', 'uni-scroll-view', 'uni-slider', 'uni-swiper', 'uni-swiper-item', 'uni-switch', 'uni-text', 'uni-textarea', 'uni-video', 'uni-view', 'uni-web-view']; + +/***/ }), +/* 81 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return generateId; }); +/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); + +function generateId(vm, parent, version) { + if (!vm.$parent) { + return '-1'; + } + + var vnode = vm.$vnode; + var context = vnode.context; + var id = vnode.data.attrs._i; + + if (version && Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* hasOwn */ "e"])(vnode.data, 'key')) { + // 补充 key 值 + id = id + ';' + vnode.data.key; + } // slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突 + + + if (context && context !== parent && context._$id) { + if (true) { + console.log('generateId:' + context._$id + ';' + parent._$id + ',' + id); } - }); - return res; + + return context._$id + ';' + parent._$id + ',' + id; + } + + return parent._$id + ',' + id; } -var ComponentDescriptor = /*#__PURE__*/function () { - function ComponentDescriptor(vm) { - _classCallCheck(this, ComponentDescriptor); +/***/ }), +/* 82 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - this.$vm = vm; - this.$el = vm.$el; +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return loadScript; }); +var scripts = {}; +function loadScript(globalName, src, callback) { + var globalObject = typeof globalName === 'string' ? window[globalName] : globalName; + + if (globalObject) { + callback(); + return; } - _createClass(ComponentDescriptor, [{ - key: "selectComponent", - value: function selectComponent(selector) { - if (!this.$el || !selector) { - return; - } + var callbacks = scripts[src]; - var el = this.$el.querySelector(selector); - return el && el.__vue__ && createComponentDescriptor(el.__vue__, false); - } - }, { - key: "selectAllComponents", - value: function selectAllComponents(selector) { - if (!this.$el || !selector) { - return []; - } + if (!callbacks) { + callbacks = scripts[src] = []; + var script = document.createElement('script'); + script.src = src; + document.body.appendChild(script); - var descriptors = []; - var els = this.$el.querySelectorAll(selector); + script.onload = function () { + callbacks.forEach(function (callback) { + return callback(); + }); + delete scripts[src]; + }; + } - for (var i = 0; i < els.length; i++) { - var el = els[i]; - el.__vue__ && descriptors.push(createComponentDescriptor(el.__vue__, false)); - } + callbacks.push(callback); +} - return descriptors; - } - }, { - key: "setStyle", - value: function setStyle(style) { - if (!this.$el || !style) { - return this; - } +/***/ }), +/* 83 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (typeof style === 'string') { - style = parseStyleText(style); - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge, global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9); +/* harmony import */ var uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(115); +/* harmony import */ var uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(uni_platform_view_index_css__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var uni_platform_page_factory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68); +/* harmony import */ var uni_platform_view_framework_page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69); +/* harmony import */ var uni_platform_view_framework_plugins_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(111); +/* harmony import */ var _view_api_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(95); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["a"]; }); - if (Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "e"])(style)) { - this.$el.__wxsStyle = style; - this.$vm.$forceUpdate(); - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["b"]; }); - return this; - } - }, { - key: "addClass", - value: function addClass() { - for (var _len = arguments.length, clsArr = new Array(_len), _key = 0; _key < _len; _key++) { - clsArr[_key] = arguments[_key]; - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["c"]; }); - if (!this.$el || !clsArr.length) { - return this; - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "d", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["d"]; }); - var wxsClsArr = getWxsClsArr(clsArr, this.$el.classList, true); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "e", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["e"]; }); - if (wxsClsArr.length) { - var wxsClass = this.$el.__wxsAddClass || ''; - this.$el.__wxsAddClass = wxsClass + (wxsClass ? ' ' : '') + wxsClsArr.join(' '); - this.$vm.$forceUpdate(); - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["f"]; }); - return this; - } - }, { - key: "removeClass", - value: function removeClass() { - for (var _len2 = arguments.length, clsArr = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - clsArr[_key2] = arguments[_key2]; - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["g"]; }); - if (!this.$el || !clsArr.length) { - return this; - } +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "h", function() { return _view_api_js__WEBPACK_IMPORTED_MODULE_5__["h"]; }); - var classList = this.$el.classList; - var addWxsClsArr = this.$el.__wxsAddClass ? this.$el.__wxsAddClass.split(WXS_CLASS_RE) : []; - var wxsClsArr = getWxsClsArr(clsArr, classList, false); - if (wxsClsArr.length) { - var removeWxsClsArr = []; - wxsClsArr.forEach(function (cls) { - var clsIndex = addWxsClsArr.findIndex(function (oldCls) { - return oldCls === cls; - }); - if (clsIndex !== -1) { - // 在 addWxsClass 中 - addWxsClsArr.splice(clsIndex, 1); - } - removeWxsClsArr.push(cls); - }); - this.$el.__wxsRemoveClass = removeWxsClsArr; - this.$el.__wxsAddClass = addWxsClsArr.join(' '); - this.$vm.$forceUpdate(); - } - return this; - } - }, { - key: "hasClass", - value: function hasClass(cls) { - return this.$el && this.$el.classList.contains(cls); - } - }, { - key: "getDataset", - value: function getDataset() { - return this.$el && this.$el.dataset; - } - }, { - key: "callMethod", - value: function callMethod(funcName) { - var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (this.$vm[funcName]) { - this.$vm[funcName](JSON.parse(JSON.stringify(args))); - } else if (this.$vm._$id) { - UniViewJSBridge.publishHandler('onWxsInvokeCallMethod', { - cid: this.$vm._$id, - method: funcName, - args: args - }); - } - } - }, { - key: "requestAnimationFrame", - value: function requestAnimationFrame(callback) { - return global.requestAnimationFrame(callback), this; - } - }, { - key: "getState", - value: function getState() { - return this.$el && (this.$el.__wxsState || (this.$el.__wxsState = {})); - } - }, { - key: "triggerEvent", - value: function triggerEvent(eventName) { - var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - // TODO options - return this.$vm.$emit(eventName, detail), this; - } - }]); - - return ComponentDescriptor; -}(); - -function createComponentDescriptor(vm) { - var isOwnerInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; +global.UniViewJSBridge = { + subscribe: UniViewJSBridge.subscribe, + publishHandler: UniViewJSBridge.publishHandler, + subscribeHandler: UniViewJSBridge.subscribeHandler +}; +global.getCurrentPages = uni_platform_view_framework_page__WEBPACK_IMPORTED_MODULE_3__[/* getCurrentPages */ "a"]; +global.__definePage = uni_platform_page_factory__WEBPACK_IMPORTED_MODULE_2__[/* definePage */ "a"]; +global.Vue = vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]; +vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].use(uni_platform_view_framework_plugins_index__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]); - if (isOwnerInstance && vm && vm.$options.name && vm.$options.name.indexOf('VUni') === 0) { - // ownerInstance 内置组件需要使用父 vm - vm = vm.$parent; - } +__webpack_require__(191); - if (vm && vm.$el) { - if (!vm.$el.__wxsComponentDescriptor) { - vm.$el.__wxsComponentDescriptor = new ComponentDescriptor(vm); - } - return vm.$el.__wxsComponentDescriptor; - } -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4), __webpack_require__(16))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4), __webpack_require__(19))) /***/ }), -/* 80 */ +/* 84 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VDomSync; }); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); -/* harmony import */ var _helpers_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/* harmony default export */ __webpack_exports__["a"] = ({ + props: { + id: { + type: String, + default: '' + } + }, + created: function created() { + var _this = this; -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + this._addListeners(this.id); // 初始化监听 + this.$watch('id', function (newId, oldId) { + // watch id + _this._removeListeners(oldId, true); + _this._addListeners(newId, true); + }); + }, + beforeDestroy: function beforeDestroy() { + // 销毁时移除 + this._removeListeners(this.id); + }, + methods: { + _addListeners: function _addListeners(id, watch) { + var _this2 = this; -function findParent(vm) { - var parent = vm.$parent; + if (watch && !id) { + // id被置空 + return; + } - while (parent) { - if (parent._$id) { - return parent; - } + var listeners = this.$options.listeners; - parent = parent.$parent; - } -} + if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "g"])(listeners)) { + return; + } -var VDomSync = /*#__PURE__*/function () { - function VDomSync(pageId) { - _classCallCheck(this, VDomSync); + Object.keys(listeners).forEach(function (name) { + if (watch) { + // watch id + if (name.indexOf('@') !== 0 && name.indexOf('uni-') !== 0) { + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.on("uni-".concat(name, "-").concat(_this2.$page.id, "-").concat(id), _this2[listeners[name]]); + } + } else { + if (name.indexOf('@') === 0) { + /* eslint-disable standard/computed-property-even-spacing */ + _this2.$on("uni-".concat(name.substr(1)), _this2[listeners[name]]); + } else if (name.indexOf('uni-') === 0) { + // 完全限定 - this.pageId = pageId; - this.addBatchVData = Object.create(null); - this.updateBatchVData = []; - this.vms = Object.create(null); - } + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.on(name, _this2[listeners[name]]); + } else if (id) { + // scoped - _createClass(VDomSync, [{ - key: "addVData", - value: function addVData(cid) { - var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - this.addBatchVData[cid] = [data, options]; - } - }, { - key: "updateVData", - value: function updateVData(cid) { - var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - this.updateBatchVData.push([cid, data]); - } - }, { - key: "initVm", - value: function initVm(vm) { - vm._$id = Object(_helpers_util__WEBPACK_IMPORTED_MODULE_1__[/* generateId */ "a"])(vm, findParent(vm)); - var vData = this.addBatchVData[vm._$id]; + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.on("uni-".concat(name, "-").concat(_this2.$page.id, "-").concat(id), _this2[listeners[name]]); + } + } + }); + }, + _removeListeners: function _removeListeners(id, watch) { + var _this3 = this; - if (!vData) { - console.error('cid unmatched', vm); - vData = { - data: {}, - options: {} - }; - } else { - delete this.addBatchVData[vm._$id]; + if (watch && !id) { + // id之前不存在 + return; } - var _vData = vData, - _vData2 = _slicedToArray(_vData, 2), - data = _vData2[0], - options = _vData2[1]; + var listeners = this.$options.listeners; - Object.assign(vm.$options, options); - vm.$r = data || Object.create(null); - this.vms[vm._$id] = vm; - } - }, { - key: "sendUIEvent", - value: function sendUIEvent(cid, nid, event) { - UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* VD_SYNC */ "h"], { - data: [[_constants__WEBPACK_IMPORTED_MODULE_0__[/* UI_EVENT */ "f"], [[cid, nid, event]]]], - options: { - timestamp: Date.now() - } - }); - } - }, { - key: "clearAddBatchVData", - value: function clearAddBatchVData() { - if (true) { - if (Object.keys(this.addBatchVData).length) { - console.error('this.addBatchVData...=' + JSON.stringify(this.addBatchVData)); - } + if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isPlainObject */ "g"])(listeners)) { + return; } - this.addBatchVData = Object.create(null); - } - }, { - key: "flush", - value: function flush() { - var _this = this; - - this.updateBatchVData.forEach(function (_ref) { - var _ref2 = _slicedToArray(_ref, 2), - cid = _ref2[0], - data = _ref2[1]; + Object.keys(listeners).forEach(function (name) { + if (watch) { + // watch id + if (name.indexOf('@') !== 0 && name.indexOf('uni-') !== 0) { + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.off("uni-".concat(name, "-").concat(_this3.$page.id, "-").concat(id), _this3[listeners[name]]); + } + } else { + if (name.indexOf('@') === 0) { + /* eslint-disable standard/computed-property-even-spacing */ + _this3.$off("uni-".concat(name.substr(1)), _this3[listeners[name]]); + } else if (name.indexOf('uni-') === 0) { + // 完全限定 - var vm = _this.vms[cid]; + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.off(name, _this3[listeners[name]]); + } else if (id) { + // scoped - if (!vm) { - return console.error("Not found ".concat(cid)); + /* eslint-disable standard/computed-property-even-spacing */ + UniViewJSBridge.off("uni-".concat(name, "-").concat(_this3.$page.id, "-").concat(id), _this3[listeners[name]]); + } } - - Object.keys(data).forEach(function (cid) { - Object.assign(vm.$r[cid] || (vm.$r[cid] = Object.create(null)), data[cid]); - }); - vm.$forceUpdate(); }); - this.updateBatchVData.length = 0; } - }]); - - return VDomSync; -}(); + } +}); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), -/* 81 */ +/* 85 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return generateId; }); -function generateId(vm, parent) { - if (!vm.$parent) { - return '-1'; - } +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - var vnode = vm.$vnode; - var context = vnode.context; // slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突 +/* harmony default export */ __webpack_exports__["a"] = ({ + // 取消id的定义,某些组件(canvas)内不在props内定义id + // props: { + // id: { + // type: String, + // default: '' + // } + // }, + mounted: function mounted() { + var _this = this; - if (context && context !== parent && context._$id) { - if (true) { - console.log('generateId:' + context._$id + ';' + parent._$id + ',' + vnode.data.attrs._i); - } - - return context._$id + ';' + parent._$id + ',' + vnode.data.attrs._i; - } - - return parent._$id + ',' + vnode.data.attrs._i; -} - -/***/ }), -/* 82 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + this._toggleListeners('subscribe', this.id); // 初始化监听 -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return showPage; }); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + this.$watch('id', function (newId, oldId) { + // watch id + _this._toggleListeners('unsubscribe', oldId, true); -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + _this._toggleListeners('subscribe', newId, true); + }); + }, + beforeDestroy: function beforeDestroy() { + // 销毁时移除 + this._toggleListeners('unsubscribe', this.id); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + if (this._contextId) { + this._toggleListeners('unsubscribe', this._contextId); + } + }, + methods: { + _toggleListeners: function _toggleListeners(type, id, watch) { + if (watch && !id) { + // id被置空 + return; + } -var plus_; -var weex_; -var BroadcastChannel_; + if (!Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* isFn */ "f"])(this._handleSubscribe)) { + return; + } // 纠正VUniVideo等组件命名为Video -function getRuntime() { - return (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' ? 'webview' : 'v8'; -} -function getPageId() { - return plus_.webview.currentWebview().id; -} + UniViewJSBridge[type](this.$page.id + '-' + this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase() + '-' + id, this._handleSubscribe); + }, + _getContextInfo: function _getContextInfo() { + var id = "context-".concat(this._uid); -var channel; -var globalEvent; -var callbacks = {}; + if (!this._contextId) { + this._toggleListeners('subscribe', id); -function onPlusMessage(res) { - var message = res.data && res.data.__message; + this._contextId = id; + } - if (!message || !message.__page) { - return; + return { + name: this.$options.name.replace(/VUni([A-Z])/, '$1').toLowerCase(), + id: id, + page: this.$page.id + }; + } } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - var pageId = message.__page; - var callback = callbacks[pageId]; - callback && callback(message); +/***/ }), +/* 86 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (!message.keep) { - delete callbacks[pageId]; - } -} +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony import */ var uni_shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); +/* harmony import */ var _keyboard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25); +/* harmony import */ var _interact__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26); -function addEventListener(pageId, callback) { - if (getRuntime() === 'v8') { - if (BroadcastChannel_) { - channel && channel.close(); - channel = new BroadcastChannel_(getPageId()); - channel.onmessage = onPlusMessage; - } else if (!globalEvent) { - globalEvent = weex_.requireModule('globalEvent'); - globalEvent.addEventListener('plusMessage', onPlusMessage); - } - } else { - window.__plusMessage = onPlusMessage; - } - callbacks[pageId] = callback; -} -var Page = /*#__PURE__*/function () { - function Page(webview) { - _classCallCheck(this, Page); - this.webview = webview; +UniViewJSBridge.subscribe('getSelectedTextRange', function (_ref) { + var pageId = _ref.pageId, + callbackId = _ref.callbackId; + var activeElement = document.activeElement; + var tagName = activeElement.tagName.toLowerCase(); + var tagNames = ['input', 'textarea']; + var data = {}; + + if (tagNames.includes(tagName)) { + data.errMsg = 'getSelectedTextRange:ok'; + data.start = activeElement.selectionStart; + data.end = activeElement.selectionEnd; + } else { + data.errMsg = 'getSelectedTextRange:fail no focused'; } - _createClass(Page, [{ - key: "sendMessage", - value: function sendMessage(data) { - var message = { - __message: { - data: data - } - }; - var id = this.webview.id; + UniViewJSBridge.publishHandler('onGetSelectedTextRange', { + callbackId: callbackId, + data: data + }, pageId); +}); // App 延迟获取焦点 - if (BroadcastChannel_) { - var _channel = new BroadcastChannel_(id); +var FOCUS_DELAY = 200; +var startTime; +/* harmony default export */ __webpack_exports__["a"] = ({ + name: 'Field', + mixins: [_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], _keyboard__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"], _interact__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"]], + model: { + prop: 'value', + event: 'update:value' + }, + props: { + value: { + type: [String, Number], + default: '' + }, - _channel.postMessage(message); + /** + * 已废弃属性,用于历史兼容 + */ + autoFocus: { + type: [Boolean, String], + default: false + }, + focus: { + type: [Boolean, String], + default: false + }, + cursor: { + type: [Number, String], + default: -1 + }, + selectionStart: { + type: [Number, String], + default: -1 + }, + selectionEnd: { + type: [Number, String], + default: -1 + } + }, + data: function data() { + return { + composing: false, + valueSync: this._getValueString(this.value), + focusSync: this.focus, + // Safari 14 以上修正禁用状态颜色 + fixColor: String(navigator.vendor).indexOf('Apple') === 0 && CSS.supports('image-orientation:from-image') + }; + }, + watch: { + focus: function focus(val) { + if (val) { + this._focus(); } else { - plus_.webview.postMessageToUniNView(message, id); + this._blur(); } + }, + focusSync: function focusSync(val) { + this.$emit('update:focus', val); + }, + cursorNumber: function cursorNumber() { + this._checkCursor(); + }, + selectionStartNumber: function selectionStartNumber() { + this._checkSelection(); + }, + selectionEndNumber: function selectionEndNumber() { + this._checkSelection(); } - }, { - key: "close", - value: function close() { - this.webview.close(); + }, + computed: { + needFocus: function needFocus() { + return this.autoFocus || this.focus; + }, + cursorNumber: function cursorNumber() { + var cursor = Number(this.cursor); + return isNaN(cursor) ? -1 : cursor; + }, + selectionStartNumber: function selectionStartNumber() { + var selectionStart = Number(this.selectionStart); + return isNaN(selectionStart) ? -1 : selectionStart; + }, + selectionEndNumber: function selectionEndNumber() { + var selectionEnd = Number(this.selectionEnd); + return isNaN(selectionEnd) ? -1 : selectionEnd; } - }]); + }, + created: function created() { + var _this = this; - return Page; -}(); + var valueChange = this.__valueChange = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* debounce */ "c"])(function (val) { + _this.valueSync = _this._getValueString(val); + }, 100); + this.$watch('value', valueChange); + this.__triggerInput = Object(uni_shared__WEBPACK_IMPORTED_MODULE_0__[/* throttle */ "l"])(function ($event, detail) { + _this.__valueChange.cancel(); -function showPage(_ref) { - var _ref$context = _ref.context, - context = _ref$context === void 0 ? {} : _ref$context, - url = _ref.url, - _ref$data = _ref.data, - data = _ref$data === void 0 ? {} : _ref$data, - _ref$style = _ref.style, - style = _ref$style === void 0 ? {} : _ref$style, - onMessage = _ref.onMessage, - onClose = _ref.onClose; - // eslint-disable-next-line - plus_ = context.plus || plus; // eslint-disable-next-line + _this.$emit('update:value', detail.value); - weex_ = context.weex || ((typeof weex === "undefined" ? "undefined" : _typeof(weex)) === 'object' ? weex : null); // eslint-disable-next-line + _this.$trigger('input', $event, detail); + }, 100); - BroadcastChannel_ = context.BroadcastChannel || ((typeof BroadcastChannel === "undefined" ? "undefined" : _typeof(BroadcastChannel)) === 'object' ? BroadcastChannel : null); - var titleNView = { - autoBackButton: true, - titleSize: '17px' - }; - var pageId = "page".concat(Date.now()); - style = Object.assign({}, style); + this.$triggerInput = function ($event, detail, force) { + _this.__valueChange.cancel(); - if (style.titleNView !== false && style.titleNView !== 'none') { - style.titleNView = Object.assign(titleNView, style.titleNView); - } + _this.__triggerInput($event, detail); - var defaultStyle = { - top: 0, - bottom: 0, - usingComponents: {}, - popGesture: 'close', - scrollIndicator: 'none', - animationType: 'pop-in', - animationDuration: 200, - uniNView: { - path: "".concat((typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && Object({"NODE_ENV":"development","BASE_URL":"/"}) && Object({"NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_TEMPLATE_PATH || '', "/").concat(url, ".js"), - defaultFontSize: plus_.screen.resolutionWidth / 20, - viewport: plus_.screen.resolutionWidth - } - }; - style = Object.assign(defaultStyle, style); - var page = plus_.webview.create('', pageId, style, { - extras: { - from: getPageId(), - runtime: getRuntime(), - data: data, - useGlobalEvent: !BroadcastChannel_ - } - }); - page.addEventListener('close', onClose); - addEventListener(pageId, function (message) { - if (typeof onMessage === 'function') { - onMessage(message.data); - } + if (force) { + _this.__triggerInput.flush(); + } + }; + }, + beforeDestroy: function beforeDestroy() { + this.__valueChange.cancel(); - if (!message.keep) { - page.close('auto'); + this.__triggerInput.cancel(); + }, + directives: { + field: { + inserted: function inserted(el, binding, vnode) { + vnode.context._initField(el); + } } - }); - page.show(style.animationType, style.animationDuration); - return new Page(page); -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(72))) - -/***/ }), -/* 83 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + }, + methods: { + _getValueString: function _getValueString(value) { + return value === null ? '' : String(value); + }, + _initField: function _initField(el) { + var _this2 = this; -"use strict"; + this._field = el; + startTime = startTime || Date.now(); -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ register; }); + if (this.needFocus) { + setTimeout(function () { + _this2._focus(); + }); + } + }, + _focus: function _focus() { + if (!this.needFocus) { + return; + } -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/divider.js -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + var field = this._field; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + if (!field || true && !window.plus) { + setTimeout(this._focus.bind(this), 100); + return; + } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + if (false) {} else { + var timeout = FOCUS_DELAY - (Date.now() - startTime); -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + if (timeout > 0) { + setTimeout(this._focus.bind(this), timeout); + return; + } -function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + field.focus(); // 无用户交互的 webview 需主动显示键盘(安卓) -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + if (!this.userInteract) { + plus.key.showSoftKeybord(); + } + } + }, + _blur: function _blur() { + var field = this._field; + field && field.blur(); + }, + _onFocus: function _onFocus($event) { + this.focusSync = true; + this.$trigger('focus', $event, { + value: this.valueSync + }); // 从 watch:focusSync 中移出到这里。在watcher中如果focus初始值为ture,则不会执行以下逻辑 -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + this._checkSelection(); -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + this._checkCursor(); + }, + _onBlur: function _onBlur($event) { + // iOS 输入法 compositionend 事件可能晚于 blur + if (this.composing) { + this.composing = false; -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + this._onInput($event, true); + } -/* harmony default export */ var divider = (function (Quill) { - var BlockEmbed = Quill.import('blots/block/embed'); + this.focusSync = false; + var field = $event.target; + var cursor; - var Divider = /*#__PURE__*/function (_BlockEmbed) { - _inherits(Divider, _BlockEmbed); + if (field.type === 'number') { + field.type = 'text'; + cursor = field.selectionEnd; + field.type = 'number'; + } else { + cursor = field.selectionEnd; + } - var _super = _createSuper(Divider); + this.$trigger('blur', $event, { + value: this.valueSync, + cursor: cursor + }); + }, + _checkSelection: function _checkSelection() { + var field = this._field; - function Divider() { - _classCallCheck(this, Divider); + if (this.focusSync && this.selectionStartNumber > -1 && this.selectionEndNumber > -1 && field.type !== 'number') { + field.selectionStart = this.selectionStartNumber; + field.selectionEnd = this.selectionEndNumber; + } + }, + _checkCursor: function _checkCursor() { + var field = this._field; - return _super.apply(this, arguments); + if (this.focusSync && this.selectionStartNumber < 0 && this.selectionEndNumber < 0 && this.cursorNumber > -1 && field.type !== 'number') { + field.selectionEnd = field.selectionStart = this.cursorNumber; + } } + } +}); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) - return Divider; - }(BlockEmbed); +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { - Divider.blotName = 'divider'; - Divider.tagName = 'HR'; - return { - 'formats/divider': Divider - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/ins.js -function ins_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ins_typeof = function _typeof(obj) { return typeof obj; }; } else { ins_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ins_typeof(obj); } +"use strict"; +// Top level file is just a mixin of submodules & constants -function ins_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function ins_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ins_setPrototypeOf(subClass, superClass); } +var assign = __webpack_require__(11).assign; -function ins_setPrototypeOf(o, p) { ins_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ins_setPrototypeOf(o, p); } +var deflate = __webpack_require__(120); +var inflate = __webpack_require__(123); +var constants = __webpack_require__(92); -function ins_createSuper(Derived) { return function () { var Super = ins_getPrototypeOf(Derived), result; if (ins_isNativeReflectConstruct()) { var NewTarget = ins_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ins_possibleConstructorReturn(this, result); }; } +var pako = {}; -function ins_possibleConstructorReturn(self, call) { if (call && (ins_typeof(call) === "object" || typeof call === "function")) { return call; } return ins_assertThisInitialized(self); } +assign(pako, deflate, inflate, constants); -function ins_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +module.exports = pako; -function ins_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function ins_getPrototypeOf(o) { ins_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ins_getPrototypeOf(o); } +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { -/* harmony default export */ var ins = (function (Quill) { - var Inline = Quill.import('blots/inline'); +"use strict"; - var Ins = /*#__PURE__*/function (_Inline) { - ins_inherits(Ins, _Inline); - var _super = ins_createSuper(Ins); +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It isn't worth it to make additional optimizations as in original. +// Small size is preferable. - function Ins() { - ins_classCallCheck(this, Ins); +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. - return _super.apply(this, arguments); - } +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 0; - return Ins; - }(Inline); + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; - Ins.blotName = 'ins'; - Ins.tagName = 'INS'; - return { - 'formats/ins': Ins - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/align.js -/* harmony default export */ var align = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope, - Attributor = _Quill$import.Attributor; + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); - var config = { - scope: Scope.BLOCK, - whitelist: ['left', 'right', 'center', 'justify'] - }; - var AlignStyle = new Attributor.Style('align', 'text-align', config); - return { - 'formats/align': AlignStyle - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/direction.js -/* harmony default export */ var direction = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope, - Attributor = _Quill$import.Attributor; + s1 %= 65521; + s2 %= 65521; + } - var config = { - scope: Scope.BLOCK, - whitelist: ['rtl'] - }; - var DirectionStyle = new Attributor.Style('direction', 'direction', config); - return { - 'formats/direction': DirectionStyle - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/list.js -function list_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { list_typeof = function _typeof(obj) { return typeof obj; }; } else { list_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return list_typeof(obj); } + return (s1 | (s2 << 16)) |0; +} -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function list_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +module.exports = adler32; -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { -function list_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) list_setPrototypeOf(subClass, superClass); } +"use strict"; -function list_setPrototypeOf(o, p) { list_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return list_setPrototypeOf(o, p); } -function list_createSuper(Derived) { return function () { var Super = list_getPrototypeOf(Derived), result; if (list_isNativeReflectConstruct()) { var NewTarget = list_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return list_possibleConstructorReturn(this, result); }; } +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. -function list_possibleConstructorReturn(self, call) { if (call && (list_typeof(call) === "object" || typeof call === "function")) { return call; } return list_assertThisInitialized(self); } +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. -function list_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; -function list_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } -function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + return table; +} -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = list_getPrototypeOf(object); if (object === null) break; } return object; } +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); -function list_getPrototypeOf(o) { list_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return list_getPrototypeOf(o); } -/* harmony default export */ var list = (function (Quill) { - var Parchment = Quill.import('parchment'); - var Container = Quill.import('blots/container'); - var ListItem = Quill.import('formats/list/item'); +function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; - var List = /*#__PURE__*/function (_Container) { - list_inherits(List, _Container); + crc ^= -1; - var _super = list_createSuper(List); + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } - _createClass(List, null, [{ - key: "create", - value: function create(value) { - var tagName = value === 'ordered' ? 'OL' : 'UL'; + return (crc ^ (-1)); // >>> 0; +} - var node = _get(list_getPrototypeOf(List), "create", this).call(this, tagName); - if (value === 'checked' || value === 'unchecked') { - node.setAttribute('data-checked', value === 'checked'); - } +module.exports = crc32; - return node; - } - }, { - key: "formats", - value: function formats(domNode) { - if (domNode.tagName === 'OL') return 'ordered'; - if (domNode.tagName === 'UL') { - if (domNode.hasAttribute('data-checked')) { - return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked'; - } else { - return 'bullet'; - } - } +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { - return undefined; - } - }]); +"use strict"; +// String encode/decode helpers - function List(domNode) { - var _this; - list_classCallCheck(this, List); - _this = _super.call(this, domNode); +var utils = __webpack_require__(11); - var listEventHandler = function listEventHandler(e) { - if (e.target.parentNode !== domNode) return; - var format = _this.statics.formats(domNode); +// Quick check if we can use fast array to bin string conversion +// +// - apply(Array) can fail on Android 2.2 +// - apply(Uint8Array) can fail on iOS 5.1 Safari +// +var STR_APPLY_OK = true; +var STR_APPLY_UIA_OK = true; - var blot = Parchment.find(e.target); +try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } +try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - if (format === 'checked') { - blot.format('list', 'unchecked'); - } else if (format === 'unchecked') { - blot.format('list', 'checked'); - } - }; - domNode.addEventListener('click', listEventHandler); - return _this; - } +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new utils.Buf8(256); +for (var q = 0; q < 256; q++) { + _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); +} +_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - _createClass(List, [{ - key: "format", - value: function format(name, value) { - if (this.children.length > 0) { - this.children.tail.format(name, value); - } - } - }, { - key: "formats", - value: function formats() { - // We don't inherit from FormatBlot - return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode)); + +// convert string to array (typed, when possible) +exports.string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; } - }, { - key: "insertBefore", - value: function insertBefore(blot, ref) { - if (blot instanceof ListItem) { - _get(list_getPrototypeOf(List.prototype), "insertBefore", this).call(this, blot, ref); - } else { - var index = ref == null ? this.length() : ref.offset(this); - var after = this.split(index); - after.parent.insertBefore(blot, after); - } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + buf = new utils.Buf8(buf_len); + + // convert + for (i = 0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; } - }, { - key: "optimize", - value: function optimize(context) { - _get(list_getPrototypeOf(List.prototype), "optimize", this).call(this, context); + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } - var next = this.next; + return buf; +}; - if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) { - next.moveChildren(this); - next.remove(); - } - } - }, { - key: "replace", - value: function replace(target) { - if (target.statics.blotName !== this.statics.blotName) { - var item = Parchment.create(this.statics.defaultChild); - target.moveChildren(item); - this.appendChild(item); - } +// Helper (used in 2 places) +function buf2binstring(buf, len) { + // On Chrome, the arguments in a function call that are allowed is `65534`. + // If the length of the buffer is smaller than that, we can use this optimization, + // otherwise we will take a slower path. + if (len < 65534) { + if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { + return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); + } + } - _get(list_getPrototypeOf(List.prototype), "replace", this).call(this, target); - } - }]); + var result = ''; + for (var i = 0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; +} - return List; - }(Container); - List.blotName = 'list'; - List.scope = Parchment.Scope.BLOCK_BLOT; - List.tagName = ['OL', 'UL']; - List.defaultChild = 'list-item'; - List.allowedChildren = [ListItem]; - return { - 'formats/list': List - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/background.js -/* harmony default export */ var background = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope; +// Convert byte array to binary string +exports.buf2binstring = function (buf) { + return buf2binstring(buf, buf.length); +}; - var BackgroundStyle = Quill.import('formats/background'); - var BackgroundColorStyle = new BackgroundStyle.constructor('backgroundColor', 'background-color', { - scope: Scope.INLINE - }); - return { - 'formats/backgroundColor': BackgroundColorStyle - }; -}); -// EXTERNAL MODULE: ./src/shared/index.js + 7 modules -var shared = __webpack_require__(1); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/box.js +// Convert binary string (typed, when possible) +exports.binstring2buf = function (str) { + var buf = new utils.Buf8(str.length); + for (var i = 0, len = buf.length; i < len; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; +}; -/* harmony default export */ var box = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope, - Attributor = _Quill$import.Attributor; - var config = { - scope: Scope.BLOCK - }; - var margin = ['margin', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight']; - var padding = ['padding', 'paddingTop', 'paddingBottom', 'paddingLeft', 'paddingRight']; - var result = {}; - margin.concat(padding).forEach(function (name) { - result["formats/".concat(name)] = new Attributor.Style(name, Object(shared["f" /* kebabCase */])(name), config); - }); - return result; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/font.js +// convert array to string +exports.buf2string = function (buf, max) { + var i, out, c, c_len; + var len = max || buf.length; -/* harmony default export */ var formats_font = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope, - Attributor = _Quill$import.Attributor; + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len * 2); - var config = { - scope: Scope.INLINE - }; - var font = ['font', 'fontSize', 'fontStyle', 'fontVariant', 'fontWeight', 'fontFamily']; - var result = {}; - font.forEach(function (name) { - result["formats/".concat(name)] = new Attributor.Style(name, Object(shared["f" /* kebabCase */])(name), config); - }); - return result; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/text.js + for (out = 0, i = 0; i < len;) { + c = buf[i++]; + // quick process ascii + if (c < 0x80) { utf16buf[out++] = c; continue; } -/* harmony default export */ var formats_text = (function (Quill) { - var _Quill$import = Quill.import('parchment'), - Scope = _Quill$import.Scope, - Attributor = _Quill$import.Attributor; + c_len = _utf8len[c]; + // skip 5 & 6 byte codes + if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - var text = [{ - name: 'lineHeight', - scope: Scope.BLOCK - }, { - name: 'letterSpacing', - scope: Scope.INLINE - }, { - name: 'textDecoration', - scope: Scope.INLINE - }, { - name: 'textIndent', - scope: Scope.BLOCK - }]; - var result = {}; - text.forEach(function (_ref) { - var name = _ref.name, - scope = _ref.scope; - result["formats/".concat(name)] = new Attributor.Style(name, Object(shared["f" /* kebabCase */])(name), { - scope: scope - }); - }); - return result; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/image.js -/* harmony default export */ var formats_image = (function (Quill) { - var Image = Quill.import('formats/image'); + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } - Image.sanitize = function (url) { - return url; - }; -}); -// CONCATENATED MODULE: ./src/core/view/components/editor/formats/index.js + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + return buf2binstring(utf16buf, out); +}; +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +exports.utf8border = function (buf, max) { + var pos; + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + // go back from last position, until start of sequence found + pos = max - 1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + // Very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + // If we came to start of buffer - that means buffer is too small, + // return max too. + if (pos === 0) { return max; } + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; -function register(Quill) { - var formats = { - divider: divider, - ins: ins, - align: align, - direction: direction, - list: list, - background: background, - box: box, - font: formats_font, - text: formats_text, - image: formats_image - }; - var options = {}; - Object.values(formats).forEach(function (value) { - return Object.assign(options, value(Quill)); - }); - Quill.register(options, true); -} /***/ }), -/* 84 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { "use strict"; -// EXTERNAL MODULE: ./src/core/helpers/tags.js -var tags = __webpack_require__(67); -var tags_default = /*#__PURE__*/__webpack_require__.n(tags); - -// EXTERNAL MODULE: ./src/core/helpers/index.js -var helpers = __webpack_require__(6); - -// CONCATENATED MODULE: ./src/core/vue.js -// 使用白名单过滤(前期有一批自定义组件使用了 uni-) +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} + +module.exports = ZStream; -function initVue(Vue) { - Vue.config.errorHandler = function (err) { - var app = typeof getApp === 'function' && getApp(); - if (app && Object(helpers["a" /* hasLifecycleHook */])(app.$options, 'onError')) { - app.__call_hook('onError', err); - } else { - console.error(err); - } - }; +/***/ }), +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { - var oldIsReservedTag = Vue.config.isReservedTag; +"use strict"; - Vue.config.isReservedTag = function (tag) { - return tags_default.a.indexOf(tag) !== -1 || oldIsReservedTag(tag); - }; - Vue.config.ignoredElements = tags_default.a; - var oldGetTagNamespace = Vue.config.getTagNamespace; - var conflictTags = ['switch', 'image', 'text', 'view']; +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; - Vue.config.getTagNamespace = function (tag) { - if (~conflictTags.indexOf(tag)) { - // svg 部分标签名称与 uni 标签冲突 - return false; - } - return oldGetTagNamespace(tag) || false; - }; -} -// EXTERNAL MODULE: ./src/core/view/plugins/index.js -var plugins = __webpack_require__(78); +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { -// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-real-path.js + 1 modules -var get_real_path = __webpack_require__(65); +exports.nextTick = function nextTick(fn) { + var args = Array.prototype.slice.call(arguments); + args.shift(); + setTimeout(function () { + fn.apply(null, args); + }, 0); +}; -// EXTERNAL MODULE: ./src/platforms/app-plus/view/framework/plugins/data.js -var data = __webpack_require__(14); +exports.platform = exports.arch = +exports.execPath = exports.title = 'browser'; +exports.pid = 1; +exports.browser = true; +exports.env = {}; +exports.argv = []; -// CONCATENATED MODULE: ./src/platforms/app-plus/view/framework/plugins/event.js +exports.binding = function (name) { + throw new Error('No such module. (Possibly not yet loaded)') +}; -function initEvent(Vue) { - // 部分组件内部使用了$page - Object.defineProperty(Vue.prototype, '$page', { - get: function get() { - return getCurrentPages()[0].$page; - } - }); +(function () { + var cwd = '/'; + var path; + exports.cwd = function () { return cwd }; + exports.chdir = function (dir) { + if (!path) path = __webpack_require__(158); + cwd = path.resolve(dir, cwd); + }; +})(); - Vue.prototype.$handleVModelEvent = function (nid, value) { - data["b" /* vd */].sendUIEvent(this._$id, nid, { - type: 'input', - target: { - value: value - } - }); - }; +exports.exit = exports.kill = +exports.umask = exports.dlopen = +exports.uptime = exports.memoryUsage = +exports.uvCounters = function() {}; +exports.features = {}; - Vue.prototype.$handleViewEvent = function ($vueEvent) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // const isCustomEvent = $vueEvent._processed // 自定义事件已提前处理过 - if (options.stop) { - $vueEvent.stopPropagation(); - } +/***/ }), +/* 94 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (options.prevent) { - $vueEvent.preventDefault(); - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(UniViewJSBridge) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return navigateTo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return navigateBack; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return reLaunch; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return redirectTo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return switchTab; }); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); - var $event = this.$handleEvent($vueEvent); - var cid = this._$id; - var currentTarget = $vueEvent.$origCurrentTarget || $vueEvent.currentTarget; // 当自定义组件根节点触发事件时,nid 补充前缀,避免与组件内部 nid 冲突(根组件page不需要) - var nid = (currentTarget === this.$el && this.$options.mpType !== 'page' ? 'r-' : '') + $event.options.nid; +function invokeApi(method) { + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + UniViewJSBridge.publishHandler(_constants__WEBPACK_IMPORTED_MODULE_0__[/* INVOKE_API */ "b"], { + data: { + method: method, + args: args + }, + options: { + timestamp: Date.now() + } + }); +} - if (typeof nid === 'undefined') { - return console.error("[".concat(cid, "] nid not found")); - } // 移除无用属性 +function navigateTo(args) { + invokeApi('navigateTo', args); +} +function navigateBack(args) { + invokeApi('navigateBack', args); +} +function reLaunch(args) { + invokeApi('reLaunch', args); +} +function redirectTo(args) { + invokeApi('redirectTo', args); +} +function switchTab(args) { + invokeApi('switchTab', args); +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) +/***/ }), +/* 95 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - delete $event._processed; - delete $event.mp; - delete $event.preventDefault; - delete $event.stopPropagation; - delete $event.options; - delete $event.$origCurrentTarget; // 实时发送,延迟的话,会导致 touch 类事件被合并,影响实际业务逻辑,比如 touchstart 中修改变量为 true,touchend 修改为 false +"use strict"; - data["b" /* vd */].sendUIEvent(cid, nid, $event); - }; +// EXPORTS +__webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ upx2px; }); +__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ api["b" /* navigateTo */]; }); +__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ api["a" /* navigateBack */]; }); +__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ api["c" /* reLaunch */]; }); +__webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ api["d" /* redirectTo */]; }); +__webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ api["e" /* switchTab */]; }); +__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ getSystemInfoSync; }); +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ canIUse; }); + +// CONCATENATED MODULE: ./src/core/service/api/base/upx2px.js +var EPS = 1e-4; +var BASE_DEVICE_WIDTH = 750; +var isIOS = false; +var deviceWidth = 0; +var deviceDPR = 0; + +function checkDeviceWidth() { + var _uni$getSystemInfoSyn = uni.getSystemInfoSync(), + platform = _uni$getSystemInfoSyn.platform, + pixelRatio = _uni$getSystemInfoSyn.pixelRatio, + windowWidth = _uni$getSystemInfoSyn.windowWidth; + + deviceWidth = windowWidth; + deviceDPR = pixelRatio; + isIOS = platform === 'ios'; +} + +function checkValue(value, defaultValue) { + value = Number(value); + return isNaN(value) ? defaultValue : value; } -// CONCATENATED MODULE: ./src/platforms/app-plus/view/framework/plugins/index.js +function upx2px(number, newDeviceWidth) { + if (deviceWidth === 0) { + checkDeviceWidth(); + } + number = Number(number); + if (number === 0) { + return 0; + } + var config = __uniConfig.globalStyle || __uniConfig.window || {}; + var maxWidth = checkValue(config.rpxCalcMaxDeviceWidth, 960); + var baseWidth = checkValue(config.rpxCalcBaseDeviceWidth, 375); + var includeWidth = checkValue(config.rpxCalcIncludeWidth, 750); + var width = newDeviceWidth || deviceWidth; + width = number === includeWidth || width <= maxWidth ? width : baseWidth; + var result = number / BASE_DEVICE_WIDTH * width; -/* harmony default export */ var framework_plugins = __webpack_exports__["a"] = ({ - install: function install(Vue, options) { - if (true) { - Vue.config.productionTip = false; - Vue.config.performance = true; - } + if (result < 0) { + result = -result; + } - Vue.prototype._$getRealPath = get_real_path["a" /* default */]; - initVue(Vue); - plugins["a" /* default */].install(Vue, options); - Object(data["a" /* initData */])(Vue); - initEvent(Vue); + result = Math.floor(result + EPS); + + if (result === 0) { + if (deviceDPR === 1 || !isIOS) { + result = 1; + } else { + result = 0.5; + } } + + return number < 0 ? -result : result; +} +// EXTERNAL MODULE: ./src/platforms/app-plus/view/api/index.js +var api = __webpack_require__(94); + +// EXTERNAL MODULE: ./src/platforms/app-plus/helpers/get-window-offset.js +var get_window_offset = __webpack_require__(14); + +// CONCATENATED MODULE: ./src/platforms/app-plus/helpers/uuid.js +var deviceId; +/* harmony default export */ var uuid = (function () { + deviceId = deviceId || plus.device.uuid; + return deviceId; }); +// EXTERNAL MODULE: ./node_modules/safe-area-insets/out/index.js +var out = __webpack_require__(6); +var out_default = /*#__PURE__*/__webpack_require__.n(out); -/***/ }), -/* 85 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// CONCATENATED MODULE: ./src/platforms/h5/service/api/device/get-system-info.js -"use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ initBehaviors; }); -// EXTERNAL MODULE: ./src/shared/index.js + 7 modules -var shared = __webpack_require__(1); +var ua = navigator.userAgent; +/** + * 是否安卓设备 + */ -// EXTERNAL MODULE: ./src/core/view/mixins/index.js + 2 modules -var mixins = __webpack_require__(2); +var isAndroid = /android/i.test(ua); +/** + * 是否iOS设备 + */ -// CONCATENATED MODULE: ./src/core/view/plugins/behaviors/form-field.js +var get_system_info_isIOS = /iphone|ipad|ipod/i.test(ua); /** - * uni://form-field + * 是否是Windows设备 */ +var isWindows = ua.match(/Windows NT ([\d|\d.\d]*)/i); +/** + * 是否是Mac设备 + */ +var isMac = /Macintosh|Mac/i.test(ua); +/** + * 是否是Linux设备 + */ -function created() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'add', - vm: this - }); -} +var isLinux = /Linux|X11/i.test(ua); +/** + * 是否是iPadOS + */ -function beforeDestroy() { - this.$dispatch('Form', 'uni-form-group-update', { - type: 'remove', - vm: this - }); -} +var isIPadOS = isMac && navigator.maxTouchPoints > 0; +/** + * 获取系统信息-同步 + */ -/* harmony default export */ var form_field = ({ - name: 'uni://form-field', - init: function init(options, vm) { - if (!vm.constructor.options.props || !vm.constructor.options.props.name || !vm.constructor.options.props.value) { - // 未初始化 props - if (!vm.constructor.options.props) { - vm.constructor.options.props = {}; - } +function getSystemInfoSync() { + var screen = window.screen; + var pixelRatio = window.devicePixelRatio; // 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正 - if (!vm.constructor.options.props.name) { - vm.constructor.options.props.name = options.props.name = { - type: String - }; - } + var screenFix = /^Apple/.test(navigator.vendor) && typeof window.orientation === 'number'; + var landscape = screenFix && Math.abs(window.orientation) === 90; + var screenWidth = screenFix ? Math[landscape ? 'max' : 'min'](screen.width, screen.height) : screen.width; + var screenHeight = screenFix ? Math[landscape ? 'min' : 'max'](screen.height, screen.width) : screen.height; + var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth) || screenWidth; + var windowHeight = window.innerHeight; + var language = navigator.language; + var statusBarHeight = out_default.a.top; + var osname; + var osversion; + var model; - if (!vm.constructor.options.props.value) { - vm.constructor.options.props.value = options.props.value = { - type: null - }; - } - } + if (get_system_info_isIOS) { + osname = 'iOS'; + var osversionFind = ua.match(/OS\s([\w_]+)\slike/); - if (!options.propsData) { - options.propsData = {}; + if (osversionFind) { + osversion = osversionFind[1].replace(/_/g, '.'); } - var $vnode = vm.$vnode; + var modelFind = ua.match(/\(([a-zA-Z]+);/); - if ($vnode && $vnode.data && $vnode.data.attrs) { - if (Object(shared["c" /* hasOwn */])($vnode.data.attrs, 'name')) { - options.propsData.name = $vnode.data.attrs.name; - } + if (modelFind) { + model = modelFind[1]; + } + } else if (isAndroid) { + osname = 'Android'; // eslint-disable-next-line no-useless-escape - if (Object(shared["c" /* hasOwn */])($vnode.data.attrs, 'value')) { - options.propsData.value = $vnode.data.attrs.value; - } + var _osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/); + + if (_osversionFind) { + osversion = _osversionFind[1]; } - if (!vm.constructor.options.methods || !vm.constructor.options.methods._getFormData) { - // 未初始化 methods - if (!vm.constructor.options.methods) { - vm.constructor.options.methods = {}; - } + var infoFind = ua.match(/\((.+?)\)/); + var infos = infoFind ? infoFind[1].split(';') : ua.split(' '); // eslint-disable-next-line no-useless-escape - if (!options.methods) { - options.methods = {}; + var otherInfo = [/\bAndroid\b/i, /\bLinux\b/i, /\bU\b/i, /^\s?[a-z][a-z]$/i, /^\s?[a-z][a-z]-[a-z][a-z]$/i, /\bwv\b/i, /\/[\d\.,]+$/, /^\s?[\d\.,]+$/, /\bBrowser\b/i, /\bMobile\b/i]; + + for (var i = 0; i < infos.length; i++) { + var info = infos[i]; + + if (info.indexOf('Build') > 0) { + model = info.split('Build')[0].trim(); + break; } - var formMethods = { - _getFormData: function _getFormData() { - return this.name ? { - key: this.name, - value: this.value - } : {}; - }, - _resetFormData: function _resetFormData() { - this.value = ''; + var other = void 0; + + for (var o = 0; o < otherInfo.length; o++) { + if (otherInfo[o].test(info)) { + other = true; + break; } - }; - Object.assign(vm.constructor.options.methods, formMethods); - Object.assign(options.methods, formMethods); // add $dispatch + } - Object.assign(vm.constructor.options.methods, mixins["a" /* emitter */].methods); - Object.assign(options.methods, mixins["a" /* emitter */].methods); - var createdHooks = options.created; - vm.constructor.options.created = options.created = createdHooks ? [].concat(created, createdHooks) : [created]; - var beforeDestroyHooks = options.beforeDestroy; - vm.constructor.options.beforeDestroy = options.beforeDestroy = beforeDestroyHooks ? [].concat(beforeDestroy, beforeDestroyHooks) : [beforeDestroy]; + if (!other) { + model = info.trim(); + break; + } } - } -}); -// CONCATENATED MODULE: ./src/core/view/plugins/behaviors/index.js -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + } else if (isIPadOS) { + model = 'iPad'; + osname = 'iOS'; + osversion = typeof window.BigInt === 'function' ? '14.0' : '13.0'; + } else if (isWindows || isMac || isLinux) { + model = 'PC'; + var _osversionFind2 = ua.match(/\((.+?)\)/)[1]; + + if (isWindows) { + osname = 'Windows'; + osversion = ''; + + switch (isWindows[1]) { + case '5.1': + osversion = 'XP'; + break; + case '6.0': + osversion = 'Vista'; + break; + case '6.1': + osversion = '7'; + break; -var behaviors = _defineProperty({}, form_field.name, form_field); - -function initBehaviors(options, vm) { - options.behaviors.forEach(function (name) { - var behavior = behaviors[name]; - behavior && behavior.init(options, vm); - }); -} + case '6.2': + osversion = '8'; + break; -/***/ }), -/* 86 */ -/***/ (function(module, exports, __webpack_require__) { + case '6.3': + osversion = '8.1'; + break; -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller -// MIT license -// source: https://github.com/amiller-gh/currentScript-polyfill + case '10.0': + osversion = '10'; + break; + } -// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505 + var framework = _osversionFind2.match(/[Win|WOW]([\d]+)/); -(function (root, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}(typeof self !== 'undefined' ? self : this, function () { - function getCurrentScript () { - if (document.currentScript) { - return document.currentScript - } - - // IE 8-10 support script readyState - // IE 11+ & Firefox support stack trace - try { - throw new Error(); - } - catch (err) { - // Find the second match for the "at" string to get file src url from stack. - var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig, - ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig, - stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack), - scriptLocation = (stackDetails && stackDetails[1]) || false, - line = (stackDetails && stackDetails[2]) || false, - currentLocation = document.location.href.replace(document.location.hash, ''), - pageSource, - inlineScriptSourceRegExp, - inlineScriptSource, - scripts = document.getElementsByTagName('script'); // Live NodeList collection - - if (scriptLocation === currentLocation) { - pageSource = document.documentElement.outerHTML; - inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*