├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── README.md ├── bin └── main.dart ├── lib ├── main.dart ├── mpjs.config.dart └── second_page.dart ├── mpflutter ├── mpflutter.bat ├── pubspec.lock ├── pubspec.yaml ├── scripts ├── build_mpk.dart ├── build_plugins.dart ├── build_weapp.dart ├── build_web.dart └── help.dart ├── weapp ├── app.js ├── app.json ├── app.wxss ├── kbone │ ├── miniprogram-element │ │ ├── base.js │ │ ├── base.js.map │ │ ├── custom-component │ │ │ ├── index.js │ │ │ ├── index.json │ │ │ ├── index.wxml │ │ │ └── index.wxss │ │ ├── index-vhost.js │ │ ├── index-vhost.json │ │ ├── index-vhost.wxml │ │ ├── index-vhost.wxss │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── template │ │ │ ├── inner-component.wxml │ │ │ ├── subtree-cover.wxml │ │ │ └── subtree.wxml │ └── miniprogram-render │ │ ├── index.js │ │ └── index.js.map ├── main.dart.js ├── mp-custom-components.js ├── mpdom.min.js ├── package.json ├── pages │ ├── index │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── share.js │ │ ├── share.json │ │ └── share.wxml │ └── loading-view │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss ├── plugins.min.js ├── plugins.wxml ├── project.config.json └── sitemap.json └── web ├── index.html └── plugins.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .dart_tool/ 3 | .packages 4 | .DS_Store 5 | lib/generated_plugin_registrant.dart 6 | .flutter-plugins 7 | .flutter-plugins-dependencies 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | 5 | { 6 | "name": "MPFlutter", 7 | "request": "launch", 8 | "type": "dart", 9 | "program": "bin/main.dart", 10 | "preLaunchTask": "Pre-compile MPFlutter Plugins" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.env": { 3 | "PUB_HOSTED_URL": "https://pub.mpflutter.com" 4 | } 5 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Pre-compile MPFlutter Plugins", 6 | "type": "shell", 7 | "command": "dart scripts/build_plugins.dart", 8 | "presentation": { 9 | "echo": false, 10 | "reveal": "silent", 11 | "focus": false, 12 | "panel": "shared", 13 | "showReuseMessage": false, 14 | "clear": true 15 | }, 16 | "problemMatcher": [] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MPFlutter 工程模板 2 | 3 | 本仓库是 MPFlutter 工程壳模板,你可以下载本仓库,并根据需要移除不必要的部分,然后开始开发。 4 | 5 | 在根目录下,weapp 是微信小程序工程,web 是 H5 工程,如果你不需要对应的输出端,可以移除。 6 | 7 | ## Flutter 版本要求 8 | 9 | 本模板 master 分支要求 Flutter 版本 >= 3.7.0。 10 | 11 | 如果你的 Flutter 版本 < 3.7.0,请使用 flutter_3.3.0 分支。 12 | 13 | ## 环境准备 14 | 15 | 至少需要以下开发环境 16 | 17 | - 操作系统:macOS / Windows / Linux 任一操作系统 18 | - 代码编辑器:VSCode 19 | - VSCode 扩展:Dart 和 Flutter 20 | - Flutter 开发环境 21 | - Chrome 浏览器 22 | 23 | Flutter 开发环境可以在 https://flutter.dev 或 https://flutter-io.cn 下载安装。 24 | 25 | ## 开发 26 | 27 | 1. 使用 Git clone 或直接下载本仓库,使用 VSCode 打开本仓库根目录。 28 | 2. 使用命令行,locate 到本仓库根目录,执行命令 `./mpflutter packages get`(*划重点,这里是执行 ./mpflutter 而不是 flutter*)。 29 | 2. 按下键盘上的 'F5' 键,开始调试,在 VSCode 的调试控制台上出现如下输出。 30 | 31 | ``` 32 | Connecting to VM Service at http://127.0.0.1:61276/OgoUGNgV_fE=/ 33 | lib/main.dart: Warning: Interpreting this as package URI, 'package:mpflutter_template/main.dart'. 34 | Hot reloading enabled 35 | Listening for file changes at ./lib 36 | Serve on 0.0.0.0:9898 37 | Use browser open http://0.0.0.0:9898/index.html or use MiniProgram Developer Tools import './dist/weapp' for dev. 38 | ``` 39 | 40 | 3. 打开 Chrome 浏览器,输入网址 http://0.0.0.0:9898/index.html ,如无意外,你将看到 Hello, MPFlutter! 提示。 41 | 4. 在 VSCode 中打开 `lib/main.dart`,尝试修改 Hello, MPFlutter! 文本,并保存,看看是否可以实现 Hot-Reload? 42 | 5. 如果没有问题,你可以在 lib 目录下开展业务开发了。 43 | 44 | ### 微信小程序 45 | 46 | 如果需要在微信小程序中实现边开发边调试能力,可以直接将 weapp 目录导入到『微信开发者工具』中。 47 | 48 | 你也可以通过修改 weapp 目录下的文件,实现定制化功能。 49 | 50 | ## 构建 51 | 52 | ### H5 53 | 54 | 使用操作系统的命令行工具,locate 到工程根目录,执行以下命令。 55 | 56 | ```sh 57 | dart scripts/build_web.dart 58 | ``` 59 | 60 | 执行完成后,H5 产物在 build 目录下,你可以上传到 HTTP 服务器上使用。 61 | 62 | ### 微信小程序 63 | 64 | 使用操作系统的命令行工具,locate 到工程根目录,执行以下命令。 65 | 66 | ```sh 67 | dart scripts/build_weapp.dart 68 | ``` 69 | 70 | 执行完成后,微信小程序产物在 build 目录下,你可以打开『微信开发者工具』,导入 build 目录,进一步编译、测试并上传审核。 -------------------------------------------------------------------------------- /bin/main.dart: -------------------------------------------------------------------------------- 1 | import '../lib/main.dart' as lib; 2 | 3 | void main(List args) { 4 | lib.main(); 5 | } 6 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:mpcore/mpcore.dart'; 3 | import 'package:mpflutter_template/second_page.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | MPCore().connectToHostChannel(); 8 | } 9 | 10 | class MyApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return MPApp( 14 | title: 'MPFlutter Demo', 15 | color: Colors.blue, 16 | routes: { 17 | '/': (context) => MyHomePage(), 18 | '/second': (context) => MySecondPage(), 19 | }, 20 | navigatorObservers: [MPCore.getNavigationObserver()], 21 | ); 22 | } 23 | } 24 | 25 | class MyHomePage extends StatelessWidget { 26 | @override 27 | Widget build(BuildContext context) { 28 | return MPScaffold( 29 | name: 'Template', 30 | body: Column( 31 | mainAxisAlignment: MainAxisAlignment.center, 32 | crossAxisAlignment: CrossAxisAlignment.center, 33 | children: [ 34 | _renderPushNextWidget(context), 35 | SizedBox(height: 8), 36 | _renderCallMPJSWidget(context), 37 | ], 38 | ), 39 | ); 40 | } 41 | 42 | Widget _renderPushNextWidget(BuildContext context) { 43 | return GestureDetector( 44 | onTap: () { 45 | Navigator.of(context).pushNamed('/second'); 46 | }, 47 | child: Container( 48 | width: 200, 49 | height: 100, 50 | color: Colors.blue, 51 | child: Center( 52 | child: Text( 53 | 'Hello, MPFlutter!', 54 | style: TextStyle( 55 | fontSize: 18, 56 | fontWeight: FontWeight.bold, 57 | color: Colors.white, 58 | ), 59 | ), 60 | ), 61 | ), 62 | ); 63 | } 64 | 65 | Widget _renderCallMPJSWidget(BuildContext context) { 66 | return GestureDetector( 67 | onTap: () async { 68 | final result = await MPJS.evalTemplate('foo', ['MPFlutter']); 69 | print(result); 70 | }, 71 | child: Container( 72 | width: 200, 73 | height: 100, 74 | color: Colors.pink, 75 | child: Center( 76 | child: Text( 77 | 'Hello, MPJS!', 78 | style: TextStyle( 79 | fontSize: 18, 80 | fontWeight: FontWeight.bold, 81 | color: Colors.white, 82 | ), 83 | ), 84 | ), 85 | ), 86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/mpjs.config.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | const isMiniProgram = bool.fromEnvironment( 4 | 'isMiniProgram', 5 | defaultValue: false, 6 | ); 7 | 8 | const isWeb = bool.fromEnvironment( 9 | 'isWeb', 10 | defaultValue: false, 11 | ); 12 | 13 | final templates = { 14 | 'foo': isMiniProgram 15 | ? '''function(arg0) { 16 | wx.showModal({title: 'alert', content: (new Date()).toString()}); 17 | return 'foo result: ' + arg0; 18 | } 19 | ''' 20 | : '''function(arg0) { 21 | alert(new Date().toString()); 22 | return 'foo result: ' + arg0; 23 | }''', 24 | }; 25 | 26 | void main(List args) { 27 | print(json.encode(templates)); 28 | } 29 | -------------------------------------------------------------------------------- /lib/second_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:mpcore/mpcore.dart'; 3 | 4 | class MySecondPage extends StatelessWidget { 5 | @override 6 | Widget build(BuildContext context) { 7 | return MPScaffold( 8 | name: 'Second', 9 | body: Center( 10 | child: GestureDetector( 11 | onTap: () { 12 | if (Navigator.of(context).canPop()) { 13 | Navigator.of(context).pop(); 14 | } 15 | }, 16 | child: Container( 17 | width: 200, 18 | height: 200, 19 | color: Colors.pink, 20 | child: Center( 21 | child: Text( 22 | 'Tap here', 23 | style: TextStyle(fontSize: 18, color: Colors.white), 24 | ), 25 | ), 26 | ), 27 | ), 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mpflutter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export PUB_HOSTED_URL=https://pub.mpflutter.com 4 | flutter $1 $2 $3 $4 $5 $6 $7 $8 $9 -------------------------------------------------------------------------------- /mpflutter.bat: -------------------------------------------------------------------------------- 1 | set PUB_HOSTED_URL=https://pub.mpflutter.com 2 | flutter %1 %2 %3 %4 %5 %6 %7 %8 %9 -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: db4766341bd8ecb66556f31ab891a5d596ef829221993531bd64a8e6342f0cda 9 | url: "https://pub.mpflutter.com" 10 | source: hosted 11 | version: "2.8.2" 12 | characters: 13 | dependency: transitive 14 | description: 15 | name: characters 16 | sha256: "9a462645329872f11cf4709edf4ae7b092bf60d3d6b6a072a39ab18311e04bb7" 17 | url: "https://pub.mpflutter.com" 18 | source: hosted 19 | version: "1.1.0" 20 | charcode: 21 | dependency: transitive 22 | description: 23 | name: charcode 24 | sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 25 | url: "https://pub.mpflutter.com" 26 | source: hosted 27 | version: "1.3.1" 28 | cli_dialog: 29 | dependency: transitive 30 | description: 31 | name: cli_dialog 32 | sha256: "47530e1c4a6190662954cefce196d35143c4ed2675ea697d6e542790bdef5641" 33 | url: "https://pub.mpflutter.com" 34 | source: hosted 35 | version: "0.5.0" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "6d4193120997ecfd09acf0e313f13dc122b119e5eca87ef57a7d065ec9183762" 41 | url: "https://pub.mpflutter.com" 42 | source: hosted 43 | version: "1.15.0" 44 | crypto: 45 | dependency: transitive 46 | description: 47 | name: crypto 48 | sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c 49 | url: "https://pub.mpflutter.com" 50 | source: hosted 51 | version: "3.0.1" 52 | dart_console: 53 | dependency: transitive 54 | description: 55 | name: dart_console 56 | sha256: eba6af9ef2172df11ce49053d16b868de82684bc02123baf21bd8c9b1850a106 57 | url: "https://pub.mpflutter.com" 58 | source: hosted 59 | version: "1.0.0" 60 | ffi: 61 | dependency: transitive 62 | description: 63 | name: ffi 64 | sha256: "35d0f481d939de0d640b3db9a7aa36a52cd22054a798a73b4f50bdad5ce12678" 65 | url: "https://pub.mpflutter.com" 66 | source: hosted 67 | version: "1.1.2" 68 | file: 69 | dependency: transitive 70 | description: 71 | name: file 72 | sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" 73 | url: "https://pub.mpflutter.com" 74 | source: hosted 75 | version: "6.1.4" 76 | flutter: 77 | dependency: "direct main" 78 | description: 79 | name: flutter 80 | sha256: b5252b8ea8975dfb145a490535580cc1132f2b74de33c45a339af6f3ae0296e8 81 | url: "https://pub.mpflutter.com" 82 | source: hosted 83 | version: "1.3.0" 84 | flutter_web_plugins: 85 | dependency: "direct main" 86 | description: 87 | name: flutter_web_plugins 88 | sha256: bfcdbeb555f842da7b1c4b0c73fccc6b8eb49bde40fe1fdd31597f9ae94a12fa 89 | url: "https://pub.mpflutter.com" 90 | source: hosted 91 | version: "1.3.0" 92 | glob: 93 | dependency: transitive 94 | description: 95 | name: glob 96 | sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" 97 | url: "https://pub.mpflutter.com" 98 | source: hosted 99 | version: "2.1.1" 100 | http: 101 | dependency: transitive 102 | description: 103 | name: http 104 | sha256: "8c76b1ebdd6a9098e917ffb56c291fbcce8e862da3a01a776a2a772122259c62" 105 | url: "https://pub.mpflutter.com" 106 | source: hosted 107 | version: "0.13.1" 108 | http_parser: 109 | dependency: transitive 110 | description: 111 | name: http_parser 112 | sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 113 | url: "https://pub.mpflutter.com" 114 | source: hosted 115 | version: "4.0.0" 116 | meta: 117 | dependency: transitive 118 | description: 119 | name: meta 120 | sha256: "98a7492d10d7049ea129fd4e50f7cdd2d5008522b1dfa1148bbbc542b9dd21f7" 121 | url: "https://pub.mpflutter.com" 122 | source: hosted 123 | version: "1.3.0" 124 | mime_type: 125 | dependency: transitive 126 | description: 127 | name: mime_type 128 | sha256: "2ad6e67d3d2de9ac0f8ef5352d998fd103cb21351ae8c02fb0c78b079b37d275" 129 | url: "https://pub.mpflutter.com" 130 | source: hosted 131 | version: "1.0.0" 132 | mp_build_tools: 133 | dependency: "direct main" 134 | description: 135 | name: mp_build_tools 136 | sha256: db5705f48c5e41e58d5bfd87961edea3b1a3357f60b59375485d738a72c4f3ba 137 | url: "https://pub.mpflutter.com" 138 | source: hosted 139 | version: "1.3.0" 140 | mpcore: 141 | dependency: "direct main" 142 | description: 143 | name: mpcore 144 | sha256: a0ff7c6a29d758a04a5310b5f725f77f7babddf1d1efefbfdfb42ea4cd61109a 145 | url: "https://pub.mpflutter.com" 146 | source: hosted 147 | version: "1.3.0" 148 | path: 149 | dependency: transitive 150 | description: 151 | name: path 152 | sha256: "240ed0e9bd73daa2182e33c4efc68c7dd53c7c656f3da73515a2d163e151412d" 153 | url: "https://pub.mpflutter.com" 154 | source: hosted 155 | version: "1.8.1" 156 | pedantic: 157 | dependency: transitive 158 | description: 159 | name: pedantic 160 | sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" 161 | url: "https://pub.mpflutter.com" 162 | source: hosted 163 | version: "1.11.1" 164 | source_span: 165 | dependency: transitive 166 | description: 167 | name: source_span 168 | sha256: d77dbb9d0b7469d91e42d352334b2b4bbd5cec4379542f1bdb630db368c4d9f6 169 | url: "https://pub.mpflutter.com" 170 | source: hosted 171 | version: "1.8.2" 172 | string_scanner: 173 | dependency: transitive 174 | description: 175 | name: string_scanner 176 | sha256: dd11571b8a03f7cadcf91ec26a77e02bfbd6bbba2a512924d3116646b4198fc4 177 | url: "https://pub.mpflutter.com" 178 | source: hosted 179 | version: "1.1.0" 180 | term_glyph: 181 | dependency: transitive 182 | description: 183 | name: term_glyph 184 | sha256: a88162591b02c1f3a3db3af8ce1ea2b374bd75a7bb8d5e353bcfbdc79d719830 185 | url: "https://pub.mpflutter.com" 186 | source: hosted 187 | version: "1.2.0" 188 | typed_data: 189 | dependency: transitive 190 | description: 191 | name: typed_data 192 | sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" 193 | url: "https://pub.mpflutter.com" 194 | source: hosted 195 | version: "1.3.0" 196 | usage: 197 | dependency: transitive 198 | description: 199 | name: usage 200 | sha256: "5ecee630efef684f48c9b9e688974cf16e746c092f4bd97d847468d036a73cbd" 201 | url: "https://pub.mpflutter.com" 202 | source: hosted 203 | version: "4.0.2" 204 | vector_math: 205 | dependency: transitive 206 | description: 207 | name: vector_math 208 | sha256: "15cdf04f64b23c2ff6b999c193cbb0c928698dc602ed73075b9562527fcb5bb5" 209 | url: "https://pub.mpflutter.com" 210 | source: hosted 211 | version: "2.1.0" 212 | vm_service: 213 | dependency: transitive 214 | description: 215 | name: vm_service 216 | sha256: "422eda09e2a50eb27fe9eca2c897d624cea7fa432a8442e1ea1a10d50a4321ab" 217 | url: "https://pub.mpflutter.com" 218 | source: hosted 219 | version: "6.2.0" 220 | watcher: 221 | dependency: transitive 222 | description: 223 | name: watcher 224 | sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" 225 | url: "https://pub.mpflutter.com" 226 | source: hosted 227 | version: "1.1.0" 228 | win32: 229 | dependency: transitive 230 | description: 231 | name: win32 232 | sha256: "4379fb664564ca239dcb05f6e03e27096b1e2ad09d35d89786a2f8966ecfc8a9" 233 | url: "https://pub.mpflutter.com" 234 | source: hosted 235 | version: "2.6.0" 236 | sdks: 237 | dart: ">=3.0.0 <4.0.0" 238 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mpflutter_template 2 | description: A new MPFlutter project. 3 | publish_to: "none" 4 | version: 1.0.0+1 5 | playbox: 6 | name: 模板工程 7 | description: 8 | icon: school 9 | background: blue 10 | environment: 11 | sdk: ">=2.18.0 <4.0.0" 12 | dependencies: 13 | flutter: "1.3.0" 14 | flutter_web_plugins: "1.3.0" 15 | mpcore: "1.3.0" 16 | mp_build_tools: "1.3.0" 17 | dependency_overrides: 18 | flutter: "1.3.0" 19 | mpcore: "1.3.0" 20 | flutter_web_plugins: "1.3.0" 21 | -------------------------------------------------------------------------------- /scripts/build_mpk.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_mpk.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/build_plugins.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_plugins.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/build_weapp.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_weapp.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/build_web.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/build_web.dart' as builder; 2 | 3 | main(List args) { 4 | builder.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /scripts/help.dart: -------------------------------------------------------------------------------- 1 | import 'package:mp_build_tools/help.dart' as help; 2 | 3 | main(List args) { 4 | help.main(args); 5 | } 6 | -------------------------------------------------------------------------------- /weapp/app.js: -------------------------------------------------------------------------------- 1 | // app.js 2 | App({ 3 | onLaunch() { 4 | const { MPEnv, Engine, WXApp } = require("./mpdom.min"); 5 | MPEnv.platformAppInstance = this; 6 | try { 7 | require("./plugins.min"); 8 | } catch (error) {} 9 | const engine = new Engine(); 10 | var dev = true; 11 | if (dev) { 12 | engine.initWithDebuggerServerAddr("127.0.0.1:9898"); 13 | } else { 14 | engine.initWithCodeBlock(Engine.codeBlockWithFile("./main.dart.js")); 15 | } 16 | const app = new WXApp("pages/index/index", engine); 17 | this.app = app; 18 | engine.start(); 19 | try { 20 | // 为了防止 main.dart.js 和 mp-custom-components.js 被微信开发者工具过滤,在这里 require 一下。 21 | require("./main.dart"); 22 | require("./mp-custom-components"); 23 | } catch (error) {} 24 | }, 25 | globalData: {}, 26 | }); 27 | -------------------------------------------------------------------------------- /weapp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": ["pages/index/index", "pages/index/share"], 3 | "window": { 4 | "backgroundTextStyle": "light", 5 | "navigationBarBackgroundColor": "#fff", 6 | "navigationBarTitleText": "", 7 | "navigationBarTextStyle": "black" 8 | }, 9 | "style": "v2", 10 | "sitemapLocation": "sitemap.json", 11 | "darkmode": true, 12 | "newFramework": { 13 | "enabled": true, 14 | "minimumSupportedVersion": "5.12" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /weapp/app.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpflutter/mpflutter_template/e6f66366585e5de09956800eb46a48cf9a27dc45/weapp/app.wxss -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/base.js: -------------------------------------------------------------------------------- 1 | module.exports=function(e){var t={};function a(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(n,o,function(t){return e[t]}.bind(null,o));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}([function(e,t){e.exports=require('../miniprogram-render/index')},function(e,t,a){const n=a(0),{cache:o,tool:i}=n.$$adapter;function r(e){e.detail||(e.detail={}),void 0!==e.markerId&&(e.detail.markerId=e.markerId),void 0!==e.controlId&&(e.detail.controlId=e.controlId),void 0!==e.name&&(e.detail.name=e.name),void 0!==e.longitude&&(e.detail.longitude=e.longitude),void 0!==e.latitude&&(e.detail.latitude=e.latitude)}function l(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e=void 0}return e}function s(e,t,a){const n=e.getAttribute(t);return"false"!==n&&(!(!a||void 0!==n)||!!n)}function c(e,t,a){const n=parseFloat(e.getAttribute(t));return isNaN(n)?a:n}function d(e){e.currentTarget&&e.currentTarget.dataset.privateNodeId||(e.currentTarget=e.currentTarget||{dataset:{}},e.currentTarget.dataset.privateNodeId=e.target.dataset.privateNodeId)}const g={"cover-image":{wxCompName:"cover-image",properties:[{name:"src",get(e){const t=o.getWindow(e.$$pageId);return e.src?i.completeURL(e.src,t.location.origin,!0):""}}],handles:{onCoverImageLoad(e){this.callSingleEvent("load",e)},onCoverImageError(e){this.callSingleEvent("error",e)}}},"cover-view":{wxCompName:"cover-view",properties:[{name:"scrollTop",get:e=>e.getAttribute("scroll-top")},{name:"forceInCover",get:e=>void 0!==e.getAttribute("marker-id")},{name:"markerId",get:e=>e.getAttribute("marker-id")}]},"match-media":{wxCompName:"match-media",properties:[{name:"minWidth",get:e=>+e.getAttribute("min-width")||0},{name:"maxWidth",get:e=>+e.getAttribute("max-width")||0},{name:"width",get:e=>+e.getAttribute("width")||0},{name:"minHeight",get:e=>+e.getAttribute("min-height")||0},{name:"maxHeight",get:e=>+e.getAttribute("max-height")||0},{name:"height",get:e=>+e.getAttribute("height")||0},{name:"orientation",get:e=>e.getAttribute("orientation")||""}]},"movable-area":{wxCompName:"movable-area",properties:[{name:"scaleArea",get:e=>s(e,"scale-area")}]},"page-container":{wxCompName:"page-container",properties:[{name:"show",get:e=>s(e,"show")},{name:"duration",get:e=>c(e,"duration",300)},{name:"zIndex",get:e=>c(e,"z-index",100)},{name:"overlay",get:e=>s(e,"overlay",!0)},{name:"position",get:e=>e.getAttribute("position")||"bottom"},{name:"round",get:e=>s(e,"round")},{name:"closeOnSlideDown",get:e=>s(e,"close-on-slideDown")},{name:"overlayStyle",get:e=>e.getAttribute("overlay-style")||""},{name:"customStyle",get:e=>e.getAttribute("custom-style")||""}],handles:{onPageContainerBeforeenter(e){this.callSingleEvent("beforeenter",e);const t=this.getDomNodeFromEvt(e);t&&t.$$setAttributeWithoutUpdate("show",!0)},onPageContainerEnter(e){this.callSingleEvent("enter",e)},onPageContainerAfterenter(e){this.callSingleEvent("afterenter",e)},onPageContainerBeforeleave(e){this.callSingleEvent("beforeleave",e);const t=this.getDomNodeFromEvt(e);t&&t.$$setAttributeWithoutUpdate("show",!1)},onPageContainerLeave(e){this.callSingleEvent("leave",e)},onPageContainerAfterleave(e){this.callSingleEvent("afterleave",e)},onPageContainerClickoverlay(e){this.callSingleEvent("clickoverlay",e)}}},"scroll-view":{wxCompName:"scroll-view",properties:[{name:"scrollX",get:e=>s(e,"scroll-x")},{name:"scrollY",get:e=>s(e,"scroll-y")},{name:"upperThreshold",get:e=>e.getAttribute("upper-threshold")||"50"},{name:"lowerThreshold",get:e=>e.getAttribute("lower-threshold")||"50"},{name:"scrollTop",canBeUserChanged:!0,get:e=>e.getAttribute("scroll-top")||""},{name:"scrollLeft",canBeUserChanged:!0,get:e=>e.getAttribute("scroll-left")||""},{name:"scrollWithAnimation",get:e=>s(e,"scroll-with-animation")},{name:"enableBackToTop",get:e=>s(e,"enable-back-to-top")},{name:"enableFlex",get:e=>s(e,"enable-flex")},{name:"scrollAnchoring",get:e=>s(e,"scroll-anchoring")},{name:"refresherEnabled",get:e=>s(e,"refresher-enabled")},{name:"refresherThreshold",get:e=>e.getAttribute("refresher-threshold")||"45"},{name:"refresherDefaultStyle",get:e=>e.getAttribute("refresher-default-style")||"black"},{name:"refresherBackground",get:e=>e.getAttribute("refresher-background")||"#FFF"},{name:"refresherTriggered",get(e){const t=s(e,"refresher-triggered");return!s(e,"refresher-enabled")&&t?(e.$$setAttributeWithoutUpdate("refresher-triggered",!1),!1):t}}],handles:{onScrollViewScrolltoupper(e){this.callSingleEvent("scrolltoupper",e)},onScrollViewScrolltolower(e){this.callSingleEvent("scrolltolower",e)},onScrollViewScroll(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("scroll-into-view",""),t.$$setAttributeWithoutUpdate("scroll-top",e.detail.scrollTop),t.$$setAttributeWithoutUpdate("scroll-left",e.detail.scrollLeft),t.$$setAttributeWithoutUpdate("scroll-width",e.detail.scrollWidth),t.$$setAttributeWithoutUpdate("scroll-height",e.detail.scrollHeight),t._oldValues=t._oldValues||{},t._oldValues.scrollIntoView="",t._oldValues.scrollTop=e.detail.scrollTop||"",t._oldValues.scrollLeft=e.detail.scrollLeft||"",t._oldValues.scrollWidth=e.detail.scrollWidth||"",t._oldValues.scrollHeight=e.detail.scrollHeight||"",this.callSimpleEvent("scroll",e))},onScrollViewRefresherPulling(e){this.callSingleEvent("refresherpulling",e)},onScrollViewRefresherRefresh(e){const t=this.getDomNodeFromEvt(e);t&&t.setAttribute("refresher-triggered",!0),this.callSingleEvent("refresherrefresh",e)},onScrollViewRefresherRestore(e){const t=this.getDomNodeFromEvt(e);t&&t.setAttribute("refresher-triggered",!1),this.callSingleEvent("refresherrestore",e)},onScrollViewRefresherAbort(e){const t=this.getDomNodeFromEvt(e);t&&t.setAttribute("refresher-triggered",!1),this.callSingleEvent("refresherabort",e)}}},swiper:{wxCompName:"swiper",properties:[{name:"indicatorDots",get:e=>s(e,"indicator-dots")},{name:"indicatorColor",get:e=>e.getAttribute("indicator-color")||"rgba(0, 0, 0, .3)"},{name:"indicatorActiveColor",get:e=>e.getAttribute("indicator-active-color")||"#000000"},{name:"autoplay",get:e=>s(e,"autoplay")},{name:"current",canBeUserChanged:!0,get:e=>+e.getAttribute("current")||0},{name:"interval",get:e=>c(e,"interval",5e3)},{name:"duration",get:e=>c(e,"duration",500)},{name:"circular",get:e=>s(e,"circular")},{name:"vertical",get:e=>s(e,"vertical")},{name:"previousMargin",get:e=>e.getAttribute("previous-margin")||"0px"},{name:"nextMargin",get:e=>e.getAttribute("next-margin")||"0px"},{name:"snapToEdge",get:e=>s(e,"snap-to-edge")},{name:"displayMultipleItems",get:e=>c(e,"display-multiple-items",1)},{name:"skipHiddenItemLayout",get:e=>s(e,"skip-hidden-item-layout")},{name:"easingFunction",get:e=>e.getAttribute("easing-function")||"default"}],handles:{onSwiperChange(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("current",e.detail.current),t._oldValues=t._oldValues||{},t._oldValues.current=e.detail.current,this.callSingleEvent("change",e))},onSwiperTransition(e){this.callSingleEvent("transition",e)},onSwiperAnimationfinish(e){this.callSingleEvent("animationfinish",e)}}},view:{wxCompName:"view",properties:[{name:"hoverClass",get:e=>e.getAttribute("hover-class")||"none"},{name:"hoverStopPropagation",get:e=>s(e,"hover-stop-propagation")},{name:"hoverStartTime",get:e=>c(e,"hover-start-time",50)},{name:"hoverStayTime",get:e=>c(e,"hover-stay-time",400)}]},icon:{wxCompName:"icon",properties:[{name:"type",get:e=>e.getAttribute("type")||""},{name:"size",get:e=>e.getAttribute("size")||"23"},{name:"color",get:e=>e.getAttribute("color")||""}]},progress:{wxCompName:"progress",properties:[{name:"percent",get:e=>+e.getAttribute("percent")||0},{name:"showInfo",get:e=>s(e,"show-info")},{name:"borderRadius",get:e=>e.getAttribute("border-radius")||"0"},{name:"fontSize",get:e=>e.getAttribute("font-size")||"16"},{name:"strokeWidth",get:e=>e.getAttribute("stroke-width")||"6"},{name:"color",get:e=>e.getAttribute("color")||"#09BB07"},{name:"activeColor",get:e=>e.getAttribute("active-color")||"#09BB07"},{name:"backgroundColor",get:e=>e.getAttribute("background-color")||"#EBEBEB"},{name:"active",get:e=>s(e,"active")},{name:"activeMode",get:e=>e.getAttribute("active-mode")||"backwards"},{name:"duration",get:e=>c(e,"duration",30)}],handles:{onProgressActiveEnd(e){this.callSingleEvent("activeend",e)}}},"rich-text":{wxCompName:"rich-text",properties:[{name:"nodes",get(e){const t=e.getAttribute("nodes"),a=l(t);return void 0!==a?a:t||[]}},{name:"space",get:e=>e.getAttribute("space")||""}]},text:{wxCompName:"text",properties:[{name:"selectable",get:e=>s(e,"selectable")},{name:"userSelect",get:e=>s(e,"user-select")},{name:"space",get:e=>e.getAttribute("space")||""},{name:"decode",get:e=>s(e,"decode")}]},button:{wxCompName:"button",properties:[{name:"size",get:e=>e.getAttribute("size")||"default"},{name:"type",get:e=>e.getAttribute("type")||void 0},{name:"plain",get:e=>s(e,"plain")},{name:"disabled",get:e=>s(e,"disabled")},{name:"loading",get:e=>s(e,"loading")},{name:"formType",get:e=>e.getAttribute("form-type")||""},{name:"openType",get:e=>e.getAttribute("open-type")||""},{name:"hoverClass",get:e=>e.getAttribute("hover-class")||"button-hover"},{name:"hoverStopPropagation",get:e=>s(e,"hover-stop-propagation")},{name:"hoverStartTime",get:e=>c(e,"hover-start-time",20)},{name:"hoverStayTime",get:e=>c(e,"hover-stay-time",70)},{name:"lang",get:e=>e.getAttribute("lang")||"en"},{name:"sessionFrom",get:e=>e.getAttribute("session-from")||""},{name:"sendMessageTitle",get:e=>e.getAttribute("send-message-title")||""},{name:"sendMessagePath",get:e=>e.getAttribute("send-message-path")||""},{name:"sendMessageImg",get:e=>e.getAttribute("send-message-img")||""},{name:"appParameter",get:e=>e.getAttribute("app-parameter")||""},{name:"showMessageCard",get:e=>s(e,"show-message-card")},{name:"businessId",get:e=>e.getAttribute("business-id")||""},{name:"shareType",get:e=>c(e,"share-type",27)},{name:"shareMode",get:e=>e.getAttribute("share-mode")}],handles:{onButtonGetUserInfo(e){this.callSingleEvent("getuserinfo",e)},onButtonContact(e){this.callSingleEvent("contact",e)},onButtonGetPhoneNumber(e){this.callSingleEvent("getphonenumber",e)},onButtonError(e){this.callSingleEvent("error",e)},onButtonOpenSetting(e){this.callSingleEvent("opensetting",e)},onButtonLaunchApp(e){this.callSingleEvent("launchapp",e)},onButtonGetRealnameAuthInfo(e){this.callSingleEvent("getrealnameauthinfo",e)},onButtonChooseAvatar(e){this.callSingleEvent("chooseavatar",e)}}},editor:{wxCompName:"editor",properties:[{name:"readOnly",get:e=>s(e,"read-only")},{name:"placeholder",get:e=>e.getAttribute("placeholder")||""},{name:"showImgSize",get:e=>s(e,"show-img-size")},{name:"showImgToolbar",get:e=>s(e,"show-img-toolbar")},{name:"showImgResize",get:e=>s(e,"show-img-resize")}],handles:{onEditorReady(e){this.callSingleEvent("ready",e)},onEditorFocus(e){this.callSingleEvent("focus",e)},onEditorBlur(e){this.callSingleEvent("blur",e)},onEditorInput(e){this.callSingleEvent("input",e)},onEditorStatusChange(e){this.callSingleEvent("statuschange",e)}}},form:{wxCompName:"form",properties:[{name:"reportSubmit",get:e=>s(e,"report-submit")},{name:"reportSubmitTimeout",get:e=>+e.getAttribute("report-submit-timeout")||0}],handles:{onFormSubmit(e){const t=this.getDomNodeFromEvt(e);t&&(t._formId=e.detail.formId)},onFormReset(){}}},INPUT:{wxCompName:"input",properties:[{name:"value",canBeUserChanged:!0,get:e=>e.value||""},{name:"type",get(e){const t=e.type||"text";return"password"!==t?t:"text"}},{name:"password",get:e=>"password"===e.type||s(e,"password")},{name:"placeholder",get:e=>e.placeholder},{name:"placeholderStyle",get:e=>e.getAttribute("placeholder-style")||""},{name:"placeholderClass",get:e=>e.getAttribute("placeholder-class")||"input-placeholder"},{name:"disabled",get:e=>e.disabled},{name:"maxlength",get:e=>c(e,"maxlength",140)},{name:"cursorSpacing",get:e=>+e.getAttribute("cursor-spacing")||0},{name:"autoFocus",get:e=>s(e,"autofocus")},{name:"focus",canBeUserChanged:!0,get:e=>s(e,"focus")},{name:"confirmType",get:e=>e.getAttribute("confirm-type")||"done"},{name:"confirmHold",get:e=>s(e,"confirm-hold")},{name:"cursor",get:e=>c(e,"cursor",-1)},{name:"selectionStart",get:e=>c(e,"selection-start",-1)},{name:"selectionEnd",get:e=>c(e,"selection-end",-1)},{name:"adjustPosition",get:e=>s(e,"adjust-position",!0)},{name:"holdKeyboard",get:e=>s(e,"hold-keyboard")},{name:"checked",canBeUserChanged:!0,get:e=>s(e,"checked")},{name:"color",get:e=>e.getAttribute("color")||"#09BB07"}],handles:{onInputInput(e){const t=this.getDomNodeFromEvt(e);if(!t)return;const a=""+e.detail.value;t.$$setAttributeWithoutUpdate("value",a),t._oldValues=t._oldValues||{},t._oldValues.value=a,this.callEvent("input",e)},onInputFocus(e){const t=this.getDomNodeFromEvt(e);t&&(t._inputOldValue=t.value,t.$$setAttributeWithoutUpdate("focus",!0),t._oldValues=t._oldValues||{},t._oldValues.focus=!0,this.callSimpleEvent("focus",e),this.callEvent("focusin",e))},onInputBlur(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("focus",!1),t._oldValues=t._oldValues||{},t._oldValues.focus=!1,void 0!==t._inputOldValue&&t.value!==t._inputOldValue&&(t._inputOldValue=void 0,this.callEvent("change",e)),this.callSimpleEvent("blur",e),this.callEvent("focusout",e))},onInputConfirm(e){this.callSimpleEvent("confirm",e)},onInputKeyBoardHeightChange(e){this.callSingleEvent("keyboardheightchange",e)},onRadioChange(e){const t=this.getDomNodeFromEvt(e);if(!t)return;const a=o.getWindow(this.pageId),n=e.detail.value,i=t.name;if(n===t.value){t.$$setAttributeWithoutUpdate("checked",!0),t._oldValues=t._oldValues||{},t._oldValues.checked=!0;const n=a.document.querySelectorAll(`input[name=${i}]`)||[];for(const e of n)"radio"===e.type&&e!==t&&(e.setAttribute("checked",!1),e._oldValues=e._oldValues||{},e._oldValues.checked=!1);this.callEvent("$$radioChange",e)}this.callEvent("input",e),this.callEvent("change",e)},onCheckboxChange(e){const t=this.getDomNodeFromEvt(e);if(!t)return;(e.detail.value||[]).indexOf(t.value)>=0?(t.$$setAttributeWithoutUpdate("checked",!0),t._oldValues=t._oldValues||{},t._oldValues.checked=!0):(t.$$setAttributeWithoutUpdate("checked",!1),t._oldValues=t._oldValues||{},t._oldValues.checked=!1),this.callEvent("$$checkboxChange",e),this.callEvent("input",e),this.callEvent("change",e)}}},picker:{wxCompName:"picker",properties:[{name:"headerText",get:e=>e.getAttribute("header-text")||""},{name:"mode",get:e=>e.getAttribute("mode")||"selector"},{name:"disabled",get:e=>s(e,"disabled")},{name:"range",get(e){if("SELECT"===e.tagName)return e.options.map(e=>({label:e.label,value:e.value}));let t=e.getAttribute("range");if("string"==typeof t){const e=l(t);t=void 0!==e?e:t.split(",")}return void 0!==t?t:[]}},{name:"rangeKey",get:e=>"SELECT"===e.tagName?"label":e.getAttribute("range-key")||""},{name:"value",canBeUserChanged:!0,get(e){if("SELECT"===e.tagName)return+e.selectedIndex||0;const t=e.getAttribute("mode")||"selector";let a=e.getAttribute("value");if("selector"===t)return+a||0;if("multiSelector"===t){if("string"==typeof a){const e=l(a);a=void 0!==e?e:a.split(","),a=a.map(e=>parseInt(e,10))}return a||[]}if("time"===t)return a||"";if("date"===t)return a||"0";if("region"===t){if("string"==typeof a){const e=l(a);a=void 0!==e?e:a.split(",")}return a||[]}return a}},{name:"start",get:e=>e.getAttribute("start")||""},{name:"end",get:e=>e.getAttribute("end")||""},{name:"fields",get:e=>e.getAttribute("fields")||"day"},{name:"customItem",get:e=>e.getAttribute("custom-item")||""}],handles:{onPickerChange(e){const t=this.getDomNodeFromEvt(e);if(!t)return;let a=e.detail.value;t._oldValues=t._oldValues||{},t._oldValues.value=a,"SELECT"===t.tagName?(a=+a,t.$$setAttributeWithoutUpdate("value",t.options[a]&&t.options[a].value||""),t.$$setAttributeWithoutUpdate("selectedIndex",a),t.$$resetOptions(),this.callEvent("change",e)):(t.$$setAttributeWithoutUpdate("value",a),this.callSingleEvent("change",e))},onPickerColumnChange(e){this.callSingleEvent("columnchange",e)},onPickerCancel(e){this.callSingleEvent("cancel",e)}}},"picker-view":{wxCompName:"picker-view",properties:[{name:"value",canBeUserChanged:!0,get(e){let t=e.getAttribute("value");if("string"==typeof t){const e=l(t);t=void 0!==e?e:t.split(","),t=t.map(e=>parseInt(e,10))}return void 0!==t?t:[]}},{name:"indicatorStyle",get:e=>e.getAttribute("indicator-style")||""},{name:"indicatorClass",get:e=>e.getAttribute("indicator-class")||""},{name:"maskStyle",get:e=>e.getAttribute("mask-style")||""},{name:"maskClass",get:e=>e.getAttribute("mask-class")||""}],handles:{onPickerViewChange(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("value",e.detail.value),t._oldValues=t._oldValues||{},t._oldValues.value=e.detail.value,this.callSingleEvent("change",e))},onPickerViewPickstart(e){this.callSingleEvent("pickstart",e)},onPickerViewPickend(e){this.callSingleEvent("pickend",e)}}},slider:{wxCompName:"slider",properties:[{name:"min",get:e=>+e.getAttribute("min")||0},{name:"max",get:e=>c(e,"max",100)},{name:"step",get:e=>c(e,"step",1)},{name:"disabled",get:e=>s(e,"disabled")},{name:"value",canBeUserChanged:!0,get:e=>+e.getAttribute("value")||0},{name:"color",get:e=>e.getAttribute("color")||"#e9e9e9"},{name:"selectedColor",get:e=>e.getAttribute("selected-color")||"#1aad19"},{name:"activeColor",get:e=>e.getAttribute("active-color")||"#1aad19"},{name:"backgroundColor",get:e=>e.getAttribute("background-color")||"#e9e9e9"},{name:"blockSize",get:e=>c(e,"block-size",28)},{name:"blockColor",get:e=>e.getAttribute("block-color")||"#ffffff"},{name:"showValue",get:e=>s(e,"show-value")}],handles:{onSliderChange(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("value",e.detail.value),t._oldValues=t._oldValues||{},t._oldValues.value=e.detail.value,this.callSingleEvent("change",e))},onSliderChanging(e){this.callSingleEvent("changing",e)}}},switch:{wxCompName:"switch",properties:[{name:"checked",canBeUserChanged:!0,get:e=>s(e,"checked")},{name:"disabled",get:e=>s(e,"disabled")},{name:"type",get:e=>e.getAttribute("type")||"switch"},{name:"color",get:e=>e.getAttribute("color")||"#04BE02"}],handles:{onSwitchChange(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("checked",e.detail.value),t._oldValues=t._oldValues||{},t._oldValues.checked=e.detail.value,this.callSingleEvent("change",e))}}},TEXTAREA:{wxCompName:"textarea",properties:[{name:"value",canBeUserChanged:!0,get:e=>e.value||""},{name:"placeholder",get:e=>e.placeholder},{name:"placeholderStyle",get:e=>e.getAttribute("placeholder-style")||""},{name:"placeholderClass",get:e=>e.getAttribute("placeholder-class")||"textarea-placeholder"},{name:"disabled",get:e=>e.disabled},{name:"maxlength",get:e=>c(e,"maxlength",140)},{name:"autoFocus",get:e=>s(e,"autofocus")},{name:"focus",canBeUserChanged:!0,get:e=>s(e,"focus")},{name:"autoHeight",get:e=>s(e,"auto-height")},{name:"fixed",get:e=>s(e,"fixed")},{name:"cursorSpacing",get:e=>+e.getAttribute("cursor-spacing")||0},{name:"cursor",get:e=>c(e,"cursor",-1)},{name:"showConfirmBar",get:e=>s(e,"show-confirm-bar",!0)},{name:"selectionStart",get:e=>c(e,"selection-start",-1)},{name:"selectionEnd",get:e=>c(e,"selection-end",-1)},{name:"adjustPosition",get:e=>s(e,"adjust-position",!0)},{name:"holdKeyboard",get:e=>s(e,"hold-keyboard")},{name:"disableDefaultPadding",get:e=>s(e,"disable-default-padding")}],handles:{onTextareaFocus(e){const t=this.getDomNodeFromEvt(e);t&&(t._textareaOldValue=t.value,t.$$setAttributeWithoutUpdate("focus",!0),t._oldValues=t._oldValues||{},t._oldValues.focus=!0,this.callSimpleEvent("focus",e),this.callEvent("focusin",e))},onTextareaBlur(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("focus",!1),t._oldValues=t._oldValues||{},t._oldValues.focus=!1,void 0!==t._textareaOldValue&&t.value!==t._textareaOldValue&&(t._textareaOldValue=void 0,this.callEvent("change",e)),this.callSimpleEvent("blur",e),this.callEvent("focusout",e))},onTextareaLineChange(e){this.callSingleEvent("linechange",e)},onTextareaInput(e){const t=this.getDomNodeFromEvt(e);if(!t)return;const a=""+e.detail.value;t.$$setAttributeWithoutUpdate("value",a),t._oldValues=t._oldValues||{},t._oldValues.value=a,this.callEvent("input",e)},onTextareaConfirm(e){this.callSimpleEvent("confirm",e)},onTextareaKeyBoardHeightChange(e){this.callSingleEvent("keyboardheightchange",e)}}},navigator:{wxCompName:"navigator",properties:[{name:"target",get:e=>e.getAttribute("target")||"self"},{name:"url",get:e=>e.getAttribute("url")||""},{name:"openType",get:e=>e.getAttribute("open-type")||"navigate"},{name:"delta",get:e=>c(e,"delta",1)},{name:"appId",get:e=>e.getAttribute("app-id")||""},{name:"path",get:e=>e.getAttribute("path")||""},{name:"extraData",get:e=>e.getAttribute("extra-data")||{}},{name:"version",get:e=>e.getAttribute("version")||"release"},{name:"hoverClass",get:e=>e.getAttribute("hover-class")||"navigator-hover"},{name:"hoverStopPropagation",get:e=>s(e,"hover-stop-propagation")},{name:"hoverStartTime",get:e=>c(e,"hover-start-time",50)},{name:"hoverStayTime",get:e=>c(e,"hover-stay-time",600)}],handles:{onNavigatorSuccess(e){this.callSingleEvent("success",e)},onNavigatorFail(e){this.callSingleEvent("fail",e)},onNavigatorComplete(e){this.callSingleEvent("complete",e)}}},camera:{wxCompName:"camera",properties:[{name:"mode",get:e=>e.getAttribute("mode")||"normal"},{name:"resolution",get:e=>e.getAttribute("resolution")||"medium"},{name:"devicePosition",get:e=>e.getAttribute("device-position")||"back"},{name:"flash",get:e=>e.getAttribute("flash")||"auto"},{name:"frameSize",get:e=>e.getAttribute("frame-size")||"medium"}],handles:{onCameraStop(e){this.callSingleEvent("stop",e)},onCameraError(e){this.callSingleEvent("error",e)},onCameraInitDone(e){this.callSingleEvent("initdone",e)},onCameraScanCode(e){this.callSingleEvent("scancode",e)}}},image:{wxCompName:"image",properties:[{name:"renderingMode",get:e=>e.getAttribute("rendering-mode")||""},{name:"src",get(e){const t=o.getWindow(e.$$pageId);return e.src?i.completeURL(e.src,t.location.origin,!0):""}},{name:"mode",get:e=>e.getAttribute("mode")||"scaleToFill"},{name:"webp",get:e=>s(e,"webp")},{name:"lazyLoad",get:e=>s(e,"lazy-load")},{name:"showMenuByLongpress",get:e=>s(e,"show-menu-by-longpress")}],handles:{onImageLoad(e){this.callSingleEvent("load",e)},onImageError(e){this.callSingleEvent("error",e)}}},"live-player":{wxCompName:"live-player",properties:[{name:"src",get(e){const t=o.getWindow(e.$$pageId);return e.src?i.completeURL(e.src,t.location.origin,!0):""}},{name:"mode",get:e=>e.getAttribute("mode")||"live"},{name:"autoplay",get:e=>s(e,"autoplay")},{name:"muted",get:e=>s(e,"muted")},{name:"orientation",get:e=>e.getAttribute("orientation")||"vertical"},{name:"objectFit",get:e=>e.getAttribute("object-fit")||"contain"},{name:"backgroundMute",get:e=>s(e,"background-mute")},{name:"minCache",get:e=>c(e,"min-cache",1)},{name:"maxCache",get:e=>c(e,"max-cache",3)},{name:"soundMode",get:e=>e.getAttribute("sound-mode")||"speaker"},{name:"autoPauseIfNavigate",get:e=>s(e,"auto-pause-if-navigate",!0)},{name:"autoPauseIfOpenNative",get:e=>s(e,"auto-pause-if-open-native",!0)},{name:"pictureInPictureMode",get(e){let t=e.getAttribute("picture-in-picture-mode");if("string"==typeof t){const e=l(t);t=void 0!==e?e:t.split(","),Array.isArray(t)&&1===t.length&&(t=""+t[0])}return t}}],handles:{onLivePlayerStateChange(e){this.callSingleEvent("statechange",e)},onLivePlayerFullScreenChange(e){this.callSingleEvent("fullscreenchange",e)},onLivePlayerNetStatus(e){this.callSingleEvent("netstatus",e)},onLivePlayerAudioVolumeNotify(e){this.callSingleEvent("audiovolumenotify",e)},onLivePlayerEnterPictureInPicture(e){this.callSingleEvent("enterpictureinpicture",e)},onLivePlayerLeavePictureInPicture(e){this.callSingleEvent("leavepictureinpicture",e)}}},"live-pusher":{wxCompName:"live-pusher",properties:[{name:"url",get(e){const t=o.getWindow(e.$$pageId),a=e.getAttribute("url");return a?i.completeURL(a,t.location.origin,!0):""}},{name:"mode",get:e=>e.getAttribute("mode")||"RTC"},{name:"autopush",get:e=>s(e,"autopush")},{name:"muted",get:e=>s(e,"muted")},{name:"enableCamera",get:e=>s(e,"enable-camera",!0)},{name:"autoFocus",get:e=>s(e,"auto-focus",!0)},{name:"orientation",get:e=>e.getAttribute("orientation")||"vertical"},{name:"beauty",get:e=>+e.getAttribute("beauty")||0},{name:"whiteness",get:e=>+e.getAttribute("whiteness")||0},{name:"aspect",get:e=>e.getAttribute("aspect")||"9:16"},{name:"minBitrate",get:e=>c(e,"min-bitrate",200)},{name:"maxBitrate",get:e=>c(e,"max-bitrate",1e3)},{name:"waitingImage",get:e=>e.getAttribute("waiting-image")||""},{name:"waitingImageHash",get:e=>e.getAttribute("waiting-image-hash")||""},{name:"zoom",get:e=>s(e,"zoom")},{name:"devicePosition",get:e=>e.getAttribute("device-position")||"front"},{name:"backgroundMute",get:e=>s(e,"background-mute")},{name:"mirror",get:e=>s(e,"mirror")},{name:"remoteMirror",get:e=>s(e,"remote-mirror")},{name:"localMirror",get:e=>e.getAttribute("local-mirror")||"auto"},{name:"audioReverbType",get:e=>+e.getAttribute("audio-reverb-type")||0},{name:"enableMic",get:e=>s(e,"enable-mic",!0)},{name:"enableAgc",get:e=>s(e,"enable-agc")},{name:"enableAns",get:e=>s(e,"enable-ans")},{name:"audioVolumeType",get:e=>e.getAttribute("audio-volume-type")||"voicecall"},{name:"videoWidth",get:e=>c(e,"video-width",360)},{name:"videoHeight",get:e=>c(e,"video-height",640)}],handles:{onLivePusherStateChange(e){this.callSingleEvent("statechange",e)},onLivePusherNetStatus(e){this.callSingleEvent("netstatus",e)},onLivePusherError(e){this.callSingleEvent("error",e)},onLivePusherBgmStart(e){this.callSingleEvent("bgmstart",e)},onLivePusherBgmProgress(e){this.callSingleEvent("bgmprogress",e)},onLivePusherBgmComplete(e){this.callSingleEvent("bgmcomplete",e)}}},VIDEO:{wxCompName:"video",properties:[{name:"src",get(e){const t=o.getWindow(e.$$pageId);return e.src?i.completeURL(e.src,t.location.origin,!0):""}},{name:"duration",get:e=>+e.getAttribute("duration")||0},{name:"controls",get:e=>e.controls},{name:"danmuList",get(e){const t=e.getAttribute("danmu-list");return void 0!==t?t:[]}},{name:"danmuBtn",get:e=>s(e,"danmu-btn")},{name:"enableDanmu",get:e=>s(e,"enable-danmu")},{name:"autoplay",get:e=>e.autoplay},{name:"loop",get:e=>e.loop},{name:"muted",get:e=>e.muted},{name:"initialTime",get:e=>+e.getAttribute("initial-time")||0},{name:"direction",get:e=>c(e,"direction",-1)},{name:"showProgress",get:e=>s(e,"show-progress",!0)},{name:"showFullscreenBtn",get:e=>s(e,"show-fullscreen-btn",!0)},{name:"showPlayBtn",get:e=>s(e,"show-play-btn",!0)},{name:"showCenterPlayBtn",get:e=>s(e,"show-center-play-btn",!0)},{name:"enableProgressGesture",get:e=>s(e,"enable-progress-gesture",!0)},{name:"objectFit",get:e=>e.getAttribute("object-fit")||"contain"},{name:"poster",get(e){const t=o.getWindow(e.$$pageId);return e.poster?i.completeURL(e.poster,t.location.origin,!0):""}},{name:"showMuteBtn",get:e=>s(e,"show-mute-btn")},{name:"title",get:e=>e.getAttribute("title")||""},{name:"playBtnPosition",get:e=>e.getAttribute("play-btn-position")||"bottom"},{name:"enablePlayGesture",get:e=>s(e,"enable-play-gesture")},{name:"autoPauseIfNavigate",get:e=>s(e,"auto-pause-if-navigate",!0)},{name:"autoPauseIfOpenNative",get:e=>s(e,"auto-pause-if-open-native",!0)},{name:"vslideGesture",get:e=>s(e,"vslide-gesture")},{name:"vslideGestureInFullscreen",get:e=>s(e,"vslide-gesture-in-fullscreen",!0)},{name:"adUnitId",get:e=>e.getAttribute("ad-unit-id")||""},{name:"posterForCrawler",get:e=>e.getAttribute("poster-for-crawler")||""},{name:"showCastingButton",get:e=>s(e,"show-casting-button")},{name:"pictureInPictureMode",get(e){let t=e.getAttribute("picture-in-picture-mode");if("string"==typeof t){const e=l(t);t=void 0!==e?e:t.split(","),Array.isArray(t)&&1===t.length&&(t=""+t[0])}return t}},{name:"pictureInPictureShowProgress",get:e=>s(e,"picture-in-picture-show-progress")},{name:"enableAutoRotation",get:e=>s(e,"enable-auto-rotation")},{name:"showScreenLockButton",get:e=>s(e,"show-screen-lock-button")}],handles:{onVideoPlay(e){this.callSingleEvent("play",e)},onVideoPause(e){this.callSingleEvent("pause",e)},onVideoEnded(e){this.callSingleEvent("ended",e)},onVideoTimeUpdate(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("currentTime",e.detail.currentTime),this.callSingleEvent("timeupdate",e))},onVideoFullScreenChange(e){this.callSingleEvent("fullscreenchange",e)},onVideoWaiting(e){this.callSingleEvent("waiting",e)},onVideoError(e){this.callSingleEvent("error",e)},onVideoProgress(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("buffered",e.detail.buffered),this.callSingleEvent("progress",e))},onVideoLoadedMetaData(e){this.callSingleEvent("loadedmetadata",e)},onVideoControlsToggle(e){this.callSingleEvent("controlstoggle",e)},onVideoEnterPictureInPicture(e){this.callSingleEvent("enterpictureinpicture",e)},onVideoLeavePictureInPicture(e){this.callSingleEvent("leavepictureinpicture",e)}}},"voip-room":{wxCompName:"voip-room",properties:[{name:"openid",get:e=>e.getAttribute("openid")||""},{name:"mode",get:e=>e.getAttribute("mode")||"camera"},{name:"devicePosition",get:e=>e.getAttribute("device-position")||"front"}],handles:{onVoipRoomError(e){this.callSingleEvent("error",e)}}},map:{wxCompName:"map",properties:[{name:"longitude",canBeUserChanged:!0,get:e=>c(e,"longitude",116.46)},{name:"latitude",canBeUserChanged:!0,get:e=>c(e,"latitude",39.92)},{name:"scale",canBeUserChanged:!0,get:e=>c(e,"scale",16)},{name:"markers",get(e){const t=l(e.getAttribute("markers"));return void 0!==t?t:[]}},{name:"polyline",get(e){const t=l(e.getAttribute("polyline"));return void 0!==t?t:[]}},{name:"circles",get(e){const t=l(e.getAttribute("circles"));return void 0!==t?t:[]}},{name:"controls",get(e){const t=l(e.getAttribute("controls"));return void 0!==t?t:[]}},{name:"includePoints",get(e){const t=l(e.getAttribute("include-points"));return void 0!==t?t:[]}},{name:"showLocation",get:e=>s(e,"show-location")},{name:"polygons",get(e){const t=l(e.getAttribute("polygons"));return void 0!==t?t:[]}},{name:"subkey",get:e=>e.getAttribute("subkey")||""},{name:"layerStyle",get:e=>c(e,"layer-style",1)},{name:"rotate",canBeUserChanged:!0,get:e=>+e.getAttribute("rotate")||0},{name:"skew",canBeUserChanged:!0,get:e=>+e.getAttribute("skew")||0},{name:"enable3D",get:e=>s(e,"enable-3D")},{name:"showCompass",get:e=>s(e,"show-compass")},{name:"showScale",get:e=>s(e,"show-scale")},{name:"enableOverlooking",get:e=>s(e,"enable-overlooking")},{name:"enableZoom",get:e=>s(e,"enable-zoom",!0)},{name:"enableScroll",get:e=>s(e,"enable-scroll",!0)},{name:"enableRotate",get:e=>s(e,"enable-rotate")},{name:"enableSatellite",get:e=>s(e,"enable-satellite")},{name:"enableTraffic",get:e=>s(e,"enable-traffic")},{name:"setting",get:e=>l(e.getAttribute("setting"))||{}}],handles:{onMapTap(e){this.callSingleEvent("tap",e)},onMapMarkerTap(e){r(e),this.callSingleEvent("markertap",e)},onMapLabelTap(e){r(e),this.callSingleEvent("labeltap",e)},onMapControlTap(e){r(e),this.callSingleEvent("controltap",e)},onMapCalloutTap(e){r(e),this.callSingleEvent("callouttap",e)},onMapUpdated(e){this.callSingleEvent("updated",e)},onMapRegionChange(e){const t=this.getDomNodeFromEvt(e);t&&(e.detail.causedBy||(e.detail.causedBy=e.causedBy),"end"!==e.type&&"end"!==e.detail.type||(t._oldValues=t._oldValues||{},t._oldValues.longitude=e.detail.centerLocation&&e.detail.centerLocation.longitude,t._oldValues.latitude=e.detail.centerLocation&&e.detail.centerLocation.latitude,t._oldValues.scale=e.detail.scale,t._oldValues.rotate=e.detail.rotate,t._oldValues.skew=e.detail.skew),this.callSingleEvent("regionchange",e))},onMapPoiTap(e){r(e),this.callSingleEvent("poitap",e)}}},CANVAS:{wxCompName:"canvas",properties:[{name:"type",get:e=>e.getAttribute("type")||""},{name:"canvasId",get:e=>e.getAttribute("canvas-id")||""},{name:"disableScroll",get:e=>s(e,"disable-scroll")},{name:"disableEvent",get:e=>s(e,"disable-event")}],handles:{onCanvasTouchStart(e){d(e),this.callSingleEvent("canvastouchstart",e),this.onTouchStart(e)},onCanvasTouchMove(e){d(e),this.callSingleEvent("canvastouchmove",e),this.onTouchMove(e)},onCanvasTouchEnd(e){d(e),this.callSingleEvent("canvastouchend",e),this.onTouchEnd(e)},onCanvasTouchCancel(e){d(e),this.callSingleEvent("canvastouchcancel",e),this.onTouchCancel(e)},onCanvasLongTap(e){d(e),this.callSingleEvent("longtap",e)},onCanvasError(e){d(e),this.callSingleEvent("error",e)}}},ad:{wxCompName:"ad",properties:[{name:"unitId",get:e=>e.getAttribute("unit-id")||""},{name:"adIntervals",get:e=>+e.getAttribute("ad-intervals")||0},{name:"adType",get:e=>e.getAttribute("ad-type")||"banner"},{name:"adTheme",get:e=>e.getAttribute("ad-theme")||"white"}],handles:{onAdLoad(e){this.callSingleEvent("load",e)},onAdError(e){this.callSingleEvent("error",e)},onAdClose(e){this.callSingleEvent("close",e)}}},"ad-custom":{wxCompName:"ad-custom",properties:[{name:"unitId",get:e=>e.getAttribute("unit-id")||""},{name:"adIntervals",get:e=>+e.getAttribute("ad-intervals")||0}],handles:{onAdCustomLoad(e){this.callSingleEvent("load",e)},onAdCustomError(e){this.callSingleEvent("error",e)}}},"official-account":{wxCompName:"official-account",handles:{onOfficialAccountLoad(e){this.callSingleEvent("load",e)},onOfficialAccountError(e){this.callSingleEvent("error",e)}}},"open-data":{wxCompName:"open-data",properties:[{name:"type",get:e=>e.getAttribute("type")||""},{name:"openGid",get:e=>e.getAttribute("open-gid")||""},{name:"lang",get:e=>e.getAttribute("lang")||"en"},{name:"defaultText",get:e=>e.getAttribute("default-text")||""},{name:"defaultAvatar",get:e=>e.getAttribute("default-avatar")||""}],handles:{onOpenDataError(e){this.callSingleEvent("error",e)}}},"web-view":{wxCompName:"web-view",properties:[{name:"src",get(e){const t=o.getWindow(e.$$pageId);return e.src?i.completeURL(e.src,t.location.origin,!0):""}}],handles:{onWebviewMessage(e){this.callSingleEvent("message",e)},onWebviewLoad(e){this.callSingleEvent("load",e)},onWebviewError(e){this.callSingleEvent("error",e)}}},capture:{wxCompName:"capture"},catch:{wxCompName:"catch"},animation:{wxCompName:"animation",properties:[{name:"animation",get:e=>l(e.getAttribute("animation"))}]},"not-support":{wxCompName:"not-support"}};g.SELECT=g.picker;const u={"movable-view":{properties:[{name:"direction",get:e=>e.getAttribute("direction")||"none"},{name:"inertia",get:e=>s(e,"inertia")},{name:"outOfBounds",get:e=>s(e,"out-of-bounds")},{name:"x",canBeUserChanged:!0,get:e=>+e.getAttribute("x")||0},{name:"y",canBeUserChanged:!0,get:e=>+e.getAttribute("y")||0},{name:"damping",get:e=>c(e,"damping",20)},{name:"friction",get:e=>c(e,"friction",2)},{name:"disabled",get:e=>s(e,"disabled")},{name:"scale",get:e=>s(e,"scale")},{name:"scaleMin",get:e=>c(e,"scale-min",.5)},{name:"scaleMax",get:e=>c(e,"scale-max",10)},{name:"scaleValue",canBeUserChanged:!0,get:e=>c(e,"scale-value",1)},{name:"animation",get:e=>s(e,"animation",!0)}],handles:{onMovableViewChange(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("x",e.detail.x),t.$$setAttributeWithoutUpdate("y",e.detail.y),t._oldValues=t._oldValues||{scaleValue:c(t,"scale-value",1)},t._oldValues.x=e.detail.x,t._oldValues.y=e.detail.y,this.callSingleEvent("change",e))},onMovableViewScale(e){const t=this.getDomNodeFromEvt(e);t&&(t.$$setAttributeWithoutUpdate("x",e.detail.x),t.$$setAttributeWithoutUpdate("y",e.detail.y),t.$$setAttributeWithoutUpdate("scale-value",e.detail.scale),t._oldValues=t._oldValues||{},t._oldValues.x=e.detail.x,t._oldValues.y=e.detail.y,t._oldValues.scaleValue=e.detail.scale,this.callSingleEvent("scale",e))},onMovableViewHtouchmove(e){this.callSingleEvent("htouchmove",e)},onMovableViewVtouchmove(e){this.callSingleEvent("vtouchmove",e)}}},"swiper-item":{properties:[{name:"itemId",get:e=>e.getAttribute("item-id")||""}]}},m=Object.keys(g),h={},p={},v={};m.forEach(e=>{const{wxCompName:t,properties:a,handles:n}=g[e];h[e]=t,p[t]=a||[],n&&Object.assign(v,n)}),Object.keys(u).forEach(e=>{const{handles:t}=u[e];t&&Object.assign(v,t)}),e.exports={wxCompData:p,wxCompHandles:v,wxCompNameMap:h,wxSubComponentMap:u}},function(e,t,a){const n=a(0),o=a(3),i=a(1),{cache:r,Event:l,EventTarget:s,tool:c}=n.$$adapter,{USE_TEMPLATE:d}=o,{wxCompHandles:g,wxCompNameMap:u}=i;let m=10,h=!1;var p;p="undefined"==typeof Behavior?function(e){return Object.assign(e,e.methods),{mixins:[{onInit(){e.created()},didMount(){e.dataset=this.props,e.setData=this.setData,e.attached()},didUnmount(){e.detached()}},{data:e.data},{props:{privateNodeId:"",privatePageId:""}},{methods:e.methods}]}}:Behavior,e.exports=p({behaviors:[],properties:{inCover:{type:Boolean,value:!1},privateNodeId:{type:String},privatePageId:{type:String}},data:{wxCompName:"",wxCustomCompName:"",childNodes:[]},created(){const e=r.getConfig(),t=+e.optimization.domSubTreeLevel;t>=1&&t<=10&&(m=t),h="original"===e.optimization.setDataMode},attached(){const e=this.dataset.privateNodeId||this.data.privateNodeId,t=this.dataset.privatePageId||this.data.privatePageId,a={};if(this.nodeId=e,this.pageId=t,this.domNode=r.getNode(t,e),!this.domNode)return;this.document=r.getDocument(t),this.onChildNodesUpdate=c.throttle(this.onChildNodesUpdate.bind(this)),this.domNode.$$clearEvent("$$childNodesUpdate",{$$namespace:"root"}),this.domNode.addEventListener("$$childNodesUpdate",this.onChildNodesUpdate,{$$namespace:"root"}),this.onSelfNodeUpdate=c.throttle(this.onSelfNodeUpdate.bind(this)),this.domNode.$$clearEvent("$$domNodeUpdate",{$$namespace:"root"}),this.domNode.addEventListener("$$domNodeUpdate",this.onSelfNodeUpdate,{$$namespace:"root"}),this.init(a);const n=o.filterNodes(this.domNode,m-1,this);a.childNodes=o.dealWithLeafAndSimple(n,this.onChildNodesUpdate),a.wxCompName&&(this.domNode._wxComponent=this),Object.keys(a).length&&o.setData(this,a)},detached(){this.nodeId=null,this.pageId=null,this.domNode=null,this.document=null},methods:{init(e){const t=this.domNode,a=t.tagName;if(-1===d.indexOf(a)&&-1===d.indexOf(t.behavior)&&"WX-COMPONENT"===a){e.wxCompName=t.behavior;const a=u[e.wxCompName];a?o.checkComponentAttr(a,t,e):console.warn(`value "${e.wxCompName}" is not supported for wx-component's behavior`)}},onChildNodesUpdate(){if(!this.pageId||!this.nodeId)return;const e=o.filterNodes(this.domNode,m-1,this);if(h)o.checkDiffChildNodes(e,this.data.childNodes)&&o.setData(this,{childNodes:o.dealWithLeafAndSimple(e,this.onChildNodesUpdate)});else{const t={count:0},a=o.dealWithLeafAndSimple(e,this.onChildNodesUpdate);if(this.data.childNodes.length){o.getDiffChildNodes(a,this.data.childNodes,t,"childNodes")?o.setData(this,{childNodes:a}):t.count&&(delete t.count,o.setData(this,t))}else o.setData(this,{childNodes:a})}},onSelfNodeUpdate(){if(!this.pageId||!this.nodeId)return;const e=this.domNode,t=this.data,a=e.tagName;if(-1===d.indexOf(a)&&-1===d.indexOf(e.behavior)&&"WX-COMPONENT"===a){const a={},n=u[e.behavior];t.wxCompName!==e.behavior&&(a.wxCompName=e.behavior),n&&o.checkComponentAttr(n,e,a,t),Object.keys(a)&&o.setData(this,a)}},callSingleEvent(e,t){const a=this.getDomNodeFromEvt(t);if(!a)return;const n=r.getWindow(this.pageId);n&&a.$$trigger(e,{event:new l({timeStamp:n.performance.now(),touches:t&&t.touches,changedTouches:t&&t.changedTouches,name:e,target:a,eventPhase:l.AT_TARGET,detail:t&&t.detail,$$extra:t&&t.extra}),currentTarget:a})},callSimpleEvent(e,t,a){(a=a||this.getDomNodeFromEvt(t))&&s.$$process(a,new l({touches:t.touches,changedTouches:t.changedTouches,name:e,target:a,eventPhase:l.AT_TARGET,detail:t&&t.detail,$$extra:t&&t.extra,bubbles:!1}))},callEvent(e,t,a){const n=this.getDomNodeFromEvt(t),i=t;if(n&&(s.$$process(n,e,t,a,(t,a,n)=>{if(setTimeout(()=>{if(a.$$preventDefault)return;const e=r.getWindow(this.pageId);if("A"!==t.tagName||"click"!==a.type||n)if("LABEL"!==t.tagName||"click"!==a.type||n){if(("BUTTON"===t.tagName||"WX-COMPONENT"===t.tagName&&"button"===t.behavior)&&"click"===a.type&&!n){const a="BUTTON"===t.tagName?t.getAttribute("type"):t.getAttribute("form-type"),n=t.getAttribute("form"),i=n?e.document.getElementById(n):o.findParentNode(t,"FORM");if(!i)return;if("submit"!==a&&"reset"!==a)return;const r=i.querySelectorAll("input[name]"),l=i.querySelectorAll("textarea[name]"),s=i.querySelectorAll("wx-component[behavior=switch]").filter(e=>!!e.getAttribute("name")),c=i.querySelectorAll("wx-component[behavior=slider]").filter(e=>!!e.getAttribute("name")),d=i.querySelectorAll("wx-component[behavior=picker]").filter(e=>!!e.getAttribute("name")),g=i.querySelectorAll("wx-component[behavior=picker-view]").filter(e=>!!e.getAttribute("name"));if("submit"===a){const e={};r.length&&r.forEach(t=>{"radio"===t.type?t.checked&&(e[t.name]=t.value):"checkbox"===t.type?(e[t.name]=e[t.name]||[],t.checked&&e[t.name].push(t.value)):e[t.name]=t.value}),l.length&&l.forEach(t=>e[t.getAttribute("name")]=t.value),s.length&&s.forEach(t=>e[t.getAttribute("name")]=!!t.getAttribute("checked")),c.length&&c.forEach(t=>e[t.getAttribute("name")]=+t.getAttribute("value")||0),(d.length||g.length)&&[].concat(d,g).forEach(t=>{let a=t.getAttribute("value");if("string"==typeof a)try{a=JSON.parse(a)}catch(e){}e[t.getAttribute("name")]=a});const t={value:e};i._formId&&(t.formId=i._formId,i._formId=null),this.callSimpleEvent("submit",{detail:t,extra:{$$from:"button"}},i)}else"reset"===a&&(r.length&&r.forEach(e=>{"radio"===e.type||"checkbox"===e.type?e.setAttribute("checked",!1):e.setAttribute("value","")}),l.length&&l.forEach(e=>e.setAttribute("value","")),s.length&&s.forEach(e=>e.setAttribute("checked",void 0)),c.length&&c.forEach(e=>e.setAttribute("value",void 0)),d.length&&d.forEach(e=>e.setAttribute("value",void 0)),g.length&&g.forEach(e=>e.setAttribute("value",void 0)),this.callSimpleEvent("reset",{extra:{$$from:"button"}},i))}}else{const n=t.getAttribute("for");let i;if(n?i=e.document.getElementById(n):(i=t.querySelector("input"),i||(i=t.querySelector("wx-component[behavior=switch]")),i||(i=t.querySelector("wx-component[behavior=button]"))),!i||i.getAttribute("disabled"))return;if("INPUT"===i.tagName){if(o.checkEventAccessDomNode(a,i,t))return;const n=i.type;if("radio"===n){i.setAttribute("checked",!0);const t=i.name;if(t){const a=e.document.querySelectorAll(`input[name=${t}]`)||[];for(const e of a)"radio"===e.type&&e!==i&&e.setAttribute("checked",!1);this.callSimpleEvent("change",{detail:{value:i.value}},i)}else{const t={dataset:{pageId:this.pageId,privateNodeId:i.$$nodeId}};this.callEvent("$$radioChange",{target:t,currentTarget:t,timeStamp:e.performance.now(),touches:a.touches,changedTouches:a.changedTouches,detail:{}})}}else if("checkbox"===n){const t=i.name;if(i.setAttribute("checked",!i.checked),t)this.callSimpleEvent("change",{detail:{value:i.checked?[i.value]:[]}},i);else{const t={dataset:{pageId:this.pageId,privateNodeId:i.$$nodeId}};this.callEvent("$$checkboxChange",{target:t,currentTarget:t,timeStamp:e.performance.now(),touches:a.touches,changedTouches:a.changedTouches,detail:{}})}}else i.focus()}else if("WX-COMPONENT"===i.tagName){if(o.checkEventAccessDomNode(a,i,t))return;const n=i.behavior;if("switch"===n){const e=!i.getAttribute("checked");i.setAttribute("checked",e),this.callSimpleEvent("change",{detail:{value:e}},i)}else if("button"===n){const t={dataset:{pageId:this.pageId,privateNodeId:i.$$nodeId}},n={target:t,currentTarget:t,timeStamp:e.performance.now(),touches:a.touches,changedTouches:a.changedTouches,detail:{}};this.callEvent("click",n,{button:0});r.getConfig().runtime.disableMpEvent||this.callEvent("tap",n)}}}else{const a=t.href,n=t.target;if(!a||-1!==a.indexOf("javascript"))return;"_blank"===n?e.open(a):e.location.href=a}},0),"touchend"===e&&t._needCallTap){t._needCallTap=!1;const e={target:i.target,currentTarget:i.currentTarget};this.callEvent("click",e,{button:0});r.getConfig().runtime.disableMpEvent||this.callEvent("tap",e)}}),"longpress"===e)){let t=!0,a=n.parentNode;for(;a;)(a.$$hasEventHandler(e)||"function"==typeof a["on"+e])&&(t=!1),a=a.parentNode;n._needCallTap=t}},onTouchStart(e){this.document&&this.document.$$checkEvent(e)&&this.callEvent("touchstart",e)},onTouchMove(e){this.document&&this.document.$$checkEvent(e)&&this.callEvent("touchmove",e)},onTouchEnd(e){this.document&&this.document.$$checkEvent(e)&&this.callEvent("touchend",e)},onTouchCancel(e){this.document&&this.document.$$checkEvent(e)&&this.callEvent("touchcancel",e)},onTap(e){if(this.document&&this.document.$$checkEvent(e)){this.callEvent("click",e,{button:0});r.getConfig().runtime.disableMpEvent||this.callEvent("tap",e)}},onLongPress(e){if(this.document&&this.document.$$checkEvent(e)){r.getConfig().runtime.disableMpEvent||this.callEvent("longpress",e)}},onImgLoad(e){this.callSingleEvent("load",e)},onImgError(e){this.callSingleEvent("error",e)},onCaptureTouchStart(e){this.callSingleEvent("touchstart",e)},onCaptureTouchMove(e){this.callSingleEvent("touchmove",e)},onCaptureTouchEnd(e){this.callSingleEvent("touchend",e)},onCaptureTouchCancel(e){this.callSingleEvent("touchcancel",e)},onCaptureTap(e){this.callSingleEvent("click",e);r.getConfig().runtime.disableMpEvent||this.callSingleEvent("tap",e)},onCaptureLongPress(e){r.getConfig().runtime.disableMpEvent||this.callSingleEvent("longpress",e)},onTransitionEnd(e){this.callEvent("transitionend",e)},onAnimationStart(e){this.callEvent("animationstart",e)},onAnimationIteration(e){this.callEvent("animationiteration",e)},onAnimationEnd(e){this.callEvent("animationend",e)},getDomNodeFromEvt(e){if(!e)return;const t=this.pageId,a=e.currentTarget&&e.currentTarget.dataset.privateNodeId||this.nodeId;return r.getNode(t,a)},...g}})},function(e,t,a){const n=a(0),o=a(1),{cache:i,tool:r}=n.$$adapter,{wxCompData:l,wxCompNameMap:s,wxSubComponentMap:c}=o,d=["nodeId","pageId","id","className","style","isImage","src","mode","webp","lazyLoad","showMenuByLongpress","useTemplate","extra","compName","isLeaf","content","isSimple"],g=["nodeId","pageId","content"],u=["WX-COMPONENT","WX-CUSTOM-COMPONENT"],m=["swiper","movable-area","picker-view"],h=["swiper-item","movable-view","picker-view-column"],p=["IFRAME",...u],v=["cover-image","cover-view","match-media","movable-area","movable-view","page-container","scroll-view","swiper","swiper-item","icon","progress","rich-text","text","button","editor","form","INPUT","picker","SELECT","picker-view","picker-view-column","slider","switch","TEXTAREA","navigator","camera","image","live-player","live-pusher","VIDEO","voip-room","map","CANVAS","ad","ad-custom","official-account","open-data","web-view","capture","catch","animation","not-support","WX-CUSTOM-COMPONENT"],b=Object.prototype.hasOwnProperty;function f(e,t,a){if("number"==typeof e&&"number"==typeof t)return parseInt(1e3*e,10)===parseInt(1e3*t,10);if(a){if(void 0===t)return!e;if(void 0===e)return!t}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return e===t;const n=Array.isArray(e),o=Array.isArray(t);if(n&&o){if(e.length!==t.length)return!1;for(let n=0,o=e.length;ne.value===t.value);r=-1!==e?[r[e]]:[]}return r.map(t=>{const i=t.$$domInfo;if("element"!==i.type&&"text"!==i.type)return;if(i.slot)return;if(t._wxComponent=o,i.className="element"===i.type?`h5-${i.tagName} node-${i.nodeId} ${i.className||""}`:"",i.domNode=t,u.indexOf(t.tagName)>=0){if("wx-component"===i.tagName&&-1!==h.indexOf(t.behavior)){i.compName=t.behavior,i.extra={hidden:t.getAttribute("hidden")||!1};const{properties:n}=c[t.behavior]||{};return n&&n.length&&n.forEach(({name:e,get:a,canBeUserChanged:n=!1})=>{const o=a(t);if(i.extra[e]=o,n){const a=t._oldValues;a&&!f(o,a[e],!0)&&(i.extra.forceUpdate=!0)}}),t.childNodes.length&&a>0&&(i.childNodes=e(t,a-1,o)),i}i.className=`h5-${i.tagName} ${"wx-component"===i.tagName?"wx-"+t.behavior:""}`,i.id="",i.style=""}i.isImage="element"===i.type&&"img"===i.tagName,i.isImage&&(i.src=t.src,i.mode=t.getAttribute("mode")||"",i.webp=!!t.getAttribute("webp"),i.lazyLoad=!!t.getAttribute("lazy-load"),i.showMenuByLongpress=!!t.getAttribute("show-menu-by-longpress"));let r="wx-component"===i.tagName?t.behavior:t.tagName;if(r=n.$$adapter.tool.isTagNameSupport(r)?r:"not-support",i.useTemplate=!i.isImage&&-1!==v.indexOf(r),i.useTemplate){const a=s[r],n={};a&&E(a,t,n,null,`h5-${i.tagName} ${"wx-component"===i.tagName?"wx-"+t.behavior:""}`),n.pageId=i.pageId,n.nodeId=i.nodeId,n.inCover=o.data.inCover,n.hasChildren=!!t.childNodes.length,i.extra=n;const l=m.indexOf(r);if(-1!==l){const a=e(t,"picker-view"===r?1:0)||[];n.childNodes=a.filter(e=>"element"===e.type&&e.compName===h[l]).map(e=>{const t=Object.assign({},e);return t.childNodes&&(t.childNodes=t.childNodes.map(e=>Object.assign({},e,{style:""}))),t})}if("map"===r||"scroll-view"===r){const e=t.childNodes.map(e=>{const t=e.$$domInfo;return{slot:t.slot,nodeId:t.nodeId,pageId:t.pageId,id:t.id,className:"element"===t.type?`h5-${t.tagName} node-${t.nodeId} ${t.className||""}`:"",style:t.style}}).filter(e=>!!e.slot);n.hasSlots=e.length,n.hasChildren=e.length"text"===e.$$domInfo.type?e.textContent:"").join("")),i.isSimple=!i.isImage&&!i.useTemplate&&!i.isLeaf&&"element"===i.type&&-1===p.indexOf(t.tagName)&&a>0,i.isSimple&&(i.content="",i.childNodes=e(t,a-1,o)),i}).filter(e=>!!e)},checkDiffChildNodes:function e(t,a){if(t.length!==a.length)return!0;for(let n=0,o=t.length;n100)return!0}else for(let i=0,r=t.length;i100)return!0}else{const s=t.type,c=a.type,u="element"===s?["childNodes"].concat(d):g,m=!r&&("element"===s||"text"===s),h=!r&&("element"===s||"text"===s);if(m&&h&&s===c)for(const r of u){const l=`${o}.${r}`,s="extra"===r?i.getNode(t.pageId,t.nodeId):null;if(e(t[r],a[r],n,l,"extra"===r,s))return!0}else if(m||h){if(n[o]=t,n.count++>100)return!0}else if(r&&t.forceUpdate){if(t.forceUpdate=!1,n[o]=t,n.count++>100)return!0}else{const i=Object.keys(t);for(const r of i){const i=`${o}.${r}`;if(b.call(a,r)){let o=a[r];l&&l._oldValues&&void 0!==l._oldValues[r]&&(o=l._oldValues[r]);if(e(t[r],o,n,i))return!0}else if(n[i]=t[r],n.count++>100)return!0}const r=Object.keys(a);for(const e of r){const a=`${o}.${e}`;if(!b.call(t,e)&&(n[a]=null,n.count++>100))return!0}}}}else if(!f(t,a)&&(t="undefined"===s?null:t,n[o]=t,n.count++>100))return!0},checkComponentAttr:E,dealWithLeafAndSimple:function e(t,a){return t&&t.length&&(t=t.map(t=>{const n=Object.assign({},t);return n.domNode.$$clearEvent("$$childNodesUpdate",{$$namespace:"child"}),(n.isImage||n.isLeaf||n.isSimple||n.useTemplate)&&n.domNode.addEventListener("$$childNodesUpdate",a,{$$namespace:"child"}),delete n.domNode,n.childNodes=e(n.childNodes,a)||[],n.extra&&n.extra.childNodes&&(n.extra.childNodes=e(n.extra.childNodes,a)||[]),n})),t},checkEventAccessDomNode:function(e,t,a){a=a||t.ownerDocument.body;let n=e.target;if(t===a)return!0;for(;n&&n!==a;){if(n===t)return!0;n=n.parentNode}return!1},findParentNode:function(e,t){const a=(e,t)=>!!e&&(e.tagName===t||"WX-COMPONENT"===e.tagName&&e.behavior===t.toLowerCase());let n=e.parentNode;if(a(n,t))return n;for(;n&&n.tagName!==t;)if(n=n.parentNode,a(n,t))return n;return null},compareVersion:function(e,t){e=e.split("."),t=t.split(".");const a=Math.max(e.length,t.length);for(;e.lengtho)return 1;if(a{const e=t.$$domInfo;return{slot:e.slot,nodeId:e.nodeId,pageId:e.pageId,id:e.id,className:"element"===e.type?`h5-${e.tagName} node-${e.nodeId} ${e.className||""}`:"",style:e.style}}).filter(t=>!!t.slot);s.hasSlots=l.length,s.slots=l}function setData(t,e){tool.setData?tool.setData(t,e):t.setData(e)}Component({properties:{kboneCustomComponentName:{type:String,value:""},privateNodeId:{type:String},privatePageId:{type:String}},options:{addGlobalClass:!0,virtualHost:!0},attached(){const t=this.dataset.privateNodeId||this.data.privateNodeId,e=this.dataset.privatePageId||this.data.privatePageId,o={};this.nodeId=t,this.pageId=e,this.domNode=cache.getNode(e,t);const n=cache.getConfig();this.compConfig=n.runtime&&n.runtime.usingComponents&&n.runtime.usingComponents[this.domNode.behavior]||{},this.onSelfNodeUpdate=tool.throttle(this.onSelfNodeUpdate.bind(this)),this.domNode.$$clearEvent("$$domNodeUpdate",{$$namespace:"proxy"}),this.domNode.addEventListener("$$domNodeUpdate",this.onSelfNodeUpdate,{$$namespace:"proxy"});const{events:s=[]}=this.compConfig;if(s.length)for(const t of s)this["on"+t]=e=>this.callSimpleEvent(t,e);checkComponentAttr(this.compConfig,this.domNode.behavior,this.domNode,o),Object.keys(o).length&&setData(this,o),this.domNode._wxCustomComponent=this.selectComponent(".node-"+this.domNode.$$nodeId)},detached(){this.nodeId=null,this.pageId=null,this.domNode._wxCustomComponent=null,this.domNode=null},methods:{onSelfNodeUpdate(){if(!this.pageId||!this.nodeId)return;const t={};checkComponentAttr(this.compConfig,this.domNode.behavior,this.domNode,t,this.data),setData(this,t),this.domNode._wxCustomComponent=this.selectComponent(".node-"+this.domNode.$$nodeId)},callSimpleEvent(t,e){const o=this.domNode;o&&o.$$trigger(t,{event:new Event({name:t,target:o,eventPhase:Event.AT_TARGET,detail:e&&e.detail}),currentTarget:o})}}}); -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.json: -------------------------------------------------------------------------------- 1 | {"component":true,"usingComponents":{}} -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.wxml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpflutter/mpflutter_template/e6f66366585e5de09956800eb46a48cf9a27dc45/weapp/kbone/miniprogram-element/custom-component/index.wxml -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/custom-component/index.wxss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpflutter/mpflutter_template/e6f66366585e5de09956800eb46a48cf9a27dc45/weapp/kbone/miniprogram-element/custom-component/index.wxss -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.js: -------------------------------------------------------------------------------- 1 | const base=require("./base");Component({behaviors:[base],options:{addGlobalClass:!0,virtualHost:!0}}); -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": { 4 | "element": "./index", 5 | "element-vhost": "./index-vhost", 6 | "custom-component": "./custom-component/index" 7 | }, 8 | "componentGenerics": { 9 | "custom-component": { 10 | "default": "./custom-component/index" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /weapp/kbone/miniprogram-element/index-vhost.wxml: -------------------------------------------------------------------------------- 1 |