diff --git a/build/build.qa.js b/build/build.qa.js new file mode 100644 index 0000000000000000000000000000000000000000..8313da85f01ad569ab6b4d4203bb1ca240443187 --- /dev/null +++ b/build/build.qa.js @@ -0,0 +1,77 @@ +const fs = require('fs') +const del = require('del') +const path = require('path') +const copy = require('copy') +const rollup = require('rollup') + +const genConfig = require('./rollup.config.qa') + +const filename = 'vue.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev') + '.js' + +async function build () { + const bridgeBundle = await rollup.rollup(genConfig('bridge')) + const { + output: bridgeOutput + } = await bridgeBundle.generate({ + format: 'iife' + }) + const bridgeCode = bridgeOutput[0].code + const appBundle = await rollup.rollup(genConfig('app')) + const { + output: appOutput + } = await appBundle.generate({ + format: 'iife', + banner: ` +dsl.onInitApp(function({ + inst, + context, + instRequireModule +}) { + if(!context.quickapp.dock.makeEvaluateBuildScript){ + context.quickapp.dock.makeEvaluateBuildScript = args => args + } + const $app_require$ = instRequireModule; +`, + footer: ` +});` + }) + const appCode = appOutput[0].code + // const pageBundle = await rollup.rollup(genConfig('page')) + // const { + // output: pageOutput + // } = await pageBundle.generate({ + // format: 'iife', + // banner: ` + // dsl.onInitPage(function({ + // $app_require$, + // Vue + // }) { + // `, + // footer: ` + // });` + // }) + // const pageCode = pageOutput[0].code + const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp/lib/' + filename)) + + fs.writeFileSync( + path.resolve(__dirname, '../packages/uni-quickapp/lib/dsls/' + filename), + vueCode + bridgeCode + appCode, { + encoding: 'utf8' + } + ) + + if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy + const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp/view/components/**/*') + const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp/lib/components') + + del.sync([componentsDest]) + + copy(componentsSrc, componentsDest, function (err, file) { + if (err) { + throw err + } + }) + } +} + +build() diff --git a/build/rollup.config.qa.js b/build/rollup.config.qa.js new file mode 100644 index 0000000000000000000000000000000000000000..f5c6618b254fd1cc360e0255730eb6bf0a4f6805 --- /dev/null +++ b/build/rollup.config.qa.js @@ -0,0 +1,72 @@ +const path = require('path') +const alias = require('rollup-plugin-alias') +const replace = require('rollup-plugin-replace') +const nodeResolve = require('rollup-plugin-node-resolve') +const commonjs = require('rollup-plugin-commonjs') +const terser = require('rollup-plugin-terser') +const requireContext = require('../lib/rollup-plugin-require-context') + +process.env.UNI_PLATFORM = 'quickapp' + +const external = [] + +const resolve = dir => path.resolve(__dirname, '../', dir) + +function replaceModuleImport (str) { + return str.replace( + /require\s*\(\s*(['"])@([\w$_][\w$-.]*?)\1\)/gm, + (e, r, p) => `$app_require$(${r}@app-module/${p}${r})` + ).replace( + /import\s+([\w${}]+?)\s+from\s+(['"])@([\w$_][\w$-.]*?)\2/gm, + (e, r, p, t) => `var ${r} = $app_require$(${p}@app-module/${t}${p})` + ) +} + +const plugins = [{ + name: 'replaceModuleImport', + transform (source) { + return { + code: replaceModuleImport(source) + } + } +}, +alias({ + 'uni-core': resolve('src/core'), + 'uni-platform': resolve('src/platforms/' + process.env.UNI_PLATFORM), + 'uni-platforms': resolve('src/platforms'), + 'uni-shared': resolve('src/shared/index.js'), + 'uni-helpers': resolve('src/core/helpers'), + 'uni-invoke-api': resolve('src/platforms/quickapp/service/invoke-api'), + 'uni-service-api': resolve('src/platforms/quickapp/service/api'), + 'uni-api-protocol': resolve('src/core/helpers/protocol') +}), +nodeResolve(), +requireContext(), +commonjs(), +replace({ + __PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM), + __PLATFORM_TITLE__: '快应用' +}) +] + +// if (process.env.NODE_ENV === 'production') { +plugins.push(terser.terser()) +// } + +module.exports = function (type) { + let input = '' + + if (type === 'bridge') { + input = 'src/platforms/quickapp/runtime/bridge.js' + } else if (type === 'app') { + input = 'src/platforms/quickapp/runtime/app.js' + } else if (type === 'page') { + input = 'src/platforms/quickapp/runtime/page.js' + } + + return { + input, + plugins, + external + } +} diff --git a/package.json b/package.json index be975b27174bcf0bb8d27afd5e09e75209caca96..39e4691a53423e4b3ab65f34e8469d94b0d296ea 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js", "build:mp-weixin:mp": "npm run lint && cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js", "build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js", + "build:quickapp": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js", "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus", "build:stat": "npm run lint && rollup -c build/rollup.config.stat.js", "build:web-view": "npm run lint && rollup -c build/rollup.config.web-view.js", @@ -70,8 +71,10 @@ "rollup-plugin-alias": "^1.4.0", "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.0.1", + "rollup-plugin-inject": "^3.0.2", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-replace": "^2.1.0", + "rollup-plugin-terser": "^5.2.0", "rollup-plugin-uglify": "^6.0.3", "shell-exec": "^1.0.2", "strip-json-comments": "^2.0.1", @@ -139,4 +142,4 @@ "main": "index.js", "description": "", "author": "" -} +} diff --git a/packages/uni-cli-shared/lib/platform.js b/packages/uni-cli-shared/lib/platform.js index 6b0da7dad18207e3df3cc2ff6e36d8d6acce0e86..84862e0e7960c81353ce5bec2aecaa289b2f8065 100644 --- a/packages/uni-cli-shared/lib/platform.js +++ b/packages/uni-cli-shared/lib/platform.js @@ -337,6 +337,23 @@ const PLATFORMS = { ...getCopyOptions(['ttcomponents']) ] } + }, + 'quickapp': { + vue: '@dcloudio/vue-cli-plugin-uni/packages/h5-vue', + subPackages: false, + cssVars: { + '--status-bar-height': '25px', + '--window-top': '0px', + '--window-bottom': '0px' + }, + copyWebpackOptions ({ + assetsDir + }) { + return [ + ...getStaticCopyOptions(assetsDir), + ...getCopyOptions(['qacomponents']) + ] + } } } // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在 @@ -579,7 +596,7 @@ module.exports = { mergeLonghand: false, mergeRules: false, cssDeclarationSorter: false, - uniqueSelectors: false, // 标签排序影响头条小程序 + uniqueSelectors: false, // 标签排序影响头条小程序 minifySelectors: false, // 标签排序影响头条小程序 discardComments: false, discardDuplicates: false // 条件编译会导致重复 diff --git a/packages/uni-quickapp/LICENSE b/packages/uni-quickapp/LICENSE new file mode 100755 index 0000000000000000000000000000000000000000..7a4a3ea2424c09fbe48d455aed1eaa94d9124835 --- /dev/null +++ b/packages/uni-quickapp/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/packages/uni-quickapp/README.md b/packages/uni-quickapp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fcb145165e7400280ebfe2e49aa37eca478f7946 --- /dev/null +++ b/packages/uni-quickapp/README.md @@ -0,0 +1,3 @@ +1.解析pages.json,manifest.json 输出 manifest.json ,webpack entries +2.webpack 增加各种loader +1.copy dsl.js \ No newline at end of file diff --git a/packages/uni-quickapp/lib/components/button/button.vue b/packages/uni-quickapp/lib/components/button/button.vue new file mode 100644 index 0000000000000000000000000000000000000000..9ae2cd5cc2dd0dddd92b957c28abfa98eb978ac1 --- /dev/null +++ b/packages/uni-quickapp/lib/components/button/button.vue @@ -0,0 +1,14 @@ + + + diff --git a/packages/uni-quickapp/lib/dsls/vue.dev.js b/packages/uni-quickapp/lib/dsls/vue.dev.js new file mode 100644 index 0000000000000000000000000000000000000000..0c890a9a36958dd0a8b35247e58bec3574cff1a2 --- /dev/null +++ b/packages/uni-quickapp/lib/dsls/vue.dev.js @@ -0,0 +1,3 @@ +var dsl=function(){"use strict";const e={initApp:"quickapp.app.initApp",initPage:"quickapp.page.initPage",destroyPage:"quickapp.page.destroyPage",fireEvent:"quickapp.page.fireEvent",onShow:"quickapp.page.onShow",onHide:"quickapp.page.onHide",onBackPress:"quickapp.page.onBackPress",onMenuPress:"quickapp.page.onMenuPress",onOrientationChange:"quickapp.page.onOrientationChange",onConfigurationChanged:"quickapp.page.onConfigurationChanged",onRefresh:"quickapp.page.onRefresh",callbackDone:"quickapp.page.callbackDone"},t=/^@(app)-application\//,n=/^@(app)-component\//,r=/^@(app)-module\//;function o(e){return e.replace(t,"").replace(n,"").replace(r,"")}var i={};function a(e,t,n){return"function"==typeof global.compileAndRunScript?function(e,t,n){let r="(function (";const o=[],i=[];for(const t in e)o.push(t),i.push(e[t]);for(let e=0;e=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function m(e){return null==e?"":Array.isArray(e)||f(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function y(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var w=Object.prototype.hasOwnProperty;function A(e,t){return w.call(e,t)}function k(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var x=/-(\w)/g,O=k(function(e){return e.replace(x,function(e,t){return t?t.toUpperCase():""})}),C=k(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),S=/\B([A-Z])/g,j=k(function(e){return e.replace(S,"-$1").toLowerCase()});var E=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function I(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function P(e,t){for(var n in t)e[n]=t[n];return e}function M(e,t,n){}var T=function(e,t,n){return!1},D=function(e){return e};function F(e,t){if(e===t)return!0;var n=c(e),r=c(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(function(e,n){return F(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||i)return!1;var a=Object.keys(e),s=Object.keys(t);return a.length===s.length&&a.every(function(n){return F(e[n],t[n])})}catch(e){return!1}}function N(e,t){for(var n=0;n0,te=X&&X.indexOf("edge/")>0,ne=(X&&X.indexOf("android"),X&&/iphone|ipad|ipod|ios/.test(X)||"ios"===G),re=(X&&/chrome\/\d+/.test(X),X&&/phantomjs/.test(X),X&&X.match(/firefox\/(\d+)/),{}.watch);if(Q)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){}}),window.addEventListener("test-passive",null,oe)}catch(e){}var ie=function(){return void 0===W&&(W=!Q&&!Y&&void 0!==u&&(u.process&&"server"===u.process.env.VUE_ENV)),W},ae=Q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function se(e){return"function"==typeof e&&/native code/.test(e.toString())}var ce,ue="undefined"!=typeof Symbol&&se(Symbol)&&"undefined"!=typeof Reflect&&se(Reflect.ownKeys);ce="undefined"!=typeof Set&&se(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var le=M,pe=M,fe=M,de=M,ve="undefined"!=typeof console,he=/(?:^|[-_])(\w)/g;le=function(e,t){var n=t?fe(t):"";B.warnHandler?B.warnHandler.call(null,e,t,n):ve&&!B.silent&&console.error("[Vue warn]: "+e+n)},pe=function(e,t){ve&&!B.silent&&console.warn("[Vue tip]: "+e+(t?fe(t):""))},de=function(e,t){if(e.$root===e)return"";var n="function"==typeof e&&null!=e.cid?e.options:e._isVue?e.$options||e.constructor.options:e,r=n.name||n._componentTag,o=n.__file;if(!r&&o){var i=o.match(/([^/\\]+)\.vue$/);r=i&&i[1]}return(r?"<"+r.replace(he,function(e){return e.toUpperCase()}).replace(/[-_]/g,"")+">":"")+(o&&!1!==t?" at "+o:"")};fe=function(e){if(e._isVue&&e.$parent){for(var t=[],n=0;e;){if(t.length>0){var r=t[t.length-1];if(r.constructor===e.constructor){n++,e=e.$parent;continue}n>0&&(t[t.length-1]=[r,n],n=0)}t.push(e),e=e.$parent}return"\n\nfound in\n\n"+t.map(function(e,t){return""+(0===t?"---\x3e ":function(e,t){for(var n="";t;)t%2==1&&(n+=e),t>1&&(e+=e),t>>=1;return n}(" ",5+2*t))+(Array.isArray(e)?de(e[0])+"... ("+e[1]+" recursive calls)":de(e))}).join("\n")}return"\n\n(found in "+de(e)+")"};var me=0,ye=function(){"undefined"!=typeof SharedObject?this.id=SharedObject.uid++:this.id=me++,this.subs=[]};function ge(e){ye.SharedObject.targetStack.push(e),ye.SharedObject.target=e}function _e(){ye.SharedObject.targetStack.pop(),ye.SharedObject.target=ye.SharedObject.targetStack[ye.SharedObject.targetStack.length-1]}ye.prototype.addSub=function(e){this.subs.push(e)},ye.prototype.removeSub=function(e){$(this.subs,e)},ye.prototype.depend=function(){ye.SharedObject.target&&ye.SharedObject.target.addDep(this)},ye.prototype.notify=function(){var e=this.subs.slice();B.async||e.sort(function(e,t){return e.id-t.id});for(var t=0,n=e.length;t-1)if(i&&!A(o,"default"))a=!1;else if(""===a||a===j(e)){var u=Ye(String,o.type);(u<0||s0&&(Pt((u=e(u,(n||"")+"_"+c))[0])&&Pt(p)&&(r[l]=Ae(p.text+u[0].text),u.shift()),r.push.apply(r,u)):s(u)?Pt(p)?r[l]=Ae(p.text+u):""!==u&&r.push(Ae(u)):Pt(u)&&Pt(p)?r[l]=Ae(p.text+u.text):(a(t._isVList)&&i(u.tag)&&o(u.key)&&i(n)&&(u.key="__vlist"+n+"_"+c+"__"),r.push(u)));return r}(e):void 0}function Pt(e){return i(e)&&i(e.text)&&!1===e.isComment}function Mt(e,t){if(e){for(var n=Object.create(null),r=ue?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=Nt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=Lt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),z(o,"$stable",a),z(o,"$key",s),z(o,"$hasNormal",i),o}function Nt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:It(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function Lt(e,t){return function(){return e[t]}}function qt(e,t){var n,r,o,a,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;r.",e),l=new be(B.parsePlatformTagName(t),n,r,void 0,void 0,e)):l=n&&n.pre||!i(f=Ue(e.$options,"components",t))?new be(t,n,r,void 0,void 0,e):an(f,n,e,r,t)}else l=an(t,n,e,r);return Array.isArray(l)?l:i(l)?(i(p)&&function e(t,n,r){t.ns=n;"foreignObject"===t.tag&&(n=void 0,r=!0);if(i(t.children))for(var s=0,c=t.children.length;st.createEvent("Event").timeStamp&&(In=function(){return Pn.now()})}function Mn(){var e,t;for(In(),jn=!0,kn.sort(function(e,t){return e.id-t.id}),En=0;EnAn)){le("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var n=xn.slice(),r=kn.slice();En=kn.length=xn.length=0,On={},Cn={},Sn=jn=!1,function(e){for(var t=0;tEn&&kn[n].id>e.id;)n--;kn.splice(n+1,0,e)}else kn.push(e);if(!Sn){if(Sn=!0,!B.async)return void Mn();ft(Mn)}}}(this)},Dn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ze(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Dn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Dn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Dn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||$(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Fn={enumerable:!0,configurable:!0,get:M,set:M};function Nn(e,t,n){Fn.get=function(){return this[t][n]},Fn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,Fn)}function Ln(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;i||je(!1);var a=function(a){o.push(a);var s=ze(a,t,n,e),c=j(a);(b(c)||B.isReservedAttr(c))&&le('"'+c+'" is a reserved attribute and cannot be used as component prop.',e),Pe(r,a,s,function(){i||_n||le("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',e)}),a in e||Nn(e,"_props",a)};for(var s in t)a(s);je(!0)}(e,t.props),t.methods&&function(e,t){var n=e.$options.props;for(var r in t)"function"!=typeof t[r]&&le('Method "'+r+'" has type "'+typeof t[r]+'" in the component definition. Did you reference the function correctly?',e),n&&A(n,r)&&le('Method "'+r+'" has already been defined as a prop.',e),r in e&&U(r)&&le('Method "'+r+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),e[r]="function"!=typeof t[r]?M:E(t[r],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;f(t=e._data="function"==typeof t?function(e,t){ge();try{return e.call(t,t)}catch(e){return Ze(e,t,"data()"),{}}finally{_e()}}(t,e):t||{})||(t={},le("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));var n=Object.keys(t),r=e.$options.props,o=e.$options.methods,i=n.length;for(;i--;){var a=n[i];o&&A(o,a)&&le('Method "'+a+'" has already been defined as a data property.',e),r&&A(r,a)?le('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',e):U(a)||Nn(e,"_data",a)}Ie(t,!0)}(e):Ie(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ie();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;null==a&&le('Getter is missing for computed property "'+o+'".',e),r||(n[o]=new Dn(e,a||M,M,qn)),o in e?o in e.$data?le('The computed property "'+o+'" is already defined in data.',e):e.$options.props&&o in e.$options.props&&le('The computed property "'+o+'" is already defined as a prop.',e):Rn(e,o,i)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!d(e)&&e.test(t)}function Yn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=Kn(a.componentOptions);s&&!t(s)&&Gn(n,i,r,o)}}}function Gn(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,$(n,t)}!function(e){e.prototype._init=function(e){var t,n,o=this;o._uid=Un++,B.performance&&bt&&(t="vue-perf-start:"+o._uid,n="vue-perf-end:"+o._uid,bt(t)),o._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(o,e):o.$options=He(zn(o.constructor),e||{},o),ot(o),o._self=o,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(o),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&yn(e,t)}(o),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=Tt(t._renderChildren,o),e.$scopedSlots=r,e._c=function(t,n,r,o){return ln(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return ln(e,t,n,r,o,!0)};var i=n&&n.data;Pe(e,"$attrs",i&&i.attrs||r,function(){!_n&&le("$attrs is readonly.",e)},!0),Pe(e,"$listeners",t._parentListeners||r,function(){!_n&&le("$listeners is readonly.",e)},!0)}(o),wn(o,"beforeCreate"),"mp-toutiao"!==o.mpHost&&function(e){var t=Mt(e.$options.inject,e);t&&(je(!1),Object.keys(t).forEach(function(n){Pe(e,n,t[n],function(){le('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',e)})}),je(!0))}(o),Ln(o),"mp-toutiao"!==o.mpHost&&function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(o),"mp-toutiao"!==o.mpHost&&wn(o,"created"),B.performance&&bt&&(o._name=de(o,!1),bt(n),$t("vue "+o._name+" init",t,n)),o.$options.el&&o.$mount(o.$options.el)}}(Jn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};t.set=function(){le("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){le("$props is readonly.",this)},Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=Me,e.prototype.$delete=Te,e.prototype.$watch=function(e,t,n){if(f(t))return Hn(this,e,t,n);(n=n||{}).user=!0;var r=new Dn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Ze(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(Jn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?I(r):r;for(var o=I(arguments,1),i='event handler for "'+e+'"',a=0,s=r.length;aparseInt(this.max)&&Gn(s,c[0],c,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return B},set:function(){le("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(e,"config",t),e.util={warn:le,extend:P,mergeOptions:He,defineReactive:Pe},e.set=Me,e.delete=Te,e.nextTick=ft,e.observable=function(e){return Ie(e),e},e.options=Object.create(null),R.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,P(e.options.components,Zn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=I(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=He(this.options,e),this}}(e),Wn(e),function(e){R.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&Ve(e),"component"===t&&f(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Jn),Object.defineProperty(Jn.prototype,"$isServer",{get:ie}),Object.defineProperty(Jn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Jn,"FunctionalRenderContext",{value:en}),Jn.version="2.6.11";function er(e,t,r){n.setElementAttr(e,t,r)}var tr=Object.freeze({namespaceMap:{},createElement:function(e){var r=t.createElement(e);return n.bindElementMethods(r),r},createElementNS:function(e,n){return t.createElement(e+":"+n)},createTextNode:function(e){return t.createTextNode(e)},createComment:function(e){return t.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){n.setElementAttr(e.parentNode,"value",t)},setAttribute:er}),nr={create:function(e,t){rr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(rr(e,!0),rr(t))},destroy:function(e){rr(e,!0)}};function rr(e,t){var n=e.data.ref;if(i(n)){var r=e.context,o=e.componentInstance||e.elm,a=r.$refs;t?Array.isArray(a[n])?$(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])?a[n].indexOf(o)<0&&a[n].push(o):a[n]=[o]:a[n]=o}}g("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),g("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0);var or=g("text,number,password,search,email,tel,url"),ir=new be("",{},[]),ar=["create","activate","update","remove","destroy"];function sr(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&i(e.data)===i(t.data)&&function(e,t){if("input"!==e.tag)return!0;var n,r=i(n=e.data)&&i(n=n.attrs)&&n.type,o=i(n=t.data)&&i(n=n.attrs)&&n.type;return r===o||or(r)&&or(o)}(e,t)||a(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&o(t.asyncFactory.error))}function cr(e,t,n){var r,o,a={};for(r=t;r<=n;++r)i(o=e[r].key)&&(a[o]=r);return a}var ur={create:lr,update:lr,destroy:function(e){lr(e,ir)}};function lr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===ir,a=t===ir,s=fr(e.data.directives,e.context),c=fr(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,vr(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(vr(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var p=function(){for(var n=0;n1,j=t.context.$options.style||{},E=j[$],I=j["@TRANSITION"]&&j["@TRANSITION"][A]||{},T=function(e,t,n,r,o,i){var a={},s=t[n],c=t[r],u=t[o];if(s)for(var l in s)a[l]=e.style[l],null!=a[l]||u&&null!=u[l]||c&&null!=c[l]||le('transition property "'+l+'" is declared in enter starting class (.'+n+"), but not declared anywhere in enter ending class (."+r+"), enter active cass (."+o+") or the element's default styling. Note in Quickapp, CSS properties need explicit values to be transitionable.");if(u)for(var p in u)0!==p.indexOf("transition")&&(a[p]=u[p]);c&&P(a,c);return a}(n,j,$,w,A,t.context),D=Object.keys(T).length>0,F=n._enterCb=L(function(){F.cancelled?C&&C(n):O&&O(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),x&&x(n,F),D)?t.context.$requireQuickappModule("animation").transition(n.ref,{styles:T,duration:I.duration||0,delay:I.delay||0,timingFunction:I.timingFunction||"linear"},S?M:F):S||F()},16),k&&k(n),E)for(var N in E)n.setStyle(N,E[N]);D||S||F()}}}function qr(e,t){if(!o(e.data.domProps)||!o(t.data.domProps)){var n,r,a=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in i(c.__ob__)&&(c=t.data.domProps=P({},c)),s)o(c[n])&&er(a,n,"");for(n in c){if(r=c[n],"value"===n)er(a,n,o(r)?"":String(r));else er(a,n,r)}}}var Rr=function(e){var t,n,r={},c=e.modules,u=e.nodeOps;for(t=0;t - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context),e.elm=e.ns?u.createElementNS(e.ns,g):u.createElement(g,e),$(e),y(e,v,t),i(d)&&b(e,t),m(n,e.elm,o),d&&d.pre&&f--):a(e.isComment)?(e.elm=u.createComment(e.text),m(n,e.elm,o)):(e.elm=u.createTextNode(e.text),m(n,e.elm,o))}}function h(e,t){i(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,_(e)?(b(e,t),$(e)):(rr(e),t.push(e))}function m(e,t,n){i(e)&&(i(n)?u.parentNode(n)===e&&u.insertBefore(e,t,n):u.appendChild(e,t))}function y(e,t,n){if(Array.isArray(t)){O(t);for(var r=0;rd?w(e,o(n[y+1])?null:n[y+1].elm,n,f,y,r):f>y&&k(t,p,d)}(p,h,m,n,l):i(m)?(O(m),i(e.text)&&u.setTextContent(p,""),w(p,null,m,0,m.length-1,n)):i(h)?k(h,0,h.length-1):i(e.text)&&u.setTextContent(p,""):e.text!==t.text&&u.setTextContent(p,t.text),i(d)&&i(f=d.hook)&&i(f=f.postpatch)&&f(e,t)}}}function j(e,t,n){if(a(n)&&i(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r, or missing . Bailing hydration and performing full client-side render.")}c=e,e=new be(u.tagName(c).toLowerCase(),{},[],void 0,c)}var d=e.elm,h=u.parentNode(d);if(v(t,p,d._leaveCb?null:h,u.nextSibling(d)),i(t.parent))for(var m=t.parent,y=_(t);m;){for(var g=0;g1,d=e.context.$options.style||{},v=d[o],h=d[i]||d[a],m=d["@TRANSITION"]&&d["@TRANSITION"][a]||{},y=n._leaveCb=L(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[e.key]=null),y.cancelled?l&&l(n):(t(),u&&u(n)),n._leaveCb=null});p?p(g):g();function g(){var t=e.context.$requireQuickappModule("animation");function r(){t.transition(n.ref,{styles:h,duration:m.duration||0,delay:m.delay||0,timingFunction:m.timingFunction||"linear"},f?M:y)}y.cancelled||(e.data.show||((n.parentNode._pending||(n.parentNode._pending={}))[e.key]=e),s&&s(n),v?t.transition(n.ref,{styles:v},r):r(),c&&c(n,y),h||f||y())}}}].concat(hr),LONG_LIST_THRESHOLD:10}),Vr={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?St(n,"postpatch",function(){Vr.componentUpdated(e,t,n)}):Br(e,t,n.context),e._vOptions=[].map.call(e.options,Ur)):("textarea"===n.tag||kr(e.attr.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||e.addEventListener("change",zr))},componentUpdated:function(e,t,n){if("select"===n.tag){Br(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,Ur);if(o.some(function(e,t){return!F(e,r[t])}))(e.multiple?t.value.some(function(e){return Hr(e,o)}):t.value!==t.oldValue&&Hr(t.value,o))&&Jr(e,"change")}}};function Br(e,t,n){!function(e,t,n){var r,o,i=t.value,a=e.multiple;if(a&&!Array.isArray(i))return void le(' expects an Array value for its binding, but got '+Object.prototype.toString.call(i).slice(8,-1),n);for(var s=0,c=e.options.length;s-1,o.selected!==r&&(o.selected=r);else if(F(Ur(o),i))return void(e.selectedIndex!==s&&(e.selectedIndex=s));a||(e.selectedIndex=-1)}(e,t,n)}function Hr(e,t){return t.every(function(t){return!F(t,e)})}function Ur(e){return"_value"in e?e._value:e.value}function zr(e){e.target.composing=!1,Jr(e.target,"input")}function Jr(e,n){var r=t.createEvent(n);e.dispatchEvent(r)}var Wr={model:Vr,show:{bind:function(e,t,r){var o=t.value,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display||"";n.setElementStyle(e,"display",o?i:"none")},update:function(e,t,r){var o=t.value;o!==t.oldValue&&n.setElementStyle(e,"display",o?e.__vOriginalDisplay:"none")},unbind:function(e,t,r,o,i){i||n.setElementStyle(e,"display",e.__vOriginalDisplay)}}};P(Jn.options.directives,Wr),P(Jn.options.components,{});var Kr=["public","protected","private"];Jn.config.mustUseProp=function(){},Jn.config.isReservedTag=wr,Jn.config.isRuntimeComponent=Ar,Jn.config.isUnknownElement=function(){},Jn.prototype.__patch__=Rr,Jn.prototype.$mount=function(e,t){var n=this.$options.type;void 0===n&&(n="component");var r=function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=we,e.$options.template&&"#"!==e.$options.template.charAt(0)||e.$options.el||t?le("You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.",e):le("Failed to mount component: template or render function not defined.",e)),wn(e,"beforeMount"),r=B.performance&&bt?function(){var t=e._name,r=e._uid,o="vue-perf-start:"+r,i="vue-perf-end:"+r;bt(o);var a=e._render();bt(i),$t("vue "+t+" render",o,i),bt(o),e._update(a,n),bt(i),$t("vue "+t+" patch",o,i)}:function(){e._update(e._render(),n)},new Dn(e,r,M,{before:function(){e._isMounted&&!e._isDestroyed&&wn(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(wn(e,"onServiceCreated"),wn(e,"onServiceAttached"),e._isMounted=!0,wn(e,"mounted")),e}(this,e&&function(e,t){if("object"==typeof e&&null!==e)return e;var n=t.body,r=t.createElement("div");return n.appendChild(r),r}.bind(this)(e,this.$document),t);return"page"===n&&(this._connectVm2Page&&this._connectVm2Page(),this._registerPageLifecycle&&this._registerPageLifecycle()),r},Jn.prototype._initExternalData=function(){var e=Jn.config.externalData;if("page"===this.$options.type&&e)if(this.$options._descriptor){var t=this._page.intent&&this._page.intent.fromExternal;for(var n in this._page.intent&&void 0!==this._page.intent.fromExternal||(t=!0),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 页面VM中声明的权限定义:"+JSON.stringify(this.$options._descriptor)),this.$options.$props&&!function(e){for(var t in e)return!1;return!0}(e)&&console.warn("### App Framework ### 页面VM中不支持props,推荐在public或protected中声明参数"),e){var r=this.$options._descriptor[n];if(r){var o=t&&Kr.indexOf(r.access)>0,i=!t&&Kr.indexOf(r.access)>1;o||i?console.warn("### App Framework ### 传递外部数据"+n+"在VM中声明为"+r.access+",放弃更新"):(global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",原值为:"+JSON.stringify(this._data[n])),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",新值为:"+JSON.stringify(e[n])),this.$options.data[n]=e[n])}else global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+"在VM中未声明,放弃更新")}}else(function e(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];if("function"==typeof Object.assign)Object.assign.apply(Object,[t].concat(n));else{var o=n.shift();for(var i in o)t[i]=o[i];n.length&&e.apply(void 0,[t].concat(n))}return t})(this.$options.data,e)},Jn.prototype._mergeAccess2Data=function(e){if("function"==typeof e.data&&(e.data=e.data()),e.data&&Kr.some(function(t){return e[t]}))throw new Error("页面VM对象中的属性data不可与"+Kr.join(",")+"同时存在,请使用private替换data名称");e.data||(e.data={},e._descriptor={},Kr.forEach(function(t){var n=typeof e[t];if("object"===n)for(var r in e.data=Object.assign(e.data,e[t]),e[t])e._descriptor[r]={access:t};else"function"===n&&console.warn("页面VM对象中的属性"+t+"的值不能是函数,请使用对象")}))};var Qr=Jn.prototype._init;Jn.prototype._init=function(e){var t=this.constructor.options;"page"===t.type&&(this._connectLifecycle&&this._connectLifecycle(t),this._mergeAccess2Data&&this._mergeAccess2Data(t)),Qr.call(this,e)},Jn.prototype._connectLifecycle=function(e){var t=this;e.mounted=e.mounted||[],e.mounted=Array.isArray(e.mounted)?e.mounted:[e.mounted],e.mounted.push(function(){t._ready=!0});e.created=e.created||[],e.created=Array.isArray(e.created)?e.created:[e.created],e.created.push(function(){t._initExternalData()}),e.created.unshift(function(){var e=t.$options.onInit;e&&"function"==typeof e&&e.call(t,t._page._meta.query)})},e.Vue=Jn}}(l={exports:{}},l.exports),l.exports),d=(p=f)&&p.__esModule?p.default:p;const v={onShow:"onShow",onHide:"onHide",onBackPress:"onBackPress",onMenuPress:"onMenuPress",onDestroy:"onDestroy",onConfigurationChanged:"onConfigurationChanged",onOrientationChange:"onOrientationChange",onRefresh:"onRefresh"},h={};let m=null;let y,g=null;function _(e,t,n,r,o){const a=function(e,t){return i.quickapp.runtime.helper.getDocumentNodeByRef(e,t)}(e.doc,t);if(a){return function(e,t,n,r){if(!e)return;const o=i.quickapp.runtime.helper.createEvent(t);if(Object.assign(o,n),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### fireEventWrap():事件(${t})的参数:${JSON.stringify(n)}, ${JSON.stringify(r)}`),r){const t=r.attr||{};for(const n in t)i.quickapp.runtime.helper.setElementAttr(e,n,t[n],!0);const n=r.style||{};for(const t in n)i.quickapp.runtime.helper.setElementStyle(e,t,n[t],!0)}return e.dispatchEvent(o)}(a,n,r,{attr:o})}return new Error(`fireEvent: 无效element索引 "${t}"`)}function b(e){g||(g=Promise.resolve().then(()=>{e.doc.listener.updateFinish(),g=null}))}function $(e,t,n,r){const s=e.id,c=e.doc.listener,u=c.addActions;c.addActions=((...t)=>{b(e),u.apply(c,t)});const l=e.doc,p=l.createElement("div");l.documentElement.appendChild(p);const f=h[s]={instanceId:s,document:l},g=f.Vue=function(e,t,n){const r=t.page,o=t.appRequireModule,a={setElementAttr(e,t,n){i.quickapp.runtime.helper.setElementAttr(e,t,n)},setElementStyle(e,t,n){"number"==typeof n&&(n+=""),i.quickapp.runtime.helper.setElementStyle(e,t,n)},bindElementMethods(e){i.quickapp.dock.bindComponentMethods(r,e)}},s={};d(s,r.doc,a);const c=s.Vue;global.Vue=!0;const u=h[e],l=/^quickapp:/i,p=c.config.isReservedTag||function(){return!1},f=c.config.isRuntimeComponent||function(){return!1};return c.config.externalData=n,c.config.isReservedTag=function(e){return f(e),p(e)||l.test(e)},c.config.parsePlatformTagName=function(e){return e.replace(l,"")},c.prototype.$instanceId=e,c.prototype.$document=u.document,c.prototype._connectVm2Page=function(){r.vm=this},Object.defineProperty(c.prototype,"$app",{get(){if(!this._isDestroyed)return r.app}}),Object.defineProperty(c.prototype,"$page",{get(){if(this._isDestroyed)return;const e=r.app;return Object.assign({setTitleBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setTitleBar ----`),i.quickapp.runtime.helper.updatePageTitleBar(r.doc,e))},scrollTo:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollTo ----`),i.quickapp.runtime.helper.scrollTo(r.doc,e))},scrollBy:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollBy ----`),i.quickapp.runtime.helper.scrollBy(r.doc,e))},exitFullscreen:function(){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 exitFullscreen ----`),i.quickapp.runtime.helper.exitFullscreen(r.doc))},setStatusBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setStatusBar ----`),i.quickapp.runtime.helper.updatePageStatusBar(r.doc,e))},finish:function(){r&&r.doc&&(null===m&&(m=i.quickapp.platform.requireModule(e,"system.page")),m.finishPage(r.id))}},r&&r._meta)}}),Object.defineProperties(c.prototype,{$valid:{get:()=>!!r&&r._valid,configurable:!1},$visible:{get:()=>!!r&&r._valid&&r._visible,configurable:!1},$destroyed:{get:()=>!!r&&r.vm&&r.vm._isDestroyed,configurable:!1}}),c.prototype._registerPageLifecycle=function(){Object.keys(v).forEach(e=>{this.$on(`xlc:${e}`,(...t)=>{let n=!1;const r=this.$options[e];if(!r||"function"!=typeof r)return;const o=Array.isArray(r)?r:[r];if(o&&o.length)for(let e=0;e{},$app_bootstrap$:()=>{},$app_define_wrap$:()=>{},$app_require$:t=>i.quickapp.platform.requireModule(e,o(t)),$app_evaluate$:i.quickapp.dock.makeEvaluateBuildScript(r)},r);let $;"function"==typeof y&&y(_),$="(function(global){"+($=t.toString())+"\n })(Object.create(this))";{const t=e.pageName?`${e.pageName}/${e.pageComponent}.js`:"";global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### bundleUrl----",t),a(_,$,t)}return e.doc.listener.createFinish(),f}function w(e,t,n,...r){let o=!1;return t.vm&&t.vm._ready?(t.vm.$emit(`xlc:${e}`,n,...r),o=t.vm._events[`xlc:${e}`].result,b(t),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} (${t.id})----`)):global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} 页面(${t.id})创建失败, 无法响应事件---- `),o}return{init:function(t){i.quickapp=t,global.process=global.process||{},global.process.env={},t.subscribe(e.initApp,e=>(function(e,t){global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 开始初始化App(${e.id})`);const n=t=>i.quickapp.platform.requireModule(e,o(t)),r=t=>{e.$def=t,"function"==typeof c&&c(t)},u=()=>{global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 调用App(${e.name})生命周期---- onCreate`),e.$emit("applc:onCreate")};"function"==typeof s&&s({context:i,inst:e,instRequireModule:n});const l=i.quickapp.dock.makeEvaluateBuildScript(null);let p;p=`(function(global){"use strict"; ${p=t.toString()}; \n })(Object.create(this))`,global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 开始编译代码----"),a({$app_define$:r,$app_require$:n,$app_bootstrap$:u,$app_evaluate$:l},p,"app.js")})(...e)),t.subscribe(e.initPage,e=>$(...e)),t.subscribe(e.destroyPage,e=>{!function(e){e.vm&&(e.vm.$emit("xlc:onDestroy"),e.vm.$destroy())}(...e)}),t.subscribe(e.fireEvent,e=>{const t=_(...e);return b(e[0]),t}),t.subscribe(e.callbackDone,e=>{b(e[0])}),t.subscribe(e.onShow,e=>w(v.onShow,...e)),t.subscribe(e.onHide,e=>w(v.onHide,...e)),t.subscribe(e.onBackPress,e=>w(v.onBackPress,...e)),t.subscribe(e.onMenuPress,e=>(w(v.onMenuPress,...e),function(e){let t=!1;if(e.vm&&e.vm._ready){const n=e.vm._events,r=n&&n["xlc:onMenuPress"]&&n["xlc:onMenuPress"].handlers;r&&r.length&&(t=!0)}return t}(...e))),t.subscribe(e.onConfigurationChanged,e=>w(v.onConfigurationChanged,...e)),t.subscribe(e.onOrientationChange,e=>w(v.onOrientationChange,...e)),t.subscribe(e.onRefresh,e=>w(v.onRefresh,...e))},onInitApp:function(e){s=e},onDefineApp:function(e){c=e},onInitPage:function(e){y=e}}}(); diff --git a/packages/uni-quickapp/lib/vue.prod.js b/packages/uni-quickapp/lib/vue.prod.js new file mode 100644 index 0000000000000000000000000000000000000000..aadd1c901d505990526d7cf9f0a181780be0fa03 --- /dev/null +++ b/packages/uni-quickapp/lib/vue.prod.js @@ -0,0 +1 @@ +var dsl=function(){"use strict";const e={initApp:"quickapp.app.initApp",initPage:"quickapp.page.initPage",destroyPage:"quickapp.page.destroyPage",fireEvent:"quickapp.page.fireEvent",onShow:"quickapp.page.onShow",onHide:"quickapp.page.onHide",onBackPress:"quickapp.page.onBackPress",onMenuPress:"quickapp.page.onMenuPress",onOrientationChange:"quickapp.page.onOrientationChange",onConfigurationChanged:"quickapp.page.onConfigurationChanged",onRefresh:"quickapp.page.onRefresh",callbackDone:"quickapp.page.callbackDone"},t=/^@(app)-application\//,n=/^@(app)-component\//,r=/^@(app)-module\//;function o(e){return e.replace(t,"").replace(n,"").replace(r,"")}var i={};function a(e,t,n){return"function"==typeof global.compileAndRunScript?function(e,t,n){let r="(function (";const o=[],i=[];for(const t in e)o.push(t),i.push(e[t]);for(let e=0;e=0&&Math.floor(t)===t&&isFinite(e)}function d(e){return i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function v(e){return null==e?"":Array.isArray(e)||p(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function h(e){var t=parseFloat(e);return isNaN(t)?e:t}function y(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var _=Object.prototype.hasOwnProperty;function b(e,t){return _.call(e,t)}function $(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var A=/-(\w)/g,k=$(function(e){return e.replace(A,function(e,t){return t?t.toUpperCase():""})}),w=$(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),O=/\B([A-Z])/g,x=$(function(e){return e.replace(O,"-$1").toLowerCase()});var C=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function S(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function j(e,t){for(var n in t)e[n]=t[n];return e}function E(e,t,n){}var P=function(e,t,n){return!1},I=function(e){return e};function D(e,t){if(e===t)return!0;var n=c(e),r=c(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var o=Array.isArray(e),i=Array.isArray(t);if(o&&i)return e.length===t.length&&e.every(function(e,n){return D(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(o||i)return!1;var a=Object.keys(e),s=Object.keys(t);return a.length===s.length&&a.every(function(n){return D(e[n],t[n])})}catch(e){return!1}}function F(e,t){for(var n=0;n0,X=W&&W.indexOf("edge/")>0,G=(W&&W.indexOf("android"),W&&/iphone|ipad|ipod|ios/.test(W)||"ios"===K),Z=(W&&/chrome\/\d+/.test(W),W&&/phantomjs/.test(W),W&&W.match(/firefox\/(\d+)/),{}.watch);if(U)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){}}),window.addEventListener("test-passive",null,Y)}catch(e){}var ee=function(){return void 0===B&&(B=!U&&!z&&void 0!==u&&(u.process&&"server"===u.process.env.VUE_ENV)),B},te=U&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ne(e){return"function"==typeof e&&/native code/.test(e.toString())}var re,oe="undefined"!=typeof Symbol&&ne(Symbol)&&"undefined"!=typeof Reflect&&ne(Reflect.ownKeys);re="undefined"!=typeof Set&&ne(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ie=E,ae=0,se=function(){"undefined"!=typeof SharedObject?this.id=SharedObject.uid++:this.id=ae++,this.subs=[]};function ce(e){se.SharedObject.targetStack.push(e),se.SharedObject.target=e}function ue(){se.SharedObject.targetStack.pop(),se.SharedObject.target=se.SharedObject.targetStack[se.SharedObject.targetStack.length-1]}se.prototype.addSub=function(e){this.subs.push(e)},se.prototype.removeSub=function(e){g(this.subs,e)},se.prototype.depend=function(){se.SharedObject.target&&se.SharedObject.target.addDep(this)},se.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t-1)if(i&&!b(o,"default"))a=!1;else if(""===a||a===x(e)){var c=Me(String,o.type);(c<0||s0&&(it((u=e(u,(n||"")+"_"+c))[0])&&it(p)&&(r[l]=de(p.text+u[0].text),u.shift()),r.push.apply(r,u)):s(u)?it(p)?r[l]=de(p.text+u):""!==u&&r.push(de(u)):it(u)&&it(p)?r[l]=de(p.text+u.text):(a(t._isVList)&&i(u.tag)&&o(u.key)&&i(n)&&(u.key="__vlist"+n+"_"+c+"__"),r.push(u)));return r}(e):void 0}function it(e){return i(e)&&i(e.text)&&!1===e.isComment}function at(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=lt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=pt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),R(o,"$stable",a),R(o,"$key",s),R(o,"$hasNormal",i),o}function lt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:ot(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function pt(e,t){return function(){return e[t]}}function ft(e,t){var n,r,o,a,s;if(Array.isArray(e)||"string"==typeof e)for(n=new Array(e.length),r=0,o=e.length;rt.createEvent("Event").timeStamp&&(en=function(){return tn.now()})}function nn(){var e,t;for(en(),Zt=!0,Jt.sort(function(e,t){return e.id-t.id}),Yt=0;YtYt&&Jt[n].id>e.id;)n--;Jt.splice(n+1,0,e)}else Jt.push(e);Gt||(Gt=!0,Qe(nn))}}(this)},on.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ne(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},on.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},on.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},on.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||g(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var an={enumerable:!0,configurable:!0,get:E,set:E};function sn(e,t,n){an.get=function(){return this[t][n]},an.set=function(e){this[t][n]=e},Object.defineProperty(e,n,an)}function cn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[];e.$parent&&_e(!1);var i=function(i){o.push(i);var a=De(i,t,n,e);Ae(r,i,a),i in e||sn(e,"_props",i)};for(var a in t)i(a);_e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?E:C(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;p(t=e._data="function"==typeof t?function(e,t){ce();try{return e.call(t,t)}catch(e){return Ne(e,t,"data()"),{}}finally{ue()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);for(;o--;){var i=n[o];r&&b(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&sn(e,"_data",i))}var a;$e(t,!0)}(e):$e(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=ee();for(var o in t){var i=t[o],a="function"==typeof i?i:i.get;r||(n[o]=new on(e,a||E,E,un)),o in e||ln(e,o,i)}}(e,t.computed),t.watch&&t.watch!==Z&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===l.call(n)&&e.test(t));var n}function bn(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=gn(a.componentOptions);s&&!t(s)&&$n(n,i,r,o)}}}function $n(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,g(n,t)}!function(e){e.prototype._init=function(e){var t=this;t._uid=vn++,t._isVue=!0,e&&e._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(t,e):t.$options=Pe(hn(t.constructor),e||{},t),t._renderProxy=t,t._self=t,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(t),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Ht(e,t)}(t),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,n=e.$vnode=t._parentVnode,o=n&&n.context;e.$slots=st(t._renderChildren,o),e.$scopedSlots=r,e._c=function(t,n,r,o){return Mt(e,t,n,r,o,!1)},e.$createElement=function(t,n,r,o){return Mt(e,t,n,r,o,!0)};var i=n&&n.data;Ae(e,"$attrs",i&&i.attrs||r,null,!0),Ae(e,"$listeners",t._parentListeners||r,null,!0)}(t),Wt(t,"beforeCreate"),"mp-toutiao"!==t.mpHost&&function(e){var t=at(e.$options.inject,e);t&&(_e(!1),Object.keys(t).forEach(function(n){Ae(e,n,t[n])}),_e(!0))}(t),cn(t),"mp-toutiao"!==t.mpHost&&function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(t),"mp-toutiao"!==t.mpHost&&Wt(t,"created"),t.$options.el&&t.$mount(t.$options.el)}}(yn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=we,e.prototype.$watch=function(e,t,n){if(p(t))return dn(this,e,t,n);(n=n||{}).user=!0;var r=new on(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Ne(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(yn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var o=0,i=e.length;o1?S(t):t;for(var n=S(arguments,1),r='event handler for "'+e+'"',o=0,i=t.length;oparseInt(this.max)&&$n(s,c[0],c,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return L}};Object.defineProperty(e,"config",t),e.util={warn:ie,extend:j,mergeOptions:Pe,defineReactive:Ae},e.set=ke,e.delete=we,e.nextTick=Qe,e.observable=function(e){return $e(e),e},e.options=Object.create(null),N.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,j(e.options.components,kn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=S(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Pe(this.options,e),this}}(e),mn(e),function(e){N.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&p(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(yn),Object.defineProperty(yn.prototype,"$isServer",{get:ee}),Object.defineProperty(yn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(yn,"FunctionalRenderContext",{value:Ct}),yn.version="2.6.11";function wn(e,t,r){n.setElementAttr(e,t,r)}var On=Object.freeze({namespaceMap:{},createElement:function(e){var r=t.createElement(e);return n.bindElementMethods(r),r},createElementNS:function(e,n){return t.createElement(e+":"+n)},createTextNode:function(e){return t.createTextNode(e)},createComment:function(e){return t.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){n.setElementAttr(e.parentNode,"value",t)},setAttribute:wn}),xn={create:function(e,t){Cn(t)},update:function(e,t){e.data.ref!==t.data.ref&&(Cn(e,!0),Cn(t))},destroy:function(e){Cn(e,!0)}};function Cn(e,t){var n=e.data.ref;if(i(n)){var r=e.context,o=e.componentInstance||e.elm,a=r.$refs;t?Array.isArray(a[n])?g(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])?a[n].indexOf(o)<0&&a[n].push(o):a[n]=[o]:a[n]=o}}y("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),y("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0);var Sn=y("text,number,password,search,email,tel,url"),jn=new le("",{},[]),En=["create","activate","update","remove","destroy"];function Pn(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&i(e.data)===i(t.data)&&function(e,t){if("input"!==e.tag)return!0;var n,r=i(n=e.data)&&i(n=n.attrs)&&n.type,o=i(n=t.data)&&i(n=n.attrs)&&n.type;return r===o||Sn(r)&&Sn(o)}(e,t)||a(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&o(t.asyncFactory.error))}function In(e,t,n){var r,o,a={};for(r=t;r<=n;++r)i(o=e[r].key)&&(a[o]=r);return a}var Dn={create:Fn,update:Fn,destroy:function(e){Fn(e,jn)}};function Fn(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,o,i=e===jn,a=t===jn,s=Mn(e.data.directives,e.context),c=Mn(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,qn(o,"update",t,e),o.def&&o.def.componentUpdated&&l.push(o)):(qn(o,"bind",t,e),o.def&&o.def.inserted&&u.push(o));if(u.length){var p=function(){for(var n=0;n1,P=t.context.$options.style||{},I=P[$],D=P["@TRANSITION"]&&P["@TRANSITION"][k]||{},F=function(e,t,n,r,o,i){var a={},s=t[n],c=t[r],u=t[o];if(s)for(var l in s)a[l]=e.style[l];if(u)for(var p in u)0!==p.indexOf("transition")&&(a[p]=u[p]);c&&j(a,c);return a}(n,P,$,A,k,t.context),M=Object.keys(F).length>0,N=n._enterCb=T(function(){N.cancelled?C&&C(n):x&&x(n),n._enterCb=null});if(setTimeout(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];(r&&r.context===t.context&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),O&&O(n,N),M)?t.context.$requireQuickappModule("animation").transition(n.ref,{styles:F,duration:D.duration||0,delay:D.delay||0,timingFunction:D.timingFunction||"linear"},S?E:N):S||N()},16),w&&w(n),I)for(var q in I)n.setStyle(q,I[q]);M||S||N()}}}function ur(e,t){if(!o(e.data.domProps)||!o(t.data.domProps)){var n,r,a=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in i(c.__ob__)&&(c=t.data.domProps=j({},c)),s)o(c[n])&&wn(a,n,"");for(n in c){if(r=c[n],"value"===n)wn(a,n,o(r)?"":String(r));else wn(a,n,r)}}}var lr=function(e){var t,n,r={},c=e.modules,u=e.nodeOps;for(t=0;tv?_(e,o(n[m+1])?null:n[m+1].elm,n,d,m,r):d>m&&$(t,f,v)}(f,y,m,n,l):i(m)?(i(e.text)&&u.setTextContent(f,""),_(f,null,m,0,m.length-1,n)):i(y)?$(y,0,y.length-1):i(e.text)&&u.setTextContent(f,""):e.text!==t.text&&u.setTextContent(f,t.text),i(v)&&i(d=v.hook)&&i(d=d.postpatch)&&d(e,t)}}}function O(e,t,n){if(a(n)&&i(e.parent))e.parent.data.pendingInsert=t;else for(var r=0;r1,d=e.context.$options.style||{},v=d[o],h=d[i]||d[a],y=d["@TRANSITION"]&&d["@TRANSITION"][a]||{},m=n._leaveCb=T(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[e.key]=null),m.cancelled?l&&l(n):(t(),u&&u(n)),n._leaveCb=null});p?p(g):g();function g(){var t=e.context.$requireQuickappModule("animation");function r(){t.transition(n.ref,{styles:h,duration:y.duration||0,delay:y.delay||0,timingFunction:y.timingFunction||"linear"},f?E:m)}m.cancelled||(e.data.show||((n.parentNode._pending||(n.parentNode._pending={}))[e.key]=e),s&&s(n),v?t.transition(n.ref,{styles:v},r):r(),c&&c(n,m),h||f||m())}}}].concat(Ln),LONG_LIST_THRESHOLD:10}),pr={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?tt(n,"postpatch",function(){pr.componentUpdated(e,t,n)}):fr(e,t,n.context),e._vOptions=[].map.call(e.options,vr)):("textarea"===n.tag||Jn(e.attr.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||e.addEventListener("change",hr))},componentUpdated:function(e,t,n){if("select"===n.tag){fr(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,vr);if(o.some(function(e,t){return!D(e,r[t])}))(e.multiple?t.value.some(function(e){return dr(e,o)}):t.value!==t.oldValue&&dr(t.value,o))&&yr(e,"change")}}};function fr(e,t,n){!function(e,t,n){var r,o,i=t.value,a=e.multiple;if(a&&!Array.isArray(i))return;for(var s=0,c=e.options.length;s-1,o.selected!==r&&(o.selected=r);else if(D(vr(o),i))return void(e.selectedIndex!==s&&(e.selectedIndex=s));a||(e.selectedIndex=-1)}(e,t)}function dr(e,t){return t.every(function(t){return!D(t,e)})}function vr(e){return"_value"in e?e._value:e.value}function hr(e){e.target.composing=!1,yr(e.target,"input")}function yr(e,n){var r=t.createEvent(n);e.dispatchEvent(r)}var mr={model:pr,show:{bind:function(e,t,r){var o=t.value,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display||"";n.setElementStyle(e,"display",o?i:"none")},update:function(e,t,r){var o=t.value;o!==t.oldValue&&n.setElementStyle(e,"display",o?e.__vOriginalDisplay:"none")},unbind:function(e,t,r,o,i){i||n.setElementStyle(e,"display",e.__vOriginalDisplay)}}};j(yn.options.directives,mr),j(yn.options.components,{});var gr=["public","protected","private"];yn.config.mustUseProp=function(){},yn.config.isReservedTag=Kn,yn.config.isRuntimeComponent=Wn,yn.config.isUnknownElement=function(){},yn.prototype.__patch__=lr,yn.prototype.$mount=function(e,t){var n=this.$options.type;void 0===n&&(n="component");var r=function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=fe),Wt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new on(e,r,E,{before:function(){e._isMounted&&!e._isDestroyed&&Wt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(Wt(e,"onServiceCreated"),Wt(e,"onServiceAttached"),e._isMounted=!0,Wt(e,"mounted")),e}(this,e&&function(e,t){if("object"==typeof e&&null!==e)return e;var n=t.body,r=t.createElement("div");return n.appendChild(r),r}.bind(this)(e,this.$document),t);return"page"===n&&(this._connectVm2Page&&this._connectVm2Page(),this._registerPageLifecycle&&this._registerPageLifecycle()),r},yn.prototype._initExternalData=function(){var e=yn.config.externalData;if("page"===this.$options.type&&e)if(this.$options._descriptor){var t=this._page.intent&&this._page.intent.fromExternal;for(var n in this._page.intent&&void 0!==this._page.intent.fromExternal||(t=!0),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 页面VM中声明的权限定义:"+JSON.stringify(this.$options._descriptor)),this.$options.$props&&!function(e){for(var t in e)return!1;return!0}(e)&&console.warn("### App Framework ### 页面VM中不支持props,推荐在public或protected中声明参数"),e){var r=this.$options._descriptor[n];if(r){var o=t&&gr.indexOf(r.access)>0,i=!t&&gr.indexOf(r.access)>1;o||i?console.warn("### App Framework ### 传递外部数据"+n+"在VM中声明为"+r.access+",放弃更新"):(global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",原值为:"+JSON.stringify(this._data[n])),global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+",新值为:"+JSON.stringify(e[n])),this.$options.data[n]=e[n])}else global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 传递外部数据"+n+"在VM中未声明,放弃更新")}}else(function e(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];if("function"==typeof Object.assign)Object.assign.apply(Object,[t].concat(n));else{var o=n.shift();for(var i in o)t[i]=o[i];n.length&&e.apply(void 0,[t].concat(n))}return t})(this.$options.data,e)},yn.prototype._mergeAccess2Data=function(e){if("function"==typeof e.data&&(e.data=e.data()),e.data&&gr.some(function(t){return e[t]}))throw new Error("页面VM对象中的属性data不可与"+gr.join(",")+"同时存在,请使用private替换data名称");e.data||(e.data={},e._descriptor={},gr.forEach(function(t){var n=typeof e[t];if("object"===n)for(var r in e.data=Object.assign(e.data,e[t]),e[t])e._descriptor[r]={access:t};else"function"===n&&console.warn("页面VM对象中的属性"+t+"的值不能是函数,请使用对象")}))};var _r=yn.prototype._init;yn.prototype._init=function(e){var t=this.constructor.options;"page"===t.type&&(this._connectLifecycle&&this._connectLifecycle(t),this._mergeAccess2Data&&this._mergeAccess2Data(t)),_r.call(this,e)},yn.prototype._connectLifecycle=function(e){var t=this;e.mounted=e.mounted||[],e.mounted=Array.isArray(e.mounted)?e.mounted:[e.mounted],e.mounted.push(function(){t._ready=!0});e.created=e.created||[],e.created=Array.isArray(e.created)?e.created:[e.created],e.created.push(function(){t._initExternalData()}),e.created.unshift(function(){var e=t.$options.onInit;e&&"function"==typeof e&&e.call(t,t._page._meta.query)})},e.Vue=yn}}(l={exports:{}},l.exports),l.exports),d=(p=f)&&p.__esModule?p.default:p;const v={onShow:"onShow",onHide:"onHide",onBackPress:"onBackPress",onMenuPress:"onMenuPress",onDestroy:"onDestroy",onConfigurationChanged:"onConfigurationChanged",onOrientationChange:"onOrientationChange",onRefresh:"onRefresh"},h={};let y=null;let m,g=null;function _(e,t,n,r,o){const a=function(e,t){return i.quickapp.runtime.helper.getDocumentNodeByRef(e,t)}(e.doc,t);if(a){return function(e,t,n,r){if(!e)return;const o=i.quickapp.runtime.helper.createEvent(t);if(Object.assign(o,n),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### fireEventWrap():事件(${t})的参数:${JSON.stringify(n)}, ${JSON.stringify(r)}`),r){const t=r.attr||{};for(const n in t)i.quickapp.runtime.helper.setElementAttr(e,n,t[n],!0);const n=r.style||{};for(const t in n)i.quickapp.runtime.helper.setElementStyle(e,t,n[t],!0)}return e.dispatchEvent(o)}(a,n,r,{attr:o})}return new Error(`fireEvent: 无效element索引 "${t}"`)}function b(e){g||(g=Promise.resolve().then(()=>{e.doc.listener.updateFinish(),g=null}))}function $(e,t,n,r){const s=e.id,c=e.doc.listener,u=c.addActions;c.addActions=((...t)=>{b(e),u.apply(c,t)});const l=e.doc,p=l.createElement("div");l.documentElement.appendChild(p);const f=h[s]={instanceId:s,document:l},g=f.Vue=function(e,t,n){const r=t.page,o=t.appRequireModule,a={setElementAttr(e,t,n){i.quickapp.runtime.helper.setElementAttr(e,t,n)},setElementStyle(e,t,n){"number"==typeof n&&(n+=""),i.quickapp.runtime.helper.setElementStyle(e,t,n)},bindElementMethods(e){i.quickapp.dock.bindComponentMethods(r,e)}},s={};d(s,r.doc,a);const c=s.Vue;global.Vue=!0;const u=h[e],l=/^quickapp:/i,p=c.config.isReservedTag||function(){return!1},f=c.config.isRuntimeComponent||function(){return!1};return c.config.externalData=n,c.config.isReservedTag=function(e){return f(e),p(e)||l.test(e)},c.config.parsePlatformTagName=function(e){return e.replace(l,"")},c.prototype.$instanceId=e,c.prototype.$document=u.document,c.prototype._connectVm2Page=function(){r.vm=this},Object.defineProperty(c.prototype,"$app",{get(){if(!this._isDestroyed)return r.app}}),Object.defineProperty(c.prototype,"$page",{get(){if(this._isDestroyed)return;const e=r.app;return Object.assign({setTitleBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setTitleBar ----`),i.quickapp.runtime.helper.updatePageTitleBar(r.doc,e))},scrollTo:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollTo ----`),i.quickapp.runtime.helper.scrollTo(r.doc,e))},scrollBy:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 scrollBy ----`),i.quickapp.runtime.helper.scrollBy(r.doc,e))},exitFullscreen:function(){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 exitFullscreen ----`),i.quickapp.runtime.helper.exitFullscreen(r.doc))},setStatusBar:function(e){r&&r.doc&&(console.log(`### App Framework ### 页面 ${r.id} 调用 setStatusBar ----`),i.quickapp.runtime.helper.updatePageStatusBar(r.doc,e))},finish:function(){r&&r.doc&&(null===y&&(y=i.quickapp.platform.requireModule(e,"system.page")),y.finishPage(r.id))}},r&&r._meta)}}),Object.defineProperties(c.prototype,{$valid:{get:()=>!!r&&r._valid,configurable:!1},$visible:{get:()=>!!r&&r._valid&&r._visible,configurable:!1},$destroyed:{get:()=>!!r&&r.vm&&r.vm._isDestroyed,configurable:!1}}),c.prototype._registerPageLifecycle=function(){Object.keys(v).forEach(e=>{this.$on(`xlc:${e}`,(...t)=>{let n=!1;const r=this.$options[e];if(!r||"function"!=typeof r)return;const o=Array.isArray(r)?r:[r];if(o&&o.length)for(let e=0;e{},$app_bootstrap$:()=>{},$app_define_wrap$:()=>{},$app_require$:t=>i.quickapp.platform.requireModule(e,o(t)),$app_evaluate$:i.quickapp.dock.makeEvaluateBuildScript(r)},r);let $;"function"==typeof m&&m(_),$="(function(global){"+($=t.toString())+"\n })(Object.create(this))";{const t=e.pageName?`${e.pageName}/${e.pageComponent}.js`:"";global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### bundleUrl----",t),a(_,$,t)}return e.doc.listener.createFinish(),f}function A(e,t,n,...r){let o=!1;return t.vm&&t.vm._ready?(t.vm.$emit(`xlc:${e}`,n,...r),o=t.vm._events[`xlc:${e}`].result,b(t),global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} (${t.id})----`)):global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### ${e} 页面(${t.id})创建失败, 无法响应事件---- `),o}return{init:function(t){i.quickapp=t,global.process=global.process||{},global.process.env={},t.subscribe(e.initApp,e=>(function(e,t){global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 开始初始化App(${e.id})`);const n=t=>i.quickapp.platform.requireModule(e,o(t)),r=t=>{e.$def=t,"function"==typeof c&&c(t)},u=()=>{global.Env&&"trace"===global.Env.logLevel&&console.trace(`### App Framework ### 调用App(${e.name})生命周期---- onCreate`),e.$emit("applc:onCreate")};"function"==typeof s&&s({context:i,inst:e,instRequireModule:n});const l=i.quickapp.dock.makeEvaluateBuildScript(null);let p;p=`(function(global){"use strict"; ${p=t.toString()}; \n })(Object.create(this))`,global.Env&&"trace"===global.Env.logLevel&&console.trace("### App Framework ### 开始编译代码----"),a({$app_define$:r,$app_require$:n,$app_bootstrap$:u,$app_evaluate$:l},p,"app.js")})(...e)),t.subscribe(e.initPage,e=>$(...e)),t.subscribe(e.destroyPage,e=>{!function(e){e.vm&&(e.vm.$emit("xlc:onDestroy"),e.vm.$destroy())}(...e)}),t.subscribe(e.fireEvent,e=>{const t=_(...e);return b(e[0]),t}),t.subscribe(e.callbackDone,e=>{b(e[0])}),t.subscribe(e.onShow,e=>A(v.onShow,...e)),t.subscribe(e.onHide,e=>A(v.onHide,...e)),t.subscribe(e.onBackPress,e=>A(v.onBackPress,...e)),t.subscribe(e.onMenuPress,e=>(A(v.onMenuPress,...e),function(e){let t=!1;if(e.vm&&e.vm._ready){const n=e.vm._events,r=n&&n["xlc:onMenuPress"]&&n["xlc:onMenuPress"].handlers;r&&r.length&&(t=!0)}return t}(...e))),t.subscribe(e.onConfigurationChanged,e=>A(v.onConfigurationChanged,...e)),t.subscribe(e.onOrientationChange,e=>A(v.onOrientationChange,...e)),t.subscribe(e.onRefresh,e=>A(v.onRefresh,...e))},onInitApp:function(e){s=e},onDefineApp:function(e){c=e},onInitPage:function(e){m=e}}}(); diff --git a/packages/uni-quickapp/package.json b/packages/uni-quickapp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..61a850b3dcd4b3dcd0adbe59010014b5150cf5c7 --- /dev/null +++ b/packages/uni-quickapp/package.json @@ -0,0 +1,17 @@ +{ + "name": "@dcloudio/uni-quickapp", + "version": "2.0.0-alpha-24720191216006", + "description": "uni-app quickapp", + "main": "dist/index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/dcloudio/uni-app.git", + "directory": "packages/uni-quickapp" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "fxy060608", + "license": "Apache-2.0", + "gitHead": "110501ffb0313e417858dec92acf07522d4ded00" +} diff --git a/src/platforms/quickapp/helpers/Emitter.js b/src/platforms/quickapp/helpers/Emitter.js new file mode 100644 index 0000000000000000000000000000000000000000..66451c28a520f10f4cbe3c688b4e78207fc45679 --- /dev/null +++ b/src/platforms/quickapp/helpers/Emitter.js @@ -0,0 +1,29 @@ +export default class Emitter { + constructor () { + this._events = Object.create(null) + } + + on (event, fn) { + const vm = this + if (Array.isArray(event)) { + for (let i = 0, l = event.length; i < l; i++) { + vm.on(event[i], fn) + } + } else { + (vm._events[event] || (vm._events[event] = [])).push(fn) + } + return vm + } + + emit (event, ...args) { + const vm = this + const callbacks = vm._events[event] + if (callbacks) { + const cbs = callbacks.slice(0) + for (let i = 0, l = cbs.length; i < l; i++) { + cbs[i].apply(vm, args) + } + } + return vm + } +} diff --git a/src/platforms/quickapp/helpers/can-i-use.js b/src/platforms/quickapp/helpers/can-i-use.js new file mode 100644 index 0000000000000000000000000000000000000000..b1c6ea436a540020ff61f01dea449d5b39367b27 --- /dev/null +++ b/src/platforms/quickapp/helpers/can-i-use.js @@ -0,0 +1 @@ +export default {} diff --git a/src/platforms/quickapp/helpers/get-real-path.js b/src/platforms/quickapp/helpers/get-real-path.js new file mode 100644 index 0000000000000000000000000000000000000000..f0e5bdd6b94b97f36ace6da5cb225d260941aa49 --- /dev/null +++ b/src/platforms/quickapp/helpers/get-real-path.js @@ -0,0 +1,4 @@ +export { + default +} + from '../../h5/helpers/get-real-path' diff --git a/src/platforms/quickapp/runtime/app.js b/src/platforms/quickapp/runtime/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aa6369fd59b4b13116ab68a0b8f3ed610d2d3bf1 --- /dev/null +++ b/src/platforms/quickapp/runtime/app.js @@ -0,0 +1,34 @@ +import globalRef from '../service/index' + +const injectRef = Object.getPrototypeOf(global) || global + +function parseRoutes ({ + pages +}) { + const routes = [] + Object.keys(pages).forEach((folder) => { + const options = pages[folder] + routes.push({ + path: '/' + folder + '/' + options.component, + meta: {} + }) + }) + return routes +} + +/* eslint-disable no-undef */ +dsl.onDefineApp(def => { + // 处理生命周期 + const hasOnLaunch = typeof def.onLaunch === 'function' + const hasOnShow = typeof def.onShow === 'function' + if (hasOnLaunch || hasOnShow) { + (inst._events['applc:onCreate'] || (inst._events['applc:onCreate'] = [])).push(() => { + hasOnLaunch && def.onLaunch() + hasOnShow && def.onShow() + }) + } + // __uniRoutes + injectRef.__uniRoutes = parseRoutes(def.manifest.router) +}) + +Object.assign(injectRef, globalRef) diff --git a/src/platforms/quickapp/runtime/bridge.js b/src/platforms/quickapp/runtime/bridge.js new file mode 100644 index 0000000000000000000000000000000000000000..af001629e35491651574c5e49038710d18ac3947 --- /dev/null +++ b/src/platforms/quickapp/runtime/bridge.js @@ -0,0 +1,6 @@ +import Emitter from '../helpers/Emitter' + +const injectRef = Object.getPrototypeOf(global) || global + +injectRef.UniServiceJSBridge = new Emitter() +injectRef.UniViewJSBridge = new Emitter() diff --git a/src/platforms/quickapp/runtime/page.js b/src/platforms/quickapp/runtime/page.js new file mode 100644 index 0000000000000000000000000000000000000000..e9b557b8fe1bcf3382de440d1c1fb407c8990a7e --- /dev/null +++ b/src/platforms/quickapp/runtime/page.js @@ -0,0 +1 @@ +// 快应用vue组件样式需要被合并到独立的css.json中,目前采用easycom实时编译 diff --git a/src/platforms/quickapp/service/api.js b/src/platforms/quickapp/service/api.js new file mode 100644 index 0000000000000000000000000000000000000000..3e0c21de714857ca510e854562c89fb5c7b830fd --- /dev/null +++ b/src/platforms/quickapp/service/api.js @@ -0,0 +1,7 @@ +import * as baseApi from './base-api' +import * as platformApi from './platform-api' + +export default { + ...baseApi, + ...platformApi +} diff --git a/src/platforms/quickapp/service/api/route/navigate-back.js b/src/platforms/quickapp/service/api/route/navigate-back.js new file mode 100644 index 0000000000000000000000000000000000000000..b818b738fc527eb8f44a526b3dc0021c83858591 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/navigate-back.js @@ -0,0 +1,11 @@ +import router from '@system.router' + +export function navigateBack ({ + delta +}) { + // TODO delta + router.back() + return { + errMsg: 'navigateBack:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/navigate-to.js b/src/platforms/quickapp/service/api/route/navigate-to.js new file mode 100644 index 0000000000000000000000000000000000000000..ed2b6ad4c08818be5dc5f0ff5675738bdb55acb2 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/navigate-to.js @@ -0,0 +1,24 @@ +import { + parseQuery +} from 'uni-shared' + +import { + parseUri +} from './util' + +import router from '@system.router' + +export function navigateTo ({ + url +}) { + const urls = url.split('?') + const path = urls[0] + const query = parseQuery(urls[1] || '') + router.push({ + uri: parseUri(path), + params: query + }) + return { + errMsg: 'navigateTo:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/redirect-to.js b/src/platforms/quickapp/service/api/route/redirect-to.js new file mode 100644 index 0000000000000000000000000000000000000000..0c99863432162735f6eb8a377578295d2099f98f --- /dev/null +++ b/src/platforms/quickapp/service/api/route/redirect-to.js @@ -0,0 +1,24 @@ +import { + parseQuery +} from 'uni-shared' + +import { + parseUri +} from './util' + +import router from '@system.router' + +export function redirectTo ({ + url +}) { + const urls = url.split('?') + const path = urls[0] + const query = parseQuery(urls[1] || '') + router.replace({ + uri: parseUri(path), + params: query + }) + return { + errMsg: 'redirectTo:ok' + } +} diff --git a/src/platforms/quickapp/service/api/route/util.js b/src/platforms/quickapp/service/api/route/util.js new file mode 100644 index 0000000000000000000000000000000000000000..1e14180e9ce6bb880d11e56902d01e0a6bf34002 --- /dev/null +++ b/src/platforms/quickapp/service/api/route/util.js @@ -0,0 +1,3 @@ +export function parseUri (path) { + return path.substr(0, path.lastIndexOf('/')) +} diff --git a/src/platforms/quickapp/service/base-api.js b/src/platforms/quickapp/service/base-api.js new file mode 100644 index 0000000000000000000000000000000000000000..302b7c293a35dc6f1b302b7ceb1bb457dbca49df --- /dev/null +++ b/src/platforms/quickapp/service/base-api.js @@ -0,0 +1,9 @@ +// base +export * from 'uni-core/service/api/base/base64' +export * from 'uni-core/service/api/base/can-i-use' +export * from 'uni-core/service/api/base/interceptor' +export * from 'uni-core/service/api/base/upx2px' + +export * from 'uni-core/service/api/context/audio' +export * from 'uni-core/service/api/context/background-audio' +// TODO diff --git a/src/platforms/quickapp/service/bridge.js b/src/platforms/quickapp/service/bridge.js new file mode 100644 index 0000000000000000000000000000000000000000..3a2b6525075db0bc698fe2c4c448c5fb534d956d --- /dev/null +++ b/src/platforms/quickapp/service/bridge.js @@ -0,0 +1,3 @@ +export function invoke (...args) { + return global.UniServiceJSBridge.invokeCallbackHandler(...args) +} diff --git a/src/platforms/quickapp/service/framework/app.js b/src/platforms/quickapp/service/framework/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e9a538e94144aa1c4a56ff10f1ac1d6152b0793f --- /dev/null +++ b/src/platforms/quickapp/service/framework/app.js @@ -0,0 +1,40 @@ +const defaultApp = { + globalData: {} +} + +function wrapper (def) { + if (def.__$processed) { + return def + } + const methods = def.methods + if (methods) { + Object.keys(methods).forEach(name => { + def[name] = methods[name] + }) + delete def.methods + } + // merge defaultApp + Object.keys(defaultApp).forEach(name => { + if (name !== 'globalData') { + def[name] = defaultApp[name] + } + }) + if (!def.globalData) { + def.globalData = {} + } + Object.assign(def.globalData, defaultApp.globalData) + def.__$processed = true + return def +} + +export function getApp ({ + allowDefault = false +} = {}) { + /* eslint-disable no-undef */ + if (inst.$def) { + return wrapper(inst.$def) + } + if (allowDefault) { // 返回默认实现 + return defaultApp + } +} diff --git a/src/platforms/quickapp/service/framework/page.js b/src/platforms/quickapp/service/framework/page.js new file mode 100644 index 0000000000000000000000000000000000000000..8800cfb88c352940b0ac7d5144440d9b76409126 --- /dev/null +++ b/src/platforms/quickapp/service/framework/page.js @@ -0,0 +1,4 @@ +// TODO 需要自己维护路由堆栈? +export function getCurrentPages () { + return [] +} diff --git a/src/platforms/quickapp/service/index.js b/src/platforms/quickapp/service/index.js new file mode 100644 index 0000000000000000000000000000000000000000..29ac1fbbfe4dd51a3663d894834c6b4e059c4966 --- /dev/null +++ b/src/platforms/quickapp/service/index.js @@ -0,0 +1,25 @@ +import { + uni +} from 'uni-core/service/uni' + +import { + invokeCallbackHandler +} from 'uni-helpers/api' + +import { + getApp +} from './framework/app' + +import { + getCurrentPages +} from './framework/page' + +global.UniServiceJSBridge.invokeCallbackHandler = invokeCallbackHandler + +// TODO 补充__uniRoutes?路由校验那里用到了 + +export default { + uni, + getApp, + getCurrentPages +} diff --git a/src/platforms/quickapp/service/invoke-api.js b/src/platforms/quickapp/service/invoke-api.js new file mode 100644 index 0000000000000000000000000000000000000000..54ea567e9f4b48e57050f8dcd7d8f017a49bda02 --- /dev/null +++ b/src/platforms/quickapp/service/invoke-api.js @@ -0,0 +1,3 @@ +import * as api from './platform-api' + +export default api diff --git a/src/platforms/quickapp/service/platform-api.js b/src/platforms/quickapp/service/platform-api.js new file mode 100644 index 0000000000000000000000000000000000000000..a36bfa45f872d6adfc8597c7f748f5178013e572 --- /dev/null +++ b/src/platforms/quickapp/service/platform-api.js @@ -0,0 +1,3 @@ +export * from './api/route/navigate-back' +export * from './api/route/navigate-to' +export * from './api/route/redirect-to' diff --git a/src/platforms/quickapp/service/publish-handler.js b/src/platforms/quickapp/service/publish-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..13b05913ea4ca6ad10af3db9da66bfd0f692dbb4 --- /dev/null +++ b/src/platforms/quickapp/service/publish-handler.js @@ -0,0 +1,3 @@ +export function publishHandler (event, args, pageId) { + // TODO +} diff --git a/src/platforms/quickapp/view/components/button/button.vue b/src/platforms/quickapp/view/components/button/button.vue new file mode 100644 index 0000000000000000000000000000000000000000..9ae2cd5cc2dd0dddd92b957c28abfa98eb978ac1 --- /dev/null +++ b/src/platforms/quickapp/view/components/button/button.vue @@ -0,0 +1,14 @@ + + + diff --git a/yarn.lock b/yarn.lock index 1b458b27018fe239cc47da5ffecbf84e0367eed2..b81b32132fa277a954b984ed70148a7b10c017c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5640,6 +5640,12 @@ magic-string@^0.25.2: dependencies: sourcemap-codec "^1.4.4" +magic-string@^0.25.3: + version "0.25.7" + resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + dependencies: + sourcemap-codec "^1.4.4" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -7515,6 +7521,14 @@ rollup-plugin-commonjs@^10.0.1: resolve "^1.11.0" rollup-pluginutils "^2.8.1" +rollup-plugin-inject@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" + dependencies: + estree-walker "^0.6.1" + magic-string "^0.25.3" + rollup-pluginutils "^2.8.1" + rollup-plugin-node-resolve@^5.2.0: version "5.2.0" resolved "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" @@ -7532,6 +7546,16 @@ rollup-plugin-replace@^2.1.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" +rollup-plugin-terser@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.2.0.tgz#ba758adf769347b7f1eaf9ef35978d2e207dccc7" + dependencies: + "@babel/code-frame" "^7.5.5" + jest-worker "^24.9.0" + rollup-pluginutils "^2.8.2" + serialize-javascript "^2.1.2" + terser "^4.6.2" + rollup-plugin-uglify@^6.0.3: version "6.0.4" resolved "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-6.0.4.tgz#65a0959d91586627f1e46a7db966fd504ec6c4e6" @@ -7541,7 +7565,7 @@ rollup-plugin-uglify@^6.0.3: serialize-javascript "^2.1.2" uglify-js "^3.4.9" -rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: +rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: version "2.8.2" resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" dependencies: @@ -8289,6 +8313,14 @@ terser@^4.1.2, terser@^4.4.3: source-map "~0.6.1" source-map-support "~0.5.12" +terser@^4.6.2: + version "4.6.6" + resolved "https://registry.npmjs.org/terser/-/terser-4.6.6.tgz#da2382e6cafbdf86205e82fb9a115bd664d54863" + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + test-exclude@^5.2.3: version "5.2.3" resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"