From abb8dd499c18a061d8bf687350afead2c85a5d96 Mon Sep 17 00:00:00 2001 From: startheart <704469176@qq.com> Date: Mon, 27 May 2019 20:50:42 +0800 Subject: [PATCH] add preview --- README.md | 2 +- .../components/polyScroller/polyScroller.acss | 140 +- .../components/button/button.acss | 284 + .../components/button/button.axml | 4 + .../components/button/button.js | 4 + .../components/button/button.json | 4 + .../carousel-item/carousel-item.axml | 0 .../components/carousel-item/carousel-item.js | 4 + .../carousel-item/carousel-item.json | 4 + .../components/carousel/carousel.acss | 139 + .../components/carousel/carousel.axml | 0 .../components/carousel/carousel.js | 4 + .../components/carousel/carousel.json | 4 + .../components/checkbox/checkbox.acss | 200 + .../components/checkbox/checkbox.axml | 10 + .../components/checkbox/checkbox.js | 4 + .../components/checkbox/checkbox.json | 4 + .../components/input/input.acss | 152 + .../components/input/input.axml | 1 + .../components/input/input.js | 4 + .../components/input/input.json | 4 + .../components/layout/aside/aside.acss | 150 + .../components/layout/aside/aside.axml | 3 + .../components/layout/aside/aside.js | 4 + .../components/layout/aside/aside.json | 4 + .../components/layout/col/col.acss | 139 + .../components/layout/col/col.axml | 3 + .../components/layout/col/col.js | 4 + .../components/layout/col/col.json | 4 + .../layout/container/container.acss | 152 + .../layout/container/container.axml | 3 + .../components/layout/container/container.js | 4 + .../layout/container/container.json | 4 + .../components/layout/foot/foot.acss | 150 + .../components/layout/foot/foot.axml | 3 + .../components/layout/foot/foot.js | 4 + .../components/layout/foot/foot.json | 4 + .../components/layout/head/head.acss | 150 + .../components/layout/head/head.axml | 3 + .../components/layout/head/head.js | 4 + .../components/layout/head/head.json | 4 + .../components/layout/main/main.acss | 150 + .../components/layout/main/main.axml | 3 + .../components/layout/main/main.js | 4 + .../components/layout/main/main.json | 4 + .../components/layout/row/row.acss | 376 + .../components/layout/row/row.axml | 3 + .../components/layout/row/row.js | 4 + .../components/layout/row/row.json | 4 + .../components/list/list.acss | 139 + .../components/list/list.axml | 5 + .../components/list/list.js | 4 + .../components/list/list.json | 4 + .../components/page/page.acss | 149 + .../components/page/page.axml | 3 + .../components/page/page.js | 4 + .../components/page/page.json | 4 + .../components/radio/radio.acss | 198 + .../components/radio/radio.axml | 9 + .../components/radio/radio.js | 4 + .../components/radio/radio.json | 4 + .../components/richtext/richtext.acss | 149 + .../components/richtext/richtext.axml | 3 + .../components/richtext/richtext.js | 4 + .../components/richtext/richtext.json | 4 + .../components/scroller/scroller.acss | 139 + .../components/scroller/scroller.axml | 3 + .../components/scroller/scroller.js | 4 + .../components/scroller/scroller.json | 4 + .../components/switch/switch.acss | 154 + .../components/switch/switch.axml | 4 + .../components/switch/switch.js | 4 + .../components/switch/switch.json | 4 + .../components/textarea/textarea.acss | 153 + .../components/textarea/textarea.axml | 2 + .../components/textarea/textarea.js | 4 + .../components/textarea/textarea.json | 4 + .../components/video/video.acss | 139 + .../components/video/video.axml | 2 + .../components/video/video.js | 4 + .../components/video/video.json | 4 + dist/alipay/pages/index/index.acss | 611 +- dist/alipay/static/img/selected_520dcc8.png | Bin 0 -> 1721 bytes dist/alipay/static/img/unselected_4e38c39.png | Bin 0 -> 1672 bytes dist/alipay/static/js/app.js | 159 +- dist/alipay/static/js/common.js | 11614 ++++++++++++++- .../components/polyScroller/polyScroller.js | 321 +- dist/alipay/static/js/manifest.js | 104 +- .../components/button/button.js | 602 + .../components/carousel-item/carousel-item.js | 312 + .../components/carousel/carousel.js | 367 + .../components/checkbox/checkbox.js | 144 + .../components/input/input.js | 592 + .../components/layout/aside/aside.js | 61 + .../components/layout/col/col.js | 84 + .../components/layout/container/container.js | 70 + .../components/layout/foot/foot.js | 61 + .../components/layout/head/head.js | 61 + .../components/layout/main/main.js | 59 + .../components/layout/row/row.js | 89 + .../components/list/list.js | 471 + .../components/page/page.js | 740 + .../components/radio/radio.js | 137 + .../components/richtext/richtext.js | 434 + .../components/scroller/scroller.js | 524 + .../components/switch/switch.js | 366 + .../components/textarea/textarea.js | 465 + .../components/video/video.js | 407 + dist/alipay/static/js/pages/index/index.js | 51 +- .../components/polyScroller/polyScroller.css | 140 +- .../components/button/button.css | 284 + .../components/button/button.js | 4 + .../components/button/button.json | 4 + .../components/button/button.swan | 4 + .../components/carousel-item/carousel-item.js | 4 + .../carousel-item/carousel-item.json | 4 + .../carousel-item/carousel-item.swan | 0 .../components/carousel/carousel.css | 139 + .../components/carousel/carousel.js | 4 + .../components/carousel/carousel.json | 4 + .../components/carousel/carousel.swan | 0 .../components/checkbox/checkbox.css | 200 + .../components/checkbox/checkbox.js | 4 + .../components/checkbox/checkbox.json | 4 + .../components/checkbox/checkbox.swan | 10 + .../components/input/input.css | 152 + .../components/input/input.js | 4 + .../components/input/input.json | 4 + .../components/input/input.swan | 1 + .../components/layout/aside/aside.css | 150 + .../components/layout/aside/aside.js | 4 + .../components/layout/aside/aside.json | 4 + .../components/layout/aside/aside.swan | 3 + .../components/layout/col/col.css | 139 + .../components/layout/col/col.js | 4 + .../components/layout/col/col.json | 4 + .../components/layout/col/col.swan | 3 + .../components/layout/container/container.css | 152 + .../components/layout/container/container.js | 4 + .../layout/container/container.json | 4 + .../layout/container/container.swan | 3 + .../components/layout/foot/foot.css | 150 + .../components/layout/foot/foot.js | 4 + .../components/layout/foot/foot.json | 4 + .../components/layout/foot/foot.swan | 3 + .../components/layout/head/head.css | 150 + .../components/layout/head/head.js | 4 + .../components/layout/head/head.json | 4 + .../components/layout/head/head.swan | 3 + .../components/layout/main/main.css | 150 + .../components/layout/main/main.js | 4 + .../components/layout/main/main.json | 4 + .../components/layout/main/main.swan | 3 + .../components/layout/row/row.css | 376 + .../components/layout/row/row.js | 4 + .../components/layout/row/row.json | 4 + .../components/layout/row/row.swan | 3 + .../components/list/list.css | 139 + .../components/list/list.js | 4 + .../components/list/list.json | 4 + .../components/list/list.swan | 5 + .../components/page/page.css | 149 + .../components/page/page.js | 4 + .../components/page/page.json | 4 + .../components/page/page.swan | 3 + .../components/radio/radio.css | 198 + .../components/radio/radio.js | 4 + .../components/radio/radio.json | 4 + .../components/radio/radio.swan | 9 + .../components/richtext/richtext.css | 149 + .../components/richtext/richtext.js | 4 + .../components/richtext/richtext.json | 4 + .../components/richtext/richtext.swan | 3 + .../components/scroller/scroller.css | 139 + .../components/scroller/scroller.js | 4 + .../components/scroller/scroller.json | 4 + .../components/scroller/scroller.swan | 3 + .../components/switch/switch.css | 149 + .../components/switch/switch.js | 4 + .../components/switch/switch.json | 4 + .../components/switch/switch.swan | 4 + .../components/textarea/textarea.css | 153 + .../components/textarea/textarea.js | 4 + .../components/textarea/textarea.json | 4 + .../components/textarea/textarea.swan | 2 + .../components/video/video.css | 139 + .../components/video/video.js | 4 + .../components/video/video.json | 4 + .../components/video/video.swan | 2 + dist/baidu/pages/index/index.css | 611 +- dist/baidu/static/img/selected_520dcc8.png | Bin 0 -> 1721 bytes dist/baidu/static/img/unselected_4e38c39.png | Bin 0 -> 1672 bytes dist/baidu/static/js/app.js | 159 +- dist/baidu/static/js/common.js | 11992 ++++++++++++++- .../components/polyScroller/polyScroller.js | 321 +- dist/baidu/static/js/manifest.js | 104 +- .../components/button/button.js | 602 + .../components/carousel-item/carousel-item.js | 312 + .../components/carousel/carousel.js | 367 + .../components/checkbox/checkbox.js | 144 + .../components/input/input.js | 592 + .../components/layout/aside/aside.js | 61 + .../components/layout/col/col.js | 84 + .../components/layout/container/container.js | 70 + .../components/layout/foot/foot.js | 61 + .../components/layout/head/head.js | 61 + .../components/layout/main/main.js | 59 + .../components/layout/row/row.js | 89 + .../components/list/list.js | 476 + .../components/page/page.js | 740 + .../components/radio/radio.js | 137 + .../components/richtext/richtext.js | 434 + .../components/scroller/scroller.js | 527 + .../components/switch/switch.js | 366 + .../components/textarea/textarea.js | 465 + .../components/video/video.js | 407 + dist/baidu/static/js/pages/index/index.js | 51 +- .../components/polyScroller/polyScroller.wxss | 144 +- .../components/button/button.js | 4 + .../components/button/button.json | 4 + .../components/button/button.wxml | 4 + .../components/button/button.wxss | 288 + .../components/carousel-item/carousel-item.js | 4 + .../carousel-item/carousel-item.json | 4 + .../carousel-item/carousel-item.wxml | 0 .../components/carousel/carousel.js | 4 + .../components/carousel/carousel.json | 4 + .../components/carousel/carousel.wxml | 0 .../components/carousel/carousel.wxss | 143 + .../components/checkbox/checkbox.js | 4 + .../components/checkbox/checkbox.json | 4 + .../components/checkbox/checkbox.wxml | 10 + .../components/checkbox/checkbox.wxss | 204 + .../components/input/input.js | 4 + .../components/input/input.json | 4 + .../components/input/input.wxml | 1 + .../components/input/input.wxss | 156 + .../components/layout/aside/aside.js | 4 + .../components/layout/aside/aside.json | 4 + .../components/layout/aside/aside.wxml | 3 + .../components/layout/aside/aside.wxss | 154 + .../components/layout/col/col.js | 4 + .../components/layout/col/col.json | 4 + .../components/layout/col/col.wxml | 3 + .../components/layout/col/col.wxss | 143 + .../components/layout/container/container.js | 4 + .../layout/container/container.json | 4 + .../layout/container/container.wxml | 3 + .../layout/container/container.wxss | 156 + .../components/layout/foot/foot.js | 4 + .../components/layout/foot/foot.json | 4 + .../components/layout/foot/foot.wxml | 3 + .../components/layout/foot/foot.wxss | 154 + .../components/layout/head/head.js | 4 + .../components/layout/head/head.json | 4 + .../components/layout/head/head.wxml | 3 + .../components/layout/head/head.wxss | 154 + .../components/layout/main/main.js | 4 + .../components/layout/main/main.json | 4 + .../components/layout/main/main.wxml | 3 + .../components/layout/main/main.wxss | 154 + .../components/layout/row/row.js | 4 + .../components/layout/row/row.json | 4 + .../components/layout/row/row.wxml | 3 + .../components/layout/row/row.wxss | 380 + .../components/list/list.js | 4 + .../components/list/list.json | 4 + .../components/list/list.wxml | 5 + .../components/list/list.wxss | 143 + .../components/page/page.js | 4 + .../components/page/page.json | 4 + .../components/page/page.wxml | 3 + .../components/page/page.wxss | 153 + .../components/radio/radio.js | 4 + .../components/radio/radio.json | 4 + .../components/radio/radio.wxml | 9 + .../components/radio/radio.wxss | 202 + .../components/richtext/richtext.js | 4 + .../components/richtext/richtext.json | 4 + .../components/richtext/richtext.wxml | 3 + .../components/richtext/richtext.wxss | 153 + .../components/scroller/scroller.js | 4 + .../components/scroller/scroller.json | 4 + .../components/scroller/scroller.wxml | 3 + .../components/scroller/scroller.wxss | 143 + .../components/switch/switch.js | 4 + .../components/switch/switch.json | 4 + .../components/switch/switch.wxml | 4 + .../components/switch/switch.wxss | 153 + .../components/textarea/textarea.js | 4 + .../components/textarea/textarea.json | 4 + .../components/textarea/textarea.wxml | 2 + .../components/textarea/textarea.wxss | 157 + .../components/video/video.js | 4 + .../components/video/video.json | 4 + .../components/video/video.wxml | 2 + .../components/video/video.wxss | 143 + dist/wx/pages/index/index.wxss | 615 +- dist/wx/static/img/selected_520dcc8.png | Bin 0 -> 1721 bytes dist/wx/static/img/unselected_4e38c39.png | Bin 0 -> 1672 bytes dist/wx/static/js/app.js | 159 +- dist/wx/static/js/common.js | 11993 +++++++++++++++- .../components/polyScroller/polyScroller.js | 321 +- dist/wx/static/js/manifest.js | 104 +- .../components/button/button.js | 602 + .../components/carousel-item/carousel-item.js | 312 + .../components/carousel/carousel.js | 367 + .../components/checkbox/checkbox.js | 144 + .../components/input/input.js | 592 + .../components/layout/aside/aside.js | 61 + .../components/layout/col/col.js | 84 + .../components/layout/container/container.js | 70 + .../components/layout/foot/foot.js | 61 + .../components/layout/head/head.js | 61 + .../components/layout/main/main.js | 59 + .../components/layout/row/row.js | 89 + .../components/list/list.js | 474 + .../components/page/page.js | 740 + .../components/radio/radio.js | 137 + .../components/richtext/richtext.js | 434 + .../components/scroller/scroller.js | 525 + .../components/switch/switch.js | 366 + .../components/textarea/textarea.js | 465 + .../components/video/video.js | 407 + dist/wx/static/js/pages/index/index.js | 51 +- preview/preview.html | 485 + 326 files changed, 68871 insertions(+), 64 deletions(-) create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/button/button.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/button/button.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/button/button.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/input/input.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/input/input.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/input/input.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/list/list.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/list/list.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/list/list.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/page/page.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/page/page.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/page/page.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.json create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/video/video.acss create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/video/video.axml create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 dist/alipay/npm/chameleon-ui-builtin/components/video/video.json create mode 100644 dist/alipay/static/img/selected_520dcc8.png create mode 100644 dist/alipay/static/img/unselected_4e38c39.png create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/alipay/static/js/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/button/button.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/button/button.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/button/button.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/input/input.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/input/input.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/input/input.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/list/list.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/list/list.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/list/list.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/page/page.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/page/page.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/page/page.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.swan create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/video/video.css create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/video/video.json create mode 100644 dist/baidu/npm/chameleon-ui-builtin/components/video/video.swan create mode 100644 dist/baidu/static/img/selected_520dcc8.png create mode 100644 dist/baidu/static/img/unselected_4e38c39.png create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/baidu/static/js/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/button/button.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/button/button.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/button/button.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/input/input.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/input/input.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/input/input.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/list/list.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/list/list.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/list/list.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/page/page.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/page/page.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/page/page.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/radio/radio.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/switch/switch.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxss create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/video/video.json create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/video/video.wxml create mode 100644 dist/wx/npm/chameleon-ui-builtin/components/video/video.wxss create mode 100644 dist/wx/static/img/selected_520dcc8.png create mode 100644 dist/wx/static/img/unselected_4e38c39.png create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/button/button.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/input/input.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/list/list.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/page/page.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/radio/radio.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/switch/switch.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js create mode 100644 dist/wx/static/js/npm/chameleon-ui-builtin/components/video/video.js create mode 100644 preview/preview.html diff --git a/README.md b/README.md index 12589aa..02f4e90 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # cml-flexbox 基于[chameleon](https://github.com/didi/chameleon)跨端框架,测试 FlexBox 布局实现效果 -web 端访问地址: +web 端访问地址:https://startheart.github.io/cml-flexbox/dist/web/cml-flexbox.html # 使用 diff --git a/dist/alipay/components/polyScroller/polyScroller.acss b/dist/alipay/components/polyScroller/polyScroller.acss index 592ae11..301b4e7 100644 --- a/dist/alipay/components/polyScroller/polyScroller.acss +++ b/dist/alipay/components/polyScroller/polyScroller.acss @@ -1 +1,139 @@ -.cml-493eb537.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-493eb537.cml-base,.cml-493eb537.cml-base:after,.cml-493eb537.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}.cml-493eb537.cml-view{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-493eb537.cml-text,.cml-493eb537.cml-view{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-493eb537.cml-text{display:block;white-space:pre-wrap;word-wrap:break-word;overflow:hidden}.cml-493eb537.cml-border-1px,.cml-493eb537.cml-border-bottom-1px,.cml-493eb537.cml-border-left-1px,.cml-493eb537.cml-border-right-1px,.cml-493eb537.cml-border-top-1px{position:relative}.cml-493eb537.cml-border-1px:after,.cml-493eb537.cml-border-bottom-1px:after,.cml-493eb537.cml-border-left-1px:before,.cml-493eb537.cml-border-right-1px:after,.cml-493eb537.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-493eb537.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-493eb537.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-493eb537.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-493eb537.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-493eb537.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-493eb537.cml-border-none:after,.cml-493eb537.cml-border-none:before{display:none}.cml-493eb537.cml-c-button{-webkit-align-self:stretch;align-self:stretch} \ No newline at end of file +.cml-493eb537.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-493eb537.cml-base, +.cml-493eb537.cml-base::before, +.cml-493eb537.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-493eb537.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-493eb537.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-493eb537.cml-border-1px, +.cml-493eb537.cml-border-top-1px, +.cml-493eb537.cml-border-right-1px, +.cml-493eb537.cml-border-bottom-1px, +.cml-493eb537.cml-border-left-1px { + position: relative; +} + +.cml-493eb537.cml-border-top-1px:before, +.cml-493eb537.cml-border-left-1px:before, +.cml-493eb537.cml-border-1px:after, +.cml-493eb537.cml-border-right-1px:after, +.cml-493eb537.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-493eb537.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-493eb537.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-493eb537.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-493eb537.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-493eb537.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-493eb537.cml-border-none:before, .cml-493eb537.cml-border-none:after { + display: none; +} + +.cml-493eb537.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/button/button.acss b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.acss new file mode 100644 index 0000000..9864c31 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.acss @@ -0,0 +1,284 @@ +.cml-90dfce7a.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-90dfce7a.cml-base, +.cml-90dfce7a.cml-base::before, +.cml-90dfce7a.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-90dfce7a.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-90dfce7a.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-90dfce7a.cml-border-1px, +.cml-90dfce7a.cml-border-top-1px, +.cml-90dfce7a.cml-border-right-1px, +.cml-90dfce7a.cml-border-bottom-1px, +.cml-90dfce7a.cml-border-left-1px { + position: relative; +} + +.cml-90dfce7a.cml-border-top-1px:before, +.cml-90dfce7a.cml-border-left-1px:before, +.cml-90dfce7a.cml-border-1px:after, +.cml-90dfce7a.cml-border-right-1px:after, +.cml-90dfce7a.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-90dfce7a.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-90dfce7a.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-90dfce7a.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-90dfce7a.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-90dfce7a.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-90dfce7a.cml-border-none:before, .cml-90dfce7a.cml-border-none:after { + display: none; +} + +.cml-90dfce7a.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-90dfce7a.cml-btn { + display: -webkit-box; + display: -webkit-flex; + display: flex; + padding: 0 30rpx; + height: 88rpx; + line-height: 88rpx; + background: #4a4c5b; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + border-radius: 4rpx; + font-size: 32rpx; + color: #fff; +} + +.cml-90dfce7a.cml-btn-active { + background: #444654; +} + +.cml-90dfce7a.cml-btn:after { + border: none; +} + +.cml-90dfce7a.cml-btn-orange { + background: #fc9153; +} + +.cml-90dfce7a.cml-btn-orange-active { + background: #e8864c; +} + +.cml-90dfce7a.cml-btn-green { + background: #50a050; +} + +.cml-90dfce7a.cml-btn-green-active { + background: #57a957; +} + +.cml-90dfce7a.cml-btn-red { + background: #db2a36; +} + +.cml-90dfce7a.cml-btn-red-active { + background: #ea2e3b; +} + +.cml-90dfce7a.cml-btn-disable { + background: #ccc; +} + +.cml-90dfce7a.cml-btn-disable:active { + background: #ccc; +} + +.cml-90dfce7a.cml-btn-white { + color: #666; + background: #FFFFFF; + border: 1rpx solid #A5A5A5; +} + +.cml-90dfce7a.cml-btn-white-active { + background: #e8e8e8; +} + +.cml-90dfce7a.cml-btn-white-disable, +.cml-90dfce7a.cml-btn-white:disabled { + color: #fff; + background: #ccc; + border: 0; +} + +.cml-90dfce7a.cml-btn-white-disable:active, +.cml-90dfce7a.cml-btn-white:disabled:active { + background: #ccc; +} + +.cml-90dfce7a.cml-btn-full { + width: 702rpx; + height: 88rpx; +} + +.cml-90dfce7a.cml-btn-big { + width: 339rpx; + height: 70rpx; +} + +.cml-90dfce7a.cml-btn-medium { + width: 218rpx; + height: 60rpx; +} + +.cml-90dfce7a.cml-btn-small { + width: 157rpx; + height: 44rpx; +} + +.cml-90dfce7a.cml-btn-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-90dfce7a.cml-btn-auto { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.cml-90dfce7a.btn-text { + text-align: center; + vertical-align: middle; + text-overflow: ellipsis; + white-space: nowrap; + outline: none; + font-size: 36rpx; + color: #ffffff; +} + +.cml-90dfce7a.btn-text-white { + color: #666; +} + +.cml-90dfce7a.btn-text-white-disable { + color: #fff; +} + +.cml-90dfce7a.btn-text-full { + font-size: 36rpx; +} + +.cml-90dfce7a.btn-text-big { + font-size: 32rpx; +} + +.cml-90dfce7a.btn-text-medium { + font-size: 28rpx; +} + +.cml-90dfce7a.btn-text-small { + font-size: 24rpx; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/button/button.axml b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.axml new file mode 100644 index 0000000..b890bfe --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.axml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/button/button.js b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.js new file mode 100644 index 0000000..7027445 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/button/button.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/button/button.json b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/button/button.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.axml b/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.axml new file mode 100644 index 0000000..e69de29 diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..08d4150 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json b/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.acss b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.acss new file mode 100644 index 0000000..625a829 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.acss @@ -0,0 +1,139 @@ +.cml-231eed43.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-231eed43.cml-base, +.cml-231eed43.cml-base::before, +.cml-231eed43.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-231eed43.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-231eed43.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-231eed43.cml-border-1px, +.cml-231eed43.cml-border-top-1px, +.cml-231eed43.cml-border-right-1px, +.cml-231eed43.cml-border-bottom-1px, +.cml-231eed43.cml-border-left-1px { + position: relative; +} + +.cml-231eed43.cml-border-top-1px:before, +.cml-231eed43.cml-border-left-1px:before, +.cml-231eed43.cml-border-1px:after, +.cml-231eed43.cml-border-right-1px:after, +.cml-231eed43.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-231eed43.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-231eed43.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-231eed43.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-231eed43.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-231eed43.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-231eed43.cml-border-none:before, .cml-231eed43.cml-border-none:after { + display: none; +} + +.cml-231eed43.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.axml b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.axml new file mode 100644 index 0000000..e69de29 diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..055aa6a --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.json b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/carousel/carousel.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.acss b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.acss new file mode 100644 index 0000000..88ba512 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.acss @@ -0,0 +1,200 @@ +.cml-fca93ac6.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-fca93ac6.cml-base, +.cml-fca93ac6.cml-base::before, +.cml-fca93ac6.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-fca93ac6.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-fca93ac6.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-fca93ac6.cml-border-1px, +.cml-fca93ac6.cml-border-top-1px, +.cml-fca93ac6.cml-border-right-1px, +.cml-fca93ac6.cml-border-bottom-1px, +.cml-fca93ac6.cml-border-left-1px { + position: relative; +} + +.cml-fca93ac6.cml-border-top-1px:before, +.cml-fca93ac6.cml-border-left-1px:before, +.cml-fca93ac6.cml-border-1px:after, +.cml-fca93ac6.cml-border-right-1px:after, +.cml-fca93ac6.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-fca93ac6.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-fca93ac6.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-fca93ac6.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-fca93ac6.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-fca93ac6.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-fca93ac6.cml-border-none:before, .cml-fca93ac6.cml-border-none:after { + display: none; +} + +.cml-fca93ac6.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-fca93ac6.cml-checkbox { + margin: 10rpx; +} + +.cml-fca93ac6.cml-checkbox-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-fca93ac6.cml-checkbox-checked { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-fca93ac6.cml-checkbox-uncheck { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-fca93ac6.cml-checkbox-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} + +.cml-fca93ac6.inner-icon { + width: 32rpx; + height: 32rpx; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.axml b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.axml new file mode 100644 index 0000000..0e0584c --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.axml @@ -0,0 +1,10 @@ + + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..51d57e2 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.json b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/checkbox/checkbox.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/input/input.acss b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.acss new file mode 100644 index 0000000..4b9c90d --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.acss @@ -0,0 +1,152 @@ +.cml-a4149026.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-a4149026.cml-base, +.cml-a4149026.cml-base::before, +.cml-a4149026.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-a4149026.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-a4149026.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-a4149026.cml-border-1px, +.cml-a4149026.cml-border-top-1px, +.cml-a4149026.cml-border-right-1px, +.cml-a4149026.cml-border-bottom-1px, +.cml-a4149026.cml-border-left-1px { + position: relative; +} + +.cml-a4149026.cml-border-top-1px:before, +.cml-a4149026.cml-border-left-1px:before, +.cml-a4149026.cml-border-1px:after, +.cml-a4149026.cml-border-right-1px:after, +.cml-a4149026.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-a4149026.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-a4149026.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-a4149026.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-a4149026.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-a4149026.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-a4149026.cml-border-none:before, .cml-a4149026.cml-border-none:after { + display: none; +} + +.cml-a4149026.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-a4149026.input-wrap { + font-size: 33rpx; + height: 80rpx; + line-height: 80rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + border: 1rpx solid #999; + border-radius: 8rpx; + text-align: left; + background-color: #fff; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/input/input.axml b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.axml new file mode 100644 index 0000000..0892e86 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.axml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/input/input.js b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..999c8fe --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/input/input.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/input/input.json b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/input/input.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.acss new file mode 100644 index 0000000..42197c6 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.acss @@ -0,0 +1,150 @@ +.cml-4c57d696.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-4c57d696.cml-base, +.cml-4c57d696.cml-base::before, +.cml-4c57d696.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-4c57d696.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-4c57d696.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-4c57d696.cml-border-1px, +.cml-4c57d696.cml-border-top-1px, +.cml-4c57d696.cml-border-right-1px, +.cml-4c57d696.cml-border-bottom-1px, +.cml-4c57d696.cml-border-left-1px { + position: relative; +} + +.cml-4c57d696.cml-border-top-1px:before, +.cml-4c57d696.cml-border-left-1px:before, +.cml-4c57d696.cml-border-1px:after, +.cml-4c57d696.cml-border-right-1px:after, +.cml-4c57d696.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-4c57d696.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-4c57d696.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-4c57d696.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-4c57d696.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-4c57d696.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-4c57d696.cml-border-none:before, .cml-4c57d696.cml-border-none:after { + display: none; +} + +.cml-4c57d696.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-4c57d696.c-aside { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #d3dce6; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.axml new file mode 100644 index 0000000..3489bfc --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..2ab3b73 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/aside/aside.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.acss new file mode 100644 index 0000000..c493887 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.acss @@ -0,0 +1,139 @@ +.cml-288dc1e6.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-288dc1e6.cml-base, +.cml-288dc1e6.cml-base::before, +.cml-288dc1e6.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-288dc1e6.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-288dc1e6.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-288dc1e6.cml-border-1px, +.cml-288dc1e6.cml-border-top-1px, +.cml-288dc1e6.cml-border-right-1px, +.cml-288dc1e6.cml-border-bottom-1px, +.cml-288dc1e6.cml-border-left-1px { + position: relative; +} + +.cml-288dc1e6.cml-border-top-1px:before, +.cml-288dc1e6.cml-border-left-1px:before, +.cml-288dc1e6.cml-border-1px:after, +.cml-288dc1e6.cml-border-right-1px:after, +.cml-288dc1e6.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-288dc1e6.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-288dc1e6.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-288dc1e6.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-288dc1e6.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-288dc1e6.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-288dc1e6.cml-border-none:before, .cml-288dc1e6.cml-border-none:after { + display: none; +} + +.cml-288dc1e6.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.axml new file mode 100644 index 0000000..6f53d11 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..1a8c010 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/col/col.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/col/col.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.acss new file mode 100644 index 0000000..21bb065 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.acss @@ -0,0 +1,152 @@ +.cml-c51f5130.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-c51f5130.cml-base, +.cml-c51f5130.cml-base::before, +.cml-c51f5130.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-c51f5130.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-c51f5130.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-c51f5130.cml-border-1px, +.cml-c51f5130.cml-border-top-1px, +.cml-c51f5130.cml-border-right-1px, +.cml-c51f5130.cml-border-bottom-1px, +.cml-c51f5130.cml-border-left-1px { + position: relative; +} + +.cml-c51f5130.cml-border-top-1px:before, +.cml-c51f5130.cml-border-left-1px:before, +.cml-c51f5130.cml-border-1px:after, +.cml-c51f5130.cml-border-right-1px:after, +.cml-c51f5130.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-c51f5130.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-c51f5130.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-c51f5130.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-c51f5130.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-c51f5130.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-c51f5130.cml-border-none:before, .cml-c51f5130.cml-border-none:after { + display: none; +} + +.cml-c51f5130.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-c51f5130.c-container { + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.axml new file mode 100644 index 0000000..97659e1 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..207a677 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/container/container.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/container/container.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.acss new file mode 100644 index 0000000..774ab3e --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.acss @@ -0,0 +1,150 @@ +.cml-307218b8.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-307218b8.cml-base, +.cml-307218b8.cml-base::before, +.cml-307218b8.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-307218b8.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-307218b8.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-307218b8.cml-border-1px, +.cml-307218b8.cml-border-top-1px, +.cml-307218b8.cml-border-right-1px, +.cml-307218b8.cml-border-bottom-1px, +.cml-307218b8.cml-border-left-1px { + position: relative; +} + +.cml-307218b8.cml-border-top-1px:before, +.cml-307218b8.cml-border-left-1px:before, +.cml-307218b8.cml-border-1px:after, +.cml-307218b8.cml-border-right-1px:after, +.cml-307218b8.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-307218b8.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-307218b8.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-307218b8.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-307218b8.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-307218b8.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-307218b8.cml-border-none:before, .cml-307218b8.cml-border-none:after { + display: none; +} + +.cml-307218b8.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-307218b8.c-foot { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.axml new file mode 100644 index 0000000..32da294 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..6a8a99f --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/foot/foot.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.acss new file mode 100644 index 0000000..1318547 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.acss @@ -0,0 +1,150 @@ +.cml-967b2a38.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-967b2a38.cml-base, +.cml-967b2a38.cml-base::before, +.cml-967b2a38.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-967b2a38.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-967b2a38.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-967b2a38.cml-border-1px, +.cml-967b2a38.cml-border-top-1px, +.cml-967b2a38.cml-border-right-1px, +.cml-967b2a38.cml-border-bottom-1px, +.cml-967b2a38.cml-border-left-1px { + position: relative; +} + +.cml-967b2a38.cml-border-top-1px:before, +.cml-967b2a38.cml-border-left-1px:before, +.cml-967b2a38.cml-border-1px:after, +.cml-967b2a38.cml-border-right-1px:after, +.cml-967b2a38.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-967b2a38.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-967b2a38.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-967b2a38.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-967b2a38.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-967b2a38.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-967b2a38.cml-border-none:before, .cml-967b2a38.cml-border-none:after { + display: none; +} + +.cml-967b2a38.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-967b2a38.c-head { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.axml new file mode 100644 index 0000000..e2920b1 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..06983eb --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/head/head.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/head/head.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.acss new file mode 100644 index 0000000..6594dd4 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.acss @@ -0,0 +1,150 @@ +.cml-9ae0caf8.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-9ae0caf8.cml-base, +.cml-9ae0caf8.cml-base::before, +.cml-9ae0caf8.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-9ae0caf8.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-9ae0caf8.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-9ae0caf8.cml-border-1px, +.cml-9ae0caf8.cml-border-top-1px, +.cml-9ae0caf8.cml-border-right-1px, +.cml-9ae0caf8.cml-border-bottom-1px, +.cml-9ae0caf8.cml-border-left-1px { + position: relative; +} + +.cml-9ae0caf8.cml-border-top-1px:before, +.cml-9ae0caf8.cml-border-left-1px:before, +.cml-9ae0caf8.cml-border-1px:after, +.cml-9ae0caf8.cml-border-right-1px:after, +.cml-9ae0caf8.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-9ae0caf8.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-9ae0caf8.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-9ae0caf8.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-9ae0caf8.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-9ae0caf8.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-9ae0caf8.cml-border-none:before, .cml-9ae0caf8.cml-border-none:after { + display: none; +} + +.cml-9ae0caf8.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-9ae0caf8.c-main { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + background-color: #e9eef3; + color: #333; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.axml new file mode 100644 index 0000000..e9dc5cd --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..1d3339f --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/main/main.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/main/main.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.acss b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.acss new file mode 100644 index 0000000..195f288 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.acss @@ -0,0 +1,376 @@ +.cml-5afd7b9a.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-5afd7b9a.cml-base, +.cml-5afd7b9a.cml-base::before, +.cml-5afd7b9a.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-5afd7b9a.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-5afd7b9a.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-5afd7b9a.cml-border-1px, +.cml-5afd7b9a.cml-border-top-1px, +.cml-5afd7b9a.cml-border-right-1px, +.cml-5afd7b9a.cml-border-bottom-1px, +.cml-5afd7b9a.cml-border-left-1px { + position: relative; +} + +.cml-5afd7b9a.cml-border-top-1px:before, +.cml-5afd7b9a.cml-border-left-1px:before, +.cml-5afd7b9a.cml-border-1px:after, +.cml-5afd7b9a.cml-border-right-1px:after, +.cml-5afd7b9a.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-5afd7b9a.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-5afd7b9a.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-5afd7b9a.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-5afd7b9a.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-5afd7b9a.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-5afd7b9a.cml-border-none:before, .cml-5afd7b9a.cml-border-none:after { + display: none; +} + +.cml-5afd7b9a.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-5afd7b9a.flex-row-start-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-5afd7b9a.flex-row-end-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-5afd7b9a.flex-row-center-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-5afd7b9a.flex-row-space-between-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-5afd7b9a.flex-row-space-around-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-5afd7b9a.flex-row-start-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-5afd7b9a.flex-row-end-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-5afd7b9a.flex-row-center-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-5afd7b9a.flex-row-space-between-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-5afd7b9a.flex-row-space-around-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-5afd7b9a.flex-row-start-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.cml-5afd7b9a.flex-row-end-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.cml-5afd7b9a.flex-row-center-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.cml-5afd7b9a.flex-row-space-between-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.cml-5afd7b9a.flex-row-space-around-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.axml b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.axml new file mode 100644 index 0000000..effd735 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..25d59d6 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/row/row.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.json b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/layout/row/row.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/list/list.acss b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.acss new file mode 100644 index 0000000..02081d5 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.acss @@ -0,0 +1,139 @@ +.cml-0d5155fa.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-0d5155fa.cml-base, +.cml-0d5155fa.cml-base::before, +.cml-0d5155fa.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-0d5155fa.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-0d5155fa.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-0d5155fa.cml-border-1px, +.cml-0d5155fa.cml-border-top-1px, +.cml-0d5155fa.cml-border-right-1px, +.cml-0d5155fa.cml-border-bottom-1px, +.cml-0d5155fa.cml-border-left-1px { + position: relative; +} + +.cml-0d5155fa.cml-border-top-1px:before, +.cml-0d5155fa.cml-border-left-1px:before, +.cml-0d5155fa.cml-border-1px:after, +.cml-0d5155fa.cml-border-right-1px:after, +.cml-0d5155fa.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-0d5155fa.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-0d5155fa.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-0d5155fa.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-0d5155fa.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-0d5155fa.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-0d5155fa.cml-border-none:before, .cml-0d5155fa.cml-border-none:after { + display: none; +} + +.cml-0d5155fa.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/list/list.axml b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.axml new file mode 100644 index 0000000..e822225 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.axml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/list/list.js b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..8073000 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/list/list.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/list/list.json b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/list/list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/page/page.acss b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.acss new file mode 100644 index 0000000..a1e6852 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.acss @@ -0,0 +1,149 @@ +.cml-1e993b3a.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-1e993b3a.cml-base, +.cml-1e993b3a.cml-base::before, +.cml-1e993b3a.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-1e993b3a.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-1e993b3a.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-1e993b3a.cml-border-1px, +.cml-1e993b3a.cml-border-top-1px, +.cml-1e993b3a.cml-border-right-1px, +.cml-1e993b3a.cml-border-bottom-1px, +.cml-1e993b3a.cml-border-left-1px { + position: relative; +} + +.cml-1e993b3a.cml-border-top-1px:before, +.cml-1e993b3a.cml-border-left-1px:before, +.cml-1e993b3a.cml-border-1px:after, +.cml-1e993b3a.cml-border-right-1px:after, +.cml-1e993b3a.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-1e993b3a.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-1e993b3a.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-1e993b3a.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-1e993b3a.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-1e993b3a.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-1e993b3a.cml-border-none:before, .cml-1e993b3a.cml-border-none:after { + display: none; +} + +.cml-1e993b3a.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-1e993b3a.page { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/page/page.axml b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.axml new file mode 100644 index 0000000..f4838c6 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/page/page.js b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..7a60280 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/page/page.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/page/page.json b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/page/page.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.acss b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.acss new file mode 100644 index 0000000..68f9b6b --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.acss @@ -0,0 +1,198 @@ +.cml-757cc275.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-757cc275.cml-base, +.cml-757cc275.cml-base::before, +.cml-757cc275.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-757cc275.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-757cc275.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-757cc275.cml-border-1px, +.cml-757cc275.cml-border-top-1px, +.cml-757cc275.cml-border-right-1px, +.cml-757cc275.cml-border-bottom-1px, +.cml-757cc275.cml-border-left-1px { + position: relative; +} + +.cml-757cc275.cml-border-top-1px:before, +.cml-757cc275.cml-border-left-1px:before, +.cml-757cc275.cml-border-1px:after, +.cml-757cc275.cml-border-right-1px:after, +.cml-757cc275.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-757cc275.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-757cc275.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-757cc275.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-757cc275.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-757cc275.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-757cc275.cml-border-none:before, .cml-757cc275.cml-border-none:after { + display: none; +} + +.cml-757cc275.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-757cc275.cml-radio { + margin: 10rpx; +} + +.cml-757cc275.cml-radio-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-757cc275.cml-radio-selected { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; +} + +.cml-757cc275.cml-radio-selected-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; + opacity: 0.5; +} + +.cml-757cc275.cml-radio-unselect { + width: 32rpx; + height: 32rpx; + border: 1px solid #ccc; + border-radius: 20rpx; + box-sizing: border-box; +} + +.cml-757cc275.cml-radio-unselect-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 20rpx; + background: #ccc; + box-sizing: border-box; +} + +.cml-757cc275.cml-radio-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.axml b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.axml new file mode 100644 index 0000000..0458918 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.axml @@ -0,0 +1,9 @@ + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..f1d0c62 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/radio/radio.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.json b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/radio/radio.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.acss b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.acss new file mode 100644 index 0000000..f7e5dda --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.acss @@ -0,0 +1,149 @@ +.cml-30b96b23.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-30b96b23.cml-base, +.cml-30b96b23.cml-base::before, +.cml-30b96b23.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-30b96b23.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-30b96b23.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-30b96b23.cml-border-1px, +.cml-30b96b23.cml-border-top-1px, +.cml-30b96b23.cml-border-right-1px, +.cml-30b96b23.cml-border-bottom-1px, +.cml-30b96b23.cml-border-left-1px { + position: relative; +} + +.cml-30b96b23.cml-border-top-1px:before, +.cml-30b96b23.cml-border-left-1px:before, +.cml-30b96b23.cml-border-1px:after, +.cml-30b96b23.cml-border-right-1px:after, +.cml-30b96b23.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-30b96b23.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-30b96b23.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-30b96b23.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-30b96b23.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-30b96b23.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-30b96b23.cml-border-none:before, .cml-30b96b23.cml-border-none:after { + display: none; +} + +.cml-30b96b23.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-30b96b23.rich-text { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.axml b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.axml new file mode 100644 index 0000000..486f4d3 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.axml @@ -0,0 +1,3 @@ + + {{item.text}} + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..9549bcc --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.json b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/richtext/richtext.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.acss b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.acss new file mode 100644 index 0000000..e7f0c14 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.acss @@ -0,0 +1,139 @@ +.cml-472a9003.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-472a9003.cml-base, +.cml-472a9003.cml-base::before, +.cml-472a9003.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-472a9003.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-472a9003.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-472a9003.cml-border-1px, +.cml-472a9003.cml-border-top-1px, +.cml-472a9003.cml-border-right-1px, +.cml-472a9003.cml-border-bottom-1px, +.cml-472a9003.cml-border-left-1px { + position: relative; +} + +.cml-472a9003.cml-border-top-1px:before, +.cml-472a9003.cml-border-left-1px:before, +.cml-472a9003.cml-border-1px:after, +.cml-472a9003.cml-border-right-1px:after, +.cml-472a9003.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-472a9003.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-472a9003.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-472a9003.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-472a9003.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-472a9003.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-472a9003.cml-border-none:before, .cml-472a9003.cml-border-none:after { + display: none; +} + +.cml-472a9003.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.axml b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.axml new file mode 100644 index 0000000..0f23291 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..422eb40 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.json b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/scroller/scroller.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.acss b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.acss new file mode 100644 index 0000000..c87017d --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.acss @@ -0,0 +1,154 @@ +.cml-786a2703.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-786a2703.cml-base, +.cml-786a2703.cml-base::before, +.cml-786a2703.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-786a2703.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-786a2703.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-786a2703.cml-border-1px, +.cml-786a2703.cml-border-top-1px, +.cml-786a2703.cml-border-right-1px, +.cml-786a2703.cml-border-bottom-1px, +.cml-786a2703.cml-border-left-1px { + position: relative; +} + +.cml-786a2703.cml-border-top-1px:before, +.cml-786a2703.cml-border-left-1px:before, +.cml-786a2703.cml-border-1px:after, +.cml-786a2703.cml-border-right-1px:after, +.cml-786a2703.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-786a2703.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-786a2703.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-786a2703.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-786a2703.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-786a2703.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-786a2703.cml-border-none:before, .cml-786a2703.cml-border-none:after { + display: none; +} + +.cml-786a2703.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +switch { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.cml-786a2703.cml-switch-disabled { + opacity: 0.5; +} + +.cml-786a2703.cml-switch-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.axml b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.axml new file mode 100644 index 0000000..0984830 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.axml @@ -0,0 +1,4 @@ + + + {{label}} + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..4203283 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/switch/switch.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.json b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/switch/switch.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.acss b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.acss new file mode 100644 index 0000000..0e99488 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.acss @@ -0,0 +1,153 @@ +.cml-27999ffa.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-27999ffa.cml-base, +.cml-27999ffa.cml-base::before, +.cml-27999ffa.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-27999ffa.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-27999ffa.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-27999ffa.cml-border-1px, +.cml-27999ffa.cml-border-top-1px, +.cml-27999ffa.cml-border-right-1px, +.cml-27999ffa.cml-border-bottom-1px, +.cml-27999ffa.cml-border-left-1px { + position: relative; +} + +.cml-27999ffa.cml-border-top-1px:before, +.cml-27999ffa.cml-border-left-1px:before, +.cml-27999ffa.cml-border-1px:after, +.cml-27999ffa.cml-border-right-1px:after, +.cml-27999ffa.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-27999ffa.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-27999ffa.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-27999ffa.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-27999ffa.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-27999ffa.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-27999ffa.cml-border-none:before, .cml-27999ffa.cml-border-none:after { + display: none; +} + +.cml-27999ffa.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-27999ffa.textarea-wrap { + font-size: 40rpx; + height: 150rpx; + line-height: 50rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + text-align: left; + background-color: #fff; + width: auto; + border: 1rpx solid #999; + border-radius: 8rpx; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.axml b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.axml new file mode 100644 index 0000000..27ddc3b --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.axml @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..ea53823 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.json b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/textarea/textarea.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/video/video.acss b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.acss new file mode 100644 index 0000000..36561ce --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.acss @@ -0,0 +1,139 @@ +.cml-768223ea.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-768223ea.cml-base, +.cml-768223ea.cml-base::before, +.cml-768223ea.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-768223ea.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-768223ea.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-768223ea.cml-border-1px, +.cml-768223ea.cml-border-top-1px, +.cml-768223ea.cml-border-right-1px, +.cml-768223ea.cml-border-bottom-1px, +.cml-768223ea.cml-border-left-1px { + position: relative; +} + +.cml-768223ea.cml-border-top-1px:before, +.cml-768223ea.cml-border-left-1px:before, +.cml-768223ea.cml-border-1px:after, +.cml-768223ea.cml-border-right-1px:after, +.cml-768223ea.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-768223ea.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-768223ea.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-768223ea.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-768223ea.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-768223ea.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-768223ea.cml-border-none:before, .cml-768223ea.cml-border-none:after { + display: none; +} + +.cml-768223ea.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/video/video.axml b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.axml new file mode 100644 index 0000000..950e12d --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.axml @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/video/video.js b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..499ac17 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/video/video.js') diff --git a/dist/alipay/npm/chameleon-ui-builtin/components/video/video.json b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/alipay/npm/chameleon-ui-builtin/components/video/video.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/alipay/pages/index/index.acss b/dist/alipay/pages/index/index.acss index ec68635..459050c 100644 --- a/dist/alipay/pages/index/index.acss +++ b/dist/alipay/pages/index/index.acss @@ -1 +1,610 @@ -.cml-07fd4302.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-07fd4302.cml-base,.cml-07fd4302.cml-base:after,.cml-07fd4302.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}.cml-07fd4302.cml-view{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-07fd4302.cml-text,.cml-07fd4302.cml-view{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-07fd4302.cml-text{display:block;white-space:pre-wrap;word-wrap:break-word;overflow:hidden}.cml-07fd4302.cml-border-1px,.cml-07fd4302.cml-border-bottom-1px,.cml-07fd4302.cml-border-left-1px,.cml-07fd4302.cml-border-right-1px,.cml-07fd4302.cml-border-top-1px{position:relative}.cml-07fd4302.cml-border-1px:after,.cml-07fd4302.cml-border-bottom-1px:after,.cml-07fd4302.cml-border-left-1px:before,.cml-07fd4302.cml-border-right-1px:after,.cml-07fd4302.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-07fd4302.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-07fd4302.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-07fd4302.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-07fd4302.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-07fd4302.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-07fd4302.cml-border-none:after,.cml-07fd4302.cml-border-none:before{display:none}.cml-07fd4302.cml-c-button{-webkit-align-self:stretch;align-self:stretch}.cml-07fd4302.flex-page{background-color:#f8f8f8}.cml-07fd4302.flex-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:40rpx;height:200rpx}.cml-07fd4302.flex-header__title{color:#333;font-size:40rpx;font-weight:700;height:60rpx;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;background-color:#faebd7}.cml-07fd4302.flex-panel__title{margin:2rpx;box-shadow:0 3px 5px #888;background-color:#d3d3d3;position:-webkit-sticky;position:sticky;top:0;z-index:999}.cml-07fd4302.flex-panel__content{margin-top:20rpx;overflow:hidden}.cml-07fd4302.flex-panel__content-main{background-color:#789}.cml-07fd4302.weight_700{font-weight:700}.cml-07fd4302.flex-body{background:#fff;box-shadow:0 10rpx 300rpx 0 rgba(0,0,0,.11)}.cml-07fd4302.flex-panel{padding-top:60rpx}.cml-07fd4302.flex-item__title{background-color:#faebd7}.cml-07fd4302.item{margin:8rpx;border:2rpx solid #fff}.cml-07fd4302.item-block{height:60rpx;width:100rpx;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.cml-07fd4302.item-block,.cml-07fd4302.item-wrap{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.cml-07fd4302.item-wrap{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.cml-07fd4302.item-text-inner{color:#fff}.cml-07fd4302.item-text{width:44rpx;height:44rpx;border:2rpx solid #fff;border-radius:22rpx;color:#fff;text-align:center}.cml-07fd4302.border-none{border:0}.cml-07fd4302.row{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.cml-07fd4302.row-reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.cml-07fd4302.column-reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.cml-07fd4302.nowrap{-webkit-flex-wrap:nowrap;flex-wrap:nowrap}.cml-07fd4302.wrap{-webkit-flex-wrap:wrap;flex-wrap:wrap}.cml-07fd4302.wrap-reverse{-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse}.cml-07fd4302.justify-flex-start{-webkit-box-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start}.cml-07fd4302.justify-flex-end{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.cml-07fd4302.justify-center{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.cml-07fd4302.justify-space-between{-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.cml-07fd4302.justify-space-around{-webkit-justify-content:space-around;justify-content:space-around}.cml-07fd4302.align-flex-start{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.cml-07fd4302.align-flex-end{-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end}.cml-07fd4302.align-center{-webkit-box-align:center;-webkit-align-items:center;align-items:center}.cml-07fd4302.align-baseline{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.cml-07fd4302.align-stretch{-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch}.cml-07fd4302.align-content-flex-start{-webkit-align-content:flex-start;align-content:flex-start}.cml-07fd4302.align-content-flex-end{-webkit-align-content:flex-end;align-content:flex-end}.cml-07fd4302.align-content-center{-webkit-align-content:center;align-content:center}.cml-07fd4302.align-content-space-between{-webkit-align-content:space-between;align-content:space-between}.cml-07fd4302.align-content-space-around{-webkit-align-content:space-around;align-content:space-around}.cml-07fd4302.align-content-stretch{-webkit-align-content:stretch;align-content:stretch}.cml-07fd4302.order_0{-webkit-box-ordinal-group:1;-webkit-order:0;order:0}.cml-07fd4302.order_1{-webkit-box-ordinal-group:2;-webkit-order:1;order:1}.cml-07fd4302.order_2{-webkit-box-ordinal-group:3;-webkit-order:2;order:2}.cml-07fd4302.order_3{-webkit-box-ordinal-group:4;-webkit-order:3;order:3}.cml-07fd4302.order_4{-webkit-box-ordinal-group:5;-webkit-order:4;order:4}.cml-07fd4302.order_-1{-webkit-box-ordinal-group:0;-webkit-order:-1;order:-1}.cml-07fd4302.flex-grow_0{-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.cml-07fd4302.flex-grow_1{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.cml-07fd4302.flex-grow_2{-webkit-box-flex:2;-webkit-flex-grow:2;flex-grow:2}.cml-07fd4302.flex-shrink_0{-webkit-flex-shrink:0;flex-shrink:0}.cml-07fd4302.flex-shrink_1{-webkit-flex-shrink:1;flex-shrink:1}.cml-07fd4302.flex-shrink_2{-webkit-flex-shrink:2;flex-shrink:2}.cml-07fd4302.flex-basis_auto{-webkit-flex-basis:auto;flex-basis:auto}.cml-07fd4302.flex-basis_25{-webkit-flex-basis:187.5rpx;flex-basis:187.5rpx}.cml-07fd4302.flex-basis_50{-webkit-flex-basis:375rpx;flex-basis:375rpx}.cml-07fd4302.align-self-flex-start{-webkit-align-self:auto;align-self:auto;-webkit-align-self:flex-start;align-self:flex-start}.cml-07fd4302.align-self-flex-end{-webkit-align-self:flex-end;align-self:flex-end}.cml-07fd4302.align-self-center{-webkit-align-self:center;align-self:center}.cml-07fd4302.align-self-baseline{-webkit-align-self:baseline;align-self:baseline}.cml-07fd4302.align-self-stretch{-webkit-align-self:stretch;align-self:stretch}.cml-07fd4302.antiquewhite{background-color:#faebd7}.cml-07fd4302.lightpink{background-color:#ffb6c1}.cml-07fd4302.lightskyblue{background-color:#87cefa}.cml-07fd4302.silver{background-color:silver}.cml-07fd4302.darkseagreen{background-color:#8fbc8f}.cml-07fd4302.lightslategrey{background-color:#789}.cml-07fd4302.cadetblue{background-color:#5f9ea0}.cml-07fd4302.lightgray{background-color:#d3d3d3}.cml-07fd4302.color-white{color:#fff}.cml-07fd4302.color-brown{color:brown}.cml-07fd4302.h_240{height:240rpx}.cml-07fd4302.h_200{height:200rpx}.cml-07fd4302.h_120{height:120rpx}.cml-07fd4302.h_100{height:100rpx}.cml-07fd4302.h_80{height:80rpx}.cml-07fd4302.h_60{height:60rpx}.cml-07fd4302.h_40{height:40rpx}.cml-07fd4302.w_200{width:200rpx}.cml-07fd4302.w_120{width:120rpx}.cml-07fd4302.w_80{width:80rpx}.cml-07fd4302.w_60{width:60rpx}.cml-07fd4302.w_40{width:40rpx} \ No newline at end of file +.cml-07fd4302.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-07fd4302.cml-base, +.cml-07fd4302.cml-base::before, +.cml-07fd4302.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-07fd4302.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-07fd4302.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-07fd4302.cml-border-1px, +.cml-07fd4302.cml-border-top-1px, +.cml-07fd4302.cml-border-right-1px, +.cml-07fd4302.cml-border-bottom-1px, +.cml-07fd4302.cml-border-left-1px { + position: relative; +} + +.cml-07fd4302.cml-border-top-1px:before, +.cml-07fd4302.cml-border-left-1px:before, +.cml-07fd4302.cml-border-1px:after, +.cml-07fd4302.cml-border-right-1px:after, +.cml-07fd4302.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-07fd4302.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-07fd4302.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-07fd4302.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-07fd4302.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-07fd4302.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-07fd4302.cml-border-none:before, .cml-07fd4302.cml-border-none:after { + display: none; +} + +.cml-07fd4302.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-07fd4302.flex-page { + background-color: #f8f8f8; +} + +.cml-07fd4302.flex-header { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + padding: 40rpx; + height: 200rpx; +} + +.cml-07fd4302.flex-header__title { + color: #333; + font-size: 40rpx; + font-weight: 700; + height: 60rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + background-color: antiquewhite; +} + +.cml-07fd4302.flex-panel__title { + margin: 2rpx; + box-shadow: 0px 3px 5px #888888; + background-color: lightgray; + /* + * https://stackoverflow.com/questions/47095596/body-overflow-x-hidden-breaks-position-sticky + */ + position: -webkit-sticky; + position: sticky; + top: 0; + z-index: 999; +} + +.cml-07fd4302.flex-panel__content { + margin-top: 20rpx; + overflow: hidden; +} + +.cml-07fd4302.flex-panel__content-main { + background-color: lightslategrey; +} + +.cml-07fd4302.weight_700 { + font-weight: 700; +} + +.cml-07fd4302.flex-body { + background: #fff; + box-shadow: 0 10rpx 300rpx 0 rgba(0, 0, 0, 0.11); +} + +.cml-07fd4302.flex-panel { + padding-top: 60rpx; +} + +.cml-07fd4302.flex-item__title { + background-color: antiquewhite; +} + +.cml-07fd4302.item { + margin: 8rpx; + border: 2rpx solid #fff; +} + +.cml-07fd4302.item-block { + height: 60rpx; + width: 100rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-07fd4302.item-wrap { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.cml-07fd4302.item-text-inner { + color: #fff; +} + +.cml-07fd4302.item-text { + width: 44rpx; + height: 44rpx; + border: 2rpx solid #fff; + border-radius: 22rpx; + color: #fff; + text-align: center; +} + +.cml-07fd4302.border-none { + border: 0; +} + +/** flex-direction **/ + +.cml-07fd4302.row { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} + +.cml-07fd4302.row-reverse { + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + flex-direction: row-reverse; +} + +.cml-07fd4302.column-reverse { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -webkit-flex-direction: column-reverse; + flex-direction: column-reverse; +} + +/** flex-wrap **/ + +.cml-07fd4302.nowrap { + -webkit-flex-wrap: nowrap; + flex-wrap: nowrap; + /* default */ +} + +.cml-07fd4302.wrap { + -webkit-flex-wrap: wrap; + flex-wrap: wrap; +} + +.cml-07fd4302.wrap-reverse { + -webkit-flex-wrap: wrap-reverse; + flex-wrap: wrap-reverse; +} + +/** justify-content **/ + +.cml-07fd4302.justify-flex-start { + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + /* default */ +} + +.cml-07fd4302.justify-flex-end { + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.cml-07fd4302.justify-center { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.cml-07fd4302.justify-space-between { + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; +} + +.cml-07fd4302.justify-space-around { + -webkit-justify-content: space-around; + justify-content: space-around; +} + +/** align-items **/ + +.cml-07fd4302.align-flex-start { + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.cml-07fd4302.align-flex-end { + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.cml-07fd4302.align-center { + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-07fd4302.align-baseline { + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.cml-07fd4302.align-stretch { + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + /* default */ +} + +/** align-content **/ + +.cml-07fd4302.align-content-flex-start { + -webkit-align-content: flex-start; + align-content: flex-start; + /* default */ +} + +.cml-07fd4302.align-content-flex-end { + -webkit-align-content: flex-end; + align-content: flex-end; +} + +.cml-07fd4302.align-content-center { + -webkit-align-content: center; + align-content: center; +} + +.cml-07fd4302.align-content-space-between { + -webkit-align-content: space-between; + align-content: space-between; +} + +.cml-07fd4302.align-content-space-around { + -webkit-align-content: space-around; + align-content: space-around; +} + +.cml-07fd4302.align-content-stretch { + -webkit-align-content: stretch; + align-content: stretch; +} + +/* order */ + +.cml-07fd4302.order_0 { + -webkit-box-ordinal-group: 1; + -webkit-order: 0; + order: 0; + /* default */ +} + +.cml-07fd4302.order_1 { + -webkit-box-ordinal-group: 2; + -webkit-order: 1; + order: 1; +} + +.cml-07fd4302.order_2 { + -webkit-box-ordinal-group: 3; + -webkit-order: 2; + order: 2; +} + +.cml-07fd4302.order_3 { + -webkit-box-ordinal-group: 4; + -webkit-order: 3; + order: 3; +} + +.cml-07fd4302.order_4 { + -webkit-box-ordinal-group: 5; + -webkit-order: 4; + order: 4; +} + +.cml-07fd4302.order_-1 { + -webkit-box-ordinal-group: 0; + -webkit-order: -1; + order: -1; +} + +/* flex-grow */ + +.cml-07fd4302.flex-grow_0 { + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + /* default */ +} + +.cml-07fd4302.flex-grow_1 { + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + flex-grow: 1; +} + +.cml-07fd4302.flex-grow_2 { + -webkit-box-flex: 2; + -webkit-flex-grow: 2; + flex-grow: 2; +} + +/* flex-shrink */ + +.cml-07fd4302.flex-shrink_0 { + -webkit-flex-shrink: 0; + flex-shrink: 0; +} + +.cml-07fd4302.flex-shrink_1 { + -webkit-flex-shrink: 1; + flex-shrink: 1; + /* default */ +} + +.cml-07fd4302.flex-shrink_2 { + -webkit-flex-shrink: 2; + flex-shrink: 2; +} + +/* flex-basis */ + +.cml-07fd4302.flex-basis_auto { + -webkit-flex-basis: auto; + flex-basis: auto; + /* default */ +} + +.cml-07fd4302.flex-basis_25 { + -webkit-flex-basis: 187.5rpx; + flex-basis: 187.5rpx; + /* 750cpx屏幕的25 %*/ +} + +.cml-07fd4302.flex-basis_50 { + -webkit-flex-basis: 375rpx; + flex-basis: 375rpx; + /* 750cpx屏幕的50 %*/ +} + +/** align-self **/ + +.cml-07fd4302.align-self-flex-start { + -webkit-align-self: auto; + align-self: auto; + /* default , inherit parent */ +} + +.cml-07fd4302.align-self-flex-start { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.cml-07fd4302.align-self-flex-end { + -webkit-align-self: flex-end; + align-self: flex-end; +} + +.cml-07fd4302.align-self-center { + -webkit-align-self: center; + align-self: center; +} + +.cml-07fd4302.align-self-baseline { + -webkit-align-self: baseline; + align-self: baseline; +} + +.cml-07fd4302.align-self-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-07fd4302.antiquewhite { + background-color: antiquewhite; +} + +.cml-07fd4302.lightpink { + background-color: lightpink; +} + +.cml-07fd4302.lightskyblue { + background-color: lightskyblue; +} + +.cml-07fd4302.silver { + background-color: silver; +} + +.cml-07fd4302.darkseagreen { + background-color: darkseagreen; +} + +.cml-07fd4302.lightslategrey { + background-color: lightslategrey; +} + +.cml-07fd4302.cadetblue { + background-color: cadetblue; +} + +.cml-07fd4302.lightgray { + background-color: lightgray; +} + +.cml-07fd4302.color-white { + color: white; +} + +.cml-07fd4302.color-brown { + color: brown; +} + +.cml-07fd4302.h_240 { + height: 240rpx; +} + +.cml-07fd4302.h_200 { + height: 200rpx; +} + +.cml-07fd4302.h_120 { + height: 120rpx; +} + +.cml-07fd4302.h_100 { + height: 100rpx; +} + +.cml-07fd4302.h_80 { + height: 80rpx; +} + +.cml-07fd4302.h_60 { + height: 60rpx; +} + +.cml-07fd4302.h_40 { + height: 40rpx; +} + +.cml-07fd4302.w_200 { + width: 200rpx; +} + +.cml-07fd4302.w_120 { + width: 120rpx; +} + +.cml-07fd4302.w_80 { + width: 80rpx; +} + +.cml-07fd4302.w_60 { + width: 60rpx; +} + +.cml-07fd4302.w_40 { + width: 40rpx; +} diff --git a/dist/alipay/static/img/selected_520dcc8.png b/dist/alipay/static/img/selected_520dcc8.png new file mode 100644 index 0000000000000000000000000000000000000000..27456e61caa75a448c2d75ae8ddaaf530b5d1217 GIT binary patch literal 1721 zcmV;q21fabP)fN55 zeQ(ds?yS9+?&+znu5Ws#AJw%Wn)Jh&S8o+-*9H`d2dRk|0>%JEp8(M-5PEg9fXf2K zGJ;qFgfx|nZFQJkEz!XFiwx` za)mlB1P&O5%}rs^k>VJPr_Kd!ClD~s9NezfR^LX%(Vz`CQV#&;WLNhjjD3F9R*y9> zzB}@aQfii9Z?|nMOnHL-mj<{|>g_W&dZmr9n;4o@uKGG^ShksMP)dBmHrX)L)x($= z?^1YmhDP0&Y?QZ3mPYkYC2Svq_{p_eZPo;)5%?}w;8*lWAFZV<()$3H9RYhGp8Ttt z9aUdx?%53i%Y@V+Y%ALw7?@wY#Nw76})-3Rn$s(0CCD0PmV}OK4lB79TUXJ z_G;jqTP9RbMVJqRVdZ%0FikZGN0OIqq1g+=j2fF>&AlB{DxCiaTr+vtv+pZ`&%_mActs`N3#LVwE|+ zvCYG3x@?#|>o=BJdC-da3!~0A3pU3UlYAl&HKb|3$*^?bfibC%KTL}erp<nq=uKnr-1 zUiYfd8aAGMoi_qTrH0Ljv$o4cQ@`GnS!r6*C-3#v$;$HYoCS2$ zusO1{)G-y7oCV@_K(`63kPcjtI)H?>P6ZIQ7uBEzyeT94X8joS(AP!h)=M;nQV>OA z=mMP~J?<9>lm|HPZ0UIxUOfF@rTVQJpi0^YxJc`U9eUwG)C(m7K?=(Bv|mkRuw;Z` z)WAA4h&tMDT;O~KXq*|oSKS0_Peoumd=&{c!;D;%?O}?8;?N+UOk>$1XbroD=g8}D zXJd+k)n+ym>!pEN4aY$RQ&*vufqw5mzhYR#`zlB_z1Yu2y`BGMriU(uefmHvD)NJ) zlW(QfIautNNO=RY*TZZE2YrQYPPDM4Oa;Ik;YK|&7dCWM`snqYEsokN0A|B3g=7Q#Qu+IkNR@Hr2TW`N%_QyfB8x!OUw4K5te;&j2v}8nd`Ps$yRN1 z6+^26!$@+S!uj@X2xx+Jx;po=%~g1_OUr5k?5}eAU>CnC)#ReQr(a{Xacu7IT6Pqy zv}y_K2sadO(VDpGn^8+oSoe7qM}GCA&P4K^dUaX>vr;@cv_~nNB@f(|dK+nmoStWe z9EFLb)uzX~r+B!h3B8{h)Z49Qz|_*oZEG7WVOg(r5BrUw-hRSGaXb`niC=N0Jb5i> z5IsiY%K1tnwaOa;Hp(d&b%(3mDe^S$p;tZB;21J6L;mD51bPDEDca37_6r5rn1H7a z-K{dKqo~v%E$&$HNVy<8y64R1-L%t48Y-~g5S$55-pSo!|}JBSD3e8g$N P00000NkvXXu0mjf(>pa7 literal 0 HcmV?d00001 diff --git a/dist/alipay/static/img/unselected_4e38c39.png b/dist/alipay/static/img/unselected_4e38c39.png new file mode 100644 index 0000000000000000000000000000000000000000..a0a72b3b03cc6769943fa2faf746f5317dbcc20c GIT binary patch literal 1672 zcmV;326y?1P)tt!(Myq3NGcgxqWky_ka-Y?~eeRZ2p8vxqC= zpKFMzhtRaNDLpi?aK+|SP@L(>5Cf)=o4Q+D}Ll*0*{d{L<>=Sp@ zxBh$k?7-~ry*Kk_zMq+SGxO%nMk;p64Gs=IPtr}1NaX0s%1Rx!4*M$C5*#O#E$8!? zdCnhmJdK^kPH`>M+uQq0adz58b~3^7@$r`z78X86^hc!IfPJo%^a1~e`zEnBs;jH7 zwYRtbSxP#E?%5IGk&%&imY0`50q}h?i76w*E@2+v@8TbE{wNlU%|@fq`FK38nytuY zvkC4?iQ*rsr27%0n=>XBkM2mO;*Ap;?f*n zLGW#w<($3l%aCpjfG0?!4d24eRW^YP*Uxu%ci-`qpeJ%kzz8}F*Z^W$ZCY8*FVp-6 zlF8%~Px{+FB(FoHeTKYFlUQ5{a(kZa41e z=;)g~^Ot~bCaq zq-twxds|vs7B#ynw%7RaJG07Wdai z!lD}ms%AZ~GsHa>6jtu8hYpl(0XYeMB{Px}VFMPE*u*GSGx31_hCm5u3mdRwa*PI;g}ZBj<_K(IYr%_Qfu=bh z5|h|0V}4CbU*9N!TLe_G*wq&nV3^K`No?-xr>S89($+7^QX;3dfkemU?8G1zF*r7J z?4azXFD>)L?QR(tRF>89&8O zy=&7~rM3pSNabejwx&w4@cHzPSN|Gd1puo~YYyAYr^a*M$mMV>&C+fe)^))DZ+TEH z+Px9|lvISbsH==;Zw0+}rBPa?8Lj<=_IHS3U6XcTJkJ9hr|{bJb<=%)bKya0$R)y!dGw;{0hE^0d;w;E{dJvs%Q2f|q` z_YiXgZ?+z8w%=0ieN%U!HkW!!gXW`dKK$E{ zEz8K6zwux%F`4+;T-nCYmU`)}rcaH(LflrwY6D4l|EN`{KzPozStf9Q#rqd~P+CjJ S$XEIR0000mNZ2G literal 0 HcmV?d00001 diff --git a/dist/alipay/static/js/app.js b/dist/alipay/static/js/app.js index a716fc2..7b83252 100644 --- a/dist/alipay/static/js/app.js +++ b/dist/alipay/static/js/app.js @@ -1 +1,158 @@ -var __CML__GLOBAL=require("./manifest.js");__CML__GLOBAL.webpackJsonp([1],{52:function(e,t,n){n(53),n(54)},53:function(e,t){},54:function(e,t,n){function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0}function i(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=St();try{var o=e.interceptors;if(o)for(var r=0,i=o.length;r0}function s(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function c(e,t){var n=St(),o=e.changeListeners;if(o){o=o.slice();for(var r=0,i=o.length;r=this.length,value:t0,"actions should have valid names, got: '"+e+"'");var n=function(){return k(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function k(e,t,n,o){var r=j(e,t,n,o);try{return t.apply(n,o)}finally{S(r)}}function j(e,t,n,o){var r=l()&&!!e,i=0;if(r){i=Date.now();var a=o&&o.length||0,u=new Array(a);if(a>0)for(var s=0;s",r="function"==typeof e?e:t,i="function"==typeof e?t:n;return Pe("function"==typeof r,O("m002")),Pe(0===r.length,O("m003")),Pe("string"==typeof o&&o.length>0,"actions should have valid names, got: '"+o+"'"),k(o,r,i,void 0)}function N(e){return"function"==typeof e&&!0===e.isMobxAction}function V(e,t,n){var o=function(){return k(t,n,e,arguments)};o.isMobxAction=!0,De(e,t,o)}function B(e,t){return $(e,t)}function $(e,t,n,o){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&U(e,t,n,o)}function U(e,t,n,o){e=z(e),t=z(t);var r=On.call(e);if(r!==On.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var i="[object Array]"===r;if(!i){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,u=t.constructor;if(a!==u&&!("function"==typeof a&&a instanceof a&&"function"==typeof u&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],o=o||[];for(var s=n.length;s--;)if(n[s]===e)return o[s]===t;if(n.push(e),o.push(t),i){if((s=e.length)!==t.length)return!1;for(;s--;)if(!$(e[s],t[s],n,o))return!1}else{var c,l=Object.keys(e);if(s=l.length,Object.keys(t).length!==s)return!1;for(;s--;)if(c=l[s],!F(t,c)||!$(e[c],t[c],n,o))return!1}return n.pop(),o.pop(),!0}function z(e){return w(e)?e.peek():Vn(e)?e.entries():ze(e)?Ge(e.entries()):e}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e,t){return e===t}function K(e,t){return B(e,t)}function W(e,t){return $e(e,t)||G(e,t)}function q(e,t,n){function o(){i(u)}var r,i,a;"string"==typeof e?(r=e,i=t,a=n):(r=e.name||"Autorun@"+je(),i=e,a=t),Pe("function"==typeof i,O("m004")),Pe(!1===N(i),O("m005")),a&&(i=i.bind(a));var u=new eo(r,function(){this.track(o)});return u.schedule(),u.getDisposer()}function J(e,t,n,o){var r,i,a,u;return"string"==typeof e?(r=e,i=t,a=n,u=o):(r="When@"+je(),i=e,a=t,u=n),q(r,function(e){if(i.call(u)){e.dispose();var t=St();a.call(u),Pt(t)}})}function Y(e,t,n,o){function r(){a(l)}var i,a,u,s;"string"==typeof e?(i=e,a=t,u=n,s=o):(i=e.name||"AutorunAsync@"+je(),a=e,u=t,s=n),Pe(!1===N(a),O("m006")),void 0===u&&(u=1),s&&(a=a.bind(s));var c=!1,l=new eo(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(r)},u))});return l.schedule(),l.getDisposer()}function X(e,t,n){function o(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!s(i,t),i=t}),a&&r.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&Se(O("m007")),ye(e)&&Se(O("m008"));var r;r="object"==typeof n?n:{},r.name=r.name||e.name||t.name||"Reaction@"+je(),r.fireImmediately=!0===n||!0===r.fireImmediately,r.delay=r.delay||0,r.compareStructural=r.compareStructural||r.struct||!1,t=wn(r.name,r.context?t.bind(r.context):t),r.context&&(e=e.bind(r.context));var i,a=!0,u=!1,s=r.equals?r.equals:r.compareStructural||r.struct?xn.structural:xn.default,c=new eo(r.name,function(){a||r.delay<1?o():u||(u=!0,setTimeout(function(){u=!1,o()},r.delay))});return c.schedule(),c.getDisposer()}function Q(e,t){if(ue(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;Pe(Object.isExtensible(e),O("m035")),Re(e)||(t=(e.constructor.name||"ObservableObject")+"@"+je()),t||(t="ObservableObject@"+je());var n=new Sn(e,t);return He(e,"$mobx",n),n}function Z(e,t,n,o){if(e.values[t]&&!jn(e.values[t]))return Pe("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ye(n.value)){var r=n.value;ee(e,t,r.initialValue,r.enhancer)}else N(n.value)&&!0===n.value.autoBind?V(e.target,t,n.value.originalFn):jn(n.value)?ne(e,t,n.value):ee(e,t,n.value,o);else te(e,t,n.get,n.set,xn.default,!0)}function ee(e,t,n,o){if(Ve(e.target,t),r(e)){var i=a(e,{object:e.target,name:t,type:"add",newValue:n});if(!i)return;n=i.newValue}n=(e.values[t]=new vn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,oe(t)),ae(e,e.target,t,n)}function te(e,t,n,o,r,i){i&&Ve(e.target,t),e.values[t]=new kn(n,e.target,r,e.name+"."+t,o),i&&Object.defineProperty(e.target,t,re(t))}function ne(e,t,n){var o=e.name+"."+t;n.name=o,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,re(t))}function oe(e){return Pn[e]||(Pn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){ie(this,e,t)}})}function re(e){return An[e]||(An[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function ie(e,t,n){var o=e.$mobx,i=o.values[t];if(r(o)){var s=a(o,{type:"update",object:e,name:t,newValue:n});if(!s)return;n=s.newValue}if((n=i.prepareNewValue(n))!==yn){var f=u(o),h=l(),s=f||h?{type:"update",object:e,oldValue:i.value,name:t,newValue:n}:null;h&&p(s),i.setNewValue(n),f&&c(o,s),h&&d()}}function ae(e,t,n,o){var r=u(e),i=l(),a=r||i?{type:"add",object:t,name:n,newValue:o}:null;i&&p(a),r&&c(e,a),i&&d()}function ue(e){return!!Ce(e)&&(L(e),En(e.$mobx))}function se(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||Vn(e))throw new Error(O("m019"));if(ue(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ue(e)||!!e.$mobx||rn(e)||oo(e)||jn(e)}function ce(e){return Pe(!!e,":("),C(function(t,n,o,r,i){Ve(t,n),Pe(!i||!i.get,O("m022")),ee(Q(t,void 0),n,o,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){ie(this,e,t)},!0,!1)}function le(e){for(var t=[],n=1;n=2,O("m014")),Pe("object"==typeof e,O("m015")),Pe(!Vn(e),O("m016")),n.forEach(function(e){Pe("object"==typeof e,O("m017")),Pe(!se(e),O("m018"))});for(var o=Q(e),r={},i=n.length-1;i>=0;i--){var a=n[i];for(var u in a)if(!0!==r[u]&&Ie(a,u)){if(r[u]=!0,e===a&&!Ne(e,u))continue;var s=Object.getOwnPropertyDescriptor(a,u);Z(o,u,s,t)}}return e}function de(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Mn.apply(null,arguments);if(Pe(arguments.length<=1,O("m021")),Pe(!ye(e),O("m020")),se(e))return e;var t=be(e,void 0,void 0);return t!==e?t:Dn.box(e)}function he(e){Se("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ye(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ve(e,t){return Pe(!ye(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function be(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),se(e)?e:Array.isArray(e)?Dn.array(e,n):Re(e)?Dn.object(e,n):ze(e)?Dn.map(e,n):e}function me(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ue(e)||w(e)||Vn(e)?e:Array.isArray(e)?Dn.shallowArray(e,n):Re(e)?Dn.shallowObject(e,n):ze(e)?Dn.shallowMap(e,n):Se("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function ge(e){return e}function _e(e,t,n){if(B(e,t))return t;if(se(e))return e;if(Array.isArray(e))return new pn(e,_e,n);if(ze(e))return new Nn(e,_e,n);if(Re(e)){var o={};return Q(o,n),pe(o,_e,[e]),o}return e}function we(e,t,n){return B(e,t)?t:e}function Oe(e,t){void 0===t&&(t=void 0),lt();try{return e.apply(t)}finally{ft()}}function xe(e){return Ae("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Dn.map(e)}function ke(){return"undefined"!=typeof window?window:e}function je(){return++Kn.mobxGuid}function Se(e,t){throw Pe(!1,e,t),"X"}function Pe(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Ae(e){return-1===$n.indexOf(e)&&($n.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Ee(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Me(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Te(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Ce(e){return null!==e&&"object"==typeof e}function Re(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Le(){for(var e=arguments[0],t=1,n=arguments.length;t0&&(t.dependencies=Me(e.observing).map(nt)),t}function ot(e,t){return rt(Qe(e,t))}function rt(e){var t={name:e.name};return it(e)&&(t.observers=at(e).map(rt)),t}function it(e){return e.observers&&e.observers.length>0}function at(e){return e.observers}function ut(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function st(e,t){if(1===e.observers.length)e.observers.length=0,ct(e);else{var n=e.observers,o=e.observersIndexes,r=n.pop();if(r!==t){var i=o[t.__mapid]||0;i?o[r.__mapid]=i:delete o[r.__mapid],n[i]=r}delete o[t.__mapid]}}function ct(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Kn.pendingUnobservations.push(e))}function lt(){Kn.inBatch++}function ft(){if(0==--Kn.inBatch){It();for(var e=Kn.pendingUnobservations,t=0;t=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return bt(e,t,n+1)})}function mt(e){return e instanceof Zn}function gt(e){switch(e.dependenciesState){case Xn.UP_TO_DATE:return!1;case Xn.NOT_TRACKING:case Xn.STALE:return!0;case Xn.POSSIBLY_STALE:for(var t=St(),n=e.observing,o=n.length,r=0;r0;Kn.computationDepth>0&&t&&Se(O("m031")+e.name),!Kn.allowStateChanges&&t&&Se(O(Kn.strictMode?"m030a":"m030b")+e.name)}function Ot(e,t,n){At(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Kn.runId;var o=Kn.trackingDerivation;Kn.trackingDerivation=e;var r;try{r=t.call(n)}catch(e){r=new Zn(e)}return Kn.trackingDerivation=o,xt(e),r}function xt(e){for(var t=e.observing,n=e.observing=e.newObserving,o=Xn.UP_TO_DATE,r=0,i=e.unboundDepsCount,a=0;ao&&(o=u.dependenciesState)}for(n.length=r,e.newObserving=null,i=t.length;i--;){var u=t[i];0===u.diffValue&&st(u,e),u.diffValue=0}for(;r--;){var u=n[r];1===u.diffValue&&(u.diffValue=0,ut(u,e))}o!==Xn.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function kt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState=Xn.NOT_TRACKING}function jt(e){var t=St(),n=e();return Pt(t),n}function St(){var e=Kn.trackingDerivation;return Kn.trackingDerivation=null,e}function Pt(e){Kn.trackingDerivation=e}function At(e){if(e.dependenciesState!==Xn.UP_TO_DATE){e.dependenciesState=Xn.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Xn.UP_TO_DATE}}function Et(e){return console.log(e),e}function Mt(e,t){return Ae("`whyRun` is deprecated in favor of `trace`"),e=Ct(arguments),e?jn(e)||oo(e)?Et(e.whyRun()):Se(O("m025")):Et(O("m024"))}function Tt(){for(var e=[],t=0;t=0&&Kn.globalReactionErrorHandlers.splice(t,1)}}function It(){Kn.inBatch>0||Kn.isRunningReactions||no(Dt)}function Dt(){Kn.isRunningReactions=!0;for(var e=Kn.pendingReactions,t=0;e.length>0;){++t===to&&(console.error("Reaction doesn't converge to a stable state after "+to+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),o=0,r=n.length;ot){for(var n=new Array(e-t),o=0;o0&&e+t+1>cn&&_(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=this;wt(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:void 0===t||null===t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=[]),r(this)){var u=a(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!u)return Bn;t=u.removedCount,n=u.added}n=n.map(function(e){return o.enhancer(e,void 0)});var s=n.length-t;this.updateArrayLength(i,s);var c=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(r=this.values).splice.apply(r,[e,t].concat(n));var o=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),o;var r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e.prototype.notifyArraySplice=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e}(),pn=function(e){function t(t,n,o,r){void 0===o&&(o="ObservableArray@"+je()),void 0===r&&(r=!1);var i=e.call(this)||this,a=new fn(o,n,i,r);return He(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),sn&&Object.defineProperty(a.array,"0",dn),i}return o(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var o,r=this.$mobx.values;o=e";De(e,t,wn(i,n))},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!0),_n=C(function(e,t,n){V(e,t,n)},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!1),wn=function(e,t,n,o){return 1===arguments.length&&"function"==typeof e?x(e.name||"",e):2===arguments.length&&"function"==typeof t?x(e,t):1===arguments.length&&"string"==typeof e?D(e):D(t).apply(null,arguments)};wn.bound=function(e,t,n){if("function"==typeof e){var o=x("",e);return o.autoBind=!0,o}return _n.apply(null,arguments)};var On=Object.prototype.toString,xn={identity:G,structural:K,default:W},kn=function(){function e(e,t,n,o,r){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=Xn.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Xn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+je(),this.value=new Zn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Qn.NONE,this.name=o||"ComputedValue@"+je(),r&&(this.setter=x(o+"-setter",r))}return e.prototype.onBecomeStale=function(){yt(this)},e.prototype.onBecomeUnobserved=function(){kt(this),this.value=void 0},e.prototype.get=function(){Pe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Kn.inBatch?(lt(),gt(this)&&(this.isTracing!==Qn.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),ft()):(pt(this),gt(this)&&this.trackAndCompute()&&ht(this));var e=this.value;if(mt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(mt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){Pe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else Pe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){l()&&f({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===Xn.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||mt(e)||mt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,Kn.computationDepth++;var t;if(e)t=Ot(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Zn(e)}return Kn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,o=!0,r=void 0;return q(function(){var i=n.get();if(!o||t){var a=St();e({type:"update",object:n,newValue:i,oldValue:r}),Pt(a)}o=!1,r=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return We(this.get())},e.prototype.whyRun=function(){var e=Boolean(Kn.trackingDerivation),t=Me(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Me(at(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Xn.NOT_TRACKING?O("m032"):" * This computation will re-run if any of the following observables changes:\n "+Te(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+O("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Te(n)+"\n")},e}();kn.prototype[Ke()]=kn.prototype.valueOf;var jn=Be("ComputedValue",kn),Sn=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return Pe(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}(),Pn={},An={},En=Be("ObservableObjectAdministration",Sn),Mn=ce(be),Tn=ce(me),Cn=ce(ge),Rn=ce(_e),Ln=ce(we),In={box:function(e,t){return arguments.length>2&&he("box"),new vn(e,be,t)},shallowBox:function(e,t){return arguments.length>2&&he("shallowBox"),new vn(e,ge,t)},array:function(e,t){return arguments.length>2&&he("array"),new pn(e,be,t)},shallowArray:function(e,t){return arguments.length>2&&he("shallowArray"),new pn(e,ge,t)},map:function(e,t){return arguments.length>2&&he("map"),new Nn(e,be,t)},shallowMap:function(e,t){return arguments.length>2&&he("shallowMap"),new Nn(e,ge,t)},object:function(e,t){arguments.length>2&&he("object");var n={};return Q(n,t),le(n,e),n},shallowObject:function(e,t){arguments.length>2&&he("shallowObject");var n={};return Q(n,t),fe(n,e),n},ref:function(){return arguments.length<2?ve(ge,arguments[0]):Cn.apply(null,arguments)},shallow:function(){return arguments.length<2?ve(me,arguments[0]):Tn.apply(null,arguments)},deep:function(){return arguments.length<2?ve(be,arguments[0]):Mn.apply(null,arguments)},struct:function(){return arguments.length<2?ve(_e,arguments[0]):Rn.apply(null,arguments)}},Dn=de;Object.keys(In).forEach(function(e){return Dn[e]=In[e]}),Dn.deep.struct=Dn.struct,Dn.ref.struct=function(){return arguments.length<2?ve(we,arguments[0]):Ln.apply(null,arguments)};var Hn={},Nn=function(){function e(e,t,n){void 0===t&&(t=be),void 0===n&&(n="ObservableMap@"+je()),this.enhancer=t,this.name=n,this.$mobx=Hn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new pn(void 0,ge,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(r(this)){var o=a(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!o)return this;t=o.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,r(this)){var n=a(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var o=l(),i=u(this),n=i||o?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return o&&p(n),Oe(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0}),i&&c(this,n),o&&d(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new vn(t,ge,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==yn){var o=l(),r=u(this),i=r||o?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;o&&p(i),n.setNewValue(t),r&&c(this,i),o&&d()}},e.prototype._addValue=function(e,t){var n=this;Oe(function(){var o=n._data[e]=new vn(t,n.enhancer,n.name+"."+e,!1);t=o.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var o=l(),r=u(this),i=r||o?{type:"add",object:this,name:e,newValue:t}:null;o&&p(i),r&&c(this,i),o&&d()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return v(this._keys.slice())},e.prototype.values=function(){return v(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return v(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(o){return e.call(t,n.get(o),o,n)})},e.prototype.merge=function(e){var t=this;return Vn(e)&&(e=e.toJS()),Oe(function(){Re(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],o=e[1];return t.set(n,o)}):ze(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&Se("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;Oe(function(){jt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return Oe(function(){var n=Fe(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return Pe(!0!==t,O("m033")),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}();b(Nn.prototype,function(){return this.entries()});var Vn=Be("ObservableMap",Nn),Bn=[];Object.freeze(Bn);var $n=[],Un=function(){},zn=Object.prototype.hasOwnProperty,Fn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Gn=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),Kn=new Gn,Wn=!1,qn=!1,Jn=!1,Yn=ke();Yn.__mobxInstanceCount?(Yn.__mobxInstanceCount++,setTimeout(function(){Wn||qn||Jn||(Jn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):Yn.__mobxInstanceCount=1;var Xn;!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Xn||(Xn={}));var Qn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Qn||(Qn={}));var Zn=function(){function e(e){this.cause=e}return e}(),eo=function(){function e(e,t){void 0===e&&(e="Reaction@"+je()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Xn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+je(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Qn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Kn.pendingReactions.push(this),It())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(lt(),this._isScheduled=!1,gt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&l()&&f({object:this,type:"scheduled-reaction"})),ft())},e.prototype.track=function(e){lt();var t,n=l();n&&(t=Date.now(),p({object:this,type:"reaction",fn:e})),this._isRunning=!0;var o=Ot(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&kt(this),mt(o)&&this.reportExceptionInDerivation(o.cause),n&&d({time:Date.now()-t}),ft()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,o=O("m037");console.error(n||o,e),l()&&f({type:"error",message:n,error:e,object:this}),Kn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(lt(),kt(this),ft()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=Rt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Me(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Te(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+O("m038")+"\n"},e.prototype.trace=function(e){void 0===e&&(e=!1),Tt(this,e)},e}(),to=100,no=function(e){return e()},oo=Be("Reaction",eo),ro=Ut(xn.default),io=Ut(xn.structural),ao=function(e,t,n){if("string"==typeof t)return ro.apply(null,arguments);Pe("function"==typeof e,O("m011")),Pe(arguments.length<3,O("m012"));var o="object"==typeof t?t:{};o.setter="function"==typeof t?t:o.setter;var r=o.equals?o.equals:o.compareStructural||o.struct?xn.structural:xn.default;return new kn(e,o.context,r,o.name||e.name||"",o.setter)};ao.struct=io,ao.equals=Ut;var uo={allowStateChanges:E,deepEqual:B,getAtom:Qe,getDebugName:et,getDependencyTree:tt,getAdministration:Ze,getGlobalState:Ye,getObserverTree:ot,interceptReads:en,isComputingDerivation:_t,isSpyEnabled:l,onReactionError:Lt,reserveArrayBuffer:_,resetGlobalState:Xe,isolateGlobalState:qe,shareGlobalState:Je,spyReport:f,spyReportEnd:d,spyReportStart:p,setReactionScheduler:Ht},so={Reaction:eo,untracked:jt,Atom:on,BaseAtom:nn,useStrict:P,isStrictModeEnabled:A,spy:h,comparer:xn,asReference:Nt,asFlat:Bt,asStructure:Vt,asMap:$t,isModifierDescriptor:ye,isObservableObject:ue,isBoxedObservable:bn,isObservableArray:w,ObservableMap:Nn,isObservableMap:Vn,map:xe,transaction:Oe,observable:Dn,computed:ao,isObservable:se,isComputed:zt,extendObservable:le,extendShallowObservable:fe,observe:Ft,intercept:Wt,autorun:q,autorunAsync:Y,when:J,reaction:X,action:wn,isAction:N,runInAction:H,expr:Yt,toJS:Xt,createTransformer:Qt,whyRun:Mt,isArrayLike:Ue,extras:uo},co=!1;for(var lo in so)!function(e){var t=so[e];Object.defineProperty(so,e,{get:function(){return co||(co=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})}(lo);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:uo}),t.default=so}.call(t,n(24))},function(e,t){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t1?t-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:[];if("Object"===(0,g.type)(t))for(var o in t)~n.indexOf(o)||(e[o]=t[o]);return e}function l(e,t){var n=void 0===e?"undefined":b(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function f(e,t,n){if(!t)return e;var o=t.split("."),r=!1,i=e,a=!0,u=!1,s=void 0;try{for(var c,f=o[Symbol.iterator]();!(a=(c=f.next()).done);a=!0){var p=c.value;if(!l(i,p)){i=void 0,r=!0;break}i=i[p]}}catch(e){u=!0,s=e}finally{try{!a&&f.return&&f.return()}finally{if(u)throw s}}return n?r?n:i:void 0===i?"":i}function p(e,t){return t.forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);n.enumerable||(n.enumerable=!0,Object.defineProperty(e,t,n))}),e}function d(e,t,n,o){return"boolean"==typeof n&&(o=n,n=null),y(t).forEach(function(r,i){var a={get:function(){return t[r]},configurable:!0,enumerable:!0};!o&&(a.set=function(e){t[r]=e}),Object.defineProperty(e,n?n[i]:r,a)}),e}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e;var n=Object.keys(e),o={},r=!0,i=!1,a=void 0;try{for(var u,s=n[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){var c=u.value;t.indexOf(c)<0&&(o[c]=e[c])}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return o}function y(e){var t=[];for(var n in e)t.push(n);return t}function v(){function e(e){return!!e||(console.error("pathStr should not be null!"),!1)}function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"Array"===(0,g.type)(n)?(e(r),n.forEach(function(e,n){t(e,r+"["+n+"]")})):"Object"===(0,g.type)(n)?Object.keys(n).forEach(function(e){t(n[e],r?r+"."+e:e)}):(e(r),o[r]=n)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o={};return t(n),o}Object.defineProperty(t,"__esModule",{value:!0});var b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=Object.assign||function(e){for(var t=1;t-1&&e.splice(n,1),t()}else for(var o=void 0;o=e.shift();)o()}}function u(e){return function(t){e.__cml_cbCollection__.push(t)}}function s(e,t){function n(t){"Function"===(0,w.type)(e.setData)&&e.setData(t,l(e))}var o=!1,r=void 0;return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("Function"===(0,w.type)(i.schedule)){e.__cml_reaction__=i;var a=e.__cml_originOptions__[t.propsName],u=(0,_.enumerableKeys)(a),s=(0,_.deleteProperties)(e.__cml_ob_data__,u),l=(0,g.default)(s),f=void 0;o?(f=(0,P.default)(l,r),c("beforeUpdate",e,l,r,f)):(o=!0,f=l),n(f),r=h({},l)}}}function c(e,t){var n=t.__cml_originOptions__;if("function"==typeof n[e]){for(var o=arguments.length,r=Array(o>2?o-2:0),i=2;i=0;r--)e.$watch(t,o[r]);else e.$watch(t,o)})}}},{key:"addPageHooks",value:function(){var e=this.context,t=e.__cml_originOptions__;x.default.get(this.platform+".page.hooks").forEach(function(n){"function"==typeof t[n]&&(e[n]=t[n])})}},{key:"start",value:function(e){if(this.context){var t=this.context,n=d(t.$setData,e);t.__cml_disposerList__.push(n)}}},{key:"destory",value:function(){if(this.context){a(this.context.__cml_disposerList__)()}}}]),e}();t.default=A},function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],n=this.data;return e.split(".").forEach(function(e){e&&void 0!==n&&(n=n[e])}),void 0!==n?n:t}},{key:"set",value:function(e,t){if(void 0===t)this.data=e;else if(e=String(e||"").trim()){var n=e.split("."),r=n.pop(),i=this.data||{};n.forEach(function(e){var t=i[e];if("object"===(void 0===t?"undefined":o(t)))i=i[e];else{if(void 0!==t)throw new Error("forbidden to set property["+e+"] of ["+t+"] data");i=i[e]={}}}),i[r]=t}}}]),e}();t.default=i},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=o(r),a=n(25),u=o(a),s=u.default.getInstance(),c={wx:{instance:s,props:"properties"},alipay:{instance:s,props:"props"},baidu:{instance:s,props:"properties"}};t.default=new i.default(c)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=n(45),r=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=r.default},function(e,t){function n(e){return Object.prototype.toString.call(e).slice(8,-1)}function o(e){if("Array"===n(e)){var t={};return e.forEach(function(e){t[e]=e}),t}return e}function r(e,t){var n=void 0===e?"undefined":u(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function i(e,t,n){if(!t)return e;var o=t.split("."),i=!1,a=e,u=!0,s=!1,c=void 0;try{for(var l,f=o[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var p=l.value;if(!r(a,p)){a=void 0,i=!0;break}a=a[p]}}catch(e){s=!0,c=e}finally{try{!u&&f.return&&f.return()}finally{if(s)throw c}}return n?i?n:a:void 0===a?"":a}function a(e,t,n,o,r){return"boolean"==typeof o&&(r=o,o=null),n.forEach(function(n,i){var a={get:function(){return t[n]},configurable:!0,enumerable:!0};!r&&(a.set=function(e){t[n]=e}),Object.defineProperty(e,o?o[i]:n,a)}),e}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.type=n,t.normalizeMap=o,t.isExistAttr=r,t.getByPath=i,t.proxy=a},function(e,t,n){n(3),e.exports=n(12)},function(e,t,n){function o(e){return i.default.createApp(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createApp=o;var r=n(16),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n-1?(0,p.mergeHooks)(t,o,r):"data"===r?(0,p.mergeData)(t,o,r):n(r)?(0,p.mergeSimpleProps)(t,o,r):"watch"===r?(0,p.mergeWatch)(t,o,r):"mixins"!==r&&(0,p.mergeDefault)(t,o,r)},n=function(t){return new RegExp("computed|methods|proto|"+e.propsName).test(t)},o={};!function e(n,o){if(o.mixins){var r=!0,i=!1,a=void 0;try{for(var u,s=o.mixins[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){e(n,u.value)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}}t(n,o)}(o,this.options),this.options=o}},{key:"transformHooks",value:function(){if(this.hooks&&this.hooks.length){var e=this;this.hooks.forEach(function(t){var n=e.options[t];n&&(e.options[t]=function(){for(var e=void 0,t=arguments.length,o=Array(t),r=0;r3&&void 0!==arguments[3])||arguments[3];if(void 0===t&&(t=!0),void 0===n&&(n=[]),t&&null===n&&(n=[]),t&&null!==e&&"object"===(void 0===e?"undefined":r(e)))for(var l=0,f=n.length;l1&&void 0!==arguments[1])||arguments[1],u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n&&null===u&&(u=[]),n&&null!==e&&"object"===(void 0===e?"undefined":i(e)))for(var s=0,c=u.length;s=o)for(var i in t){var a=e[i];void 0===a?e[i]="":r(a,t[i])}}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length&&t.forEach(function(t,n){r(e[n],t)})}function i(e,t,n,o){if(!f.extras.deepEqual(e,t))if("Object"===(0,l.type)(e)&&"Object"===(0,l.type)(t)){var r=Object.keys(e).length,s=Object.keys(t).length;if(r>=s)for(var c in e){var p=e[c],d=t[c];i(p,d,u(n,c),o)}else a(e,n,o)}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length?e.forEach(function(e,r){i(e,t[r],u(n,r,"array"),o)}):a(e,n,o)}function a(e,t,n){void 0!==e&&(n[t]=e)}function u(e,t,n){return"array"===n?e+"["+t+"]":c(t)?e+"["+t+"]":e?e+"."+t:t}function s(e){var t=Number(e);return t!==t}function c(e){return!s(Number(e))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var l=n(0),f=n(1)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Page=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d);t.Page=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="alipay";var o=new h.default({polyHooks:l.default.get("alipay.page.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{options:n.options,type:"page",builtinMixins:{onLoad:function(){o.setContext(this).init().start("page-view-render")},onReady:function(){o.setContext(this).initRefs()},onUnload:function(){o.setContext(this).destory()}},needResolveAttrs:["methods"],hooks:l.default.get("alipay.page.hooks"),hooksMap:l.default.get("alipay.page.hooksMap"),polyHooks:l.default.get("alipay.page.polyHooks"),usedHooks:l.default.get("alipay.page.usedHooks")}),__CML__GLOBAL.Page(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d),y=n(1);t.Component=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="alipay";var o=new h.default({polyHooks:l.default.get("alipay.component.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{type:"component",builtinMixins:{didMount:function(){o.setContext(this).init().initRefs().start("component-view-render")},didUpdate:function(e){var t=this,n=this.props;e&&e!==this.props&&Object.keys(n).forEach(function(o){y.extras.deepEqual(n[o],e[o])||(t[o]=n[o])})},didUnmount:function(){o.setContext(this).destory()}},hooks:l.default.get("alipay.component.hooks"),hooksMap:l.default.get("alipay.component.hooksMap"),polyHooks:l.default.get("alipay.component.polyHooks"),usedHooks:l.default.get("alipay.component.usedHooks"),needPropsHandler:!0,needTransformProperties:!1}),__CML__GLOBAL.Component(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return i.default.createPage(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createPage=o;var r=n(39),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};r.default.bootstrap.call(r.default,e)},getInfo:r.default.getInfo}},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?n-1:0),r=1;r1?n-1:0),r=1;r '' +_.disappearCssComment = function (content) { + var commentReg = /\/\*[\s\S]*?\*\//g; + return content.replace(commentReg, function (match) { + return ''; + }); +}; +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex).trim(); + var value = declaration.slice(colonIndex + 1).trim(); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/* eslint-disable */ +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + // 原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/alipay-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var commonMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js"); + +var _ = module.exports = commonMixins.deepClone(commonMixins); + +commonMixins.merge(_.mixins.methods, _defineProperty({}, _.eventEmitName, function (eventKey, detail) { + var _this = this; + + var dataset = {}; + var propKeys = Object.keys(this.props || {}); + (propKeys || []).forEach(function (propKey) { + if (propKey.indexOf('data-') === 0) { + var dataKey = propKey.slice(5); // 得到dataset中应该对应的key值 + if (dataKey) { + dataset[dataKey] = _this.props[propKey]; + } + } + }); + // let modelkey = this.props['data-modelkey']; + // let eventKeyProps = this.props["data-event" + eventKey]; + function titleLize(word) { + // 将开头字母转化为大写 + return word.replace(/^\w/, function (match) { + return match.toUpperCase(); + }); + } + var callback = this.props['on' + titleLize(eventKey)]; + if (callback && _.isType(callback, 'Function')) { + callback({ + type: eventKey, + detail: detail, + currentTarget: { + dataset: dataset + } + }); + } +})); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js": +/***/ (function(module, exports, __webpack_require__) { + + +var _ = module.exports = {}; +var utils = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js"); +_.eventProxyName = '_cmlEventProxy'; +_.modelEventProxyName = '_cmlModelEventProxy'; // c-model v-model的事件代理 +_.inlineStatementEventProxy = '_cmlInlineStatementEventProxy'; // 内联语句的事件代理 +_.eventEmitName = '$cmlEmit'; // 触发事件的方法 +_.styleParseName = '$cmlStyle'; // 提供各端处理style属性的方法 weex中处理成对象,wx中处理成字符串,web中不处理 +_.styleProxyName = '_cmlStyleProxy'; // 提供代理 weex和web端处理style +_.mergeStyleName = '$cmlMergeStyle'; +_.animationProxy = '_animationCb'; +_.weexClassProxy = '_weexClassProxy'; +_.merge = function (target, fromObj) { + Object.keys(fromObj).forEach(function (key) { + target[key] = fromObj[key]; + }); +}; + +_.isType = function (obj, type) { + return Object.prototype.toString.call(obj).slice(8, -1) === type; +}; + +_.mergeStyle = function () { + // 可以接受字符串或者对象 + function styleToObj(str) { + var obj = {}; + str.split(';').filter(function (item) { + return !!item.trim(); + }).forEach(function (item) { + var _utils$getStyleKeyVal = utils.getStyleKeyValue(item), + key = _utils$getStyleKeyVal.key, + value = _utils$getStyleKeyVal.value; + + key = key.replace(/\s+/, ''); + value = value.replace(/\s+/, ''); + obj[key] = value; + }); + return obj; + } + var arr = []; + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + args.forEach(function (arg) { + if (typeof arg === 'string') { + arr.push(styleToObj(arg)); + } else if (Object.prototype.toString.call(arg) === '[object Object]') { + arr.push(arg); + } + }); + var resultObj = Object.assign.apply(Object, arr); + + var resultStr = ''; + Object.keys(resultObj).forEach(function (key) { + resultStr += key + ':' + resultObj[key] + ';'; + }); + return resultStr; +}; +_.trim = function (value) { + return value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); +}; +_.isReactive = function (value) { + var reg = /(?:^'([^']*?)'$)/; + return _.trim(value).match(reg); +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js": +/***/ (function(module, exports) { + +var _ = module.exports = {}; + +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex); + var value = declaration.slice(colonIndex + 1); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +var _methods; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var common = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js"); +var wxStyleHandle = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/proxy/proxyMiniapp.js"); + +var deepClone = function deepClone(obj) { + if (obj.toString().slice(8, -1) !== "Object") { + return obj; + } + var res = {}; + Object.keys(obj).forEach(function (key) { + res[key] = deepClone(obj[key]); + }); + return res; +}; + +var _ = module.exports = { deepClone: deepClone }; + +common.merge(_, common); + +_.mixins = { + methods: (_methods = {}, _defineProperty(_methods, _.inlineStatementEventProxy, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + var argsStr = dataset && dataset.args; + var argsArr = []; + // 由于百度对于 data-arg="" 在dataset.arg = true 值和微信端不一样所以需要重新处理下这部分逻辑 + if (argsStr && typeof argsStr === 'string') { + argsArr = argsStr.split(',').reduce(function (result, item, index) { + var arg = dataset['arg' + index]; + if (arg === "$event") { + var newEvent = getNewEvent(e); + result.push(newEvent); + } else { + // 这里的值微信已经计算好了;到dateset的时候已经是计算的结果 比如msg = 'sss' data-arg1="{{msg + 1}}" + // dataset[arg1] = 'sss1' + result.push(dataset['arg' + index]); + } + return result; + }, []); + } + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + this[originFuncName].apply(this, _toConsumableArray(argsArr)); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.modelEventProxyName, function (e) { + var dataset = e.currentTarget && e.currentTarget.dataset; + var modelKey = dataset && dataset.modelkey; + if (modelKey) { + this[modelKey] = e.detail.value; + } + }), _defineProperty(_methods, _.eventProxyName, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + var newEvent = getNewEvent(e); + this[originFuncName](newEvent); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.styleParseName, function (content) { + var res = ''; + if (_.isType(content, 'Object')) { + Object.keys(content).forEach(function (key) { + res += key + ':' + content[key] + ';'; + }); + } else if (_.isType(content, 'String')) { + res = content; + } + return wxStyleHandle(res); + }), _defineProperty(_methods, _.mergeStyleName, function () { + return _.mergeStyle.apply(_, arguments); + }), _defineProperty(_methods, _.animationProxy, function () { + var animationValue = arguments.length <= 0 ? undefined : arguments[0]; + // animationValue:{cbs:{0:cb0,1:cb1,length:2},index} + var animation = this[animationValue]; // 引用值 + if (!animation) { + return; + } + var cbs = animation.cbs, + index = animation.index; + // 配合 解决百度端动画bug + + if (cbs === undefined || index === undefined) { + return; + } + var cb = cbs[index]; + if (cb && typeof cb === 'function') { + cb(); + } + delete animation.index; + animation.index = index + 1; + }), _methods) + +}; + +function getNewEvent(e) { + var newEvent = {}; + ['type', 'timeStamp', 'target', 'currentTarget', 'detail', 'touches', 'changedTouches'].forEach(function (key) { + if (e[key]) { + if (~['target', 'currentTarget'].indexOf(key)) { + var newTarget = {}; + newTarget = { + id: e[key].id, + dataset: e[key].dataset + }; + newEvent[key] = newTarget; + } else { + newEvent[key] = e[key]; + } + } + }); + + newEvent._originEvent = e; + return newEvent; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js": +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime-module.js": +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js": +/***/ (function(module, exports) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js": +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/cpx2px/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = cpx2px; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function cpx2px(cpx) { + if (typeof cpx !== 'number') { + console.error('Parameter must be a number'); + return; + } + var viewportWidth = _getWidth2.default.getWidth(); + var px = +(viewportWidth / 750 * cpx).toFixed(3); + return px; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": { + "res": { + "os": "String", + "env": "String", + "viewportWidth": "Number", + "viewportHeight": "Number", + "extraParams": "CMLObject" + }, + "CallBack": { + "input": ["res"], + "output": "Undefined" + } + }, + "interfaces": { + "UserInfoInterface": { + "getSystemInfo": { + "input": ["CallBack"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["UserInfoInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getSystemInfo", + value: function getSystemInfo(cb) { + my.getSystemInfo({ + success: function success(res) { + var os = res.platform === "iPhone" ? "ios" : "android"; + var viewportWidth = res.windowWidth; + var viewportHeight = res.windowHeight; + var systemInfo = { + os: os, + env: 'alipay', + viewportWidth: viewportWidth, + viewportHeight: viewportHeight, + extraParams: res || {} + }; + cb(systemInfo); + }, + fail: function fail(err) { + var systemInfo = { + os: '', + env: 'alipay', + viewportWidth: 0, + viewportHeight: 0, + extraParams: {} + }; + cb(systemInfo); + } + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.default = getSystemInfo; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +var _utils = __webpack_require__("./node_modules/chameleon-api/src/lib/utils.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getSystemInfo() { + return new Promise(function (resolve, reject) { + _index2.default.getSystemInfo(function (res) { + res.extraParams = (0, _utils.tryJsonParse)(res.extraParams); + // px2viewpx + var pxRpxRate = 750 / res.viewportWidth; + var viewportHeight = (res.viewportHeight * pxRpxRate).toFixed(3); + var viewportWidth = (res.viewportWidth * pxRpxRate).toFixed(3); + + if (res.os) { + resolve(_extends({}, res, { + viewportHeight: viewportHeight, + viewportWidth: viewportWidth + })); + } else { + reject(res); + } + }); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getWidthInterface": { + "getWidth": { + "input": [], + "output": "Number" + } + } + }, + "classes": { + "Method": ["getWidthInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getWidth", + value: function getWidth() { + var _my$getSystemInfoSync = my.getSystemInfoSync(), + windowWidth = _my$getSystemInfoSync.windowWidth; + + return windowWidth; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = px2cpx; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function px2cpx(px) { + + if (typeof px !== 'number') { + console.error('Parameter must be a number'); + return; + } + + var viewportWidth = _getWidth2.default.getWidth(); + var cpx = +(750 / viewportWidth * px).toFixed(3); + return cpx; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/lib/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isFn = isFn; +exports.isStr = isStr; +exports.isNum = isNum; +exports.isObj = isObj; +exports.isArray = isArray; +exports.isUndefined = isUndefined; +exports.isEmpty = isEmpty; +exports.noop = noop; +exports.parseQuery = parseQuery; +exports.queryStringify = queryStringify; +exports.buildQueryStringUrl = buildQueryStringUrl; +exports.queryParse = queryParse; +exports.isNeedApiPrefix = isNeedApiPrefix; +exports.addApiPrefix = addApiPrefix; +exports.tryJsonParse = tryJsonParse; +exports.getQueryParamsFromUrl = getQueryParamsFromUrl; +exports.getOpenObj = getOpenObj; +exports.getUrlWithConnector = getUrlWithConnector; +exports.getRefObj = getRefObj; +exports.compareVersion = compareVersion; + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +/** + * 基础js方法的封装 + * + */ +function typeEqual(obj, type) { + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; +} + +function isFn(obj) { + return typeEqual(obj, 'Function'); +} + +function isStr(obj) { + return typeEqual(obj, 'String'); +} + +function isNum(obj) { + return typeof obj === 'number'; +} + +function isObj(obj) { + return typeEqual(obj, 'Object'); +} + +function isArray(obj) { + return typeEqual(obj, 'Array'); +} + +function isUndefined(obj) { + return typeEqual(obj, 'Undefined'); +} + +function isEmpty(obj) { + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + return false; + } + } + return true; +} + +function noop() {} + +function parseQuery(obj) { + var str = '&'; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + str += key + '=' + encodeURIComponent(obj[key]) + '&'; + } + } + return str; +} + +function queryStringify(obj) { + var strArr = []; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + strArr.push(key + '=' + encodeURIComponent(obj[key])); + } + } + return strArr.join('&'); +} + +function buildQueryStringUrl(params) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if (!url) return queryStringify(params); + var retUrl = url; + if (queryStringify(params)) { + retUrl = url.indexOf('?') > -1 ? url + '&' + queryStringify(params) : url + '?' + queryStringify(params); + } + return retUrl; +} + +function queryParse() { + var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + var arr = search.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +function isNeedApiPrefix(url) { + return !/^(https?\:\/\/)|^(\/\/)/.test(url); +} + +function addApiPrefix(url, domainkey) { + var domainMap = process.env.domainMap; + // 新版cli + if (domainMap) { + var prefix = domainMap[domainkey] || process.env.devApiPrefix; + return prefix + url; + } else { + // 老版本配置apiPrefix + if (true) { + return "http://172.24.24.111:8005" + url; + } + } +} + +function tryJsonParse(some) { + // 这里eslint提示也先别删除\[\] + if (isStr(some) && /[\{\[].*[\}\]]/.test(some)) { + some = JSON.parse(some); + } + return some; +} + +function getQueryParamsFromUrl(url) { + var arr = url.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +/** + * 获取处理后的各端打开的地址 + * @param {String} url url地址 + * @return {Object} objTreated 处理好的三端地址及对象 + */ +function getOpenObj(url) { + var webUrlWithoutQuery = url.split('?')[0]; + var queryObj = getQueryParamsFromUrl(url); + + var _queryObj$path = queryObj.path, + path = _queryObj$path === undefined ? '' : _queryObj$path, + _queryObj$envVersion = queryObj.envVersion, + envVersion = _queryObj$envVersion === undefined ? '' : _queryObj$envVersion, + _queryObj$weixin_appi = queryObj.weixin_appid, + weixin_appid = _queryObj$weixin_appi === undefined ? '' : _queryObj$weixin_appi, + _queryObj$weixin_path = queryObj.weixin_path, + weixin_path = _queryObj$weixin_path === undefined ? '' : _queryObj$weixin_path, + _queryObj$weixin_envV = queryObj.weixin_envVersion, + weixin_envVersion = _queryObj$weixin_envV === undefined ? '' : _queryObj$weixin_envV, + _queryObj$baidu_appid = queryObj.baidu_appid, + baidu_appid = _queryObj$baidu_appid === undefined ? '' : _queryObj$baidu_appid, + _queryObj$baidu_path = queryObj.baidu_path, + baidu_path = _queryObj$baidu_path === undefined ? '' : _queryObj$baidu_path, + _queryObj$baidu_envVe = queryObj.baidu_envVersion, + baidu_envVersion = _queryObj$baidu_envVe === undefined ? '' : _queryObj$baidu_envVe, + _queryObj$alipay_appi = queryObj.alipay_appid, + alipay_appid = _queryObj$alipay_appi === undefined ? '' : _queryObj$alipay_appi, + _queryObj$alipay_path = queryObj.alipay_path, + alipay_path = _queryObj$alipay_path === undefined ? '' : _queryObj$alipay_path, + _queryObj$alipay_envV = queryObj.alipay_envVersion, + alipay_envVersion = _queryObj$alipay_envV === undefined ? '' : _queryObj$alipay_envV, + _queryObj$weex_path = queryObj.weex_path, + weex_path = _queryObj$weex_path === undefined ? '' : _queryObj$weex_path, + _queryObj$cml_addr = queryObj.cml_addr, + cml_addr = _queryObj$cml_addr === undefined ? '' : _queryObj$cml_addr, + extraData = _objectWithoutProperties(queryObj, ['path', 'envVersion', 'weixin_appid', 'weixin_path', 'weixin_envVersion', 'baidu_appid', 'baidu_path', 'baidu_envVersion', 'alipay_appid', 'alipay_path', 'alipay_envVersion', 'weex_path', 'cml_addr']); + + var objTreated = { + weex: cml_addr ? webUrlWithoutQuery + '?weex_path=' + weex_path + queryStringify(extraData) + '&cml_addr=' + cml_addr : null, + web: webUrlWithoutQuery + '?' + queryStringify(extraData), + wx: { + appId: weixin_appid, + path: weixin_path || path, + extraData: extraData, + envVersion: weixin_envVersion || envVersion + }, + alipay: { + appId: alipay_appid, + path: alipay_path || path, + extraData: extraData, + envVersion: alipay_envVersion || envVersion + }, + baidu: { + appKey: baidu_appid, + path: baidu_path || path, + extraData: extraData + } + }; + return objTreated; +} + +// 获得带正确连接符的url +function getUrlWithConnector(url) { + var connector = url.includes('?') ? '&' : '?'; + return url + connector; +} + +// 获取ref的通用对象 +function getRefObj(ref, context) { + var refObj = { + webDom: '', + id: '', + weexRef: '', + context: context + }; + // 容错处理 + if (!ref) return refObj; + + // 兼容新版ref, 为字符串 + if (typeof ref == 'string') { + refObj.id = ref; + if (false) { + refObj.weexRef = context.$refs && context.$refs[ref]; + } else if (false) { + refObj.webDom = context.$refs[ref] && context.$refs[ref][0] || context.$refs[ref] && context.$refs[ref].$el || context.$refs[ref]; + } + return refObj; + } + + // 向下兼容旧版ref + if (true) { + refObj.id = ref.id; + } else if (process.env.platform === 'weex') { + refObj.weexRef = ref; + } else if (ref.$el) { + refObj.webDom = ref.$el; + } else { + refObj.webDom = ref; + } + return refObj; +} + +/** + * 比较版本号 + * @param {String} v1 版本号1 + * @param {String} symb 比较符 + * @param {String} v2 版本号2 + */ +function compareVersion(v1, symb, v2) { + v1 = parseVersion(v1); + v2 = parseVersion(v2); + if (symb.indexOf('=') !== -1 && v1 === v2) { + return true; + } + if (symb.indexOf('>') !== -1 && v1 > v2) { + return true; + } + if (symb.indexOf('<') !== -1 && v1 < v2) { + return true; + } + return false; +} + +function parseVersion() { + var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + version = version.split('.'); + version.length = 4; + var ret = []; + version.forEach(function (n) { + n = n * 1; + if (n) { + ret.push(n >= 10 ? n : '0' + n); + } else { + ret.push('00'); + } + }); + return parseInt(ret.join(''), 10); +} + +/** + * 判断targetMap中的属性是否被checkMap的属性包含,不是则抛出错误 + * @param {Object || Array} checkMap + * @param {Object} targetMap + * @returns {Boolean} + */ +var checkValue = exports.checkValue = function checkValue(check, targetMap) { + if (isObj(check) || isArray(check)) { + var checkArray = isObj(check) ? Object.keys(check) : check; + Object.keys(targetMap).forEach(function (key) { + if (!checkArray.includes(key)) { + throw Error(key + '\u503C\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u68C0\u67E5\uFF01'); + } + }); + } else { + // redLog('请传入数组或对象') + return false; + } + return true; +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.js"); + +var _index2 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.js"); + +var _index3 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js"); + +var _index4 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js"); + +var _index5 = _interopRequireDefault(_index4); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _extends({ + createApp: _index.createApp, + createPage: _index2.createPage, + createComponent: _index3.createComponent +}, _index5.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +__webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "bootstrapInterface": { + "bootstrap": { + "input": ["CMLObject"], + "output": "Undefined" + }, + "getInfo": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["bootstrapInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +/* istanbul ignore next */ + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "bootstrap", + value: function bootstrap(options) {// 小程序端启动入口为src/app/app.cml + } + }, { + key: "getInfo", + value: function getInfo() { + return {}; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* istanbul ignore next */ +exports.default = { + bootstrap: function bootstrap() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _index2.default.bootstrap.call(_index2.default, options); + }, + getInfo: _index2.default.getInfo + +}; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js": +/***/ (function(module, exports) { + +/** + * Promise.finally、Promise.done 垫片 + */ +if (typeof Promise.prototype.finally !== 'function') { + Promise.prototype.finally = function (onFinally) { + var P = this.constructor; + return this.then(function (value) { + return P.resolve(onFinally()).then(function () { + return value; + }); + }, function (reason) { + return P.resolve(onFinally()).then(function () { + throw reason; + }); + }); + }; +} + +if (typeof Promise.prototype.done === 'undefined') { + Promise.prototype.done = function (onFulfilled, onRejected) { + this.then(onFulfilled, onRejected).catch(function (error) { + setTimeout(function () { + throw error; + }, 0); + }); + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _alipay = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createAppInterface": { + "createApp": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createAppInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createApp", + value: function createApp(options) { + return new _alipay.App(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createApp = createApp; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createApp(options) { + return _index2.default.createApp(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _alipay = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createCmptInterface": { + "createComponent": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createCmptInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createComponent", + value: function createComponent(options) { + return new _alipay.Component(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createComponent = createComponent; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createComponent(options) { + return _index2.default.createComponent(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _alipay = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createPgInterface": { + "createPage": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createPgInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createPage", + value: function createPage(options) { + return new _alipay.Page(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPage = createPage; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createPage(options) { + return _index2.default.createPage(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/core/OptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _MiniOptTransformer2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js"); + +var _MiniOptTransformer3 = _interopRequireDefault(_MiniOptTransformer2); + +var _alipayMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/alipay-mixins.js"); + +var _alipayMixins2 = _interopRequireDefault(_alipayMixins); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var OptTransformer = function (_MiniOptTransformer) { + _inherits(OptTransformer, _MiniOptTransformer); + + function OptTransformer(config) { + _classCallCheck(this, OptTransformer); + + var _this = _possibleConstructorReturn(this, (OptTransformer.__proto__ || Object.getPrototypeOf(OptTransformer)).call(this, config)); + + _this.platform = 'alipay'; + _this.baseMixins = _alipayMixins2.default.mixins; + _this.init(); + return _this; + } + + return OptTransformer; +}(_MiniOptTransformer3.default); + +exports.default = OptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _instance = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/instance/index.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _instance.App; + } +}); +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _instance.Page; + } +}); +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _instance.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/instance/app.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.App = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var App = exports.App = function (_BaseCtor) { + _inherits(App, _BaseCtor); + + function App(options) { + _classCallCheck(this, App); + + var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, options)); + + _this.cmlType = 'alipay'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('alipay.app.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'app', + builtinMixins: { + onLaunch: function onLaunch() { + // 初始化 + runtimeWidget.setContext(this).init().start('app-view-render'); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('alipay.app.hooks'), + hooksMap: _lifecycle2.default.get('alipay.app.hooksMap'), + polyHooks: _lifecycle2.default.get('alipay.app.polyHooks'), + usedHooks: _lifecycle2.default.get('alipay.app.usedHooks') + }); + + __CML__GLOBAL.App(_this.options); + return _this; + } + + return App; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/instance/component.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Component = exports.Component = function (_BaseCtor) { + _inherits(Component, _BaseCtor); + + function Component(options) { + _classCallCheck(this, Component); + + var _this = _possibleConstructorReturn(this, (Component.__proto__ || Object.getPrototypeOf(Component)).call(this, options)); + + _this.cmlType = 'alipay'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('alipay.component.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'component', + builtinMixins: { + didMount: function didMount() { + // 初始化 + runtimeWidget.setContext(this).init().initRefs().start('component-view-render'); + }, + didUpdate: function didUpdate(preProps) { + var _this2 = this; + + var nextProps = this.props; + + if (preProps && preProps !== this.props) { + Object.keys(nextProps).forEach(function (key) { + if (!_mobx.extras.deepEqual(nextProps[key], preProps[key])) { + _this2[key] = nextProps[key]; + } + }); + } + }, + didUnmount: function didUnmount() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + hooks: _lifecycle2.default.get('alipay.component.hooks'), + hooksMap: _lifecycle2.default.get('alipay.component.hooksMap'), + polyHooks: _lifecycle2.default.get('alipay.component.polyHooks'), + usedHooks: _lifecycle2.default.get('alipay.component.usedHooks'), + needPropsHandler: true, + needTransformProperties: false + }); + + __CML__GLOBAL.Component(_this.options); + return _this; + } + + return Component; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/instance/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _app = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/instance/app.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _app.App; + } +}); + +var _page = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/instance/page.js"); + +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _page.Page; + } +}); + +var _component = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/instance/component.js"); + +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _component.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/alipay/instance/page.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Page = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/alipay/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Page = exports.Page = function (_BaseCtor) { + _inherits(Page, _BaseCtor); + + function Page(options) { + _classCallCheck(this, Page); + + var _this = _possibleConstructorReturn(this, (Page.__proto__ || Object.getPrototypeOf(Page)).call(this, options)); + + _this.cmlType = 'alipay'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('alipay.page.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + options: _this.options, + type: 'page', + builtinMixins: { + onLoad: function onLoad() { + // 初始化 + runtimeWidget.setContext(this).init().start('page-view-render'); + }, + onReady: function onReady() { + runtimeWidget.setContext(this).initRefs(); + }, + onUnload: function onUnload() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('alipay.page.hooks'), + hooksMap: _lifecycle2.default.get('alipay.page.hooksMap'), + polyHooks: _lifecycle2.default.get('alipay.page.polyHooks'), + usedHooks: _lifecycle2.default.get('alipay.page.usedHooks') + }); + + __CML__GLOBAL.Page(_this.options); + return _this; + } + + return Page; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _proto = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/proto.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var BaseCtor = function () { + function BaseCtor(options) { + _classCallCheck(this, BaseCtor); + + // 拷贝原型链上属性 + (0, _proto.copyProtoProperty)(options); + + this.options = _extends({}, options); + this.originalOptions = options; + } + + _createClass(BaseCtor, [{ + key: 'initOptTransformer', + value: function initOptTransformer(OptTransformer, config) { + var optTransformer = new OptTransformer(_extends({ + options: this.options + }, config)); + this.options = optTransformer.getOptions(); + } + }, { + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseCtor; +}(); + +exports.default = BaseCtor; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _warn = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/warn.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// options transform 基类 +var BaseOptionsTransformer = function () { + function BaseOptionsTransformer(config) { + _classCallCheck(this, BaseOptionsTransformer); + + this.type = config.type; + this.options = config.options; + this.injectMixins = config.injectMixins || []; + this.builtinMixins = config.builtinMixins; + this.hooks = config.hooks; + this.hooksMap = config.hooksMap; + this.polyHooks = config.polyHooks; + this.usedHooks = config.usedHooks; + this.platform = ''; + + if (true) { + var mix = this.options.mixins; + (0, _warn.invariant)((0, _type.type)(mix) === 'Undefined' || (0, _type.type)(mix) === "Array", "mixins expects an Array"); + } + } + + _createClass(BaseOptionsTransformer, [{ + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseOptionsTransformer; +}(); + +exports.default = BaseOptionsTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _BaseOptionsTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js"); + +var _BaseOptionsTransformer2 = _interopRequireDefault(_BaseOptionsTransformer); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _resolve = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/resolve.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +// 各种小程序options transform 基类 +var MiniOptTransformer = function (_BaseOptionsTransform) { + _inherits(MiniOptTransformer, _BaseOptionsTransform); + + function MiniOptTransformer(config) { + _classCallCheck(this, MiniOptTransformer); + + //小程序特有 + var _this = _possibleConstructorReturn(this, (MiniOptTransformer.__proto__ || Object.getPrototypeOf(MiniOptTransformer)).call(this, config)); + + _this.needPropsHandler = config.needPropsHandler; + + _this.needResolveAttrs = config.needResolveAttrs; + _this.needTransformProperties = config.needTransformProperties; + return _this; + } + + _createClass(MiniOptTransformer, [{ + key: 'init', + value: function init() { + this.propsName = this.platform ? _KEY2.default.get(this.platform + '.props') : ''; + + this.needPropsHandler && this.initProps(this.options); + // 生命周期映射 + (0, _util.transferLifecycle)(this.options, this.hooksMap); + this.handleMixins(this.options); + + // 扩展各端多态生命周期 + this.extendPolyHooks(); + + // init 顺序很重要 + // this.mergeInjectedMixins() + this.mergeBuiltinMixins(); + this.resolveOptions(); + this.transformHooks(); + this.needResolveAttrs && this.resolveAttrs(); + this.needTransformProperties && this.transformProperties(); + + if (this.platform === 'alipay') { + delete this.options['computed']; + } + } + + /** + * 处理组件props属性 + * @param {Object} vmObj 组件options + * @return {[type]} [description] + */ + + }, { + key: 'initProps', + value: function initProps(vmObj) { + var _this2 = this; + + if (!vmObj['props']) return; + + Object.getOwnPropertyNames(vmObj['props']).forEach(function (name) { + var prop = vmObj['props'][name]; + // Number: 0 + // Boolean: false + // Array: false + // String: '' + // Object: null + // null: null + function make(type) { + if (!knowType(type)) { + return; + } + + switch (type) { + case Number: + prop = vmObj['props'][name] = { + type: Number, + default: 0 + }; + break; + case Boolean: + prop = vmObj['props'][name] = { + type: Boolean, + default: false + }; + break; + case Array: + prop = vmObj['props'][name] = { + type: Array, + default: [] + }; + break; + case String: + prop = vmObj['props'][name] = { + type: String, + default: '' + }; + break; + case Object: + prop = vmObj['props'][name] = { + type: Object, + default: null + }; + break; + case null: + prop = vmObj['props'][name] = { + type: null, + default: null + }; + break; + default: + break; + } + } + + function knowType(type) { + return type === Number || type === Boolean || type === Array || type === String || type === Object || type === null; + } + + // 处理 props = { a: String, b: Boolean } + make(prop); + + if ((0, _type.type)(prop) === 'Object') { + if (_this2.platform === 'alipay') { + if (!prop.hasOwnProperty('default')) { + // alipay 处理 // 处理 props = { a: {type:String}, b: {type:Boolean} } + make(prop.type); + } + + vmObj['props'][name] = prop['default']; + } else { + (0, _util.rename)(vmObj['props'][name], 'default', 'value'); + } + } + }); + + if (this.platform !== 'alipay') { + (0, _util.rename)(vmObj, 'props', 'properties'); + } + + function check(value, type) { + + if (typeof value === 'undefined') { + console.error(prop + '\u9700\u8981\u4F20\u9ED8\u8BA4\u503C'); + return false; + } + // todo type 校验 + } + } + }, { + key: 'handleMixins', + value: function handleMixins(VMObj) { + var _this3 = this; + + if (!VMObj.mixins) return; + + var mixins = VMObj.mixins; + + mixins.forEach(function (mix) { + // 生命周期映射 + (0, _util.transferLifecycle)(mix, _this3.hooksMap); + }); + } + + /** + * 小程序端差异化生命周期 hooks mixins + */ + + }, { + key: 'extendPolyHooks', + value: function extendPolyHooks() { + var _this4 = this; + + var methods = this.options.methods; + + if (!methods) { + return; + } + + this.polyHooks.forEach(function (hook) { + if ((0, _type.type)(methods[hook]) === 'Function') { + if ((0, _type.type)(_this4.options[hook]) === 'Array') { + _this4.options[hook].push(methods[hook]); + } else { + _this4.options[hook] = [methods[hook]]; + } + delete methods[hook]; + } + }); + } + }, { + key: 'mergeInjectedMixins', + value: function mergeInjectedMixins() { + this.options.mixins = this.options.mixins ? this.options.mixins.concat(this.injectMixins) : this.injectMixins; + } + }, { + key: 'mergeBuiltinMixins', + value: function mergeBuiltinMixins() { + var btMixin = [this.baseMixins, this.builtinMixins].filter(function (item) { + return item; + }); + + this.options.mixins = this.options.mixins ? btMixin.concat(this.options.mixins) : btMixin; + } + }, { + key: 'resolveOptions', + value: function resolveOptions() { + var self = this; + var extractMixins = function extractMixins(mOptions, options) { + if (options.mixins) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = options.mixins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var mix = _step.value; + + extractMixins(mOptions, mix); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + } + mergeMixins(mOptions, options); + }; + + var mergeMixins = function mergeMixins(parent, child) { + for (var key in child) { + if (self.hooks.indexOf(key) > -1) { + (0, _resolve.mergeHooks)(parent, child, key); + } else if (key === 'data') { + (0, _resolve.mergeData)(parent, child, key); + } else if (testProps(key)) { + (0, _resolve.mergeSimpleProps)(parent, child, key); + } else if (key === 'watch') { + (0, _resolve.mergeWatch)(parent, child, key); + } else if (key !== 'mixins') { + (0, _resolve.mergeDefault)(parent, child, key); + } + } + }; + + var testProps = function testProps(key) { + var regExp = new RegExp('computed|methods|proto|' + self.propsName); + return regExp.test(key); + }; + + var newOptions = {}; + extractMixins(newOptions, this.options); + this.options = newOptions; + } + }, { + key: 'transformHooks', + value: function transformHooks() { + if (!this.hooks || !this.hooks.length) return; + var self = this; + this.hooks.forEach(function (key) { + var hooksArr = self.options[key]; + hooksArr && (self.options[key] = function () { + var result = void 0; + var asyncQuene = []; + + // 多态生命周期需要统一回调参数 + // if (self.polyHooks.indexOf(key) > -1) { + // let res = args[0] + // if (type(res) !== 'Object') { + // res = { + // 'detail': args[0] + // } + // } + // args = [res] + // } + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if ((0, _type.type)(hooksArr) === 'Function') { + result = hooksArr.apply(this, args); + } else if ((0, _type.type)(hooksArr) === 'Array') { + for (var i = 0; i < hooksArr.length; i++) { + if ((0, _type.type)(hooksArr[i]) === 'Function') { + + result = hooksArr[i].apply(this, args); + + // if (result && result.enableAsync) { + // asyncQuene = hooksArr.slice(i + 1) + // break + // } + } + } + // Promise.resolve().then(() => { + // asyncQuene.forEach(fn => { + // fn.apply(this, args) + // }) + // }) + } + return result; + }); + }); + } + }, { + key: 'resolveAttrs', + value: function resolveAttrs() { + var _this5 = this; + + if (!this.needResolveAttrs.length) return; + var keys = this.needResolveAttrs; + if ((0, _type.type)(keys) === 'String') { + keys = [keys]; + } + + keys.forEach(function (key) { + var value = _this5.options[key]; + if ((0, _type.type)(value) !== 'Object') return; + + (0, _util.extendWithIgnore)(_this5.options, value, _this5.usedHooks); + delete _this5.options[key]; + }); + } + }, { + key: 'transformProperties', + value: function transformProperties() { + var originProperties = this.options[this.propsName]; + var newProps = {}; + + (0, _util.enumerableKeys)(originProperties).forEach(function (key) { + var rawFiled = originProperties[key]; + + var rawObserver = rawFiled.observer; + var newFiled = null; + if (typeof rawFiled === 'function') { + newFiled = { + type: rawFiled + }; + } else { + newFiled = (0, _util.extend)({}, rawFiled); + } + newFiled.observer = function (value, oldValue) { + // 小程序内部数据使用了JSON.parse(JSON.stringify(x))的方式,导致每次引用都会变化 + if (_mobx.extras.deepEqual(value, oldValue)) return; + this[key] = value; + typeof rawObserver === 'function' && rawObserver.call(this, value, oldValue); + }; + newProps[key] = newFiled; + }); + + this.options[this.propsName] = newProps; + } + }]); + + return MiniOptTransformer; +}(_BaseOptionsTransformer2.default); + +exports.default = MiniOptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _toJS = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/toJS.js"); + +var _toJS2 = _interopRequireDefault(_toJS); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +var _diff = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/diff.js"); + +var _diff2 = _interopRequireDefault(_diff); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var RuntimeWidget = function () { + function RuntimeWidget(config) { + _classCallCheck(this, RuntimeWidget); + + this.platform = config.platform || ''; + this.options = config.options; + this.polyHooks = config.polyHooks; + + this.propsName = _KEY2.default.get(this.platform + '.props'); + this.instance = _KEY2.default.get(this.platform + '.instance'); + } + + _createClass(RuntimeWidget, [{ + key: 'setOptions', + value: function setOptions(options) { + this.options = options; + } + }, { + key: 'setContext', + value: function setContext(context) { + this.context = context; + return this; + } + }, { + key: 'init', + value: function init() { + // 属性 + this.initData(); + + // 方法 + this.initInterface(); + + // 数据劫持 + this.proxyHandler(); + + // watch 属性mobx转换 + this.watchesHandler(); + return this; + } + }, { + key: 'initData', + value: function initData() { + if (!this.context) return; + var context = this.context; + context.__cml_originOptions__ = this.options; + // 清理函数列表 + context.__cml_disposerList__ = []; + // update后,回调函数收集器 + context.__cml_cbCollection__ = []; + + context['$cmlPolyHooks'] = this.polyHooks; + + // effect computed + context.__cml_computed__ = transformComputed(context); + + if (this.platform === 'alipay') { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.props, context.__cml_computed__); + } else { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.__cml_computed__); + } + } + + /** + * **给小程序增加refs功能** + * + * 在cml编译阶段给所有带有ref属性的元素添加 class="_cml_ref_lmc_" + * 通过在Page的onLoad阶段以及comoponent的attached阶段初始化当前实例的$refs (执行时机选定标准: 可以通过createSelectorQuery选取元素之后) + * $refs只提供id, 不提供其他属性, $refs本身初始化是在onLoad阶段, 此时获得的节点数据(例如top), 并不会随页面滚动进行变化. 所以意义不大 + * 通过this.$refs.ref获取元素class后在interface内部通过wxApi实时获取各元素信息 + */ + + }, { + key: 'initRefs', + value: function initRefs() { + if (!this.context) return; + var context = this.context; + var query = this.platform === 'alipay' ? this.instance.createSelectorQuery() : this.instance.createSelectorQuery().in(context); + + query.selectAll('._cml_ref_lmc_').boundingClientRect(); + query.exec(function (res) { + context.$refs = {}; + var doms = res[0]; + if (!doms) { + return; + } + for (var i = 0; i < doms.length; i++) { + var refItem = doms[i]; + context.$refs[refItem.id] = { + id: refItem.id + }; + } + }); + return this; + } + }, { + key: 'initInterface', + value: function initInterface() { + if (!this.context) return; + var context = this.context; + // 构造 watch 能力 + context.$watch = watchFnFactory(context); + + // 构造 updated callback 收集能力 + context.$collect = updatedCbFactory(context); + + // 构造数据更新能力 + context.$setData = setDataFactory(context, this); + + // 构造强制更新能力 + context.$forceUpdate = forceUpdateFactory(context); + } + }, { + key: 'proxyHandler', + value: function proxyHandler() { + if (!this.context) return; + var context = this.context; + context.__cml_ob_data__ = (0, _mobx.observable)(context.__cml_data__); + + var origComputed = context.__cml_originOptions__.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + /* 计算属性在mobx里面是不可枚举的,所以篡改下*/ + (0, _util.enumerable)(context.__cml_ob_data__, origComputedKeys); + + (0, _util.proxy)(context, context.__cml_ob_data__); + } + + /** + * watch 属性转换 + * @param {Object} context 上下文 + * @return {[type]} [description] + */ + + }, { + key: 'watchesHandler', + value: function watchesHandler() { + if (!this.context) return; + var context = this.context; + var options = context.__cml_originOptions__; + + var watches = options.watch; + + if ((0, _type.type)(watches) !== 'Object') { + return; + } + + (0, _util.enumerableKeys)(watches).forEach(function (key) { + var handler = watches[key]; + if ((0, _type.type)(handler) === 'Array') { + // mobx的reaction执行是倒序的,顾为保证watch正常次序,需倒序注册 + for (var i = handler.length - 1; i >= 0; i--) { + context.$watch(key, handler[i]); + } + } else { + context.$watch(key, handler); + } + }); + } + }, { + key: 'addPageHooks', + value: function addPageHooks() { + var context = this.context; + var originOptions = context.__cml_originOptions__; + // 使用createComponent创建page时,页面的事件直接写在options里是不生效的,必须注入到this上 + _lifecycle2.default.get(this.platform + '.page.hooks').forEach(function (key) { + if (typeof originOptions[key] === 'function') { + context[key] = originOptions[key]; + } + }); + } + /** + * 启动器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'start', + value: function start(name) { + if (!this.context) return; + var context = this.context; + // 渲染更新监听 + var disposer = autorunThrottle(context.$setData, name); + + context.__cml_disposerList__.push(disposer); + } + + /** + * 销毁器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'destory', + value: function destory() { + if (!this.context) return; + var context = this.context; + disposerFactory(context.__cml_disposerList__)(); + } + }]); + + return RuntimeWidget; +}(); + +/** + * watch 工厂函数 + * @param {[type]} context [description] + * @return {function} vm.$watch + */ + + +exports.default = RuntimeWidget; +function watchFnFactory(context) { + return function (expr, handler) { + var callback = handler.handler || handler; + var exprType = typeof expr === 'undefined' ? 'undefined' : _typeof(expr); + var curVal = void 0; + var oldVal = void 0; + if (!/^function|string$/.test(exprType)) { + console.warn(new Error('watch expression must be a string or function')); + return; + } + if (typeof callback !== 'function') { + console.warn(new Error('watch callback must be a function')); + return; + } + + /** + * [computed description] + * @return {[type]} [description] + */ + function dataExprFn() { + oldVal = curVal; + curVal = exprType === 'string' ? (0, _util.getByPath)(context, expr) : expr.call(context); + if (handler.deep) { + curVal = (0, _toJS2.default)(curVal, false); + } else if ((0, _mobx.isObservableArray)(curVal)) { + // 强制访问,让数组被观察 + curVal.peek(); + } + return curVal; + } + + function sideEffect(curVal, reaction) { + callback.call(context, curVal, oldVal); + } + + var options = { + fireImmediately: !!handler.immediate, + delay: handler.sync ? 0 : 1 + + // 返回清理函数 + };var disposer = (0, _mobx.reaction)(dataExprFn, sideEffect, options); + + context.__cml_disposerList__.push(disposer); + return disposerFactory(context.__cml_disposerList__, disposer); + }; +} +/** + * 清理函数构造工厂 + * @param {array} disposerList 清理函数列表 + * @param {function} disposer 清理函数 + * @return {function} 清理函数包装方法 + */ +function disposerFactory(disposerList, disposer) { + return function () { + if (disposer) { + var index = disposerList.indexOf(disposer); + index > -1 && disposerList.splice(index, 1); + disposer(); + } else { + var _disposer = void 0; + while (_disposer = disposerList.shift()) { + _disposer(); + } + } + }; +} + +/** + * 更新后回调 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function updatedCbFactory(context) { + return function (cb) { + context.__cml_cbCollection__.push(cb); + }; +} + +/** + * 设置数据工厂函数 + * @param {[type]} context [description] + */ +function setDataFactory(context, self) { + var _cached = false; + var cacheData = void 0; + + return function () { + var reaction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if ((0, _type.type)(reaction.schedule) !== 'Function') { + return; + } + // 缓存reaction + context.__cml_reaction__ = reaction; + + var properties = context.__cml_originOptions__[self.propsName]; + var propKeys = (0, _util.enumerableKeys)(properties); + + var obData = (0, _util.deleteProperties)(context.__cml_ob_data__, propKeys); + + // setData 的数据不包括 props + var data = (0, _toJS2.default)(obData); + + var diffV = void 0; + if (_cached) { + diffV = (0, _diff2.default)(data, cacheData); + + // emit 'beforeUpdate' hook ,第一次不触发 + emit('beforeUpdate', context, data, cacheData, diffV); + } else { + _cached = true; + diffV = data; + } + + update(diffV); + cacheData = _extends({}, data); + }; + + function update(diff) { + if ((0, _type.type)(context.setData) === 'Function') { + context.setData(diff, walkUpdatedCb(context)); + } + } +} + +function emit(name, context) { + var cmlVM = context.__cml_originOptions__; + + if (typeof cmlVM[name] === 'function') { + for (var _len = arguments.length, data = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + data[_key - 2] = arguments[_key]; + } + + cmlVM[name].apply(context, data); + } +} + +/** + * 执行更新后回调列表 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function walkUpdatedCb(context) { + // emit 'updated' hook + emit('updated', context); + + var cb = void 0; + var pendingList = context.__cml_cbCollection__.slice(0); + context.__cml_cbCollection__.length = 0; + while (cb = pendingList.shift()) { + typeof cb === 'function' && cb.apply(context); + } +} + +/** + * forceUpdate 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function forceUpdateFactory(context) { + return function (data, cb) { + + var dataType = (0, _type.type)(data); + if (dataType === 'Function') { + cb = data; + data = null; + } else if (dataType === 'Object') { + (0, _util.extend)(context.__cml_ob_data__, data); + } + + (0, _type.type)(cb) === 'Function' && context.$collect(cb); + + context.__cml_reaction__.dependenciesState = 2; + context.__cml_reaction__.schedule(); + }; +} + +/** + * computed 属性mobx转换 + * @param {Object} computedExpr 组件实例computed集合 + * @param {Object} context 上下文 + * @return {Object} 转换后computed + */ +function transformComputed(context) { + var options = context.__cml_originOptions__; + + var origComputed = options.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + + var newComputed = {}; + origComputedKeys.forEach(function (key) { + newComputed[key] = (0, _mobx.computed)(origComputed[key], { context: context }); + }); + + return newComputed; +} + +/** + * [autorunThrottle description] + * @param {[type]} fnc [description] + * @param {[type]} name [description] + * @return {function} unwatch函数 + */ +function autorunThrottle(fnc, name) { + // 首次同步执行,之后异步处理 + var isScheduled = false; + var first = true; + var r = new _mobx.Reaction(name, function () { + + if (!isScheduled) { + isScheduled = true; + if (first) { + reactionRunner(); + first = false; + } else { + setTimeout(reactionRunner, 0); + } + } + }); + function reactionRunner() { + isScheduled = false; + if (!r.isDisposed) { + r.track(function () { + + fnc(r); + }); + } + } + r.schedule(); + return r.getDisposer(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/KEY.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +var _api = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/api.interface"); + +var _api2 = _interopRequireDefault(_api); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var instanceAPI = _api2.default.getInstance(); + +var KEY = { + wx: { + instance: instanceAPI, + props: 'properties' + }, + alipay: { + instance: instanceAPI, + props: 'props' + }, + baidu: { + instance: instanceAPI, + props: 'properties' + } +}; + +exports.default = new _config2.default(KEY); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/api.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/platform/common/util/api.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getInstanceInterface": { + "getInstance": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["getInstanceInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getInstance", + value: function getInstance() { + return my; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/config.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Config = function () { + function Config(data) { + _classCallCheck(this, Config); + + this.data = data; + } + + _createClass(Config, [{ + key: 'get', + value: function get() { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var def = arguments[1]; + + var result = this.data; + path.split('.').forEach(function (key) { + if (key && typeof result !== 'undefined') { + result = result[key]; + } + }); + if (typeof result !== 'undefined') { + return result; + } else { + return def; + } + } + }, { + key: 'set', + value: function set(path, value) { + if (typeof value === 'undefined') { + this.data = path; + } else { + path = String(path || '').trim(); + if (path) { + var paths = path.split('.'); + var last = paths.pop(); + var data = this.data || {}; + paths.forEach(function (key) { + var type = data[key]; + if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object') { + data = data[key]; + } else if (typeof type === 'undefined') { + data = data[key] = {}; + } else { + throw new Error('forbidden to set property[' + key + '] of [' + type + '] data'); + } + }); + data[last] = value; + } + } + } + }]); + + return Config; +}(); + +exports.default = Config; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/diff.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = diff; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function diff(current, old) { + var out = {}; + prefill(current, old); + iDiff(current, old, '', out); + + if (Object.keys(out).length === 1 && out[''] !== undefined) { + out = out['']; + } + + // console.log('diff------:', out) + return out; +} + +function prefill(current, old) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in old) { + var curVal = current[key]; + if (curVal === undefined) { + current[key] = ''; + } else { + prefill(curVal, old[key]); + } + } + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array') { + if (current.length >= old.length) { + old.forEach(function (item, index) { + prefill(current[index], item); + }); + } + } +} + +function iDiff(current, old, path, result) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in current) { + var curVal = current[key]; + var oldVal = old[key]; + + iDiff(curVal, oldVal, getPath(path, key), result); + } + } else { + update(current, path, result); + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array' && current.length >= old.length) { + current.forEach(function (item, index) { + iDiff(item, old[index], getPath(path, index, 'array'), result); + }); + } else { + update(current, path, result); + } +} + +function update(item, path, collection) { + if (item !== undefined) { + collection[path] = item; + } +} + +function getPath(pathStr, key, type) { + if (type === 'array') { + return pathStr + '[' + key + ']'; + } + + return isNum(key) ? pathStr + '[' + key + ']' : pathStr ? pathStr + '.' + key : key; +} + +function isNaN(value) { + var n = Number(value); + return n !== n; +} + +function isNum(value) { + return !isNaN(Number(value)); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var LIFECYCLE = { + web: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'], + hooksMap: { + 'viewappear': 'beforeRouteEnter', + 'viewdisappear': 'beforeRouteLeave' + }, + polyHooks: ['beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'] + }, + weex: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + }, + wx: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onShow', 'onReady', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached', 'moved'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: ['moved'] + } + }, + alipay: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'] + }, + component: { + hooks: ['didMount', 'didUnmount'], + hooksMap: { + 'beforeCreate': 'didMount', + 'created': 'didMount', + 'beforeMount': 'didMount', + 'mounted': 'didMount', + 'beforeDestroy': 'didUnmount', + 'destroyed': 'didUnmount' + }, + usedHooks: ['didMount', 'didUnmount'], + polyHooks: [] + } + }, + baidu: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: [] + } + }, + cml: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + } +}; + +exports.default = new _config2.default(LIFECYCLE); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/proto.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + //原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/resolve.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDefault = mergeDefault; +exports.mergeHooks = mergeHooks; +exports.mergeSimpleProps = mergeSimpleProps; +exports.mergeData = mergeData; +exports.mergeWatch = mergeWatch; + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function mergeDefault(parent, child, key) { + parent[key] = child[key]; +} + +function mergeHooks(parent, child, key) { + + var hasKeyParent = parent.hasOwnProperty(key); + var isArrayChild = (0, _type.type)(child[key]) === 'Array'; + + if (!hasKeyParent && !isArrayChild) { + parent[key] = [child[key]]; + } else if (!hasKeyParent && isArrayChild) { + parent[key] = child[key]; + } else if (hasKeyParent && !isArrayChild) { + parent[key].push(child[key]); + } else if (hasKeyParent && isArrayChild) { + parent[key] = parent[key].concat(child[key]); + } +} + +function mergeSimpleProps(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + if (!parentVal) { + parent[key] = parentVal = {}; + } + (0, _util.extend)(parentVal, childVal); +} + +function mergeData(parent, child, key) { + var childVal = child[key]; + if (!parent[key]) { + parent[key] = {}; + } + (0, _util.merge)(parent[key], childVal); +} + +function mergeWatch(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + var ret = []; + if (!parentVal) { + parent[key] = parentVal = {}; + } + Object.keys(childVal).forEach(function (key) { + if (key in parentVal) { + parentVal[key] = (0, _type.type)(parentVal[key]) !== 'Array' ? [parentVal[key], childVal[key]] : parentVal[key].concat([childVal[key]]); + } else { + parentVal[key] = childVal[key]; + } + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/style.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.styleHandle = styleHandle; +exports.pxTransform = pxTransform; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function styleHandle(source) { + var detectCycles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var __alreadySeen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + function cache(value) { + if (detectCycles) { + __alreadySeen.push([source, value]); + } + return value; + } + + if (detectCycles && __alreadySeen === null) { + __alreadySeen = []; + } + + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) { + return __alreadySeen[i][1]; + } + } + } + + if ((0, _type.type)(source) === 'Array') { + var res = cache([]); + var toAdd = source.map(function (value) { + return styleHandle(value, detectCycles, __alreadySeen); + }); + + res.length = toAdd.length; + for (var _i = 0, _l = toAdd.length; _i < _l; _i++) { + res[_i] = toAdd[_i]; + } + + return res; + } else if ((0, _type.type)(source) === 'Object') { + var _res = cache({}); + for (var key in source) { + _res[key] = styleHandle(source[key], detectCycles, __alreadySeen); + } + return _res; + } else if ((0, _type.type)(source) === 'String') { + return pxTransform(source); + } else { + return source; + } +} + +function pxTransform(s) { + if (!~s.indexOf('cpx')) { + return s; + } + + return s.replace(/(([\s:(]|^)-?)(\d*\.?\d+)cpx/ig, function (m) { + return m.replace('cpx', 'rpx'); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/toJS.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.default = toJS; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _style = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/style.js"); + +function toJS(source, detectCycles, __alreadySeen) { + var needPxTransfer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + if (detectCycles === void 0) { + detectCycles = true; + } + if (__alreadySeen === void 0) { + __alreadySeen = []; + } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) __alreadySeen.push([source, value]); + return value; + } + + if (detectCycles && __alreadySeen === null) __alreadySeen = []; + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) return __alreadySeen[i][1]; + } + } + + if ((0, _mobx.isObservable)(source)) { + if ((0, _mobx.isObservableArray)(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) { + res[i] = toAdd[i]; + }return res; + } + if ((0, _mobx.isObservableObject)(source)) { + var res = cache({}); + for (var key in source) { + res[key] = toJS(source[key], detectCycles, __alreadySeen); + }return res; + } + if ((0, _mobx.isObservableMap)(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { + return res_1[key] = toJS(value, detectCycles, __alreadySeen); + }); + return res_1; + } + if ((0, _mobx.isBoxedObservable)(source)) return toJS(source.get(), detectCycles, __alreadySeen); + } else { + if ((0, _type.type)(source) === 'Array') { + var _res = cache([]); + var _toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + + _res.length = _toAdd.length; + for (var _i = 0, _l = _toAdd.length; _i < _l; _i++) { + _res[_i] = _toAdd[_i]; + } + + return _res; + } else if ((0, _type.type)(source) === 'Object') { + var _res2 = cache({}); + for (var _key in source) { + _res2[_key] = toJS(source[_key], detectCycles, __alreadySeen); + } + return _res2; + } else if ((0, _type.type)(source) === 'String') { + // cpx to rpx + return needPxTransfer ? (0, _style.pxTransform)(source) : source; + } else { + return source; + } + } +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/type.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.isObject = isObject; +exports.isPlainObject = isPlainObject; + +var toString = Object.prototype.toString; + +function type(n) { + return toString.call(n).slice(8, -1); +} + +/** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ +function isObject(obj) { + return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; +} + +/** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ +function isPlainObject(obj) { + return type(obj) === 'Object'; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/util.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.propToFn = propToFn; +exports.transferLifecycle = transferLifecycle; +exports.rename = rename; +exports.normalizeMap = normalizeMap; +exports.merge = merge; +exports.extend = extend; +exports.extendWithIgnore = extendWithIgnore; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.enumerable = enumerable; +exports.proxy = proxy; +exports.deleteProperties = deleteProperties; +exports.enumerableKeys = enumerableKeys; +exports.flatten = flatten; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +// transfer 对象的`${name}`属性值 to function +function propToFn(obj, name) { + if (obj && (0, _type.isObject)(obj[name])) { + var _temp = obj[name]; + + if ((0, _type.isPlainObject)(_temp)) { + obj[name] = function () { + return _extends({}, _temp); + }; + } else { + obj[name] = function () { + return _temp; + }; + } + } +} + +/** + * 生命周期映射 + * @param {Object} VMObj vm对象 + * @param {Object} hooksMap 映射表 + * @return {Object} 修改后值 + */ +function transferLifecycle(VMObj, hooksMap) { + if (!hooksMap) { + return; + } + + var _hooksTemp = []; + var _mapTemp = {}; + // 将生命周期 键名 处理成 [`$_${key}`] + Object.keys(hooksMap).forEach(function (key) { + var uniKey = '$_' + key; + _hooksTemp.push(uniKey); + _mapTemp[uniKey] = hooksMap[key]; + + if (VMObj.hasOwnProperty(key)) { + VMObj[uniKey] = VMObj[key]; + delete VMObj[key]; + } + }); + + _hooksTemp.forEach(function (uniKey) { + var mapKey = _mapTemp[uniKey]; + var hook = VMObj[uniKey]; + + if (VMObj.hasOwnProperty(uniKey) && mapKey && hook) { + if (VMObj.hasOwnProperty(mapKey)) { + if ((0, _type.type)(VMObj[mapKey]) !== 'Array') { + VMObj[mapKey] = [VMObj[mapKey], hook]; + } else { + VMObj[mapKey].push(hook); + } + } else { + VMObj[mapKey] = [hook]; + } + delete VMObj[uniKey]; + } + }); +} + +/** + * 对象键名重定义 + * @param {Object} obj 对象 + * @param {String} oldKey 原键名 + * @param {String} newKey 新键名 + * @return {Object} 新对象 + */ +function rename(obj, oldKey, newKey) { + Object.getOwnPropertyNames(obj).forEach(function (key) { + if (key === oldKey) { + obj[newKey] = obj[key]; + delete obj[key]; + return obj; + } + }); + return obj; +} + +function normalizeMap(arr) { + if ((0, _type.type)(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function merge(to, from) { + if (!from) return to; + var key = void 0, + toVal = void 0, + fromVal = void 0; + var keys = Object.keys(from); + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + toVal = to[key]; + fromVal = from[key]; + if ((0, _type.type)(toVal) === 'Object' && (0, _type.type)(fromVal) === 'Object') { + merge(toVal, fromVal); + } else { + to[key] = fromVal; + } + } + return to; +} + +function extend(target) { + for (var _len = arguments.length, froms = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + froms[_key - 1] = arguments[_key]; + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = froms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var from = _step.value; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + target[key] = from[key]; + } + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return target; +} + +function extendWithIgnore(target, from) { + var ignore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + if (!~ignore.indexOf(key)) { + target[key] = from[key]; + } + } + } + return target; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = path[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var key = _step2.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function enumerable(target, keys) { + keys.forEach(function (key) { + var descriptor = Object.getOwnPropertyDescriptor(target, key); + if (!descriptor.enumerable) { + descriptor.enumerable = true; + Object.defineProperty(target, key, descriptor); + } + }); + return target; +} + +function proxy(target, source, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + enumerableKeys(source).forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +function deleteProperties(source) { + var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + if (!props.length) return source; + var sourceKeys = Object.keys(source); + var newData = {}; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = sourceKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var key = _step3.value; + + if (props.indexOf(key) < 0) { + newData[key] = source[key]; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + return newData; +} + +function enumerableKeys(obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + } + return keys; +} + +function flatten() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + + function check(str) { + if (!str) { + console.error('pathStr should not be null!'); + return false; + } + return true; + } + + function flattenRe(d) { + var pathStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if ((0, _type.type)(d) === 'Array') { + check(pathStr); + + d.forEach(function (item, i) { + var path = pathStr + '[' + i + ']'; + flattenRe(item, path); + }); + } else if ((0, _type.type)(d) === 'Object') { + Object.keys(d).forEach(function (k) { + var v = d[k]; + var path = pathStr ? pathStr + '.' + k : k; + flattenRe(v, path); + }); + } else { + check(pathStr); + ret[pathStr] = d; + } + } + + var ret = {}; + flattenRe(obj); + + return ret; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/warn.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fail = fail; +exports.invariant = invariant; +exports.deprecated = deprecated; +var OBFUSCATED_ERROR = exports.OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is an production build."; + +function fail(message) { + invariant(false, message); + throw "X"; // unreachable +} + +function invariant(check, message) { + if (!check) throw new Error("[chameleon-runtime] " + (message || OBFUSCATED_ERROR)); +} + +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; + +function deprecated(msg, thing) { + if (false) return false; + if (thing) { + return deprecated("'" + msg + "', use '" + thing + "' instead."); + } + if (deprecatedMessages.indexOf(msg) !== -1) return false; + deprecatedMessages.push(msg); + console.error("[chameleon-runtime] Deprecated: " + msg); + return true; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.js"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _index2.default; + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _alipay = __webpack_require__("./node_modules/chameleon-store/src/platform/alipay/index.js"); + +var _alipay2 = _interopRequireDefault(_alipay); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-store/src/interfaces/createStore/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createStoreInterface": { + "createStore": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createStoreInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createStore", + value: function createStore(options) { + return (0, _alipay2.default)(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createStore(options) { + return _index2.default.createStore(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/alipay/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mini = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/index.js"); + +var _mini2 = _interopRequireDefault(_mini); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _mini2.default; + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +var _mapStore = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/mapStore.js"); + +var _mapStore2 = _interopRequireDefault(_mapStore); + +var _transform = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/transform.js"); + +var _merge = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/merge.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function Store(options) { + options = (0, _merge.mergeDeps)(options); + this.getters = {}; + this.mutations = {}; + this.actions = {}; + this.state = this.registerModule('', options).state; + Object.assign(this, (0, _mapStore2.default)(this)); +} + +Store.prototype.dispatch = function (type) { + var action = (0, _util.getByPath)(this.actions, type); + if (!action) { + return Promise.reject(new Error('unknown action type: ' + type)); + } else { + for (var _len = arguments.length, payload = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + payload[_key - 1] = arguments[_key]; + } + + return action.apply(undefined, payload); + } +}; + +Store.prototype.commit = function (type) { + var mutation = (0, _util.getByPath)(this.mutations, type); + if (!mutation) { + console.warn(new Error('unknown mutation type: ' + type)); + } else { + for (var _len2 = arguments.length, payload = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + payload[_key2 - 1] = arguments[_key2]; + } + + return mutation.apply(undefined, payload); + } +}; + +Store.prototype.registerModule = function (path, module) { + var _this = this; + + var reactiveModuleOption = { + state: module.state || {} + }; + var reactiveModule = (0, _mobx.observable)(reactiveModuleOption); + if (module.getters) { + (0, _mobx.extendObservable)(reactiveModule, { + getters: (0, _transform.transformGetters)(module.getters, reactiveModule, this) + }); + // 使用proxy,保证store.getters的属性是可观察的 + (0, _util.proxy)(this.getters, reactiveModule.getters, Object.keys(module.getters), true); + } + if (module.mutations) { + Object.assign(this.mutations, (0, _transform.transformMutations)(module.mutations, reactiveModule, this)); + } + if (module.actions) { + Object.assign(this.actions, (0, _transform.transformActions)(module.actions, reactiveModule, this)); + } + if (module.modules) { + var childs = module.modules; + Object.keys(childs).forEach(function (key) { + (0, _mobx.extendObservable)(reactiveModule.state, _defineProperty({}, key, _this.registerModule('', childs[key]).state)); + }); + } + return reactiveModule; +}; + +function createStore() { + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return new (Function.prototype.bind.apply(Store, [null].concat(args)))(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/mapStore.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (store) { + return { + mapGetters: mapFactory('getters', store), + mapMutations: mapFactory('mutations', store), + mapActions: mapFactory('actions', store), + mapState: function mapState(maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + Object.keys(maps).forEach(function (key) { + var value = maps[key]; + result[key] = function () { + if (typeof value === 'function') { + return value.call(this, store.state, store.getters); + } else if (typeof value === 'string') { + return (0, _util.getByPath)(store.state, value); + } + }; + }); + return result; + } + }; +}; + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +function mapFactory(type, store) { + return function (maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + + var _loop = function _loop(key) { + result[key] = function (payload) { + var value = maps[key]; + if (type === 'mutations') { + return store.commit(value, payload); + } else if (type === 'actions') { + return store.dispatch(value, payload); + } else { + var getterVal = (0, _util.getByPath)(store.getters, value, '__NOTFOUND__'); + if (getterVal === '__NOTFOUND__') { + console.warn(new Error('not found getter named [' + value + ']')); + return ''; + } else { + return getterVal === undefined ? '' : getterVal; + } + } + }; + }; + + for (var key in maps) { + _loop(key); + } + return result; + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/merge.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDeps = mergeDeps; +function mergeDeps(options) { + var stores = options.deps; + if (!stores) return options; + var mergeProps = ['state', 'getters', 'mutations', 'actions']; + Object.keys(stores).forEach(function (key) { + var store = stores[key]; + mergeProps.forEach(function (prop) { + if (options[prop] && key in options[prop]) { + console.warn(new Error('deps\'s name: [' + key + '] conflicts with ' + prop + '\'s key in current options')); + } else { + options[prop] = options[prop] || {}; + options[prop][key] = store[prop]; + } + }); + }); + delete options.deps; + return options; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/transform.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transformGetters = transformGetters; +exports.transformMutations = transformMutations; +exports.transformActions = transformActions; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function transformGetters(getters, module, store) { + var newGetters = {}; + + var _loop = function _loop(key) { + if (key in store.getters) { + console.warn(new Error('duplicate getter type: ' + key)); + } + newGetters[key] = typeof getters[key] === 'function' ? (0, _mobx.computed)(function () { + return getters[key](module.state, store.getters, store.state); + }) : getters[key]; + }; + + for (var key in getters) { + _loop(key); + } + return newGetters; +} + +function transformMutations(mutations, module, store) { + var newMutations = {}; + + var _loop2 = function _loop2(key) { + if (store.mutations[key]) { + console.warn(new Error('duplicate mutation type: ' + key)); + } + newMutations[key] = typeof mutations[key] === 'function' ? (0, _mobx.action)(function () { + for (var _len = arguments.length, payload = Array(_len), _key = 0; _key < _len; _key++) { + payload[_key] = arguments[_key]; + } + + return mutations[key].apply(mutations, [module.state].concat(payload)); + }) : mutations[key]; + }; + + for (var key in mutations) { + _loop2(key); + } + return newMutations; +} + +function transformActions(actions, module, store) { + var newActions = {}; + + var _loop3 = function _loop3(key) { + if (store.actions[key]) { + console.warn(new Error('duplicate action type: ' + key)); + } + newActions[key] = typeof actions[key] === 'function' ? function () { + for (var _len2 = arguments.length, payload = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + payload[_key2] = arguments[_key2]; + } + + return Promise.resolve().then(function () { + return actions[key].apply(actions, [{ + rootState: store.state, + state: module.state, + getters: store.getters, + dispatch: store.dispatch.bind(store), + commit: store.commit.bind(store) + }].concat(payload)); + }); + } : actions[key]; + }; + + for (var key in actions) { + _loop3(key); + } + return newActions; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.normalizeMap = normalizeMap; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.proxy = proxy; +function type(n) { + return Object.prototype.toString.call(n).slice(8, -1); +} + +function normalizeMap(arr) { + if (type(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = path[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var key = _step.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function proxy(target, source, keys, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + keys.forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +/***/ }), + +/***/ "./node_modules/mobx/lib/mobx.module.js": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extras", function() { return extras; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reaction", function() { return Reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "untracked", function() { return untracked; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDerivationState", function() { return IDerivationState; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Atom", function() { return Atom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseAtom", function() { return BaseAtom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useStrict", function() { return useStrict; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isStrictModeEnabled", function() { return isStrictModeEnabled; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spy", function() { return spy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "comparer", function() { return comparer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asReference", function() { return asReference; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asFlat", function() { return asFlat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asStructure", function() { return asStructure; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asMap", function() { return asMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isModifierDescriptor", function() { return isModifierDescriptor; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableObject", function() { return isObservableObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBoxedObservable", function() { return isObservableValue; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableArray", function() { return isObservableArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObservableMap", function() { return ObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableMap", function() { return isObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return observable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computed", function() { return computed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return isObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isComputed", function() { return isComputed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendObservable", function() { return extendObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendShallowObservable", function() { return extendShallowObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observe", function() { return observe; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intercept", function() { return intercept; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorun", function() { return autorun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorunAsync", function() { return autorunAsync; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "when", function() { return when; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reaction", function() { return reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "action", function() { return action; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAction", function() { return isAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runInAction", function() { return runInAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expr", function() { return expr; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toJS", function() { return toJS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTransformer", function() { return createTransformer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "whyRun", function() { return whyRun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trace", function() { return trace; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return isArrayLike; }); +/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +/** + * Anything that can be used to _store_ state is an Atom in mobx. Atoms have two important jobs + * + * 1) detect when they are being _used_ and report this (using reportObserved). This allows mobx to make the connection between running functions and the data they used + * 2) they should notify mobx whenever they have _changed_. This way mobx can re-run any functions (derivations) that are using this atom. + */ +var BaseAtom = (function () { + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function BaseAtom(name) { + if (name === void 0) { name = "Atom@" + getNextId(); } + this.name = name; + this.isPendingUnobservation = true; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.NOT_TRACKING; + } + BaseAtom.prototype.onBecomeUnobserved = function () { + // noop + }; + /** + * Invoke this method to notify mobx that your atom has been used somehow. + */ + BaseAtom.prototype.reportObserved = function () { + reportObserved(this); + }; + /** + * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. + */ + BaseAtom.prototype.reportChanged = function () { + startBatch(); + propagateChanged(this); + endBatch(); + }; + BaseAtom.prototype.toString = function () { + return this.name; + }; + return BaseAtom; +}()); +var Atom = (function (_super) { + __extends(Atom, _super); + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function Atom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { + if (name === void 0) { name = "Atom@" + getNextId(); } + if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } + if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } + var _this = _super.call(this, name) || this; + _this.name = name; + _this.onBecomeObservedHandler = onBecomeObservedHandler; + _this.onBecomeUnobservedHandler = onBecomeUnobservedHandler; + _this.isPendingUnobservation = false; // for effective unobserving. + _this.isBeingTracked = false; + return _this; + } + Atom.prototype.reportObserved = function () { + startBatch(); + _super.prototype.reportObserved.call(this); + if (!this.isBeingTracked) { + this.isBeingTracked = true; + this.onBecomeObservedHandler(); + } + endBatch(); + return !!globalState.trackingDerivation; + // return doesn't really give useful info, because it can be as well calling computed which calls atom (no reactions) + // also it could not trigger when calculating reaction dependent on Atom because Atom's value was cached by computed called by given reaction. + }; + Atom.prototype.onBecomeUnobserved = function () { + this.isBeingTracked = false; + this.onBecomeUnobservedHandler(); + }; + return Atom; +}(BaseAtom)); +var isAtom = createInstanceofPredicate("Atom", BaseAtom); + +function hasInterceptors(interceptable) { + return interceptable.interceptors && interceptable.interceptors.length > 0; +} +function registerInterceptor(interceptable, handler) { + var interceptors = interceptable.interceptors || (interceptable.interceptors = []); + interceptors.push(handler); + return once(function () { + var idx = interceptors.indexOf(handler); + if (idx !== -1) + interceptors.splice(idx, 1); + }); +} +function interceptChange(interceptable, change) { + var prevU = untrackedStart(); + try { + var interceptors = interceptable.interceptors; + if (interceptors) + for (var i = 0, l = interceptors.length; i < l; i++) { + change = interceptors[i](change); + invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); + if (!change) + break; + } + return change; + } + finally { + untrackedEnd(prevU); + } +} + +function hasListeners(listenable) { + return listenable.changeListeners && listenable.changeListeners.length > 0; +} +function registerListener(listenable, handler) { + var listeners = listenable.changeListeners || (listenable.changeListeners = []); + listeners.push(handler); + return once(function () { + var idx = listeners.indexOf(handler); + if (idx !== -1) + listeners.splice(idx, 1); + }); +} +function notifyListeners(listenable, change) { + var prevU = untrackedStart(); + var listeners = listenable.changeListeners; + if (!listeners) + return; + listeners = listeners.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i](change); + } + untrackedEnd(prevU); +} + +function isSpyEnabled() { + return !!globalState.spyListeners.length; +} +function spyReport(event) { + if (!globalState.spyListeners.length) + return; + var listeners = globalState.spyListeners; + for (var i = 0, l = listeners.length; i < l; i++) + listeners[i](event); +} +function spyReportStart(event) { + var change = objectAssign({}, event, { spyReportStart: true }); + spyReport(change); +} +var END_EVENT = { spyReportEnd: true }; +function spyReportEnd(change) { + if (change) + spyReport(objectAssign({}, change, END_EVENT)); + else + spyReport(END_EVENT); +} +function spy(listener) { + globalState.spyListeners.push(listener); + return once(function () { + var idx = globalState.spyListeners.indexOf(listener); + if (idx !== -1) + globalState.spyListeners.splice(idx, 1); + }); +} + +function iteratorSymbol() { + return (typeof Symbol === "function" && Symbol.iterator) || "@@iterator"; +} +var IS_ITERATING_MARKER = "__$$iterating"; +function arrayAsIterator(array) { + // returning an array for entries(), values() etc for maps was a mis-interpretation of the specs.., + // yet it is quite convenient to be able to use the response both as array directly and as iterator + // it is suboptimal, but alas... + invariant(array[IS_ITERATING_MARKER] !== true, "Illegal state: cannot recycle array as iterator"); + addHiddenFinalProp(array, IS_ITERATING_MARKER, true); + var idx = -1; + addHiddenFinalProp(array, "next", function next() { + idx++; + return { + done: idx >= this.length, + value: idx < this.length ? this[idx] : undefined + }; + }); + return array; +} +function declareIterator(prototType, iteratorFactory) { + addHiddenFinalProp(prototType, iteratorSymbol(), iteratorFactory); +} + +var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859 +// Detects bug in safari 9.1.1 (or iOS 9 safari mobile). See #364 +var safariPrototypeSetterInheritanceBug = (function () { + var v = false; + var p = {}; + Object.defineProperty(p, "0", { + set: function () { + v = true; + } + }); + Object.create(p)["0"] = 1; + return v === false; +})(); +/** + * This array buffer contains two lists of properties, so that all arrays + * can recycle their property definitions, which significantly improves performance of creating + * properties on the fly. + */ +var OBSERVABLE_ARRAY_BUFFER_SIZE = 0; +// Typescript workaround to make sure ObservableArray extends Array +var StubArray = (function () { + function StubArray() { + } + return StubArray; +}()); +function inherit(ctor, proto) { + if (typeof Object["setPrototypeOf"] !== "undefined") { + Object["setPrototypeOf"](ctor.prototype, proto); + } + else if (typeof ctor.prototype.__proto__ !== "undefined") { + ctor.prototype.__proto__ = proto; + } + else { + ctor["prototype"] = proto; + } +} +inherit(StubArray, Array.prototype); +// Weex freeze Array.prototype +// Make them writeable and configurable in prototype chain +// https://github.com/alibaba/weex/pull/1529 +if (Object.isFrozen(Array)) { + + [ + "constructor", + "push", + "shift", + "concat", + "pop", + "unshift", + "replace", + "find", + "findIndex", + "splice", + "reverse", + "sort" + ].forEach(function (key) { + Object.defineProperty(StubArray.prototype, key, { + configurable: true, + writable: true, + value: Array.prototype[key] + }); + }); +} +var ObservableArrayAdministration = (function () { + function ObservableArrayAdministration(name, enhancer, array, owned) { + this.array = array; + this.owned = owned; + this.values = []; + this.lastKnownLength = 0; + this.interceptors = null; + this.changeListeners = null; + this.atom = new BaseAtom(name || "ObservableArray@" + getNextId()); + this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); }; + } + ObservableArrayAdministration.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableArrayAdministration.prototype.dehanceValues = function (values) { + if (this.dehancer !== undefined) + return values.map(this.dehancer); + return values; + }; + ObservableArrayAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + if (fireImmediately) { + listener({ + object: this.array, + type: "splice", + index: 0, + added: this.values.slice(), + addedCount: this.values.length, + removed: [], + removedCount: 0 + }); + } + return registerListener(this, listener); + }; + ObservableArrayAdministration.prototype.getArrayLength = function () { + this.atom.reportObserved(); + return this.values.length; + }; + ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { + if (typeof newLength !== "number" || newLength < 0) + throw new Error("[mobx.array] Out of range: " + newLength); + var currentLength = this.values.length; + if (newLength === currentLength) + return; + else if (newLength > currentLength) { + var newItems = new Array(newLength - currentLength); + for (var i = 0; i < newLength - currentLength; i++) + newItems[i] = undefined; // No Array.fill everywhere... + this.spliceWithArray(currentLength, 0, newItems); + } + else + this.spliceWithArray(newLength, currentLength - newLength); + }; + // adds / removes the necessary numeric properties to this object + ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { + if (oldLength !== this.lastKnownLength) + throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?"); + this.lastKnownLength += delta; + if (delta > 0 && oldLength + delta + 1 > OBSERVABLE_ARRAY_BUFFER_SIZE) + reserveArrayBuffer(oldLength + delta + 1); + }; + ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { + var _this = this; + checkIfStateModificationsAreAllowed(this.atom); + var length = this.values.length; + if (index === undefined) + index = 0; + else if (index > length) + index = length; + else if (index < 0) + index = Math.max(0, length + index); + if (arguments.length === 1) + deleteCount = length - index; + else if (deleteCount === undefined || deleteCount === null) + deleteCount = 0; + else + deleteCount = Math.max(0, Math.min(deleteCount, length - index)); + if (newItems === undefined) + newItems = []; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this.array, + type: "splice", + index: index, + removedCount: deleteCount, + added: newItems + }); + if (!change) + return EMPTY_ARRAY; + deleteCount = change.removedCount; + newItems = change.added; + } + newItems = newItems.map(function (v) { return _this.enhancer(v, undefined); }); + var lengthDelta = newItems.length - deleteCount; + this.updateArrayLength(length, lengthDelta); // create or remove new entries + var res = this.spliceItemsIntoValues(index, deleteCount, newItems); + if (deleteCount !== 0 || newItems.length !== 0) + this.notifyArraySplice(index, newItems, res); + return this.dehanceValues(res); + }; + ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { + if (newItems.length < MAX_SPLICE_SIZE) { + return (_a = this.values).splice.apply(_a, [index, deleteCount].concat(newItems)); + } + else { + var res = this.values.slice(index, index + deleteCount); + this.values = this.values + .slice(0, index) + .concat(newItems, this.values.slice(index + deleteCount)); + return res; + } + var _a; + }; + ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "update", + index: index, + newValue: newValue, + oldValue: oldValue + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "splice", + index: index, + removed: removed, + added: added, + removedCount: removed.length, + addedCount: added.length + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + return ObservableArrayAdministration; +}()); +var ObservableArray = (function (_super) { + __extends(ObservableArray, _super); + function ObservableArray(initialValues, enhancer, name, owned) { + if (name === void 0) { name = "ObservableArray@" + getNextId(); } + if (owned === void 0) { owned = false; } + var _this = _super.call(this) || this; + var adm = new ObservableArrayAdministration(name, enhancer, _this, owned); + addHiddenFinalProp(_this, "$mobx", adm); + if (initialValues && initialValues.length) { + _this.spliceWithArray(0, 0, initialValues); + } + if (safariPrototypeSetterInheritanceBug) { + // Seems that Safari won't use numeric prototype setter untill any * numeric property is + // defined on the instance. After that it works fine, even if this property is deleted. + Object.defineProperty(adm.array, "0", ENTRY_0); + } + return _this; + } + ObservableArray.prototype.intercept = function (handler) { + return this.$mobx.intercept(handler); + }; + ObservableArray.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + return this.$mobx.observe(listener, fireImmediately); + }; + ObservableArray.prototype.clear = function () { + return this.splice(0); + }; + ObservableArray.prototype.concat = function () { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + this.$mobx.atom.reportObserved(); + return Array.prototype.concat.apply(this.peek(), arrays.map(function (a) { return (isObservableArray(a) ? a.peek() : a); })); + }; + ObservableArray.prototype.replace = function (newItems) { + return this.$mobx.spliceWithArray(0, this.$mobx.values.length, newItems); + }; + /** + * Converts this array back to a (shallow) javascript structure. + * For a deep clone use mobx.toJS + */ + ObservableArray.prototype.toJS = function () { + return this.slice(); + }; + ObservableArray.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableArray.prototype.peek = function () { + this.$mobx.atom.reportObserved(); + return this.$mobx.dehanceValues(this.$mobx.values); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find + ObservableArray.prototype.find = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var idx = this.findIndex.apply(this, arguments); + return idx === -1 ? undefined : this.get(idx); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex + ObservableArray.prototype.findIndex = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var items = this.peek(), l = items.length; + for (var i = fromIndex; i < l; i++) + if (predicate.call(thisArg, items[i], i, this)) + return i; + return -1; + }; + /* + * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) + * since these functions alter the inner structure of the array, the have side effects. + * Because the have side effects, they should not be used in computed function, + * and for that reason the do not call dependencyState.notifyObserved + */ + ObservableArray.prototype.splice = function (index, deleteCount) { + var newItems = []; + for (var _i = 2; _i < arguments.length; _i++) { + newItems[_i - 2] = arguments[_i]; + } + switch (arguments.length) { + case 0: + return []; + case 1: + return this.$mobx.spliceWithArray(index); + case 2: + return this.$mobx.spliceWithArray(index, deleteCount); + } + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.spliceWithArray = function (index, deleteCount, newItems) { + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.push = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(adm.values.length, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.pop = function () { + return this.splice(Math.max(this.$mobx.values.length - 1, 0), 1)[0]; + }; + ObservableArray.prototype.shift = function () { + return this.splice(0, 1)[0]; + }; + ObservableArray.prototype.unshift = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(0, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.reverse = function () { + // reverse by default mutates in place before returning the result + // which makes it both a 'derivation' and a 'mutation'. + // so we deviate from the default and just make it an dervitation + var clone = this.slice(); + return clone.reverse.apply(clone, arguments); + }; + ObservableArray.prototype.sort = function (compareFn) { + // sort by default mutates in place before returning the result + // which goes against all good practices. Let's not change the array in place! + var clone = this.slice(); + return clone.sort.apply(clone, arguments); + }; + ObservableArray.prototype.remove = function (value) { + var idx = this.$mobx.dehanceValues(this.$mobx.values).indexOf(value); + if (idx > -1) { + this.splice(idx, 1); + return true; + } + return false; + }; + ObservableArray.prototype.move = function (fromIndex, toIndex) { + function checkIndex(index) { + if (index < 0) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is negative"); + } + var length = this.$mobx.values.length; + if (index >= length) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is not smaller than " + length); + } + } + checkIndex.call(this, fromIndex); + checkIndex.call(this, toIndex); + if (fromIndex === toIndex) { + return; + } + var oldItems = this.$mobx.values; + var newItems; + if (fromIndex < toIndex) { + newItems = oldItems.slice(0, fromIndex).concat(oldItems.slice(fromIndex + 1, toIndex + 1), [ + oldItems[fromIndex] + ], oldItems.slice(toIndex + 1)); + } + else { + // toIndex < fromIndex + newItems = oldItems.slice(0, toIndex).concat([ + oldItems[fromIndex] + ], oldItems.slice(toIndex, fromIndex), oldItems.slice(fromIndex + 1)); + } + this.replace(newItems); + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.get = function (index) { + var impl = this.$mobx; + if (impl) { + if (index < impl.values.length) { + impl.atom.reportObserved(); + return impl.dehanceValue(impl.values[index]); + } + console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + impl + .values + .length + "). Please check length first. Out of bound indices will not be tracked by MobX"); + } + return undefined; + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.set = function (index, newValue) { + var adm = this.$mobx; + var values = adm.values; + if (index < values.length) { + // update at index in range + checkIfStateModificationsAreAllowed(adm.atom); + var oldValue = values[index]; + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: this, + index: index, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = adm.enhancer(newValue, oldValue); + var changed = newValue !== oldValue; + if (changed) { + values[index] = newValue; + adm.notifyArrayChildUpdate(index, newValue, oldValue); + } + } + else if (index === values.length) { + // add a new item + adm.spliceWithArray(index, 0, [newValue]); + } + else { + // out of bounds + throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); + } + }; + return ObservableArray; +}(StubArray)); +declareIterator(ObservableArray.prototype, function () { + return arrayAsIterator(this.slice()); +}); +Object.defineProperty(ObservableArray.prototype, "length", { + enumerable: false, + configurable: true, + get: function () { + return this.$mobx.getArrayLength(); + }, + set: function (newLength) { + this.$mobx.setArrayLength(newLength); + } +}); +[ + "every", + "filter", + "forEach", + "indexOf", + "join", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some", + "toString", + "toLocaleString" +].forEach(function (funcName) { + var baseFunc = Array.prototype[funcName]; + invariant(typeof baseFunc === "function", "Base function not defined on Array prototype: '" + funcName + "'"); + addHiddenProp(ObservableArray.prototype, funcName, function () { + return baseFunc.apply(this.peek(), arguments); + }); +}); +/** + * We don't want those to show up in `for (const key in ar)` ... + */ +makeNonEnumerable(ObservableArray.prototype, [ + "constructor", + "intercept", + "observe", + "clear", + "concat", + "get", + "replace", + "toJS", + "toJSON", + "peek", + "find", + "findIndex", + "splice", + "spliceWithArray", + "push", + "pop", + "set", + "shift", + "unshift", + "reverse", + "sort", + "remove", + "move", + "toString", + "toLocaleString" +]); +// See #364 +var ENTRY_0 = createArrayEntryDescriptor(0); +function createArrayEntryDescriptor(index) { + return { + enumerable: false, + configurable: false, + get: function () { + // TODO: Check `this`?, see #752? + return this.get(index); + }, + set: function (value) { + this.set(index, value); + } + }; +} +function createArrayBufferItem(index) { + Object.defineProperty(ObservableArray.prototype, "" + index, createArrayEntryDescriptor(index)); +} +function reserveArrayBuffer(max) { + for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max; index++) + createArrayBufferItem(index); + OBSERVABLE_ARRAY_BUFFER_SIZE = max; +} +reserveArrayBuffer(1000); +var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); +function isObservableArray(thing) { + return isObject(thing) && isObservableArrayAdministration(thing.$mobx); +} + +var UNCHANGED = {}; +var ObservableValue = (function (_super) { + __extends(ObservableValue, _super); + function ObservableValue(value, enhancer, name, notifySpy) { + if (name === void 0) { name = "ObservableValue@" + getNextId(); } + if (notifySpy === void 0) { notifySpy = true; } + var _this = _super.call(this, name) || this; + _this.enhancer = enhancer; + _this.hasUnreportedChange = false; + _this.dehancer = undefined; + _this.value = enhancer(value, undefined, name); + if (notifySpy && isSpyEnabled()) { + // only notify spy if this is a stand-alone observable + spyReport({ type: "create", object: _this, newValue: _this.value }); + } + return _this; + } + ObservableValue.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableValue.prototype.set = function (newValue) { + var oldValue = this.value; + newValue = this.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + if (notifySpy) { + spyReportStart({ + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + this.setNewValue(newValue); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableValue.prototype.prepareNewValue = function (newValue) { + checkIfStateModificationsAreAllowed(this); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this, + type: "update", + newValue: newValue + }); + if (!change) + return UNCHANGED; + newValue = change.newValue; + } + // apply modifier + newValue = this.enhancer(newValue, this.value, this.name); + return this.value !== newValue ? newValue : UNCHANGED; + }; + ObservableValue.prototype.setNewValue = function (newValue) { + var oldValue = this.value; + this.value = newValue; + this.reportChanged(); + if (hasListeners(this)) { + notifyListeners(this, { + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + }; + ObservableValue.prototype.get = function () { + this.reportObserved(); + return this.dehanceValue(this.value); + }; + ObservableValue.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableValue.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately) + listener({ + object: this, + type: "update", + newValue: this.value, + oldValue: undefined + }); + return registerListener(this, listener); + }; + ObservableValue.prototype.toJSON = function () { + return this.get(); + }; + ObservableValue.prototype.toString = function () { + return this.name + "[" + this.value + "]"; + }; + ObservableValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + return ObservableValue; +}(BaseAtom)); +ObservableValue.prototype[primitiveSymbol()] = ObservableValue.prototype.valueOf; +var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); + +var messages = { + m001: "It is not allowed to assign new values to @action fields", + m002: "`runInAction` expects a function", + m003: "`runInAction` expects a function without arguments", + m004: "autorun expects a function", + m005: "Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m006: "Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m007: "reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object", + m008: "wrapping reaction expression in `asReference` is no longer supported, use options object instead", + m009: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.", + m010: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'", + m011: "First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments", + m012: "computed takes one or two arguments if used as function", + m013: "[mobx.expr] 'expr' should only be used inside other reactive functions.", + m014: "extendObservable expected 2 or more arguments", + m015: "extendObservable expects an object as first argument", + m016: "extendObservable should not be used on maps, use map.merge instead", + m017: "all arguments of extendObservable should be objects", + m018: "extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540", + m019: "[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.", + m020: "modifiers can only be used for individual object properties", + m021: "observable expects zero or one arguments", + m022: "@observable can not be used on getters, use @computed instead", + m024: "whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.", + m025: "whyRun can only be used on reactions and computed values", + m026: "`action` can only be invoked on functions", + m028: "It is not allowed to set `useStrict` when a derivation is running", + m029: "INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row", + m030a: "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ", + m030b: "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ", + m031: "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ", + m032: "* This computation is suspended (not in use by any reaction) and won't run automatically.\n Didn't expect this computation to be suspended at this point?\n 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).", + m033: "`observe` doesn't support the fire immediately property for observable maps.", + m034: "`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead", + m035: "Cannot make the designated object observable; it is not extensible", + m036: "It is not possible to get index atoms from arrays", + m037: "Hi there! I'm sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle \"(...)\" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error(\"Oops\")` instead of `throw \"Oops\"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling \"Pause on caught exception\".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn't help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n", + m038: "Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n" +}; +function getMessage(id) { + return messages[id]; +} + +function createAction(actionName, fn) { + invariant(typeof fn === "function", getMessage("m026")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + var res = function () { + return executeAction(actionName, fn, this, arguments); + }; + res.originalFn = fn; + res.isMobxAction = true; + return res; +} +function executeAction(actionName, fn, scope, args) { + var runInfo = startAction(actionName, fn, scope, args); + try { + return fn.apply(scope, args); + } + finally { + endAction(runInfo); + } +} +function startAction(actionName, fn, scope, args) { + var notifySpy = isSpyEnabled() && !!actionName; + var startTime = 0; + if (notifySpy) { + startTime = Date.now(); + var l = (args && args.length) || 0; + var flattendArgs = new Array(l); + if (l > 0) + for (var i = 0; i < l; i++) + flattendArgs[i] = args[i]; + spyReportStart({ + type: "action", + name: actionName, + fn: fn, + object: scope, + arguments: flattendArgs + }); + } + var prevDerivation = untrackedStart(); + startBatch(); + var prevAllowStateChanges = allowStateChangesStart(true); + return { + prevDerivation: prevDerivation, + prevAllowStateChanges: prevAllowStateChanges, + notifySpy: notifySpy, + startTime: startTime + }; +} +function endAction(runInfo) { + allowStateChangesEnd(runInfo.prevAllowStateChanges); + endBatch(); + untrackedEnd(runInfo.prevDerivation); + if (runInfo.notifySpy) + spyReportEnd({ time: Date.now() - runInfo.startTime }); +} +function useStrict(strict) { + invariant(globalState.trackingDerivation === null, getMessage("m028")); + globalState.strictMode = strict; + globalState.allowStateChanges = !strict; +} +function isStrictModeEnabled() { + return globalState.strictMode; +} +function allowStateChanges(allowStateChanges, func) { + // TODO: deprecate / refactor this function in next major + // Currently only used by `@observer` + // Proposed change: remove first param, rename to `forbidStateChanges`, + // require error callback instead of the hardcoded error message now used + // Use `inAction` instead of allowStateChanges in derivation.ts to check strictMode + var prev = allowStateChangesStart(allowStateChanges); + var res; + try { + res = func(); + } + finally { + allowStateChangesEnd(prev); + } + return res; +} +function allowStateChangesStart(allowStateChanges) { + var prev = globalState.allowStateChanges; + globalState.allowStateChanges = allowStateChanges; + return prev; +} +function allowStateChangesEnd(prev) { + globalState.allowStateChanges = prev; +} + +/** + * Constructs a decorator, that normalizes the differences between + * TypeScript and Babel. Mainly caused by the fact that legacy-decorator cannot assign + * values during instance creation to properties that have a getter setter. + * + * - Sigh - + * + * Also takes care of the difference between @decorator field and @decorator(args) field, and different forms of values. + * For performance (cpu and mem) reasons the properties are always defined on the prototype (at least initially). + * This means that these properties despite being enumerable might not show up in Object.keys() (but they will show up in for...in loops). + */ +function createClassPropertyDecorator( + /** + * This function is invoked once, when the property is added to a new instance. + * When this happens is not strictly determined due to differences in TS and Babel: + * Typescript: Usually when constructing the new instance + * Babel, sometimes Typescript: during the first get / set + * Both: when calling `runLazyInitializers(instance)` + */ + onInitialize, get, set, enumerable, + /** + * Can this decorator invoked with arguments? e.g. @decorator(args) + */ + allowCustomArguments) { + function classPropertyDecorator(target, key, descriptor, customArgs, argLen) { + if (argLen === void 0) { argLen = 0; } + invariant(allowCustomArguments || quacksLikeADecorator(arguments), "This function is a decorator, but it wasn't invoked like a decorator"); + if (!descriptor) { + // typescript (except for getter / setters) + var newDescriptor = { + enumerable: enumerable, + configurable: true, + get: function () { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) + typescriptInitializeProperty(this, key, undefined, onInitialize, customArgs, descriptor); + return get.call(this, key); + }, + set: function (v) { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) { + typescriptInitializeProperty(this, key, v, onInitialize, customArgs, descriptor); + } + else { + set.call(this, key, v); + } + } + }; + if (arguments.length < 3 || (arguments.length === 5 && argLen < 3)) { + // Typescript target is ES3, so it won't define property for us + // or using Reflect.decorate polyfill, which will return no descriptor + // (see https://github.com/mobxjs/mobx/issues/333) + Object.defineProperty(target, key, newDescriptor); + } + return newDescriptor; + } + else { + // babel and typescript getter / setter props + if (!hasOwnProperty(target, "__mobxLazyInitializers")) { + addHiddenProp(target, "__mobxLazyInitializers", (target.__mobxLazyInitializers && target.__mobxLazyInitializers.slice()) || [] // support inheritance + ); + } + var value_1 = descriptor.value, initializer_1 = descriptor.initializer; + target.__mobxLazyInitializers.push(function (instance) { + onInitialize(instance, key, initializer_1 ? initializer_1.call(instance) : value_1, customArgs, descriptor); + }); + return { + enumerable: enumerable, + configurable: true, + get: function () { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + return get.call(this, key); + }, + set: function (v) { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + set.call(this, key, v); + } + }; + } + } + if (allowCustomArguments) { + /** If custom arguments are allowed, we should return a function that returns a decorator */ + return function () { + /** Direct invocation: @decorator bla */ + if (quacksLikeADecorator(arguments)) + return classPropertyDecorator.apply(null, arguments); + /** Indirect invocation: @decorator(args) bla */ + var outerArgs = arguments; + var argLen = arguments.length; + return function (target, key, descriptor) { + return classPropertyDecorator(target, key, descriptor, outerArgs, argLen); + }; + }; + } + return classPropertyDecorator; +} +function typescriptInitializeProperty(instance, key, v, onInitialize, customArgs, baseDescriptor) { + if (!hasOwnProperty(instance, "__mobxInitializedProps")) + addHiddenProp(instance, "__mobxInitializedProps", {}); + instance.__mobxInitializedProps[key] = true; + onInitialize(instance, key, v, customArgs, baseDescriptor); +} +function runLazyInitializers(instance) { + if (instance.__mobxDidRunLazyInitializers === true) + return; + if (instance.__mobxLazyInitializers) { + addHiddenProp(instance, "__mobxDidRunLazyInitializers", true); + instance.__mobxDidRunLazyInitializers && + instance.__mobxLazyInitializers.forEach(function (initializer) { return initializer(instance); }); + } +} +function quacksLikeADecorator(args) { + return (args.length === 2 || args.length === 3) && typeof args[1] === "string"; +} + +var actionFieldDecorator = createClassPropertyDecorator(function (target, key, value, args, originalDescriptor) { + var actionName = args && args.length === 1 ? args[0] : value.name || key || ""; + var wrappedAction = action(actionName, value); + addHiddenProp(target, key, wrappedAction); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, true); +var boundActionDecorator = createClassPropertyDecorator(function (target, key, value) { + defineBoundAction(target, key, value); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, false); +var action = function action(arg1, arg2, arg3, arg4) { + if (arguments.length === 1 && typeof arg1 === "function") + return createAction(arg1.name || "", arg1); + if (arguments.length === 2 && typeof arg2 === "function") + return createAction(arg1, arg2); + if (arguments.length === 1 && typeof arg1 === "string") + return namedActionDecorator(arg1); + return namedActionDecorator(arg2).apply(null, arguments); +}; +action.bound = function boundAction(arg1, arg2, arg3) { + if (typeof arg1 === "function") { + var action_1 = createAction("", arg1); + action_1.autoBind = true; + return action_1; + } + return boundActionDecorator.apply(null, arguments); +}; +function namedActionDecorator(name) { + return function (target, prop, descriptor) { + if (descriptor && typeof descriptor.value === "function") { + // TypeScript @action method() { }. Defined on proto before being decorated + // Don't use the field decorator if we are just decorating a method + descriptor.value = createAction(name, descriptor.value); + descriptor.enumerable = false; + descriptor.configurable = true; + return descriptor; + } + if (descriptor !== undefined && descriptor.get !== undefined) { + throw new Error("[mobx] action is not expected to be used with getters"); + } + // bound instance methods + return actionFieldDecorator(name).apply(this, arguments); + }; +} +function runInAction(arg1, arg2, arg3) { + var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; + var fn = typeof arg1 === "function" ? arg1 : arg2; + var scope = typeof arg1 === "function" ? arg2 : arg3; + invariant(typeof fn === "function", getMessage("m002")); + invariant(fn.length === 0, getMessage("m003")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + return executeAction(actionName, fn, scope, undefined); +} +function isAction(thing) { + return typeof thing === "function" && thing.isMobxAction === true; +} +function defineBoundAction(target, propertyName, fn) { + var res = function () { + return executeAction(propertyName, fn, target, arguments); + }; + res.isMobxAction = true; + addHiddenProp(target, propertyName, res); +} + +// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 +function deepEqual(a, b) { + return eq(a, b); +} +// Internal recursive comparison function for `isEqual`. +function eq(a, b, aStack, bStack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). + if (a === b) + return a !== 0 || 1 / a === 1 / b; + // `null` or `undefined` only equal to itself (strict comparison). + if (a == null || b == null) + return false; + // `NaN`s are equivalent, but non-reflexive. + if (a !== a) + return b !== b; + // Exhaust primitive checks + var type = typeof a; + if (type !== "function" && type !== "object" && typeof b != "object") + return false; + return deepEq(a, b, aStack, bStack); +} +var toString = Object.prototype.toString; +// Internal recursive comparison function for `isEqual`. +function deepEq(a, b, aStack, bStack) { + // Unwrap any wrapped objects. + a = unwrap(a); + b = unwrap(b); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className !== toString.call(b)) + return false; + switch (className) { + // Strings, numbers, regular expressions, dates, and booleans are compared by value. + case "[object RegExp]": + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case "[object String]": + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return "" + a === "" + b; + case "[object Number]": + // `NaN`s are equivalent, but non-reflexive. + // Object(NaN) is equivalent to NaN. + if (+a !== +a) + return +b !== +b; + // An `egal` comparison is performed for other numeric values. + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a === +b; + case "[object Symbol]": + return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)); + } + var areArrays = className === "[object Array]"; + if (!areArrays) { + if (typeof a != "object" || typeof b != "object") + return false; + // Objects with different constructors are not equivalent, but `Object`s or `Array`s + // from different frames are. + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && + !(typeof aCtor === "function" && + aCtor instanceof aCtor && + typeof bCtor === "function" && + bCtor instanceof bCtor) && + ("constructor" in a && "constructor" in b)) { + return false; + } + } + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + // Initializing stack of traversed objects. + // It's done here since we only need them for objects and arrays comparison. + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (aStack[length] === a) + return bStack[length] === b; + } + // Add the first object to the stack of traversed objects. + aStack.push(a); + bStack.push(b); + // Recursively compare objects and arrays. + if (areArrays) { + // Compare array lengths to determine if a deep comparison is necessary. + length = a.length; + if (length !== b.length) + return false; + // Deep compare the contents, ignoring non-numeric properties. + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) + return false; + } + } + else { + // Deep compare objects. + var keys = Object.keys(a), key; + length = keys.length; + // Ensure that both objects contain the same number of properties before comparing deep equality. + if (Object.keys(b).length !== length) + return false; + while (length--) { + // Deep compare each member + key = keys[length]; + if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) + return false; + } + } + // Remove the first object from the stack of traversed objects. + aStack.pop(); + bStack.pop(); + return true; +} +function unwrap(a) { + if (isObservableArray(a)) + return a.peek(); + if (isObservableMap(a)) + return a.entries(); + if (isES6Map(a)) + return iteratorToArray(a.entries()); + return a; +} +function has(a, key) { + return Object.prototype.hasOwnProperty.call(a, key); +} + +function identityComparer(a, b) { + return a === b; +} +function structuralComparer(a, b) { + return deepEqual(a, b); +} +function defaultComparer(a, b) { + return areBothNaN(a, b) || identityComparer(a, b); +} +var comparer = { + identity: identityComparer, + structural: structuralComparer, + default: defaultComparer +}; + +function autorun(arg1, arg2, arg3) { + var name, view, scope; + if (typeof arg1 === "string") { + name = arg1; + view = arg2; + scope = arg3; + } + else { + name = arg1.name || "Autorun@" + getNextId(); + view = arg1; + scope = arg2; + } + invariant(typeof view === "function", getMessage("m004")); + invariant(isAction(view) === false, getMessage("m005")); + if (scope) + view = view.bind(scope); + var reaction = new Reaction(name, function () { + this.track(reactionRunner); + }); + function reactionRunner() { + view(reaction); + } + reaction.schedule(); + return reaction.getDisposer(); +} +function when(arg1, arg2, arg3, arg4) { + var name, predicate, effect, scope; + if (typeof arg1 === "string") { + name = arg1; + predicate = arg2; + effect = arg3; + scope = arg4; + } + else { + name = "When@" + getNextId(); + predicate = arg1; + effect = arg2; + scope = arg3; + } + var disposer = autorun(name, function (r) { + if (predicate.call(scope)) { + r.dispose(); + var prevUntracked = untrackedStart(); + effect.call(scope); + untrackedEnd(prevUntracked); + } + }); + return disposer; +} +function autorunAsync(arg1, arg2, arg3, arg4) { + var name, func, delay, scope; + if (typeof arg1 === "string") { + name = arg1; + func = arg2; + delay = arg3; + scope = arg4; + } + else { + name = arg1.name || "AutorunAsync@" + getNextId(); + func = arg1; + delay = arg2; + scope = arg3; + } + invariant(isAction(func) === false, getMessage("m006")); + if (delay === void 0) + delay = 1; + if (scope) + func = func.bind(scope); + var isScheduled = false; + var r = new Reaction(name, function () { + if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + if (!r.isDisposed) + r.track(reactionRunner); + }, delay); + } + }); + function reactionRunner() { + func(r); + } + r.schedule(); + return r.getDisposer(); +} +function reaction(expression, effect, arg3) { + if (arguments.length > 3) { + fail(getMessage("m007")); + } + if (isModifierDescriptor(expression)) { + fail(getMessage("m008")); + } + var opts; + if (typeof arg3 === "object") { + opts = arg3; + } + else { + opts = {}; + } + opts.name = + opts.name || expression.name || effect.name || "Reaction@" + getNextId(); + opts.fireImmediately = arg3 === true || opts.fireImmediately === true; + opts.delay = opts.delay || 0; + opts.compareStructural = opts.compareStructural || opts.struct || false; + // TODO: creates ugly spy events, use `effect = (r) => runInAction(opts.name, () => effect(r))` instead + effect = action(opts.name, opts.context ? effect.bind(opts.context) : effect); + if (opts.context) { + expression = expression.bind(opts.context); + } + var firstTime = true; + var isScheduled = false; + var value; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + var r = new Reaction(opts.name, function () { + if (firstTime || opts.delay < 1) { + reactionRunner(); + } + else if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + reactionRunner(); + }, opts.delay); + } + }); + function reactionRunner() { + if (r.isDisposed) + return; + var changed = false; + r.track(function () { + var nextValue = expression(r); + changed = firstTime || !equals(value, nextValue); + value = nextValue; + }); + if (firstTime && opts.fireImmediately) + effect(value, r); + if (!firstTime && changed === true) + effect(value, r); + if (firstTime) + firstTime = false; + } + r.schedule(); + return r.getDisposer(); +} + +/** + * A node in the state dependency root that observes other nodes, and can be observed itself. + * + * ComputedValue will remember the result of the computation for the duration of the batch, or + * while being observed. + * + * During this time it will recompute only when one of its direct dependencies changed, + * but only when it is being accessed with `ComputedValue.get()`. + * + * Implementation description: + * 1. First time it's being accessed it will compute and remember result + * give back remembered result until 2. happens + * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. + * 3. When it's being accessed, recompute if any shallow dependency changed. + * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. + * go to step 2. either way + * + * If at any point it's outside batch and it isn't observed: reset everything and go to 1. + */ +var ComputedValue = (function () { + /** + * Create a new computed value based on a function expression. + * + * The `name` property is for debug purposes only. + * + * The `equals` property specifies the comparer function to use to determine if a newly produced + * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` + * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. + * Structural comparison can be convenient if you always produce an new aggregated object and + * don't want to notify observers if it is structurally the same. + * This is useful for working with vectors, mouse coordinates etc. + */ + function ComputedValue(derivation, scope, equals, name, setter) { + this.derivation = derivation; + this.scope = scope; + this.equals = equals; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = null; // during tracking it's an array with new observed observers + this.isPendingUnobservation = false; + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.runId = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.UP_TO_DATE; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.value = new CaughtException(null); + this.isComputing = false; // to check for cycles + this.isRunningSetter = false; + this.isTracing = TraceMode.NONE; + this.name = name || "ComputedValue@" + getNextId(); + if (setter) + this.setter = createAction(name + "-setter", setter); + } + ComputedValue.prototype.onBecomeStale = function () { + propagateMaybeChanged(this); + }; + ComputedValue.prototype.onBecomeUnobserved = function () { + clearObserving(this); + this.value = undefined; + }; + /** + * Returns the current value of this computed value. + * Will evaluate its computation first if needed. + */ + ComputedValue.prototype.get = function () { + invariant(!this.isComputing, "Cycle detected in computation " + this.name, this.derivation); + if (globalState.inBatch === 0) { + // This is an minor optimization which could be omitted to simplify the code + // The computedValue is accessed outside of any mobx stuff. Batch observing should be enough and don't need + // tracking as it will never be called again inside this batch. + startBatch(); + if (shouldCompute(this)) { + if (this.isTracing !== TraceMode.NONE) { + console.log("[mobx.trace] '" + this + .name + "' is being read outside a reactive context and doing a full recompute"); + } + this.value = this.computeValue(false); + } + endBatch(); + } + else { + reportObserved(this); + if (shouldCompute(this)) + if (this.trackAndCompute()) + propagateChangeConfirmed(this); + } + var result = this.value; + if (isCaughtException(result)) + throw result.cause; + return result; + }; + ComputedValue.prototype.peek = function () { + var res = this.computeValue(false); + if (isCaughtException(res)) + throw res.cause; + return res; + }; + ComputedValue.prototype.set = function (value) { + if (this.setter) { + invariant(!this.isRunningSetter, "The setter of computed value '" + this + .name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); + this.isRunningSetter = true; + try { + this.setter.call(this.scope, value); + } + finally { + this.isRunningSetter = false; + } + } + else + invariant(false, "[ComputedValue '" + this + .name + "'] It is not possible to assign a new value to a computed value."); + }; + ComputedValue.prototype.trackAndCompute = function () { + if (isSpyEnabled()) { + spyReport({ + object: this.scope, + type: "compute", + fn: this.derivation + }); + } + var oldValue = this.value; + var wasSuspended = + /* see #1208 */ this.dependenciesState === IDerivationState.NOT_TRACKING; + var newValue = (this.value = this.computeValue(true)); + return (wasSuspended || + isCaughtException(oldValue) || + isCaughtException(newValue) || + !this.equals(oldValue, newValue)); + }; + ComputedValue.prototype.computeValue = function (track) { + this.isComputing = true; + globalState.computationDepth++; + var res; + if (track) { + res = trackDerivedFunction(this, this.derivation, this.scope); + } + else { + try { + res = this.derivation.call(this.scope); + } + catch (e) { + res = new CaughtException(e); + } + } + globalState.computationDepth--; + this.isComputing = false; + return res; + }; + ComputedValue.prototype.observe = function (listener, fireImmediately) { + var _this = this; + var firstTime = true; + var prevValue = undefined; + return autorun(function () { + var newValue = _this.get(); + if (!firstTime || fireImmediately) { + var prevU = untrackedStart(); + listener({ + type: "update", + object: _this, + newValue: newValue, + oldValue: prevValue + }); + untrackedEnd(prevU); + } + firstTime = false; + prevValue = newValue; + }); + }; + ComputedValue.prototype.toJSON = function () { + return this.get(); + }; + ComputedValue.prototype.toString = function () { + return this.name + "[" + this.derivation.toString() + "]"; + }; + ComputedValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + ComputedValue.prototype.whyRun = function () { + var isTracking = Boolean(globalState.trackingDerivation); + var observing = unique(this.isComputing ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + var observers = unique(getObservers(this).map(function (dep) { return dep.name; })); + return ("\nWhyRun? computation '" + this.name + "':\n * Running because: " + (isTracking + ? "[active] the value of this computation is needed by a reaction" + : this.isComputing + ? "[get] The value of this computed was requested outside a reaction" + : "[idle] not running at the moment") + "\n" + + (this.dependenciesState === IDerivationState.NOT_TRACKING + ? getMessage("m032") + : " * This computation will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this.isComputing && isTracking + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n " + getMessage("m038") + "\n\n * If the outcome of this computation changes, the following observers will be re-run:\n " + joinStrings(observers) + "\n")); + }; + return ComputedValue; +}()); +ComputedValue.prototype[primitiveSymbol()] = ComputedValue.prototype.valueOf; +var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); + +var ObservableObjectAdministration = (function () { + function ObservableObjectAdministration(target, name) { + this.target = target; + this.name = name; + this.values = {}; + this.changeListeners = null; + this.interceptors = null; + } + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { + invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects."); + return registerListener(this, callback); + }; + ObservableObjectAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableObjectAdministration; +}()); +function asObservableObject(target, name) { + if (isObservableObject(target) && target.hasOwnProperty("$mobx")) + return target.$mobx; + invariant(Object.isExtensible(target), getMessage("m035")); + if (!isPlainObject(target)) + name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); + if (!name) + name = "ObservableObject@" + getNextId(); + var adm = new ObservableObjectAdministration(target, name); + addHiddenFinalProp(target, "$mobx", adm); + return adm; +} +function defineObservablePropertyFromDescriptor(adm, propName, descriptor, defaultEnhancer) { + if (adm.values[propName] && !isComputedValue(adm.values[propName])) { + // already observable property + invariant("value" in descriptor, "The property " + propName + " in " + adm.name + " is already observable, cannot redefine it as computed property"); + adm.target[propName] = descriptor.value; // the property setter will make 'value' reactive if needed. + return; + } + // not yet observable property + if ("value" in descriptor) { + // not a computed value + if (isModifierDescriptor(descriptor.value)) { + // x : ref(someValue) + var modifierDescriptor = descriptor.value; + defineObservableProperty(adm, propName, modifierDescriptor.initialValue, modifierDescriptor.enhancer); + } + else if (isAction(descriptor.value) && descriptor.value.autoBind === true) { + defineBoundAction(adm.target, propName, descriptor.value.originalFn); + } + else if (isComputedValue(descriptor.value)) { + // x: computed(someExpr) + defineComputedPropertyFromComputedValue(adm, propName, descriptor.value); + } + else { + // x: someValue + defineObservableProperty(adm, propName, descriptor.value, defaultEnhancer); + } + } + else { + // get x() { return 3 } set x(v) { } + defineComputedProperty(adm, propName, descriptor.get, descriptor.set, comparer.default, true); + } +} +function defineObservableProperty(adm, propName, newValue, enhancer) { + assertPropertyConfigurable(adm.target, propName); + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + object: adm.target, + name: propName, + type: "add", + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + var observable = (adm.values[propName] = new ObservableValue(newValue, enhancer, adm.name + "." + propName, false)); + newValue = observable.value; // observableValue might have changed it + Object.defineProperty(adm.target, propName, generateObservablePropConfig(propName)); + notifyPropertyAddition(adm, adm.target, propName, newValue); +} +function defineComputedProperty(adm, propName, getter, setter, equals, asInstanceProperty) { + if (asInstanceProperty) + assertPropertyConfigurable(adm.target, propName); + adm.values[propName] = new ComputedValue(getter, adm.target, equals, adm.name + "." + propName, setter); + if (asInstanceProperty) { + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); + } +} +function defineComputedPropertyFromComputedValue(adm, propName, computedValue) { + var name = adm.name + "." + propName; + computedValue.name = name; + if (!computedValue.scope) + computedValue.scope = adm.target; + adm.values[propName] = computedValue; + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); +} +var observablePropertyConfigs = {}; +var computedPropertyConfigs = {}; +function generateObservablePropConfig(propName) { + return (observablePropertyConfigs[propName] || + (observablePropertyConfigs[propName] = { + configurable: true, + enumerable: true, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + setPropertyValue(this, propName, v); + } + })); +} +function generateComputedPropConfig(propName) { + return (computedPropertyConfigs[propName] || + (computedPropertyConfigs[propName] = { + configurable: true, + enumerable: false, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + return this.$mobx.values[propName].set(v); + } + })); +} +function setPropertyValue(instance, name, newValue) { + var adm = instance.$mobx; + var observable = adm.values[name]; + // intercept + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: instance, + name: name, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = observable.prepareNewValue(newValue); + // notify spy & observers + if (newValue !== UNCHANGED) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "update", + object: instance, + oldValue: observable.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable.setNewValue(newValue); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); + } +} +function notifyPropertyAddition(adm, object, name, newValue) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "add", + object: object, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); +} +var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); +function isObservableObject(thing) { + if (isObject(thing)) { + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + return isObservableObjectAdministration(thing.$mobx); + } + return false; +} + +/** + * Returns true if the provided value is reactive. + * @param value object, function or array + * @param property if property is specified, checks whether value.property is reactive. + */ +function isObservable(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableArray(value) || isObservableMap(value)) + throw new Error(getMessage("m019")); + else if (isObservableObject(value)) { + var o = value.$mobx; + return o.values && !!o.values[property]; + } + return false; + } + // For first check, see #701 + return (isObservableObject(value) || + !!value.$mobx || + isAtom(value) || + isReaction(value) || + isComputedValue(value)); +} + +function createDecoratorForEnhancer(enhancer) { + invariant(!!enhancer, ":("); + return createClassPropertyDecorator(function (target, name, baseValue, _, baseDescriptor) { + assertPropertyConfigurable(target, name); + invariant(!baseDescriptor || !baseDescriptor.get, getMessage("m022")); + var adm = asObservableObject(target, undefined); + defineObservableProperty(adm, name, baseValue, enhancer); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + setPropertyValue(this, name, value); + }, true, false); +} + +function extendObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, deepEnhancer, properties); +} +function extendShallowObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, referenceEnhancer, properties); +} +function extendObservableHelper(target, defaultEnhancer, properties) { + invariant(arguments.length >= 2, getMessage("m014")); + invariant(typeof target === "object", getMessage("m015")); + invariant(!isObservableMap(target), getMessage("m016")); + properties.forEach(function (propSet) { + invariant(typeof propSet === "object", getMessage("m017")); + invariant(!isObservable(propSet), getMessage("m018")); + }); + var adm = asObservableObject(target); + var definedProps = {}; + // Note could be optimised if properties.length === 1 + for (var i = properties.length - 1; i >= 0; i--) { + var propSet = properties[i]; + for (var key in propSet) + if (definedProps[key] !== true && hasOwnProperty(propSet, key)) { + definedProps[key] = true; + if (target === propSet && !isPropertyConfigurable(target, key)) + continue; // see #111, skip non-configurable or non-writable props for `observable(object)`. + var descriptor = Object.getOwnPropertyDescriptor(propSet, key); + defineObservablePropertyFromDescriptor(adm, key, descriptor, defaultEnhancer); + } + } + return target; +} + +var deepDecorator = createDecoratorForEnhancer(deepEnhancer); +var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); +var refDecorator = createDecoratorForEnhancer(referenceEnhancer); +var deepStructDecorator = createDecoratorForEnhancer(deepStructEnhancer); +var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); +/** + * Turns an object, array or function into a reactive structure. + * @param v the value which should become observable. + */ +function createObservable(v) { + if (v === void 0) { v = undefined; } + // @observable someProp; + if (typeof arguments[1] === "string") + return deepDecorator.apply(null, arguments); + invariant(arguments.length <= 1, getMessage("m021")); + invariant(!isModifierDescriptor(v), getMessage("m020")); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + var res = deepEnhancer(v, undefined, undefined); + // this value could be converted to a new observable data structure, return it + if (res !== v) + return res; + // otherwise, just box it + return observable.box(v); +} +var observableFactories = { + box: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("box"); + return new ObservableValue(value, deepEnhancer, name); + }, + shallowBox: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowBox"); + return new ObservableValue(value, referenceEnhancer, name); + }, + array: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("array"); + return new ObservableArray(initialValues, deepEnhancer, name); + }, + shallowArray: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowArray"); + return new ObservableArray(initialValues, referenceEnhancer, name); + }, + map: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("map"); + return new ObservableMap(initialValues, deepEnhancer, name); + }, + shallowMap: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowMap"); + return new ObservableMap(initialValues, referenceEnhancer, name); + }, + object: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("object"); + var res = {}; + // convert to observable object + asObservableObject(res, name); + // add properties + extendObservable(res, props); + return res; + }, + shallowObject: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowObject"); + var res = {}; + asObservableObject(res, name); + extendShallowObservable(res, props); + return res; + }, + ref: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(referenceEnhancer, arguments[0]); + } + else { + return refDecorator.apply(null, arguments); + } + }, + shallow: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(shallowEnhancer, arguments[0]); + } + else { + return shallowDecorator.apply(null, arguments); + } + }, + deep: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepEnhancer, arguments[0]); + } + else { + return deepDecorator.apply(null, arguments); + } + }, + struct: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepStructEnhancer, arguments[0]); + } + else { + return deepStructDecorator.apply(null, arguments); + } + } +}; +var observable = createObservable; +// weird trick to keep our typings nicely with our funcs, and still extend the observable function +Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); }); +observable.deep.struct = observable.struct; +observable.ref.struct = function () { + if (arguments.length < 2) { + return createModifierDescriptor(refStructEnhancer, arguments[0]); + } + else { + return refStructDecorator.apply(null, arguments); + } +}; +function incorrectlyUsedAsDecorator(methodName) { + fail("Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); +} + +function isModifierDescriptor(thing) { + return typeof thing === "object" && thing !== null && thing.isMobxModifierDescriptor === true; +} +function createModifierDescriptor(enhancer, initialValue) { + invariant(!isModifierDescriptor(initialValue), "Modifiers cannot be nested"); + return { + isMobxModifierDescriptor: true, + initialValue: initialValue, + enhancer: enhancer + }; +} +function deepEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return observable.array(v, name); + if (isPlainObject(v)) + return observable.object(v, name); + if (isES6Map(v)) + return observable.map(v, name); + return v; +} +function shallowEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + if (v === undefined || v === null) + return v; + if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v)) + return v; + if (Array.isArray(v)) + return observable.shallowArray(v, name); + if (isPlainObject(v)) + return observable.shallowObject(v, name); + if (isES6Map(v)) + return observable.shallowMap(v, name); + return fail("The shallow modifier / decorator can only used in combination with arrays, objects and maps"); +} +function referenceEnhancer(newValue) { + // never turn into an observable + return newValue; +} +function deepStructEnhancer(v, oldValue, name) { + // don't confuse structurally compare enhancer with ref enhancer! The latter is probably + // more suited for immutable objects + if (deepEqual(v, oldValue)) + return oldValue; + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return new ObservableArray(v, deepStructEnhancer, name); + if (isES6Map(v)) + return new ObservableMap(v, deepStructEnhancer, name); + if (isPlainObject(v)) { + var res = {}; + asObservableObject(res, name); + extendObservableHelper(res, deepStructEnhancer, [v]); + return res; + } + return v; +} +function refStructEnhancer(v, oldValue, name) { + if (deepEqual(v, oldValue)) + return oldValue; + return v; +} + +/** + * During a transaction no views are updated until the end of the transaction. + * The transaction will be run synchronously nonetheless. + * + * @param action a function that updates some reactive state + * @returns any value that was returned by the 'action' parameter. + */ +function transaction(action, thisArg) { + if (thisArg === void 0) { thisArg = undefined; } + startBatch(); + try { + return action.apply(thisArg); + } + finally { + endBatch(); + } +} + +var ObservableMapMarker = {}; +var ObservableMap = (function () { + function ObservableMap(initialData, enhancer, name) { + if (enhancer === void 0) { enhancer = deepEnhancer; } + if (name === void 0) { name = "ObservableMap@" + getNextId(); } + this.enhancer = enhancer; + this.name = name; + this.$mobx = ObservableMapMarker; + this._data = Object.create(null); + this._hasMap = Object.create(null); // hasMap, not hashMap >-). + this._keys = new ObservableArray(undefined, referenceEnhancer, this.name + ".keys()", true); + this.interceptors = null; + this.changeListeners = null; + this.dehancer = undefined; + this.merge(initialData); + } + ObservableMap.prototype._has = function (key) { + return typeof this._data[key] !== "undefined"; + }; + ObservableMap.prototype.has = function (key) { + if (!this.isValidKey(key)) + return false; + key = "" + key; + if (this._hasMap[key]) + return this._hasMap[key].get(); + return this._updateHasMapEntry(key, false).get(); + }; + ObservableMap.prototype.set = function (key, value) { + this.assertValidKey(key); + key = "" + key; + var hasKey = this._has(key); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: hasKey ? "update" : "add", + object: this, + newValue: value, + name: key + }); + if (!change) + return this; + value = change.newValue; + } + if (hasKey) { + this._updateValue(key, value); + } + else { + this._addValue(key, value); + } + return this; + }; + ObservableMap.prototype.delete = function (key) { + var _this = this; + this.assertValidKey(key); + key = "" + key; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: "delete", + object: this, + name: key + }); + if (!change) + return false; + } + if (this._has(key)) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "delete", + object: this, + oldValue: this._data[key].value, + name: key + } + : null; + if (notifySpy) + spyReportStart(change); + transaction(function () { + _this._keys.remove(key); + _this._updateHasMapEntry(key, false); + var observable$$1 = _this._data[key]; + observable$$1.setNewValue(undefined); + _this._data[key] = undefined; + }); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + return true; + } + return false; + }; + ObservableMap.prototype._updateHasMapEntry = function (key, value) { + // optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore + var entry = this._hasMap[key]; + if (entry) { + entry.setNewValue(value); + } + else { + entry = this._hasMap[key] = new ObservableValue(value, referenceEnhancer, this.name + "." + key + "?", false); + } + return entry; + }; + ObservableMap.prototype._updateValue = function (name, newValue) { + var observable$$1 = this._data[name]; + newValue = observable$$1.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "update", + object: this, + oldValue: observable$$1.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable$$1.setNewValue(newValue); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableMap.prototype._addValue = function (name, newValue) { + var _this = this; + transaction(function () { + var observable$$1 = (_this._data[name] = new ObservableValue(newValue, _this.enhancer, _this.name + "." + name, false)); + newValue = observable$$1.value; // value might have been changed + _this._updateHasMapEntry(name, true); + _this._keys.push(name); + }); + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "add", + object: this, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableMap.prototype.get = function (key) { + key = "" + key; + if (this.has(key)) + return this.dehanceValue(this._data[key].get()); + return this.dehanceValue(undefined); + }; + ObservableMap.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) { + return this.dehancer(value); + } + return value; + }; + ObservableMap.prototype.keys = function () { + return arrayAsIterator(this._keys.slice()); + }; + ObservableMap.prototype.values = function () { + return arrayAsIterator(this._keys.map(this.get, this)); + }; + ObservableMap.prototype.entries = function () { + var _this = this; + return arrayAsIterator(this._keys.map(function (key) { return [key, _this.get(key)]; })); + }; + ObservableMap.prototype.forEach = function (callback, thisArg) { + var _this = this; + this.keys().forEach(function (key) { return callback.call(thisArg, _this.get(key), key, _this); }); + }; + /** Merge another object into this object, returns this. */ + ObservableMap.prototype.merge = function (other) { + var _this = this; + if (isObservableMap(other)) { + other = other.toJS(); + } + transaction(function () { + if (isPlainObject(other)) + Object.keys(other).forEach(function (key) { return _this.set(key, other[key]); }); + else if (Array.isArray(other)) + other.forEach(function (_a) { + var key = _a[0], value = _a[1]; + return _this.set(key, value); + }); + else if (isES6Map(other)) + other.forEach(function (value, key) { return _this.set(key, value); }); + else if (other !== null && other !== undefined) + fail("Cannot initialize map from " + other); + }); + return this; + }; + ObservableMap.prototype.clear = function () { + var _this = this; + transaction(function () { + untracked(function () { + _this.keys().forEach(_this.delete, _this); + }); + }); + }; + ObservableMap.prototype.replace = function (values) { + var _this = this; + transaction(function () { + // grab all the keys that are present in the new map but not present in the current map + // and delete them from the map, then merge the new map + // this will cause reactions only on changed values + var newKeys = getMapLikeKeys(values); + var oldKeys = _this.keys(); + var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; }); + missingKeys.forEach(function (k) { return _this.delete(k); }); + _this.merge(values); + }); + return this; + }; + Object.defineProperty(ObservableMap.prototype, "size", { + get: function () { + return this._keys.length; + }, + enumerable: true, + configurable: true + }); + /** + * Returns a shallow non observable object clone of this map. + * Note that the values might still be observable. For a deep clone use mobx.toJS. + */ + ObservableMap.prototype.toJS = function () { + var _this = this; + var res = {}; + this.keys().forEach(function (key) { return (res[key] = _this.get(key)); }); + return res; + }; + ObservableMap.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableMap.prototype.isValidKey = function (key) { + if (key === null || key === undefined) + return false; + if (typeof key === "string" || typeof key === "number" || typeof key === "boolean") + return true; + return false; + }; + ObservableMap.prototype.assertValidKey = function (key) { + if (!this.isValidKey(key)) + throw new Error("[mobx.map] Invalid key: '" + key + "', only strings, numbers and booleans are accepted as key in observable maps."); + }; + ObservableMap.prototype.toString = function () { + var _this = this; + return (this.name + + "[{ " + + this.keys().map(function (key) { return key + ": " + ("" + _this.get(key)); }).join(", ") + + " }]"); + }; + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableMap.prototype.observe = function (listener, fireImmediately) { + invariant(fireImmediately !== true, getMessage("m033")); + return registerListener(this, listener); + }; + ObservableMap.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableMap; +}()); +declareIterator(ObservableMap.prototype, function () { + return this.entries(); +}); +function map(initialValues) { + deprecated("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"); + return observable.map(initialValues); +} +/* 'var' fixes small-build issue */ +var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); + +var EMPTY_ARRAY = []; +Object.freeze(EMPTY_ARRAY); +function getGlobal() { + return typeof window !== "undefined" ? window : global; +} +function getNextId() { + return ++globalState.mobxGuid; +} +function fail(message, thing) { + invariant(false, message, thing); + throw "X"; // unreachable +} +function invariant(check, message, thing) { + if (!check) + throw new Error("[mobx] Invariant failed: " + message + (thing ? " in '" + thing + "'" : "")); +} +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; +function deprecated(msg) { + if (deprecatedMessages.indexOf(msg) !== -1) + return false; + deprecatedMessages.push(msg); + console.error("[mobx] Deprecated: " + msg); + return true; +} +/** + * Makes sure that the provided function is invoked at most once. + */ +function once(func) { + var invoked = false; + return function () { + if (invoked) + return; + invoked = true; + return func.apply(this, arguments); + }; +} +var noop = function () { }; +function unique(list) { + var res = []; + list.forEach(function (item) { + if (res.indexOf(item) === -1) + res.push(item); + }); + return res; +} +function joinStrings(things, limit, separator) { + if (limit === void 0) { limit = 100; } + if (separator === void 0) { separator = " - "; } + if (!things) + return ""; + var sliced = things.slice(0, limit); + return "" + sliced.join(separator) + (things.length > limit + ? " (... and " + (things.length - limit) + "more)" + : ""); +} +function isObject(value) { + return value !== null && typeof value === "object"; +} +function isPlainObject(value) { + if (value === null || typeof value !== "object") + return false; + var proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; +} +function objectAssign() { + var res = arguments[0]; + for (var i = 1, l = arguments.length; i < l; i++) { + var source = arguments[i]; + for (var key in source) + if (hasOwnProperty(source, key)) { + res[key] = source[key]; + } + } + return res; +} +var prototypeHasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwnProperty(object, propName) { + return prototypeHasOwnProperty.call(object, propName); +} +function makeNonEnumerable(object, propNames) { + for (var i = 0; i < propNames.length; i++) { + addHiddenProp(object, propNames[i], object[propNames[i]]); + } +} +function addHiddenProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: true, + configurable: true, + value: value + }); +} +function addHiddenFinalProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: false, + configurable: true, + value: value + }); +} +function isPropertyConfigurable(object, prop) { + var descriptor = Object.getOwnPropertyDescriptor(object, prop); + return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false); +} +function assertPropertyConfigurable(object, prop) { + invariant(isPropertyConfigurable(object, prop), "Cannot make property '" + prop + "' observable, it is not configurable and writable in the target object"); +} +function createInstanceofPredicate(name, clazz) { + var propName = "isMobX" + name; + clazz.prototype[propName] = true; + return function (x) { + return isObject(x) && x[propName] === true; + }; +} +function areBothNaN(a, b) { + return typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); +} +/** + * Returns whether the argument is an array, disregarding observability. + */ +function isArrayLike(x) { + return Array.isArray(x) || isObservableArray(x); +} +function isES6Map(thing) { + if (getGlobal().Map !== undefined && thing instanceof getGlobal().Map) + return true; + return false; +} +function getMapLikeKeys(map$$1) { + if (isPlainObject(map$$1)) + return Object.keys(map$$1); + if (Array.isArray(map$$1)) + return map$$1.map(function (_a) { + var key = _a[0]; + return key; + }); + if (isES6Map(map$$1)) + return Array.from(map$$1.keys()); + if (isObservableMap(map$$1)) + return map$$1.keys(); + return fail("Cannot get keys from " + map$$1); +} +function iteratorToArray(it) { + var res = []; + while (true) { + var r = it.next(); + if (r.done) + break; + res.push(r.value); + } + return res; +} +function primitiveSymbol() { + return (typeof Symbol === "function" && Symbol.toPrimitive) || "@@toPrimitive"; +} +function toPrimitive(value) { + return value === null ? null : typeof value === "object" ? "" + value : value; +} + +/** + * These values will persist if global state is reset + */ +var persistentKeys = ["mobxGuid", "resetId", "spyListeners", "strictMode", "runId"]; +var MobXGlobals = (function () { + function MobXGlobals() { + /** + * MobXGlobals version. + * MobX compatiblity with other versions loaded in memory as long as this version matches. + * It indicates that the global state still stores similar information + */ + this.version = 5; + /** + * Currently running derivation + */ + this.trackingDerivation = null; + /** + * Are we running a computation currently? (not a reaction) + */ + this.computationDepth = 0; + /** + * Each time a derivation is tracked, it is assigned a unique run-id + */ + this.runId = 0; + /** + * 'guid' for general purpose. Will be persisted amongst resets. + */ + this.mobxGuid = 0; + /** + * Are we in a batch block? (and how many of them) + */ + this.inBatch = 0; + /** + * Observables that don't have observers anymore, and are about to be + * suspended, unless somebody else accesses it in the same batch + * + * @type {IObservable[]} + */ + this.pendingUnobservations = []; + /** + * List of scheduled, not yet executed, reactions. + */ + this.pendingReactions = []; + /** + * Are we currently processing reactions? + */ + this.isRunningReactions = false; + /** + * Is it allowed to change observables at this point? + * In general, MobX doesn't allow that when running computations and React.render. + * To ensure that those functions stay pure. + */ + this.allowStateChanges = true; + /** + * If strict mode is enabled, state changes are by default not allowed + */ + this.strictMode = false; + /** + * Used by createTransformer to detect that the global state has been reset. + */ + this.resetId = 0; + /** + * Spy callbacks + */ + this.spyListeners = []; + /** + * Globally attached error handlers that react specifically to errors in reactions + */ + this.globalReactionErrorHandlers = []; + } + return MobXGlobals; +}()); +var globalState = new MobXGlobals(); +var shareGlobalStateCalled = false; +var runInIsolationCalled = false; +var warnedAboutMultipleInstances = false; +{ + var global_1 = getGlobal(); + if (!global_1.__mobxInstanceCount) { + global_1.__mobxInstanceCount = 1; + } + else { + global_1.__mobxInstanceCount++; + setTimeout(function () { + if (!shareGlobalStateCalled && !runInIsolationCalled && !warnedAboutMultipleInstances) { + warnedAboutMultipleInstances = true; + console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."); + } + }); + } +} +function isolateGlobalState() { + runInIsolationCalled = true; + getGlobal().__mobxInstanceCount--; +} +function shareGlobalState() { + // TODO: remove in 4.0; just use peer dependencies instead. + deprecated("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."); + shareGlobalStateCalled = true; + var global = getGlobal(); + var ownState = globalState; + /** + * Backward compatibility check + */ + if (global.__mobservableTrackingStack || global.__mobservableViewStack) + throw new Error("[mobx] An incompatible version of mobservable is already loaded."); + if (global.__mobxGlobal && global.__mobxGlobal.version !== ownState.version) + throw new Error("[mobx] An incompatible version of mobx is already loaded."); + if (global.__mobxGlobal) + globalState = global.__mobxGlobal; + else + global.__mobxGlobal = ownState; +} +function getGlobalState() { + return globalState; +} + +/** + * For testing purposes only; this will break the internal state of existing observables, + * but can be used to get back at a stable state after throwing errors + */ +function resetGlobalState() { + globalState.resetId++; + var defaultGlobals = new MobXGlobals(); + for (var key in defaultGlobals) + if (persistentKeys.indexOf(key) === -1) + globalState[key] = defaultGlobals[key]; + globalState.allowStateChanges = !globalState.strictMode; +} + +function getAtom(thing, property) { + if (typeof thing === "object" && thing !== null) { + if (isObservableArray(thing)) { + invariant(property === undefined, getMessage("m036")); + return thing.$mobx.atom; + } + if (isObservableMap(thing)) { + var anyThing = thing; + if (property === undefined) + return getAtom(anyThing._keys); + var observable = anyThing._data[property] || anyThing._hasMap[property]; + invariant(!!observable, "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'"); + return observable; + } + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (property && !thing.$mobx) + thing[property]; // See #1072 // TODO: remove in 4.0 + if (isObservableObject(thing)) { + if (!property) + return fail("please specify a property"); + var observable = thing.$mobx.values[property]; + invariant(!!observable, "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'"); + return observable; + } + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { + return thing; + } + } + else if (typeof thing === "function") { + if (isReaction(thing.$mobx)) { + // disposer function + return thing.$mobx; + } + } + return fail("Cannot obtain atom from " + thing); +} +function getAdministration(thing, property) { + invariant(thing, "Expecting some object"); + if (property !== undefined) + return getAdministration(getAtom(thing, property)); + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) + return thing; + if (isObservableMap(thing)) + return thing; + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (thing.$mobx) + return thing.$mobx; + invariant(false, "Cannot obtain administration from " + thing); +} +function getDebugName(thing, property) { + var named; + if (property !== undefined) + named = getAtom(thing, property); + else if (isObservableObject(thing) || isObservableMap(thing)) + named = getAdministration(thing); + else + named = getAtom(thing); // valid for arrays as well + return named.name; +} + +function getDependencyTree(thing, property) { + return nodeToDependencyTree(getAtom(thing, property)); +} +function nodeToDependencyTree(node) { + var result = { + name: node.name + }; + if (node.observing && node.observing.length > 0) + result.dependencies = unique(node.observing).map(nodeToDependencyTree); + return result; +} +function getObserverTree(thing, property) { + return nodeToObserverTree(getAtom(thing, property)); +} +function nodeToObserverTree(node) { + var result = { + name: node.name + }; + if (hasObservers(node)) + result.observers = getObservers(node).map(nodeToObserverTree); + return result; +} + +function hasObservers(observable) { + return observable.observers && observable.observers.length > 0; +} +function getObservers(observable) { + return observable.observers; +} +function addObserver(observable, node) { + // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1"); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node"); + // invariantObservers(observable); + var l = observable.observers.length; + if (l) { + // because object assignment is relatively expensive, let's not store data about index 0. + observable.observersIndexes[node.__mapid] = l; + } + observable.observers[l] = node; + if (observable.lowestObserverState > node.dependenciesState) + observable.lowestObserverState = node.dependenciesState; + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node"); +} +function removeObserver(observable, node) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node"); + // invariantObservers(observable); + if (observable.observers.length === 1) { + // deleting last observer + observable.observers.length = 0; + queueForUnobservation(observable); + } + else { + // deleting from _observersIndexes is straight forward, to delete from _observers, let's swap `node` with last element + var list = observable.observers; + var map = observable.observersIndexes; + var filler = list.pop(); // get last element, which should fill the place of `node`, so the array doesn't have holes + if (filler !== node) { + // otherwise node was the last element, which already got removed from array + var index = map[node.__mapid] || 0; // getting index of `node`. this is the only place we actually use map. + if (index) { + // map store all indexes but 0, see comment in `addObserver` + map[filler.__mapid] = index; + } + else { + delete map[filler.__mapid]; + } + list[index] = filler; + } + delete map[node.__mapid]; + } + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2"); +} +function queueForUnobservation(observable) { + if (!observable.isPendingUnobservation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables"); + observable.isPendingUnobservation = true; + globalState.pendingUnobservations.push(observable); + } +} +/** + * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. + * During a batch `onBecomeUnobserved` will be called at most once per observable. + * Avoids unnecessary recalculations. + */ +function startBatch() { + globalState.inBatch++; +} +function endBatch() { + if (--globalState.inBatch === 0) { + runReactions(); + // the batch is actually about to finish, all unobserving should happen here. + var list = globalState.pendingUnobservations; + for (var i = 0; i < list.length; i++) { + var observable = list[i]; + observable.isPendingUnobservation = false; + if (observable.observers.length === 0) { + observable.onBecomeUnobserved(); + // NOTE: onBecomeUnobserved might push to `pendingUnobservations` + } + } + globalState.pendingUnobservations = []; + } +} +function reportObserved(observable) { + var derivation = globalState.trackingDerivation; + if (derivation !== null) { + /** + * Simple optimization, give each derivation run an unique id (runId) + * Check if last time this observable was accessed the same runId is used + * if this is the case, the relation is already known + */ + if (derivation.runId !== observable.lastAccessedBy) { + observable.lastAccessedBy = derivation.runId; + derivation.newObserving[derivation.unboundDepsCount++] = observable; + } + } + else if (observable.observers.length === 0) { + queueForUnobservation(observable); + } +} +/** + * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly + * It will propagate changes to observers from previous run + * It's hard or maybe impossible (with reasonable perf) to get it right with current approach + * Hopefully self reruning autoruns aren't a feature people should depend on + * Also most basic use cases should be ok + */ +// Called by Atom when its value changes +function propagateChanged(observable) { + // invariantLOS(observable, "changed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + d.dependenciesState = IDerivationState.STALE; + } + // invariantLOS(observable, "changed end"); +} +// Called by ComputedValue when it recalculate and its value changed +function propagateChangeConfirmed(observable) { + // invariantLOS(observable, "confirmed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) + d.dependenciesState = IDerivationState.STALE; + else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date. + ) + observable.lowestObserverState = IDerivationState.UP_TO_DATE; + } + // invariantLOS(observable, "confirmed end"); +} +// Used by computed when its dependency changed, but we don't wan't to immediately recompute. +function propagateMaybeChanged(observable) { + // invariantLOS(observable, "maybe start"); + if (observable.lowestObserverState !== IDerivationState.UP_TO_DATE) + return; + observable.lowestObserverState = IDerivationState.POSSIBLY_STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + d.dependenciesState = IDerivationState.POSSIBLY_STALE; + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + } + // invariantLOS(observable, "maybe end"); +} +function logTraceInfo(derivation, observable) { + console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'"); + if (derivation.isTracing === TraceMode.BREAK) { + var lines = []; + printDepTree(getDependencyTree(derivation), lines, 1); + // prettier-ignore + new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString() : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")(); + } +} +function printDepTree(tree, lines, depth) { + if (lines.length >= 1000) { + lines.push("(and many more)"); + return; + } + lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :) + if (tree.dependencies) + tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); }); +} + +var IDerivationState; +(function (IDerivationState) { + // before being run or (outside batch and not being observed) + // at this point derivation is not holding any data about dependency tree + IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; + // no shallow dependency changed since last computation + // won't recalculate derivation + // this is what makes mobx fast + IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; + // some deep dependency changed, but don't know if shallow dependency changed + // will require to check first if UP_TO_DATE or POSSIBLY_STALE + // currently only ComputedValue will propagate POSSIBLY_STALE + // + // having this state is second big optimization: + // don't have to recompute on every dependency change, but only when it's needed + IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; + // A shallow dependency has changed since last computation and the derivation + // will need to recompute when it's needed next. + IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; +})(IDerivationState || (IDerivationState = {})); +var TraceMode; +(function (TraceMode) { + TraceMode[TraceMode["NONE"] = 0] = "NONE"; + TraceMode[TraceMode["LOG"] = 1] = "LOG"; + TraceMode[TraceMode["BREAK"] = 2] = "BREAK"; +})(TraceMode || (TraceMode = {})); +var CaughtException = (function () { + function CaughtException(cause) { + this.cause = cause; + // Empty + } + return CaughtException; +}()); +function isCaughtException(e) { + return e instanceof CaughtException; +} +/** + * Finds out whether any dependency of the derivation has actually changed. + * If dependenciesState is 1 then it will recalculate dependencies, + * if any dependency changed it will propagate it by changing dependenciesState to 2. + * + * By iterating over the dependencies in the same order that they were reported and + * stopping on the first change, all the recalculations are only called for ComputedValues + * that will be tracked by derivation. That is because we assume that if the first x + * dependencies of the derivation doesn't change then the derivation should run the same way + * up until accessing x-th dependency. + */ +function shouldCompute(derivation) { + switch (derivation.dependenciesState) { + case IDerivationState.UP_TO_DATE: + return false; + case IDerivationState.NOT_TRACKING: + case IDerivationState.STALE: + return true; + case IDerivationState.POSSIBLY_STALE: { + var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction. + var obs = derivation.observing, l = obs.length; + for (var i = 0; i < l; i++) { + var obj = obs[i]; + if (isComputedValue(obj)) { + try { + obj.get(); + } + catch (e) { + // we are not interested in the value *or* exception at this moment, but if there is one, notify all + untrackedEnd(prevUntracked); + return true; + } + // if ComputedValue `obj` actually changed it will be computed and propagated to its observers. + // and `derivation` is an observer of `obj` + if (derivation.dependenciesState === IDerivationState.STALE) { + untrackedEnd(prevUntracked); + return true; + } + } + } + changeDependenciesStateTo0(derivation); + untrackedEnd(prevUntracked); + return false; + } + } +} +function isComputingDerivation() { + return globalState.trackingDerivation !== null; // filter out actions inside computations +} +function checkIfStateModificationsAreAllowed(atom) { + var hasObservers$$1 = atom.observers.length > 0; + // Should never be possible to change an observed observable from inside computed, see #798 + if (globalState.computationDepth > 0 && hasObservers$$1) + fail(getMessage("m031") + atom.name); + // Should not be possible to change observed state outside strict mode, except during initialization, see #563 + if (!globalState.allowStateChanges && hasObservers$$1) + fail(getMessage(globalState.strictMode ? "m030a" : "m030b") + atom.name); +} +/** + * Executes the provided function `f` and tracks which observables are being accessed. + * The tracking information is stored on the `derivation` object and the derivation is registered + * as observer of any of the accessed observables. + */ +function trackDerivedFunction(derivation, f, context) { + // pre allocate array allocation + room for variation in deps + // array will be trimmed by bindDependencies + changeDependenciesStateTo0(derivation); + derivation.newObserving = new Array(derivation.observing.length + 100); + derivation.unboundDepsCount = 0; + derivation.runId = ++globalState.runId; + var prevTracking = globalState.trackingDerivation; + globalState.trackingDerivation = derivation; + var result; + try { + result = f.call(context); + } + catch (e) { + result = new CaughtException(e); + } + globalState.trackingDerivation = prevTracking; + bindDependencies(derivation); + return result; +} +/** + * diffs newObserving with observing. + * update observing to be newObserving with unique observables + * notify observers that become observed/unobserved + */ +function bindDependencies(derivation) { + // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1"); + var prevObserving = derivation.observing; + var observing = (derivation.observing = derivation.newObserving); + var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE; + // Go through all new observables and check diffValue: (this list can contain duplicates): + // 0: first occurrence, change to 1 and keep it + // 1: extra occurrence, drop it + var i0 = 0, l = derivation.unboundDepsCount; + for (var i = 0; i < l; i++) { + var dep = observing[i]; + if (dep.diffValue === 0) { + dep.diffValue = 1; + if (i0 !== i) + observing[i0] = dep; + i0++; + } + // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined, + // not hitting the condition + if (dep.dependenciesState > lowestNewObservingDerivationState) { + lowestNewObservingDerivationState = dep.dependenciesState; + } + } + observing.length = i0; + derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614) + // Go through all old observables and check diffValue: (it is unique after last bindDependencies) + // 0: it's not in new observables, unobserve it + // 1: it keeps being observed, don't want to notify it. change to 0 + l = prevObserving.length; + while (l--) { + var dep = prevObserving[l]; + if (dep.diffValue === 0) { + removeObserver(dep, derivation); + } + dep.diffValue = 0; + } + // Go through all new observables and check diffValue: (now it should be unique) + // 0: it was set to 0 in last loop. don't need to do anything. + // 1: it wasn't observed, let's observe it. set back to 0 + while (i0--) { + var dep = observing[i0]; + if (dep.diffValue === 1) { + dep.diffValue = 0; + addObserver(dep, derivation); + } + } + // Some new observed derivations may become stale during this derivation computation + // so they have had no chance to propagate staleness (#916) + if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) { + derivation.dependenciesState = lowestNewObservingDerivationState; + derivation.onBecomeStale(); + } +} +function clearObserving(derivation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch"); + var obs = derivation.observing; + derivation.observing = []; + var i = obs.length; + while (i--) + removeObserver(obs[i], derivation); + derivation.dependenciesState = IDerivationState.NOT_TRACKING; +} +function untracked(action) { + var prev = untrackedStart(); + var res = action(); + untrackedEnd(prev); + return res; +} +function untrackedStart() { + var prev = globalState.trackingDerivation; + globalState.trackingDerivation = null; + return prev; +} +function untrackedEnd(prev) { + globalState.trackingDerivation = prev; +} +/** + * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 + * + */ +function changeDependenciesStateTo0(derivation) { + if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) + return; + derivation.dependenciesState = IDerivationState.UP_TO_DATE; + var obs = derivation.observing; + var i = obs.length; + while (i--) + obs[i].lowestObserverState = IDerivationState.UP_TO_DATE; +} + +function log(msg) { + console.log(msg); + return msg; +} +function whyRun(thing, prop) { + deprecated("`whyRun` is deprecated in favor of `trace`"); + thing = getAtomFromArgs(arguments); + if (!thing) + return log(getMessage("m024")); + if (isComputedValue(thing) || isReaction(thing)) + return log(thing.whyRun()); + return fail(getMessage("m025")); +} +function trace() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var enterBreakPoint = false; + if (typeof args[args.length - 1] === "boolean") + enterBreakPoint = args.pop(); + var derivation = getAtomFromArgs(args); + if (!derivation) { + return fail("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly"); + } + if (derivation.isTracing === TraceMode.NONE) { + console.log("[mobx.trace] '" + derivation.name + "' tracing enabled"); + } + derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG; +} +function getAtomFromArgs(args) { + switch (args.length) { + case 0: + return globalState.trackingDerivation; + case 1: + return getAtom(args[0]); + case 2: + return getAtom(args[0], args[1]); + } +} + +var Reaction = (function () { + function Reaction(name, onInvalidate) { + if (name === void 0) { name = "Reaction@" + getNextId(); } + this.name = name; + this.onInvalidate = onInvalidate; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = []; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.diffValue = 0; + this.runId = 0; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.isDisposed = false; + this._isScheduled = false; + this._isTrackPending = false; + this._isRunning = false; + this.isTracing = TraceMode.NONE; + } + Reaction.prototype.onBecomeStale = function () { + this.schedule(); + }; + Reaction.prototype.schedule = function () { + if (!this._isScheduled) { + this._isScheduled = true; + globalState.pendingReactions.push(this); + runReactions(); + } + }; + Reaction.prototype.isScheduled = function () { + return this._isScheduled; + }; + /** + * internal, use schedule() if you intend to kick off a reaction + */ + Reaction.prototype.runReaction = function () { + if (!this.isDisposed) { + startBatch(); + this._isScheduled = false; + if (shouldCompute(this)) { + this._isTrackPending = true; + this.onInvalidate(); + if (this._isTrackPending && isSpyEnabled()) { + // onInvalidate didn't trigger track right away.. + spyReport({ + object: this, + type: "scheduled-reaction" + }); + } + } + endBatch(); + } + }; + Reaction.prototype.track = function (fn) { + startBatch(); + var notify = isSpyEnabled(); + var startTime; + if (notify) { + startTime = Date.now(); + spyReportStart({ + object: this, + type: "reaction", + fn: fn + }); + } + this._isRunning = true; + var result = trackDerivedFunction(this, fn, undefined); + this._isRunning = false; + this._isTrackPending = false; + if (this.isDisposed) { + // disposed during last run. Clean up everything that was bound after the dispose call. + clearObserving(this); + } + if (isCaughtException(result)) + this.reportExceptionInDerivation(result.cause); + if (notify) { + spyReportEnd({ + time: Date.now() - startTime + }); + } + endBatch(); + }; + Reaction.prototype.reportExceptionInDerivation = function (error) { + var _this = this; + if (this.errorHandler) { + this.errorHandler(error, this); + return; + } + var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this; + var messageToUser = getMessage("m037"); + console.error(message || messageToUser /* latter will not be true, make sure uglify doesn't remove */, error); + /** If debugging brought you here, please, read the above message :-). Tnx! */ + if (isSpyEnabled()) { + spyReport({ + type: "error", + message: message, + error: error, + object: this + }); + } + globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); }); + }; + Reaction.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + if (!this._isRunning) { + // if disposed while running, clean up later. Maybe not optimal, but rare case + startBatch(); + clearObserving(this); + endBatch(); + } + } + }; + Reaction.prototype.getDisposer = function () { + var r = this.dispose.bind(this); + r.$mobx = this; + r.onError = registerErrorHandler; + return r; + }; + Reaction.prototype.toString = function () { + return "Reaction[" + this.name + "]"; + }; + Reaction.prototype.whyRun = function () { + var observing = unique(this._isRunning ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + return "\nWhyRun? reaction '" + this.name + "':\n * Status: [" + (this.isDisposed + ? "stopped" + : this._isRunning ? "running" : this.isScheduled() ? "scheduled" : "idle") + "]\n * This reaction will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this._isRunning + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n\t" + getMessage("m038") + "\n"; + }; + Reaction.prototype.trace = function (enterBreakPoint) { + if (enterBreakPoint === void 0) { enterBreakPoint = false; } + trace(this, enterBreakPoint); + }; + return Reaction; +}()); +function registerErrorHandler(handler) { + invariant(this && this.$mobx && isReaction(this.$mobx), "Invalid `this`"); + invariant(!this.$mobx.errorHandler, "Only one onErrorHandler can be registered"); + this.$mobx.errorHandler = handler; +} +function onReactionError(handler) { + globalState.globalReactionErrorHandlers.push(handler); + return function () { + var idx = globalState.globalReactionErrorHandlers.indexOf(handler); + if (idx >= 0) + globalState.globalReactionErrorHandlers.splice(idx, 1); + }; +} +/** + * Magic number alert! + * Defines within how many times a reaction is allowed to re-trigger itself + * until it is assumed that this is gonna be a never ending loop... + */ +var MAX_REACTION_ITERATIONS = 100; +var reactionScheduler = function (f) { return f(); }; +function runReactions() { + // Trampolining, if runReactions are already running, new reactions will be picked up + if (globalState.inBatch > 0 || globalState.isRunningReactions) + return; + reactionScheduler(runReactionsHelper); +} +function runReactionsHelper() { + globalState.isRunningReactions = true; + var allReactions = globalState.pendingReactions; + var iterations = 0; + // While running reactions, new reactions might be triggered. + // Hence we work with two variables and check whether + // we converge to no remaining reactions after a while. + while (allReactions.length > 0) { + if (++iterations === MAX_REACTION_ITERATIONS) { + console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + + (" Probably there is a cycle in the reactive function: " + allReactions[0])); + allReactions.splice(0); // clear reactions + } + var remainingReactions = allReactions.splice(0); + for (var i = 0, l = remainingReactions.length; i < l; i++) + remainingReactions[i].runReaction(); + } + globalState.isRunningReactions = false; +} +var isReaction = createInstanceofPredicate("Reaction", Reaction); +function setReactionScheduler(fn) { + var baseScheduler = reactionScheduler; + reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); }; +} + +function asReference(value) { + deprecated("asReference is deprecated, use observable.ref instead"); + return observable.ref(value); +} +function asStructure(value) { + deprecated("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."); + return observable.struct(value); +} +function asFlat(value) { + deprecated("asFlat is deprecated, use observable.shallow instead"); + return observable.shallow(value); +} +function asMap(data) { + deprecated("asMap is deprecated, use observable.map or observable.shallowMap instead"); + return observable.map(data || {}); +} + +function createComputedDecorator(equals) { + return createClassPropertyDecorator(function (target, name, _, __, originalDescriptor) { + invariant(typeof originalDescriptor !== "undefined", getMessage("m009")); + invariant(typeof originalDescriptor.get === "function", getMessage("m010")); + var adm = asObservableObject(target, ""); + defineComputedProperty(adm, name, originalDescriptor.get, originalDescriptor.set, equals, false); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + this.$mobx.values[name].set(value); + }, false, false); +} +var computedDecorator = createComputedDecorator(comparer.default); +var computedStructDecorator = createComputedDecorator(comparer.structural); +/** + * Decorator for class properties: @computed get value() { return expr; }. + * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; + */ +var computed = function computed(arg1, arg2, arg3) { + if (typeof arg2 === "string") { + return computedDecorator.apply(null, arguments); + } + invariant(typeof arg1 === "function", getMessage("m011")); + invariant(arguments.length < 3, getMessage("m012")); + var opts = typeof arg2 === "object" ? arg2 : {}; + opts.setter = typeof arg2 === "function" ? arg2 : opts.setter; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + return new ComputedValue(arg1, opts.context, equals, opts.name || arg1.name || "", opts.setter); +}; +computed.struct = computedStructDecorator; +computed.equals = createComputedDecorator; + +function isComputed(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableObject(value) === false) + return false; + if (!value.$mobx.values[property]) + return false; + var atom = getAtom(value, property); + return isComputedValue(atom); + } + return isComputedValue(value); +} + +function observe(thing, propOrCb, cbOrFire, fireImmediately) { + if (typeof cbOrFire === "function") + return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately); + else + return observeObservable(thing, propOrCb, cbOrFire); +} +function observeObservable(thing, listener, fireImmediately) { + return getAdministration(thing).observe(listener, fireImmediately); +} +function observeObservableProperty(thing, property, listener, fireImmediately) { + return getAdministration(thing, property).observe(listener, fireImmediately); +} + +function intercept(thing, propOrHandler, handler) { + if (typeof handler === "function") + return interceptProperty(thing, propOrHandler, handler); + else + return interceptInterceptable(thing, propOrHandler); +} +function interceptInterceptable(thing, handler) { + return getAdministration(thing).intercept(handler); +} +function interceptProperty(thing, property, handler) { + return getAdministration(thing, property).intercept(handler); +} + +/** + * expr can be used to create temporarily views inside views. + * This can be improved to improve performance if a value changes often, but usually doesn't affect the outcome of an expression. + * + * In the following example the expression prevents that a component is rerender _each time_ the selection changes; + * instead it will only rerenders when the current todo is (de)selected. + * + * reactiveComponent((props) => { + * const todo = props.todo; + * const isSelected = mobx.expr(() => props.viewState.selection === todo); + * return
{todo.title}
+ * }); + * + */ +function expr(expr, scope) { + if (!isComputingDerivation()) + console.warn(getMessage("m013")); + // optimization: would be more efficient if the expr itself wouldn't be evaluated first on the next change, but just a 'changed' signal would be fired + return computed(expr, { context: scope }).get(); +} + +function toJS(source, detectCycles, __alreadySeen) { + if (detectCycles === void 0) { detectCycles = true; } + if (__alreadySeen === void 0) { __alreadySeen = []; } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) + __alreadySeen.push([source, value]); + return value; + } + if (isObservable(source)) { + if (detectCycles && __alreadySeen === null) + __alreadySeen = []; + if (detectCycles && source !== null && typeof source === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) + if (__alreadySeen[i][0] === source) + return __alreadySeen[i][1]; + } + if (isObservableArray(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { return toJS(value, detectCycles, __alreadySeen); }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) + res[i] = toAdd[i]; + return res; + } + if (isObservableObject(source)) { + var res = cache({}); + for (var key in source) + res[key] = toJS(source[key], detectCycles, __alreadySeen); + return res; + } + if (isObservableMap(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { return (res_1[key] = toJS(value, detectCycles, __alreadySeen)); }); + return res_1; + } + if (isObservableValue(source)) + return toJS(source.get(), detectCycles, __alreadySeen); + } + return source; +} + +function createTransformer(transformer, onCleanup) { + invariant(typeof transformer === "function" && transformer.length < 2, "createTransformer expects a function that accepts one argument"); + // Memoizes: object id -> reactive view that applies transformer to the object + var objectCache = {}; + // If the resetId changes, we will clear the object cache, see #163 + // This construction is used to avoid leaking refs to the objectCache directly + var resetId = globalState.resetId; + // Local transformer class specifically for this transformer + var Transformer = (function (_super) { + __extends(Transformer, _super); + function Transformer(sourceIdentifier, sourceObject) { + var _this = _super.call(this, function () { return transformer(sourceObject); }, undefined, comparer.default, "Transformer-" + transformer.name + "-" + sourceIdentifier, undefined) || this; + _this.sourceIdentifier = sourceIdentifier; + _this.sourceObject = sourceObject; + return _this; + } + Transformer.prototype.onBecomeUnobserved = function () { + var lastValue = this.value; + _super.prototype.onBecomeUnobserved.call(this); + delete objectCache[this.sourceIdentifier]; + if (onCleanup) + onCleanup(lastValue, this.sourceObject); + }; + return Transformer; + }(ComputedValue)); + return function (object) { + if (resetId !== globalState.resetId) { + objectCache = {}; + resetId = globalState.resetId; + } + var identifier = getMemoizationId(object); + var reactiveTransformer = objectCache[identifier]; + if (reactiveTransformer) + return reactiveTransformer.get(); + // Not in cache; create a reactive view + reactiveTransformer = objectCache[identifier] = new Transformer(identifier, object); + return reactiveTransformer.get(); + }; +} +function getMemoizationId(object) { + if (typeof object === "string" || typeof object === "number") + return object; + if (object === null || typeof object !== "object") + throw new Error("[mobx] transform expected some kind of object or primitive value, got: " + object); + var tid = object.$transformId; + if (tid === undefined) { + tid = getNextId(); + addHiddenProp(object, "$transformId", tid); + } + return tid; +} + +function interceptReads(thing, propOrHandler, handler) { + var target; + if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { + target = getAdministration(thing); + } + else if (isObservableObject(thing)) { + if (typeof propOrHandler !== "string") + return fail("InterceptReads can only be used with a specific property, not with an object in general"); + target = getAdministration(thing, propOrHandler); + } + else { + return fail("Expected observable map, object or array as first array"); + } + if (target.dehancer !== undefined) + return fail("An intercept reader was already established"); + target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler; + return function () { + target.dehancer = undefined; + }; +} + +/** + * (c) Michel Weststrate 2015 - 2016 + * MIT Licensed + * + * Welcome to the mobx sources! To get an global overview of how MobX internally works, + * this is a good place to start: + * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 + * + * Source folders: + * =============== + * + * - api/ Most of the public static methods exposed by the module can be found here. + * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. + * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. + * - utils/ Utility stuff. + * + */ +var extras = { + allowStateChanges: allowStateChanges, + deepEqual: deepEqual, + getAtom: getAtom, + getDebugName: getDebugName, + getDependencyTree: getDependencyTree, + getAdministration: getAdministration, + getGlobalState: getGlobalState, + getObserverTree: getObserverTree, + interceptReads: interceptReads, + isComputingDerivation: isComputingDerivation, + isSpyEnabled: isSpyEnabled, + onReactionError: onReactionError, + reserveArrayBuffer: reserveArrayBuffer, + resetGlobalState: resetGlobalState, + isolateGlobalState: isolateGlobalState, + shareGlobalState: shareGlobalState, + spyReport: spyReport, + spyReportEnd: spyReportEnd, + spyReportStart: spyReportStart, + setReactionScheduler: setReactionScheduler +}; +var everything = { + Reaction: Reaction, + untracked: untracked, + Atom: Atom, + BaseAtom: BaseAtom, + useStrict: useStrict, + isStrictModeEnabled: isStrictModeEnabled, + spy: spy, + comparer: comparer, + asReference: asReference, + asFlat: asFlat, + asStructure: asStructure, + asMap: asMap, + isModifierDescriptor: isModifierDescriptor, + isObservableObject: isObservableObject, + isBoxedObservable: isObservableValue, + isObservableArray: isObservableArray, + ObservableMap: ObservableMap, + isObservableMap: isObservableMap, + map: map, + transaction: transaction, + observable: observable, + computed: computed, + isObservable: isObservable, + isComputed: isComputed, + extendObservable: extendObservable, + extendShallowObservable: extendShallowObservable, + observe: observe, + intercept: intercept, + autorun: autorun, + autorunAsync: autorunAsync, + when: when, + reaction: reaction, + action: action, + isAction: isAction, + runInAction: runInAction, + expr: expr, + toJS: toJS, + createTransformer: createTransformer, + whyRun: whyRun, + isArrayLike: isArrayLike, + extras: extras +}; +var warnedAboutDefaultExport = false; +var _loop_1 = function (p) { + var val = everything[p]; + Object.defineProperty(everything, p, { + get: function () { + if (!warnedAboutDefaultExport) { + warnedAboutDefaultExport = true; + console.warn("Using default export (`import mobx from 'mobx'`) is deprecated " + + "and won’t work in mobx@4.0.0\n" + + "Use `import * as mobx from 'mobx'` instead"); + } + return val; + } + }); +}; +for (var p in everything) { + _loop_1(p); +} +if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") { + __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: spy, extras: extras }); +} + +/* harmony default export */ __webpack_exports__["default"] = (everything); + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ 0: +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__("./node_modules/chameleon-runtime/index.js"); +module.exports = __webpack_require__("./node_modules/chameleon-store/index.js"); + + +/***/ }) + +},[0]); \ No newline at end of file diff --git a/dist/alipay/static/js/components/polyScroller/polyScroller.js b/dist/alipay/static/js/components/polyScroller/polyScroller.js index 4074ea6..4d9abe7 100644 --- a/dist/alipay/static/js/components/polyScroller/polyScroller.js +++ b/dist/alipay/static/js/components/polyScroller/polyScroller.js @@ -1 +1,320 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([3],{64:function(e,n,t){t(65),t(66)},65:function(e,n){},66:function(e,n,t){function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t(3),u=function(e){return e&&e.__esModule?e:{default:e}}(o),f=function e(){a(this,e)};n.default=new f,n.default=u.default.createComponent(n.default).getOptions()}},[64]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([8],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/src/components/polyScroller/polyScroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "PolyScrollerInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "PolyScroller": ["PolyScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var PolyScroller = function PolyScroller() { + _classCallCheck(this, PolyScroller); +}; + +exports.default = __CML__WRAPPER__(new PolyScroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/components/polyScroller/polyScroller.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.alipay.cml"); + + +/***/ }) + +},["./src/components/polyScroller/polyScroller.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/manifest.js b/dist/alipay/static/js/manifest.js index 3844685..7dc86fd 100644 --- a/dist/alipay/static/js/manifest.js +++ b/dist/alipay/static/js/manifest.js @@ -1 +1,103 @@ -var __CML__GLOBAL={};!function(r){function t(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return r[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e=__CML__GLOBAL.webpackJsonp;__CML__GLOBAL.webpackJsonp=function(n,u,p){for(var c,a,f,l=0,_=[];l 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Button = function Button() { + _classCallCheck(this, Button); + + this.props = { + text: { + type: String, + default: "" + }, + size: { + type: String, + default: "stretch" + }, + width: { + type: Number, + default: -1 + }, + type: { + type: String, + default: "blue" + }, + disabled: { + type: Boolean, + default: false + }, + btnStyle: { + type: String, + default: "" + }, + textStyle: { + type: String, + default: "" + }, + textStyleDisabled: { + type: String, + default: "" + }, + disabledStyle: { + type: String, + default: "" + }, + btnHoverStyle: { + type: String, + default: '' + }, + textHoverStyle: { + type: String, + default: '' + }, + openType: { + type: String, + default: "" + }, + lang: { + type: String, + default: "en" + }, + sessionFrom: { + type: String, + default: "" + }, + sendMessageTitle: { + type: String, + default: "当前标题" + }, + sendMessagePath: { + type: String, + default: "当前分享路径" + }, + sendMessageImg: { + type: String, + default: "截图" + }, + showMessageCard: { + type: Boolean, + default: false + }, + appParameter: { + type: String, + default: "" + } + }; + this.data = { + hover: false + }; + this.computed = { + hasWidth: function hasWidth() { + return this.width !== -1; + }, + btnClasses: function btnClasses() { + return (0, _util.transCls)('cml-btn', this); + }, + textClasses: function textClasses() { + return (0, _util.transCls)('btn-text', this); + }, + mrBtnStyle: function mrBtnStyle() { + var disabled = this.disabled, + btnStyle = this.btnStyle, + disabledStyle = this.disabledStyle, + hover = this.hover, + btnHoverStyle = this.btnHoverStyle, + hasWidth = this.hasWidth, + width = this.width; + + var style = disabled ? btnStyle + ";" + disabledStyle : hover ? btnStyle + ";" + btnHoverStyle : btnStyle; + + if (hasWidth) { + style = "width:" + width + "cpx;" + style; + } + + return style; + }, + mrTextStyle: function mrTextStyle() { + var disabled = this.disabled, + textStyle = this.textStyle, + textStyleDisabled = this.textStyleDisabled, + hover = this.hover, + textHoverStyle = this.textHoverStyle; + + return disabled ? textStyle + ";" + textStyleDisabled : hover ? textStyle + ";" + textHoverStyle : textStyle; + } + }; + this.methods = { + onclick: function onclick(e) { + var type = this.type, + disabled = this.disabled; + + if (disabled) return; + this.$cmlEmit('onclick', { + type: type, + disabled: disabled + }); + }, + touchstart: function touchstart(e) { + this.hover = true; + }, + touchend: function touchend(e) { + this.hover = false; + }, + getuserinfo: function getuserinfo(e) { + this.$cmlEmit('getuserinfo', e.detail); + }, + contact: function contact(e) { + this.$cmlEmit('contact'); + }, + getphonenumber: function getphonenumber(e) { + this.$cmlEmit('getphonenumber', { + errMsg: e.detail.errMsg, + encryptedData: e.detail.encryptedData || '', + //包括敏感数据在内的完整用户信息的加密数据 + iv: e.detail.iv || '' //加密算法的初始向量 + + }); + }, + error: function error(e) { + this.$cmlEmit('error', { + errMsg: e.detail.errMsg + }); + }, + opensetting: function opensetting(e) { + this.$cmlEmit('opensetting'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Button()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/button.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.alipay.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transCls = transCls; +function transCls(base, ctx) { + var type = ctx.type, + disabled = ctx.disabled, + size = ctx.size, + hover = ctx.hover, + hasWidth = ctx.hasWidth; + + + var classList = [base]; + + if (hover) { + classList.push(base + '-active'); + } + + if (!!~'red|orange|white|green'.indexOf(type)) { + classList.push(base + '-' + type); + + if (hover) { + classList.push(base + '-' + type + '-active'); + } + + if (disabled) { + classList.push(base + '-' + type + '-disable'); + } + } + + if (!!~'full|big|medium|small|stretch|auto'.indexOf(size) && !hasWidth) { + classList.push(base + '-' + size); + } + + if (disabled) { + classList.push(base + '-disable'); + } + + return classList.join(' '); +} + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/button/button.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..def552b --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,312 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([23],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CCarouselItemInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarouselItem": ["CCarouselItemInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarouselItem = function CCarouselItem() { + _classCallCheck(this, CCarouselItem); +}; + +exports.default = __CML__WRAPPER__(new CCarouselItem()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..766bf8e --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,367 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([22],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel/carousel.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": { + "current": "Number" + } + }, + "interfaces": { + "CCarouselInterface": { + "autoplay": "Boolean", + "interval": "Number", + "circular": "Boolean", + "current": "Number", + "indicatorDots": "Boolean", + "indicatorColor": "String", + "indicatorActiveColor": "String", + "change": { + "input": ["EventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarousel": ["CCarouselInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarousel = function CCarousel() { + _classCallCheck(this, CCarousel); + + this.props = { + autoplay: { + type: Boolean, + default: false + }, + interval: { + type: Number, + default: 5000 + }, + current: { + type: Number, + default: 0 + }, + indicatorDots: { + type: Boolean, + default: false + }, + indicatorColor: { + type: String, + default: '#cccccc' + }, + indicatorActiveColor: { + type: String, + default: '#000000' + }, + circular: { + type: Boolean, + default: false + } + }; +}; + +exports.default = __CML__WRAPPER__(new CCarousel()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel/carousel.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..123281f --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,144 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([2],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Checkbox = function () { + function Checkbox() { + _classCallCheck(this, Checkbox); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + } + }; + this.data = { + checkedImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png"), + uncheckImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png"), + innerChecked: false + }; + this.computed = { + checkStyle: function checkStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + checkImg: function checkImg() { + return this.innerChecked ? this.checkedImg : this.uncheckImg; + }, + checkClass: function checkClass() { + if (this.disabled) { + return 'cml-checkbox-disabled'; + } + return this.innerChecked ? 'cml-checkbox-checked' : 'cml-checkbox-uncheck'; + } + }; + this.watch = { + checked: function checked(newChecked) { + this.innerChecked = newChecked; + } + }; + this.methods = { + changeCheck: function changeCheck() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('changeevent', value); + this.$cmlEmit('change', value); + } + }; + } + + _createClass(Checkbox, [{ + key: 'created', + value: function created() { + var checked = this.checked; + + this.innerChecked = checked; + } + }]); + + return Checkbox; +}(); + +exports.default = new Checkbox(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/selected_520dcc8.png"; + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/unselected_4e38c39.png"; + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/input/input.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..101550a --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,592 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([6],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _utils = __webpack_require__("./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js"); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/input/input.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + }, + "blurEventDetail": {}, + "focusEventDetail": {}, + "confirEventDetail": {} + }, + "interfaces": { + "InputInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "type": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "maxValue": "Number", + "minValue": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Input": ["InputInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Input = function () { + function Input() { + _classCallCheck(this, Input); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + value: { + type: String, + default: '' + }, + //input的类型 + type: { + type: String, + default: 'text' //枚举值 text number password + + }, + //input的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用input输入 + disabled: { + type: Boolean, + default: false + }, + //控制input是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#bebebe' + }, + maxValue: { + //type=number 最大值 + type: Number, + default: Infinity + }, + minValue: { + //type=number 最小值 + type: Number, + default: -Infinity + } + }; + this.data = { + inputValue: "" + }; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor + ";"; + }, + isInputNumber: function isInputNumber() { + return this.type === 'number'; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {}, + value: function value(newVal, oldVal) { + this.inputValue = newVal; + } + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.handleDetail(e); + this.$cmlEmit('input', { + value: this.inputValue + }); + this.$cmlEmit('inputevent', { + value: this.inputValue + }); + }, + blurEvent: function blurEvent(e) { + this.handleDetail(e); + this.$cmlEmit('blurevent', { + value: this.inputValue + }); + this.$cmlEmit('blur', { + value: this.inputValue + }); + }, + focusEvent: function focusEvent(e) { + this.handleDetail(e); + this.$cmlEmit('focusevent', { + value: this.inputValue + }); + this.$cmlEmit('focus', { + value: this.inputValue + }); + }, + confirmEvent: function confirmEvent(e) { + this.handleDetail(e); + this.$cmlEmit('confirmevent', { + value: this.inputValue + }); + this.$cmlEmit('confirm', { + value: this.inputValue + }); + }, + handleDetail: function handleDetail(e) { + if (!e) { + return ''; + } + + var value = e.detail.value; + + if (this.isInputNumber) { + value = (0, _utils.getValBetweenMaxAndMin)(value, this.maxValue, this.minValue); + } + + return this.inputValue = value || ''; + } + }; + } + + _createClass(Input, [{ + key: "mounted", + value: function mounted() { + this.inputValue = this.value; + } + }]); + + return Input; +}(); + +exports.default = __CML__WRAPPER__(new Input()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index2 = _interopRequireDefault(_index); + +exports.str2obj = str2obj; +exports.pxTransform = pxTransform; +exports.cmlStyleTransfer = cmlStyleTransfer; +exports.getValBetweenMaxAndMin = getValBetweenMaxAndMin; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function str2obj(str) { + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + var classValue = String(classObj[1]).replace(/(^\s*)|(\s*)$/g, ""); + obj[className] = classValue; + }); + return obj; +} + +function pxTransform(s) { + if (!s) return ''; + if (!!~s.indexOf('cpx')) { + return s.replace(/(-?\d*\.?\d*)cpx/ig, function (matchs, $1) { + return (0, _index2.default)(Number($1)) + 'px'; + }); + } + return s; +} + +function cmlStyleTransfer(str) { + if (!str) return {}; + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + if (className) { + var classValue = pxTransform(String(classObj[1]).replace(/(^\s*)|(\s*)$/g, "")); + obj[className] = classValue; + } + }); + return obj; +} + +function getValBetweenMaxAndMin(value, maxValue, minValue) { + if (isNaN(Number(value))) { + return ''; + } + if (isNaN(maxValue) || isNaN(minValue)) { + return value; + } + if (maxValue != Infinity && maxValue <= Number(value)) { + value = String(maxValue); + } + if (minValue != -Infinity && minValue >= Number(value)) { + value = String(minValue); + } + return value; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/input/input.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..a0bab69 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([21],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CAside = function CAside() { + _classCallCheck(this, CAside); + + this.props = { + asideStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'width:200cpx;' + }; + this.computed = { + mergeAsideStyle: function mergeAsideStyle() { + return this.defaultStyle + this.asideStyle; + } + }; +}; + +exports.default = new CAside(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..127925d --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,84 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([20],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CCol = function CCol() { + _classCallCheck(this, CCol); + + this.props = { + width: { + type: Number, + default: 0 + }, + height: { + type: Number, + default: 0 + }, + backgroundColor: { + type: String, + default: '' + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + colStyle: function colStyle() { + var style = ''; + if (this.height) { + style = 'height:' + this.height + 'cpx;'; + } + if (this.width) { + style += 'width:' + this.width + 'cpx;'; + } + if (this.backgroundColor) { + style += 'background-color:' + this.backgroundColor + ';'; + } + if (this.margin) { + var mr = this.margin / 2; + style += 'margin-right:' + mr + 'cpx;margin-left:' + mr + 'cpx;'; + } + return style; + } + }; +}; + +exports.default = new CCol(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..e8f7e20 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,70 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([19],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CContainer = function CContainer() { + _classCallCheck(this, CContainer); + + this.props = { + direction: { + type: String, + default: 'row' + } + }; + this.computed = { + isVertical: function isVertical() { + if (this.direction === 'column') { + return true; + } else if (this.direction === 'row') { + return false; + } + }, + containerStyle: function containerStyle() { + var finalStyle = ''; + + if (this.isVertical) { + finalStyle = "flex-direction:column"; + } + return finalStyle; + } + }; +}; + +exports.default = new CContainer(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..d56c6b9 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([18],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CFoot = function CFoot() { + _classCallCheck(this, CFoot); + + this.props = { + footStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeFootStyle: function mergeFootStyle() { + return this.defaultStyle + this.footStyle; + } + }; +}; + +exports.default = new CFoot(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..712cc79 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([17],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CHead = function CHead() { + _classCallCheck(this, CHead); + + this.props = { + headStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeHeadStyle: function mergeHeadStyle() { + return this.defaultStyle + this.headStyle; + } + }; +}; + +exports.default = new CHead(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..061ff5d --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,59 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([16],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CMain = function CMain() { + _classCallCheck(this, CMain); + + this.props = { + mainStyle: { + type: String, + default: '' + } + }; + this.data = {}; + this.computed = { + mergeMainStyle: function mergeMainStyle() { + return this.mainStyle; + } + }; +}; + +exports.default = new CMain(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..b7d1d60 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,89 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([15],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CRow = function CRow() { + _classCallCheck(this, CRow); + + this.props = { + // start/end/center/space-around/space-between + justify: { + type: String, + default: 'center' + }, + // top/middle/bottom + align: { + type: String, + default: 'middle' + }, + height: { + type: Number, + default: 0 + }, + wrap: { + type: Boolean, + default: false + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + rowClass: function rowClass() { + return 'flex-row-' + this.justify + '-' + this.align; + }, + rowStyle: function rowStyle() { + var style = ''; + if (this.height) { + style += 'height:' + this.height + 'cpx;'; + } + if (this.wrap) { + style += 'flex-wrap:wrap;'; + } + if (this.margin) { + style += 'margin:' + this.margin / 2 + 'cpx 0;'; + } + return style; + } + }; +}; + +exports.default = new CRow(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/list/list.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..d628267 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,471 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([14],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/list/list.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollDetail": { + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number", + "deltaX": "Number", + "deltaY": "Number" + }, + "bottomDetail": { + "direction": "String" + } + }, + "interfaces": { + "ListInterface": { + "bottomOffset": "Number", + "toElement": "String", + "bounce": "Boolean", + "height": "Number", + "cstyle": "String", + "onscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["bottomDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "List": ["ListInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var List = function () { + function List() { + _classCallCheck(this, List); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + toElement: { + type: String, + default: '' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + } + }; + this.data = { + cmtstyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "cpx;"; + } + + return this.cmtstyle + this.cstyle; + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index4.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + this.$cmlEmit('scrolltobottom', e.detail); + } + }; + } + + _createClass(List, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + var me = this; + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var query, windowRect; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (_this2.height) { + _context.next = 3; + break; + } + + console.error('list组件必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.height === -1)) { + _context.next = 9; + break; + } + + query = my.createSelectorQuery().select('#c-list').boundingClientRect(); + _context.next = 7; + return (0, _index2.default)(); + + case 7: + windowRect = _context.sent; + + query.exec(function (ret) { + if (ret[0]) { + var height = windowRect.viewportHeight - ret.top; + me.cmtstyle = "height:" + height + "cpx;"; + } + }); + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return List; +}(); + +exports.default = __CML__WRAPPER__(new List()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/list/list.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/page/page.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..a19409e --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,740 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([3],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/page/page.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CPageInterface": { + "title": "String", + "back": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CPage": ["CPageInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CPage = function () { + function CPage() { + _classCallCheck(this, CPage); + + this.props = { + title: { + required: true, + type: String, + default: '' + } + }; + this.watch = { + title: function title(v) { + this.setTitle(v); + } + }; + this.methods = { + setTitle: function setTitle(v) { + (0, _index2.default)(v); + } + }; + } + + _createClass(CPage, [{ + key: "created", + value: function created() { + this.setTitle(this.title); + } + }]); + + return CPage; +}(); + +exports.default = __CML__WRAPPER__(new CPage()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/setTitle/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "setTitleInterface": { + "setTitle": { + "input": ["String"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["setTitleInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "setTitle", + value: function setTitle(title) { + my.setNavigationBar({ + title: title + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = setTitle; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function setTitle() { + var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _index2.default.setTitle(title); +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/page/page.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..faf63e5 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,137 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([13],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Radio = function () { + function Radio() { + _classCallCheck(this, Radio); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + }, + color: { + type: String, + default: '#fc9153' + } + }; + this.data = { + innerChecked: false + }; + this.computed = { + radioStyle: function radioStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + radioInnerStyle: function radioInnerStyle() { + var style = ''; + if (this.innerChecked) { + style += 'border:10cpx solid ' + this.color + ';'; + } else { + style += 'border:1px solid #ccc;'; + } + + return style; + }, + radioClass: function radioClass() { + if (this.disabled) { + return this.innerChecked ? 'cml-radio-selected-disabled' : 'cml-radio-unselect-disabled'; + } + return this.innerChecked ? 'cml-radio-selected' : 'cml-radio-unselect'; + } + }; + this.watch = { + checked: function checked(val) { + this.innerChecked = val; + } + }; + this.methods = { + changeSelect: function changeSelect() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('change', value); + this.$cmlEmit('changeevent', value); + } + }; + } + + _createClass(Radio, [{ + key: 'mounted', + value: function mounted() { + this.innerChecked = this.checked; + } + }]); + + return Radio; +}(); + +exports.default = new Radio(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/radio/radio.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..d7b7d47 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,434 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([4],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _richHandle = __webpack_require__("./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js"); + +var _richHandle2 = _interopRequireDefault(_richHandle); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/richtext/richtext.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "richConfig": { + "color": "String", + "font_size": "Number", + "start": "Number", + "end": "Number" + }, + "richMessageArray": ["richConfig"], + "richData": { + "message": "String", + "rich_message": "richMessageArray" + } + }, + "interfaces": { + "RichtextInterface": { + "richData": "richData" + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Richtext": ["RichtextInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Richtext = function Richtext() { + _classCallCheck(this, Richtext); + + this.props = { + richData: { + type: Object, + default: { + message: '', + rich_message: [{ + color: '', + font_size: 0, + start: 0, + end: 0 + }] + } + } + }; + this.computed = { + richList: function richList() { + var richList = (0, _richHandle2.default)(this.richData); + richList = richList.map(function (item) { + if (item.color && item.font_size) { + item.style = "color:" + item.color + ";font-size:" + item.font_size + "cpx;"; + } else { + item.style = ''; + } + + return item; + }); + return richList; + } + }; +}; + +exports.default = __CML__WRAPPER__(new Richtext()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = richHandle; +function richHandle(richData) { + var richConf = richData.rich_message, + richTexts = richData.message.split(''); + //切割文本 + richTexts = richTexts.map(function (item) { + return { + text: item, + index: -1 + }; + }); + // 过滤错误配置 + richConf = richConf.filter(function (item) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + return !isNaN(start) && !isNaN(end) && start <= end; + }); + // 遍历获取文本对应样式index + richConf.forEach(function (item, index) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + start = start < 0 ? 0 : start; + end = end > richTexts.length - 1 ? richTexts.length - 1 : end; + for (var i = start; i <= end; i++) { + richTexts[i].index = index; + } + }); + var start = 0, + end = richTexts.length; + var richList = []; + while (start < end) { + var i = start; + var rIndex = richTexts[i].index; + var conf = rIndex === -1 ? null : richConf[rIndex]; + var ri = { + font_size: conf && conf.font_size, + color: conf && conf.color, + text: '' + }; + for (; i < end; i++) { + if (richTexts[i].index !== rIndex) { + break; + } + ri.text += richTexts[i].text; + } + richList.push(ri); + start = i; + } + + return richList; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/richtext/richtext.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..8e6ef2c --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,524 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([12],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _index5 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index6 = _interopRequireDefault(_index5); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/scroller/scroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollEventDetail": { + "deltaX": "Number", + "deltaY": "Number", + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number" + }, + "scrolltobottomEventDetail": { + "direction": "String" + } + }, + "interfaces": { + "ScrollerInterface": { + "cstyle": "String", + "bottomOffset": "Number", + "scrollDirection": "String", + "bounce": "Boolean", + "height": "Number", + "width": "Number", + "scrollTop": "Number", + "scrollLeft": "Number", + "onscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["scrolltobottomEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Scroller": ["ScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Scroller = function () { + function Scroller() { + _classCallCheck(this, Scroller); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + scrollDirection: { + // 可选为 horizontal 或者 vertical,默认值为 vertical 。定义滚动的方向。 + type: String, + default: 'vertical' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + }, + width: { + type: Number, + default: 0 + }, + scrollTop: { + type: Number, + default: 0 + }, + scrollLeft: { + type: Number, + default: 0 + } + }; + this.data = { + cmtStyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.scrollDirection === 'vertical') { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "rpx;"; + } + } else { + if (this.width >= 0) { + return this.cstyle + ";width:" + this.width + "rpx;white-space:nowrap;"; + } + } // 没有传递的情况 + + + return this.cmtStyle + this.cstyle; + }, + scrollTopPx: function scrollTopPx() { + // scroll-top仅支持px + return (0, _index6.default)(this.scrollTop); + }, + scrollLeftPx: function scrollLeftPx() { + return (0, _index6.default)(this.scrollLeft); + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index4.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + var detail = { + direction: '' + }; + this.$cmlEmit('scrolltobottom', detail); + } + }; + } + + _createClass(Scroller, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + var me = this; + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var query, windowRect; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(_this2.scrollDirection === 'vertical' && !_this2.height)) { + _context.next = 3; + break; + } + + console.error('纵向滚动必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.scrollDirection !== 'vertical' && !_this2.width)) { + _context.next = 6; + break; + } + + console.error('横向滚动必须传递宽度属性'); + return _context.abrupt("return"); + + case 6: + if (!(_this2.height === -1 || _this2.width === -1)) { + _context.next = 12; + break; + } + + query = my.createSelectorQuery().select('#c-scroller').boundingClientRect(); + _context.next = 10; + return (0, _index2.default)(); + + case 10: + windowRect = _context.sent; + + query.exec(function (ret) { + var rectData = ret[0]; + + if (rectData) { + if (me.scrollDirection === 'vertical') { + var height = windowRect.viewportHeight - rectData.top; + me.cmtStyle = "height:" + height + "cpx;"; + } else { + var width = windowRect.viewportWidth - rectData.left; + me.cmtStyle = "width:" + width + "cpx;white-space:nowrap;"; + } + } + }); + + case 12: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return Scroller; +}(); + +exports.default = __CML__WRAPPER__(new Scroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/scroller/scroller.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..b5cfe71 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,366 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([11],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/switch/switch.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "valueDetail": { + "value": "Boolean" + } + }, + "interfaces": { + "SwitchInterface": { + "checked": "Boolean", + "disabled": "Boolean", + "label": "String", + "opencolor": "String", + "changeevent": { + "input": ["valueDetail"], + "output": "Undefined" + }, + "change": { + "input": ["valueDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Switch": ["SwitchInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Switch = function Switch() { + _classCallCheck(this, Switch); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String, + default: '' + }, + disabled: { + type: Boolean, + default: false + }, + opencolor: { + type: String, + default: '#fc9153' + } + }; + this.methods = { + switchChange: function switchChange(e) { + this.$cmlEmit('change', { + value: e.detail.value + }); + this.$cmlEmit('changeevent', { + value: e.detail.value + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Switch()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/switch/switch.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..e2a2bbd --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,465 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([10],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/textarea/textarea.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + } + }, + "interfaces": { + "TextareaInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "rows": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Textarea": ["TextareaInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; +/* +event: cinput cblur cfocus cconfirm +*/ +var Textarea = function Textarea() { + _classCallCheck(this, Textarea); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + //textarea的内容 + value: { + type: String, + default: '' + }, + //textarea的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用textarea输入 + disabled: { + type: Boolean, + default: false + }, + //控制textarea是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#666' + }, + rows: { + type: Number, + default: 2 + } + }; + this.data = {}; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {} + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.$cmlEmit('input', { + value: e.detail.value || '' + }); + this.$cmlEmit('inputevent', { + value: e.detail.value || '' + }); + }, + blurEvent: function blurEvent(e) { + this.$cmlEmit('blur', { + value: e.detail.value || '' + }); + this.$cmlEmit('blurevent', { + value: e.detail.value || '' + }); + }, + focusEvent: function focusEvent(e) { + this.$cmlEmit('focus', { + value: e.detail.value || '' + }); + this.$cmlEmit('focusevent', { + value: e.detail.value || '' + }); + }, + confirmEvent: function confirmEvent(e) { + this.$cmlEmit('confirm', { + value: e.detail.value || '' + }); + this.$cmlEmit('confirmevent', { + value: e.detail.value || '' + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Textarea()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/textarea/textarea.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/npm/chameleon-ui-builtin/components/video/video.js b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..b0e04b7 --- /dev/null +++ b/dist/alipay/static/js/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,407 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([9],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/video/video.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": {} + }, + "interfaces": { + "VideoInterface": { + "controls": "Boolean", + "autoplay": "Boolean", + "loop": "Boolean", + "src": "String", + "cstyle": "String", + "customstart": { + "input": ["Undefined"], + "output": "Undefined" + }, + "custompause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfinish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfail": { + "input": ["Undefined"], + "output": "Undefined" + }, + "start": { + "input": ["Undefined"], + "output": "Undefined" + }, + "pause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "finish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "fail": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Video": ["VideoInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Video = function Video() { + _classCallCheck(this, Video); + + this.props = { + controls: { + type: Boolean, + default: false + }, + autoplay: { + type: Boolean, + default: false + }, + loop: { + type: Boolean, + default: false + }, + src: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + } + }; + this.computed = { + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cstyle; + } + }; + this.methods = { + onstart: function onstart(e) { + this.$cmlEmit('start'); + this.$cmlEmit('customstart'); + }, + onpause: function onpause(e) { + this.$cmlEmit('pause'); + this.$cmlEmit('custompause'); + }, + onfinish: function onfinish(e) { + this.$cmlEmit('finish'); + this.$cmlEmit('customfinish'); + }, + onfail: function onfail(e) { + this.$cmlEmit('fail'); + this.$cmlEmit('customfail'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Video()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/video/video.alipay.cml"]); \ No newline at end of file diff --git a/dist/alipay/static/js/pages/index/index.js b/dist/alipay/static/js/pages/index/index.js index e7e7739..a9f14e0 100644 --- a/dist/alipay/static/js/pages/index/index.js +++ b/dist/alipay/static/js/pages/index/index.js @@ -1 +1,50 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([2],{61:function(e,t,n){n(62),n(63)},62:function(e,t){},63:function(e,t,n){function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=n(3),f=function(e){return e&&e.__esModule?e:{default:e}}(u),i=function e(){a(this,e),this.data={list:["0","1","2","3","4","5","6","7","8","9"]}};t.default=new i,t.default=f.default.createPage(t.default).getOptions()}},[61]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([7],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Row = function Row() { + _classCallCheck(this, Row); + + this.data = { + list: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + }; +}; + +exports.default = new Row(); + + +exports.default = _chameleonRuntime2.default.createPage(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/alipay/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"alipay\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=alipay&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); + + +/***/ }) + +},["./src/pages/index/index.cml"]); \ No newline at end of file diff --git a/dist/baidu/components/polyScroller/polyScroller.css b/dist/baidu/components/polyScroller/polyScroller.css index 070b194..a0c26fc 100644 --- a/dist/baidu/components/polyScroller/polyScroller.css +++ b/dist/baidu/components/polyScroller/polyScroller.css @@ -1 +1,139 @@ -.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-base,.cml-base:after,.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}.cml-view{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-text,.cml-view{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-text{display:block;word-wrap:break-word;overflow:hidden}.cml-border-1px,.cml-border-bottom-1px,.cml-border-left-1px,.cml-border-right-1px,.cml-border-top-1px{position:relative}.cml-border-1px:after,.cml-border-bottom-1px:after,.cml-border-left-1px:before,.cml-border-right-1px:after,.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-border-none:after,.cml-border-none:before{display:none}.cml-c-button{-webkit-align-self:stretch;align-self:stretch} \ No newline at end of file +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/button/button.css b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.css new file mode 100644 index 0000000..d360dbe --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.css @@ -0,0 +1,284 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-btn { + display: -webkit-box; + display: -webkit-flex; + display: flex; + padding: 0 30rpx; + height: 88rpx; + line-height: 88rpx; + background: #4a4c5b; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + border-radius: 4rpx; + font-size: 32rpx; + color: #fff; +} + +.cml-btn-active { + background: #444654; +} + +.cml-btn:after { + border: none; +} + +.cml-btn-orange { + background: #fc9153; +} + +.cml-btn-orange-active { + background: #e8864c; +} + +.cml-btn-green { + background: #50a050; +} + +.cml-btn-green-active { + background: #57a957; +} + +.cml-btn-red { + background: #db2a36; +} + +.cml-btn-red-active { + background: #ea2e3b; +} + +.cml-btn-disable { + background: #ccc; +} + +.cml-btn-disable:active { + background: #ccc; +} + +.cml-btn-white { + color: #666; + background: #FFFFFF; + border: 1rpx solid #A5A5A5; +} + +.cml-btn-white-active { + background: #e8e8e8; +} + +.cml-btn-white-disable, +.cml-btn-white:disabled { + color: #fff; + background: #ccc; + border: 0; +} + +.cml-btn-white-disable:active, +.cml-btn-white:disabled:active { + background: #ccc; +} + +.cml-btn-full { + width: 702rpx; + height: 88rpx; +} + +.cml-btn-big { + width: 339rpx; + height: 70rpx; +} + +.cml-btn-medium { + width: 218rpx; + height: 60rpx; +} + +.cml-btn-small { + width: 157rpx; + height: 44rpx; +} + +.cml-btn-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-btn-auto { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.btn-text { + text-align: center; + vertical-align: middle; + text-overflow: ellipsis; + white-space: nowrap; + outline: none; + font-size: 36rpx; + color: #ffffff; +} + +.btn-text-white { + color: #666; +} + +.btn-text-white-disable { + color: #fff; +} + +.btn-text-full { + font-size: 36rpx; +} + +.btn-text-big { + font-size: 32rpx; +} + +.btn-text-medium { + font-size: 28rpx; +} + +.btn-text-small { + font-size: 24rpx; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/button/button.js b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.js new file mode 100644 index 0000000..7027445 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/button/button.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/button/button.json b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/button/button.swan b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.swan new file mode 100644 index 0000000..8f13e8f --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/button/button.swan @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..08d4150 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json b/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.swan b/dist/baidu/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.swan new file mode 100644 index 0000000..e69de29 diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.css b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.css new file mode 100644 index 0000000..a0c26fc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.css @@ -0,0 +1,139 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..055aa6a --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.json b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.swan b/dist/baidu/npm/chameleon-ui-builtin/components/carousel/carousel.swan new file mode 100644 index 0000000..e69de29 diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.css b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.css new file mode 100644 index 0000000..b080e66 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.css @@ -0,0 +1,200 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-checkbox { + margin: 10rpx; +} + +.cml-checkbox-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-checkbox-checked { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-checkbox-uncheck { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-checkbox-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} + +.inner-icon { + width: 32rpx; + height: 32rpx; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..51d57e2 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.json b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.swan b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.swan new file mode 100644 index 0000000..d6ad8ad --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/checkbox/checkbox.swan @@ -0,0 +1,10 @@ + + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/input/input.css b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.css new file mode 100644 index 0000000..c417b39 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.css @@ -0,0 +1,152 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.input-wrap { + font-size: 33rpx; + height: 80rpx; + line-height: 80rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + border: 1rpx solid #999; + border-radius: 8rpx; + text-align: left; + background-color: #fff; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/input/input.js b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..999c8fe --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/input/input.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/input/input.json b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/input/input.swan b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.swan new file mode 100644 index 0000000..fe6d606 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/input/input.swan @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.css new file mode 100644 index 0000000..ac5ada5 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.css @@ -0,0 +1,150 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-aside { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #d3dce6; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..2ab3b73 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.swan new file mode 100644 index 0000000..7d76930 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/aside/aside.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.css new file mode 100644 index 0000000..a0c26fc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.css @@ -0,0 +1,139 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..1a8c010 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/col/col.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.swan new file mode 100644 index 0000000..8440e61 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/col/col.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.css new file mode 100644 index 0000000..a49d21d --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.css @@ -0,0 +1,152 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-container { + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..207a677 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/container/container.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.swan new file mode 100644 index 0000000..8743e94 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/container/container.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.css new file mode 100644 index 0000000..141682f --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.css @@ -0,0 +1,150 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-foot { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..6a8a99f --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.swan new file mode 100644 index 0000000..8ddca90 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/foot/foot.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.css new file mode 100644 index 0000000..7b68841 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.css @@ -0,0 +1,150 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-head { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..06983eb --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/head/head.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.swan new file mode 100644 index 0000000..1ac8d7b --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/head/head.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.css new file mode 100644 index 0000000..4b8dcd6 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.css @@ -0,0 +1,150 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-main { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + background-color: #e9eef3; + color: #333; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..1d3339f --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/main/main.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.swan new file mode 100644 index 0000000..8340676 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/main/main.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.css b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.css new file mode 100644 index 0000000..44a81a4 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.css @@ -0,0 +1,376 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.flex-row-start-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-end-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-center-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-space-between-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-space-around-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-start-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-end-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-center-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-space-between-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-space-around-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-start-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-end-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-center-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-space-between-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-space-around-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..25d59d6 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/row/row.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.json b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.swan b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.swan new file mode 100644 index 0000000..d94d47e --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/layout/row/row.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/list/list.css b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.css new file mode 100644 index 0000000..a0c26fc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.css @@ -0,0 +1,139 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/list/list.js b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..8073000 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/list/list.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/list/list.json b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/list/list.swan b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.swan new file mode 100644 index 0000000..487b554 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/list/list.swan @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/page/page.css b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.css new file mode 100644 index 0000000..80a800a --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.css @@ -0,0 +1,149 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.page { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/page/page.js b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..7a60280 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/page/page.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/page/page.json b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/page/page.swan b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.swan new file mode 100644 index 0000000..29276ec --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/page/page.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.css b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.css new file mode 100644 index 0000000..2823cfa --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.css @@ -0,0 +1,198 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-radio { + margin: 10rpx; +} + +.cml-radio-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-radio-selected { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; +} + +.cml-radio-selected-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; + opacity: 0.5; +} + +.cml-radio-unselect { + width: 32rpx; + height: 32rpx; + border: 1px solid #ccc; + border-radius: 20rpx; + box-sizing: border-box; +} + +.cml-radio-unselect-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 20rpx; + background: #ccc; + box-sizing: border-box; +} + +.cml-radio-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..f1d0c62 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/radio/radio.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.json b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.swan b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.swan new file mode 100644 index 0000000..484b0cd --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/radio/radio.swan @@ -0,0 +1,9 @@ + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.css b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.css new file mode 100644 index 0000000..839ad49 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.css @@ -0,0 +1,149 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.rich-text { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..9549bcc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.json b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.swan b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.swan new file mode 100644 index 0000000..251833e --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/richtext/richtext.swan @@ -0,0 +1,3 @@ + + {{item.text}} + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.css b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.css new file mode 100644 index 0000000..a0c26fc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.css @@ -0,0 +1,139 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..422eb40 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.json b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.swan b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.swan new file mode 100644 index 0000000..183452a --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/scroller/scroller.swan @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.css b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.css new file mode 100644 index 0000000..bcc60be --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.css @@ -0,0 +1,149 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-switch-disabled { + opacity: 0.5; +} + +.cml-switch-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..4203283 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/switch/switch.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.json b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.swan b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.swan new file mode 100644 index 0000000..b8b2a76 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/switch/switch.swan @@ -0,0 +1,4 @@ + + + {{label}} + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.css b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.css new file mode 100644 index 0000000..bafa7b6 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.css @@ -0,0 +1,153 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.textarea-wrap { + font-size: 40rpx; + height: 150rpx; + line-height: 50rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + text-align: left; + background-color: #fff; + width: auto; + border: 1rpx solid #999; + border-radius: 8rpx; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..ea53823 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.json b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.swan b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.swan new file mode 100644 index 0000000..659461c --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/textarea/textarea.swan @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/video/video.css b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.css new file mode 100644 index 0000000..a0c26fc --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.css @@ -0,0 +1,139 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/video/video.js b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..499ac17 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/video/video.js') diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/video/video.json b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/baidu/npm/chameleon-ui-builtin/components/video/video.swan b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.swan new file mode 100644 index 0000000..0890237 --- /dev/null +++ b/dist/baidu/npm/chameleon-ui-builtin/components/video/video.swan @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/baidu/pages/index/index.css b/dist/baidu/pages/index/index.css index 0676636..505c878 100644 --- a/dist/baidu/pages/index/index.css +++ b/dist/baidu/pages/index/index.css @@ -1 +1,610 @@ -.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-base,.cml-base:after,.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}.cml-view{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-text,.cml-view{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-text{display:block;word-wrap:break-word;overflow:hidden}.cml-border-1px,.cml-border-bottom-1px,.cml-border-left-1px,.cml-border-right-1px,.cml-border-top-1px{position:relative}.cml-border-1px:after,.cml-border-bottom-1px:after,.cml-border-left-1px:before,.cml-border-right-1px:after,.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-border-none:after,.cml-border-none:before{display:none}.cml-c-button{-webkit-align-self:stretch;align-self:stretch}.flex-page{background-color:#f8f8f8}.flex-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:40rpx;height:200rpx}.flex-header__title{color:#333;font-size:40rpx;font-weight:700;height:60rpx;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;background-color:#faebd7}.flex-panel__title{margin:2rpx;box-shadow:0 3px 5px #888;background-color:#d3d3d3;position:-webkit-sticky;position:sticky;top:0;z-index:999}.flex-panel__content{margin-top:20rpx;overflow:hidden}.flex-panel__content-main{background-color:#789}.weight_700{font-weight:700}.flex-body{background:#fff;box-shadow:0 10rpx 300rpx 0 rgba(0,0,0,.11)}.flex-panel{padding-top:60rpx}.flex-item__title{background-color:#faebd7}.item{margin:8rpx;border:2rpx solid #fff}.item-block{height:60rpx;width:100rpx;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.item-block,.item-wrap{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.item-wrap{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.item-text-inner{color:#fff}.item-text{width:44rpx;height:44rpx;border:2rpx solid #fff;border-radius:22rpx;color:#fff;text-align:center}.border-none{border:0}.row{-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.row,.row-reverse{-webkit-box-orient:horizontal}.row-reverse{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.column-reverse,.row-reverse{-webkit-box-direction:reverse}.column-reverse{-webkit-box-orient:vertical;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.nowrap{-webkit-flex-wrap:nowrap;flex-wrap:nowrap}.wrap{-webkit-flex-wrap:wrap;flex-wrap:wrap}.wrap-reverse{-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse}.justify-flex-start{-webkit-box-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start}.justify-flex-end{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.justify-center{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.justify-space-between{-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.justify-space-around{-webkit-justify-content:space-around;justify-content:space-around}.align-flex-start{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.align-flex-end{-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end}.align-center{-webkit-box-align:center;-webkit-align-items:center;align-items:center}.align-baseline{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.align-stretch{-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch}.align-content-flex-start{-webkit-align-content:flex-start;align-content:flex-start}.align-content-flex-end{-webkit-align-content:flex-end;align-content:flex-end}.align-content-center{-webkit-align-content:center;align-content:center}.align-content-space-between{-webkit-align-content:space-between;align-content:space-between}.align-content-space-around{-webkit-align-content:space-around;align-content:space-around}.align-content-stretch{-webkit-align-content:stretch;align-content:stretch}.order_0{-webkit-box-ordinal-group:1;-webkit-order:0;order:0}.order_1{-webkit-box-ordinal-group:2;-webkit-order:1;order:1}.order_2{-webkit-box-ordinal-group:3;-webkit-order:2;order:2}.order_3{-webkit-box-ordinal-group:4;-webkit-order:3;order:3}.order_4{-webkit-box-ordinal-group:5;-webkit-order:4;order:4}.order_-1{-webkit-box-ordinal-group:0;-webkit-order:-1;order:-1}.flex-grow_0{-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.flex-grow_1{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.flex-grow_2{-webkit-box-flex:2;-webkit-flex-grow:2;flex-grow:2}.flex-shrink_0{-webkit-flex-shrink:0;flex-shrink:0}.flex-shrink_1{-webkit-flex-shrink:1;flex-shrink:1}.flex-shrink_2{-webkit-flex-shrink:2;flex-shrink:2}.flex-basis_auto{-webkit-flex-basis:auto;flex-basis:auto}.flex-basis_25{-webkit-flex-basis:187.5rpx;flex-basis:187.5rpx}.flex-basis_50{-webkit-flex-basis:375rpx;flex-basis:375rpx}.align-self-flex-start{-webkit-align-self:auto;align-self:auto;-webkit-align-self:flex-start;align-self:flex-start}.align-self-flex-end{-webkit-align-self:flex-end;align-self:flex-end}.align-self-center{-webkit-align-self:center;align-self:center}.align-self-baseline{-webkit-align-self:baseline;align-self:baseline}.align-self-stretch{-webkit-align-self:stretch;align-self:stretch}.antiquewhite{background-color:#faebd7}.lightpink{background-color:#ffb6c1}.lightskyblue{background-color:#87cefa}.silver{background-color:silver}.darkseagreen{background-color:#8fbc8f}.lightslategrey{background-color:#789}.cadetblue{background-color:#5f9ea0}.lightgray{background-color:#d3d3d3}.color-white{color:#fff}.color-brown{color:brown}.h_240{height:240rpx}.h_200{height:200rpx}.h_120{height:120rpx}.h_100{height:100rpx}.h_80{height:80rpx}.h_60{height:60rpx}.h_40{height:40rpx}.w_200{width:200rpx}.w_120{width:120rpx}.w_80{width:80rpx}.w_60{width:60rpx}.w_40{width:40rpx} \ No newline at end of file +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +.cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + /*white-space: pre-wrap;*/ /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.flex-page { + background-color: #f8f8f8; +} + +.flex-header { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + padding: 40rpx; + height: 200rpx; +} + +.flex-header__title { + color: #333; + font-size: 40rpx; + font-weight: 700; + height: 60rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + background-color: antiquewhite; +} + +.flex-panel__title { + margin: 2rpx; + box-shadow: 0px 3px 5px #888888; + background-color: lightgray; + /* + * https://stackoverflow.com/questions/47095596/body-overflow-x-hidden-breaks-position-sticky + */ + position: -webkit-sticky; + position: sticky; + top: 0; + z-index: 999; +} + +.flex-panel__content { + margin-top: 20rpx; + overflow: hidden; +} + +.flex-panel__content-main { + background-color: lightslategrey; +} + +.weight_700 { + font-weight: 700; +} + +.flex-body { + background: #fff; + box-shadow: 0 10rpx 300rpx 0 rgba(0, 0, 0, 0.11); +} + +.flex-panel { + padding-top: 60rpx; +} + +.flex-item__title { + background-color: antiquewhite; +} + +.item { + margin: 8rpx; + border: 2rpx solid #fff; +} + +.item-block { + height: 60rpx; + width: 100rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.item-wrap { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.item-text-inner { + color: #fff; +} + +.item-text { + width: 44rpx; + height: 44rpx; + border: 2rpx solid #fff; + border-radius: 22rpx; + color: #fff; + text-align: center; +} + +.border-none { + border: 0; +} + +/** flex-direction **/ + +.row { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} + +.row-reverse { + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + flex-direction: row-reverse; +} + +.column-reverse { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -webkit-flex-direction: column-reverse; + flex-direction: column-reverse; +} + +/** flex-wrap **/ + +.nowrap { + -webkit-flex-wrap: nowrap; + flex-wrap: nowrap; + /* default */ +} + +.wrap { + -webkit-flex-wrap: wrap; + flex-wrap: wrap; +} + +.wrap-reverse { + -webkit-flex-wrap: wrap-reverse; + flex-wrap: wrap-reverse; +} + +/** justify-content **/ + +.justify-flex-start { + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + /* default */ +} + +.justify-flex-end { + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.justify-center { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.justify-space-between { + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; +} + +.justify-space-around { + -webkit-justify-content: space-around; + justify-content: space-around; +} + +/** align-items **/ + +.align-flex-start { + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.align-flex-end { + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.align-center { + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.align-baseline { + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.align-stretch { + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + /* default */ +} + +/** align-content **/ + +.align-content-flex-start { + -webkit-align-content: flex-start; + align-content: flex-start; + /* default */ +} + +.align-content-flex-end { + -webkit-align-content: flex-end; + align-content: flex-end; +} + +.align-content-center { + -webkit-align-content: center; + align-content: center; +} + +.align-content-space-between { + -webkit-align-content: space-between; + align-content: space-between; +} + +.align-content-space-around { + -webkit-align-content: space-around; + align-content: space-around; +} + +.align-content-stretch { + -webkit-align-content: stretch; + align-content: stretch; +} + +/* order */ + +.order_0 { + -webkit-box-ordinal-group: 1; + -webkit-order: 0; + order: 0; + /* default */ +} + +.order_1 { + -webkit-box-ordinal-group: 2; + -webkit-order: 1; + order: 1; +} + +.order_2 { + -webkit-box-ordinal-group: 3; + -webkit-order: 2; + order: 2; +} + +.order_3 { + -webkit-box-ordinal-group: 4; + -webkit-order: 3; + order: 3; +} + +.order_4 { + -webkit-box-ordinal-group: 5; + -webkit-order: 4; + order: 4; +} + +.order_-1 { + -webkit-box-ordinal-group: 0; + -webkit-order: -1; + order: -1; +} + +/* flex-grow */ + +.flex-grow_0 { + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + /* default */ +} + +.flex-grow_1 { + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + flex-grow: 1; +} + +.flex-grow_2 { + -webkit-box-flex: 2; + -webkit-flex-grow: 2; + flex-grow: 2; +} + +/* flex-shrink */ + +.flex-shrink_0 { + -webkit-flex-shrink: 0; + flex-shrink: 0; +} + +.flex-shrink_1 { + -webkit-flex-shrink: 1; + flex-shrink: 1; + /* default */ +} + +.flex-shrink_2 { + -webkit-flex-shrink: 2; + flex-shrink: 2; +} + +/* flex-basis */ + +.flex-basis_auto { + -webkit-flex-basis: auto; + flex-basis: auto; + /* default */ +} + +.flex-basis_25 { + -webkit-flex-basis: 187.5rpx; + flex-basis: 187.5rpx; + /* 750cpx屏幕的25 %*/ +} + +.flex-basis_50 { + -webkit-flex-basis: 375rpx; + flex-basis: 375rpx; + /* 750cpx屏幕的50 %*/ +} + +/** align-self **/ + +.align-self-flex-start { + -webkit-align-self: auto; + align-self: auto; + /* default , inherit parent */ +} + +.align-self-flex-start { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.align-self-flex-end { + -webkit-align-self: flex-end; + align-self: flex-end; +} + +.align-self-center { + -webkit-align-self: center; + align-self: center; +} + +.align-self-baseline { + -webkit-align-self: baseline; + align-self: baseline; +} + +.align-self-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.antiquewhite { + background-color: antiquewhite; +} + +.lightpink { + background-color: lightpink; +} + +.lightskyblue { + background-color: lightskyblue; +} + +.silver { + background-color: silver; +} + +.darkseagreen { + background-color: darkseagreen; +} + +.lightslategrey { + background-color: lightslategrey; +} + +.cadetblue { + background-color: cadetblue; +} + +.lightgray { + background-color: lightgray; +} + +.color-white { + color: white; +} + +.color-brown { + color: brown; +} + +.h_240 { + height: 240rpx; +} + +.h_200 { + height: 200rpx; +} + +.h_120 { + height: 120rpx; +} + +.h_100 { + height: 100rpx; +} + +.h_80 { + height: 80rpx; +} + +.h_60 { + height: 60rpx; +} + +.h_40 { + height: 40rpx; +} + +.w_200 { + width: 200rpx; +} + +.w_120 { + width: 120rpx; +} + +.w_80 { + width: 80rpx; +} + +.w_60 { + width: 60rpx; +} + +.w_40 { + width: 40rpx; +} diff --git a/dist/baidu/static/img/selected_520dcc8.png b/dist/baidu/static/img/selected_520dcc8.png new file mode 100644 index 0000000000000000000000000000000000000000..27456e61caa75a448c2d75ae8ddaaf530b5d1217 GIT binary patch literal 1721 zcmV;q21fabP)fN55 zeQ(ds?yS9+?&+znu5Ws#AJw%Wn)Jh&S8o+-*9H`d2dRk|0>%JEp8(M-5PEg9fXf2K zGJ;qFgfx|nZFQJkEz!XFiwx` za)mlB1P&O5%}rs^k>VJPr_Kd!ClD~s9NezfR^LX%(Vz`CQV#&;WLNhjjD3F9R*y9> zzB}@aQfii9Z?|nMOnHL-mj<{|>g_W&dZmr9n;4o@uKGG^ShksMP)dBmHrX)L)x($= z?^1YmhDP0&Y?QZ3mPYkYC2Svq_{p_eZPo;)5%?}w;8*lWAFZV<()$3H9RYhGp8Ttt z9aUdx?%53i%Y@V+Y%ALw7?@wY#Nw76})-3Rn$s(0CCD0PmV}OK4lB79TUXJ z_G;jqTP9RbMVJqRVdZ%0FikZGN0OIqq1g+=j2fF>&AlB{DxCiaTr+vtv+pZ`&%_mActs`N3#LVwE|+ zvCYG3x@?#|>o=BJdC-da3!~0A3pU3UlYAl&HKb|3$*^?bfibC%KTL}erp<nq=uKnr-1 zUiYfd8aAGMoi_qTrH0Ljv$o4cQ@`GnS!r6*C-3#v$;$HYoCS2$ zusO1{)G-y7oCV@_K(`63kPcjtI)H?>P6ZIQ7uBEzyeT94X8joS(AP!h)=M;nQV>OA z=mMP~J?<9>lm|HPZ0UIxUOfF@rTVQJpi0^YxJc`U9eUwG)C(m7K?=(Bv|mkRuw;Z` z)WAA4h&tMDT;O~KXq*|oSKS0_Peoumd=&{c!;D;%?O}?8;?N+UOk>$1XbroD=g8}D zXJd+k)n+ym>!pEN4aY$RQ&*vufqw5mzhYR#`zlB_z1Yu2y`BGMriU(uefmHvD)NJ) zlW(QfIautNNO=RY*TZZE2YrQYPPDM4Oa;Ik;YK|&7dCWM`snqYEsokN0A|B3g=7Q#Qu+IkNR@Hr2TW`N%_QyfB8x!OUw4K5te;&j2v}8nd`Ps$yRN1 z6+^26!$@+S!uj@X2xx+Jx;po=%~g1_OUr5k?5}eAU>CnC)#ReQr(a{Xacu7IT6Pqy zv}y_K2sadO(VDpGn^8+oSoe7qM}GCA&P4K^dUaX>vr;@cv_~nNB@f(|dK+nmoStWe z9EFLb)uzX~r+B!h3B8{h)Z49Qz|_*oZEG7WVOg(r5BrUw-hRSGaXb`niC=N0Jb5i> z5IsiY%K1tnwaOa;Hp(d&b%(3mDe^S$p;tZB;21J6L;mD51bPDEDca37_6r5rn1H7a z-K{dKqo~v%E$&$HNVy<8y64R1-L%t48Y-~g5S$55-pSo!|}JBSD3e8g$N P00000NkvXXu0mjf(>pa7 literal 0 HcmV?d00001 diff --git a/dist/baidu/static/img/unselected_4e38c39.png b/dist/baidu/static/img/unselected_4e38c39.png new file mode 100644 index 0000000000000000000000000000000000000000..a0a72b3b03cc6769943fa2faf746f5317dbcc20c GIT binary patch literal 1672 zcmV;326y?1P)tt!(Myq3NGcgxqWky_ka-Y?~eeRZ2p8vxqC= zpKFMzhtRaNDLpi?aK+|SP@L(>5Cf)=o4Q+D}Ll*0*{d{L<>=Sp@ zxBh$k?7-~ry*Kk_zMq+SGxO%nMk;p64Gs=IPtr}1NaX0s%1Rx!4*M$C5*#O#E$8!? zdCnhmJdK^kPH`>M+uQq0adz58b~3^7@$r`z78X86^hc!IfPJo%^a1~e`zEnBs;jH7 zwYRtbSxP#E?%5IGk&%&imY0`50q}h?i76w*E@2+v@8TbE{wNlU%|@fq`FK38nytuY zvkC4?iQ*rsr27%0n=>XBkM2mO;*Ap;?f*n zLGW#w<($3l%aCpjfG0?!4d24eRW^YP*Uxu%ci-`qpeJ%kzz8}F*Z^W$ZCY8*FVp-6 zlF8%~Px{+FB(FoHeTKYFlUQ5{a(kZa41e z=;)g~^Ot~bCaq zq-twxds|vs7B#ynw%7RaJG07Wdai z!lD}ms%AZ~GsHa>6jtu8hYpl(0XYeMB{Px}VFMPE*u*GSGx31_hCm5u3mdRwa*PI;g}ZBj<_K(IYr%_Qfu=bh z5|h|0V}4CbU*9N!TLe_G*wq&nV3^K`No?-xr>S89($+7^QX;3dfkemU?8G1zF*r7J z?4azXFD>)L?QR(tRF>89&8O zy=&7~rM3pSNabejwx&w4@cHzPSN|Gd1puo~YYyAYr^a*M$mMV>&C+fe)^))DZ+TEH z+Px9|lvISbsH==;Zw0+}rBPa?8Lj<=_IHS3U6XcTJkJ9hr|{bJb<=%)bKya0$R)y!dGw;{0hE^0d;w;E{dJvs%Q2f|q` z_YiXgZ?+z8w%=0ieN%U!HkW!!gXW`dKK$E{ zEz8K6zwux%F`4+;T-nCYmU`)}rcaH(LflrwY6D4l|EN`{KzPozStf9Q#rqd~P+CjJ S$XEIR0000mNZ2G literal 0 HcmV?d00001 diff --git a/dist/baidu/static/js/app.js b/dist/baidu/static/js/app.js index a716fc2..4fa7b1f 100644 --- a/dist/baidu/static/js/app.js +++ b/dist/baidu/static/js/app.js @@ -1 +1,158 @@ -var __CML__GLOBAL=require("./manifest.js");__CML__GLOBAL.webpackJsonp([1],{52:function(e,t,n){n(53),n(54)},53:function(e,t){},54:function(e,t,n){function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0}function i(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=St();try{var o=e.interceptors;if(o)for(var r=0,i=o.length;r0}function s(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function c(e,t){var n=St(),o=e.changeListeners;if(o){o=o.slice();for(var r=0,i=o.length;r=this.length,value:t0,"actions should have valid names, got: '"+e+"'");var n=function(){return k(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function k(e,t,n,o){var r=j(e,t,n,o);try{return t.apply(n,o)}finally{S(r)}}function j(e,t,n,o){var r=l()&&!!e,i=0;if(r){i=Date.now();var a=o&&o.length||0,u=new Array(a);if(a>0)for(var s=0;s",r="function"==typeof e?e:t,i="function"==typeof e?t:n;return Pe("function"==typeof r,O("m002")),Pe(0===r.length,O("m003")),Pe("string"==typeof o&&o.length>0,"actions should have valid names, got: '"+o+"'"),k(o,r,i,void 0)}function N(e){return"function"==typeof e&&!0===e.isMobxAction}function V(e,t,n){var o=function(){return k(t,n,e,arguments)};o.isMobxAction=!0,De(e,t,o)}function B(e,t){return $(e,t)}function $(e,t,n,o){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&U(e,t,n,o)}function U(e,t,n,o){e=z(e),t=z(t);var r=On.call(e);if(r!==On.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var i="[object Array]"===r;if(!i){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,u=t.constructor;if(a!==u&&!("function"==typeof a&&a instanceof a&&"function"==typeof u&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],o=o||[];for(var s=n.length;s--;)if(n[s]===e)return o[s]===t;if(n.push(e),o.push(t),i){if((s=e.length)!==t.length)return!1;for(;s--;)if(!$(e[s],t[s],n,o))return!1}else{var c,l=Object.keys(e);if(s=l.length,Object.keys(t).length!==s)return!1;for(;s--;)if(c=l[s],!F(t,c)||!$(e[c],t[c],n,o))return!1}return n.pop(),o.pop(),!0}function z(e){return w(e)?e.peek():Vn(e)?e.entries():ze(e)?Ge(e.entries()):e}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e,t){return e===t}function K(e,t){return B(e,t)}function W(e,t){return $e(e,t)||G(e,t)}function q(e,t,n){function o(){i(u)}var r,i,a;"string"==typeof e?(r=e,i=t,a=n):(r=e.name||"Autorun@"+je(),i=e,a=t),Pe("function"==typeof i,O("m004")),Pe(!1===N(i),O("m005")),a&&(i=i.bind(a));var u=new eo(r,function(){this.track(o)});return u.schedule(),u.getDisposer()}function J(e,t,n,o){var r,i,a,u;return"string"==typeof e?(r=e,i=t,a=n,u=o):(r="When@"+je(),i=e,a=t,u=n),q(r,function(e){if(i.call(u)){e.dispose();var t=St();a.call(u),Pt(t)}})}function Y(e,t,n,o){function r(){a(l)}var i,a,u,s;"string"==typeof e?(i=e,a=t,u=n,s=o):(i=e.name||"AutorunAsync@"+je(),a=e,u=t,s=n),Pe(!1===N(a),O("m006")),void 0===u&&(u=1),s&&(a=a.bind(s));var c=!1,l=new eo(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(r)},u))});return l.schedule(),l.getDisposer()}function X(e,t,n){function o(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!s(i,t),i=t}),a&&r.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&Se(O("m007")),ye(e)&&Se(O("m008"));var r;r="object"==typeof n?n:{},r.name=r.name||e.name||t.name||"Reaction@"+je(),r.fireImmediately=!0===n||!0===r.fireImmediately,r.delay=r.delay||0,r.compareStructural=r.compareStructural||r.struct||!1,t=wn(r.name,r.context?t.bind(r.context):t),r.context&&(e=e.bind(r.context));var i,a=!0,u=!1,s=r.equals?r.equals:r.compareStructural||r.struct?xn.structural:xn.default,c=new eo(r.name,function(){a||r.delay<1?o():u||(u=!0,setTimeout(function(){u=!1,o()},r.delay))});return c.schedule(),c.getDisposer()}function Q(e,t){if(ue(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;Pe(Object.isExtensible(e),O("m035")),Re(e)||(t=(e.constructor.name||"ObservableObject")+"@"+je()),t||(t="ObservableObject@"+je());var n=new Sn(e,t);return He(e,"$mobx",n),n}function Z(e,t,n,o){if(e.values[t]&&!jn(e.values[t]))return Pe("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ye(n.value)){var r=n.value;ee(e,t,r.initialValue,r.enhancer)}else N(n.value)&&!0===n.value.autoBind?V(e.target,t,n.value.originalFn):jn(n.value)?ne(e,t,n.value):ee(e,t,n.value,o);else te(e,t,n.get,n.set,xn.default,!0)}function ee(e,t,n,o){if(Ve(e.target,t),r(e)){var i=a(e,{object:e.target,name:t,type:"add",newValue:n});if(!i)return;n=i.newValue}n=(e.values[t]=new vn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,oe(t)),ae(e,e.target,t,n)}function te(e,t,n,o,r,i){i&&Ve(e.target,t),e.values[t]=new kn(n,e.target,r,e.name+"."+t,o),i&&Object.defineProperty(e.target,t,re(t))}function ne(e,t,n){var o=e.name+"."+t;n.name=o,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,re(t))}function oe(e){return Pn[e]||(Pn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){ie(this,e,t)}})}function re(e){return An[e]||(An[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function ie(e,t,n){var o=e.$mobx,i=o.values[t];if(r(o)){var s=a(o,{type:"update",object:e,name:t,newValue:n});if(!s)return;n=s.newValue}if((n=i.prepareNewValue(n))!==yn){var f=u(o),h=l(),s=f||h?{type:"update",object:e,oldValue:i.value,name:t,newValue:n}:null;h&&p(s),i.setNewValue(n),f&&c(o,s),h&&d()}}function ae(e,t,n,o){var r=u(e),i=l(),a=r||i?{type:"add",object:t,name:n,newValue:o}:null;i&&p(a),r&&c(e,a),i&&d()}function ue(e){return!!Ce(e)&&(L(e),En(e.$mobx))}function se(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||Vn(e))throw new Error(O("m019"));if(ue(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ue(e)||!!e.$mobx||rn(e)||oo(e)||jn(e)}function ce(e){return Pe(!!e,":("),C(function(t,n,o,r,i){Ve(t,n),Pe(!i||!i.get,O("m022")),ee(Q(t,void 0),n,o,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){ie(this,e,t)},!0,!1)}function le(e){for(var t=[],n=1;n=2,O("m014")),Pe("object"==typeof e,O("m015")),Pe(!Vn(e),O("m016")),n.forEach(function(e){Pe("object"==typeof e,O("m017")),Pe(!se(e),O("m018"))});for(var o=Q(e),r={},i=n.length-1;i>=0;i--){var a=n[i];for(var u in a)if(!0!==r[u]&&Ie(a,u)){if(r[u]=!0,e===a&&!Ne(e,u))continue;var s=Object.getOwnPropertyDescriptor(a,u);Z(o,u,s,t)}}return e}function de(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Mn.apply(null,arguments);if(Pe(arguments.length<=1,O("m021")),Pe(!ye(e),O("m020")),se(e))return e;var t=be(e,void 0,void 0);return t!==e?t:Dn.box(e)}function he(e){Se("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ye(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ve(e,t){return Pe(!ye(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function be(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),se(e)?e:Array.isArray(e)?Dn.array(e,n):Re(e)?Dn.object(e,n):ze(e)?Dn.map(e,n):e}function me(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ue(e)||w(e)||Vn(e)?e:Array.isArray(e)?Dn.shallowArray(e,n):Re(e)?Dn.shallowObject(e,n):ze(e)?Dn.shallowMap(e,n):Se("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function ge(e){return e}function _e(e,t,n){if(B(e,t))return t;if(se(e))return e;if(Array.isArray(e))return new pn(e,_e,n);if(ze(e))return new Nn(e,_e,n);if(Re(e)){var o={};return Q(o,n),pe(o,_e,[e]),o}return e}function we(e,t,n){return B(e,t)?t:e}function Oe(e,t){void 0===t&&(t=void 0),lt();try{return e.apply(t)}finally{ft()}}function xe(e){return Ae("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Dn.map(e)}function ke(){return"undefined"!=typeof window?window:e}function je(){return++Kn.mobxGuid}function Se(e,t){throw Pe(!1,e,t),"X"}function Pe(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Ae(e){return-1===$n.indexOf(e)&&($n.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Ee(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Me(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Te(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Ce(e){return null!==e&&"object"==typeof e}function Re(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Le(){for(var e=arguments[0],t=1,n=arguments.length;t0&&(t.dependencies=Me(e.observing).map(nt)),t}function ot(e,t){return rt(Qe(e,t))}function rt(e){var t={name:e.name};return it(e)&&(t.observers=at(e).map(rt)),t}function it(e){return e.observers&&e.observers.length>0}function at(e){return e.observers}function ut(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function st(e,t){if(1===e.observers.length)e.observers.length=0,ct(e);else{var n=e.observers,o=e.observersIndexes,r=n.pop();if(r!==t){var i=o[t.__mapid]||0;i?o[r.__mapid]=i:delete o[r.__mapid],n[i]=r}delete o[t.__mapid]}}function ct(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Kn.pendingUnobservations.push(e))}function lt(){Kn.inBatch++}function ft(){if(0==--Kn.inBatch){It();for(var e=Kn.pendingUnobservations,t=0;t=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return bt(e,t,n+1)})}function mt(e){return e instanceof Zn}function gt(e){switch(e.dependenciesState){case Xn.UP_TO_DATE:return!1;case Xn.NOT_TRACKING:case Xn.STALE:return!0;case Xn.POSSIBLY_STALE:for(var t=St(),n=e.observing,o=n.length,r=0;r0;Kn.computationDepth>0&&t&&Se(O("m031")+e.name),!Kn.allowStateChanges&&t&&Se(O(Kn.strictMode?"m030a":"m030b")+e.name)}function Ot(e,t,n){At(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Kn.runId;var o=Kn.trackingDerivation;Kn.trackingDerivation=e;var r;try{r=t.call(n)}catch(e){r=new Zn(e)}return Kn.trackingDerivation=o,xt(e),r}function xt(e){for(var t=e.observing,n=e.observing=e.newObserving,o=Xn.UP_TO_DATE,r=0,i=e.unboundDepsCount,a=0;ao&&(o=u.dependenciesState)}for(n.length=r,e.newObserving=null,i=t.length;i--;){var u=t[i];0===u.diffValue&&st(u,e),u.diffValue=0}for(;r--;){var u=n[r];1===u.diffValue&&(u.diffValue=0,ut(u,e))}o!==Xn.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function kt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState=Xn.NOT_TRACKING}function jt(e){var t=St(),n=e();return Pt(t),n}function St(){var e=Kn.trackingDerivation;return Kn.trackingDerivation=null,e}function Pt(e){Kn.trackingDerivation=e}function At(e){if(e.dependenciesState!==Xn.UP_TO_DATE){e.dependenciesState=Xn.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Xn.UP_TO_DATE}}function Et(e){return console.log(e),e}function Mt(e,t){return Ae("`whyRun` is deprecated in favor of `trace`"),e=Ct(arguments),e?jn(e)||oo(e)?Et(e.whyRun()):Se(O("m025")):Et(O("m024"))}function Tt(){for(var e=[],t=0;t=0&&Kn.globalReactionErrorHandlers.splice(t,1)}}function It(){Kn.inBatch>0||Kn.isRunningReactions||no(Dt)}function Dt(){Kn.isRunningReactions=!0;for(var e=Kn.pendingReactions,t=0;e.length>0;){++t===to&&(console.error("Reaction doesn't converge to a stable state after "+to+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),o=0,r=n.length;ot){for(var n=new Array(e-t),o=0;o0&&e+t+1>cn&&_(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=this;wt(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:void 0===t||null===t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=[]),r(this)){var u=a(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!u)return Bn;t=u.removedCount,n=u.added}n=n.map(function(e){return o.enhancer(e,void 0)});var s=n.length-t;this.updateArrayLength(i,s);var c=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(r=this.values).splice.apply(r,[e,t].concat(n));var o=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),o;var r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e.prototype.notifyArraySplice=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e}(),pn=function(e){function t(t,n,o,r){void 0===o&&(o="ObservableArray@"+je()),void 0===r&&(r=!1);var i=e.call(this)||this,a=new fn(o,n,i,r);return He(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),sn&&Object.defineProperty(a.array,"0",dn),i}return o(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var o,r=this.$mobx.values;o=e";De(e,t,wn(i,n))},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!0),_n=C(function(e,t,n){V(e,t,n)},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!1),wn=function(e,t,n,o){return 1===arguments.length&&"function"==typeof e?x(e.name||"",e):2===arguments.length&&"function"==typeof t?x(e,t):1===arguments.length&&"string"==typeof e?D(e):D(t).apply(null,arguments)};wn.bound=function(e,t,n){if("function"==typeof e){var o=x("",e);return o.autoBind=!0,o}return _n.apply(null,arguments)};var On=Object.prototype.toString,xn={identity:G,structural:K,default:W},kn=function(){function e(e,t,n,o,r){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=Xn.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Xn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+je(),this.value=new Zn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Qn.NONE,this.name=o||"ComputedValue@"+je(),r&&(this.setter=x(o+"-setter",r))}return e.prototype.onBecomeStale=function(){yt(this)},e.prototype.onBecomeUnobserved=function(){kt(this),this.value=void 0},e.prototype.get=function(){Pe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Kn.inBatch?(lt(),gt(this)&&(this.isTracing!==Qn.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),ft()):(pt(this),gt(this)&&this.trackAndCompute()&&ht(this));var e=this.value;if(mt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(mt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){Pe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else Pe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){l()&&f({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===Xn.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||mt(e)||mt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,Kn.computationDepth++;var t;if(e)t=Ot(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Zn(e)}return Kn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,o=!0,r=void 0;return q(function(){var i=n.get();if(!o||t){var a=St();e({type:"update",object:n,newValue:i,oldValue:r}),Pt(a)}o=!1,r=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return We(this.get())},e.prototype.whyRun=function(){var e=Boolean(Kn.trackingDerivation),t=Me(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Me(at(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Xn.NOT_TRACKING?O("m032"):" * This computation will re-run if any of the following observables changes:\n "+Te(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+O("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Te(n)+"\n")},e}();kn.prototype[Ke()]=kn.prototype.valueOf;var jn=Be("ComputedValue",kn),Sn=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return Pe(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}(),Pn={},An={},En=Be("ObservableObjectAdministration",Sn),Mn=ce(be),Tn=ce(me),Cn=ce(ge),Rn=ce(_e),Ln=ce(we),In={box:function(e,t){return arguments.length>2&&he("box"),new vn(e,be,t)},shallowBox:function(e,t){return arguments.length>2&&he("shallowBox"),new vn(e,ge,t)},array:function(e,t){return arguments.length>2&&he("array"),new pn(e,be,t)},shallowArray:function(e,t){return arguments.length>2&&he("shallowArray"),new pn(e,ge,t)},map:function(e,t){return arguments.length>2&&he("map"),new Nn(e,be,t)},shallowMap:function(e,t){return arguments.length>2&&he("shallowMap"),new Nn(e,ge,t)},object:function(e,t){arguments.length>2&&he("object");var n={};return Q(n,t),le(n,e),n},shallowObject:function(e,t){arguments.length>2&&he("shallowObject");var n={};return Q(n,t),fe(n,e),n},ref:function(){return arguments.length<2?ve(ge,arguments[0]):Cn.apply(null,arguments)},shallow:function(){return arguments.length<2?ve(me,arguments[0]):Tn.apply(null,arguments)},deep:function(){return arguments.length<2?ve(be,arguments[0]):Mn.apply(null,arguments)},struct:function(){return arguments.length<2?ve(_e,arguments[0]):Rn.apply(null,arguments)}},Dn=de;Object.keys(In).forEach(function(e){return Dn[e]=In[e]}),Dn.deep.struct=Dn.struct,Dn.ref.struct=function(){return arguments.length<2?ve(we,arguments[0]):Ln.apply(null,arguments)};var Hn={},Nn=function(){function e(e,t,n){void 0===t&&(t=be),void 0===n&&(n="ObservableMap@"+je()),this.enhancer=t,this.name=n,this.$mobx=Hn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new pn(void 0,ge,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(r(this)){var o=a(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!o)return this;t=o.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,r(this)){var n=a(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var o=l(),i=u(this),n=i||o?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return o&&p(n),Oe(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0}),i&&c(this,n),o&&d(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new vn(t,ge,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==yn){var o=l(),r=u(this),i=r||o?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;o&&p(i),n.setNewValue(t),r&&c(this,i),o&&d()}},e.prototype._addValue=function(e,t){var n=this;Oe(function(){var o=n._data[e]=new vn(t,n.enhancer,n.name+"."+e,!1);t=o.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var o=l(),r=u(this),i=r||o?{type:"add",object:this,name:e,newValue:t}:null;o&&p(i),r&&c(this,i),o&&d()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return v(this._keys.slice())},e.prototype.values=function(){return v(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return v(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(o){return e.call(t,n.get(o),o,n)})},e.prototype.merge=function(e){var t=this;return Vn(e)&&(e=e.toJS()),Oe(function(){Re(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],o=e[1];return t.set(n,o)}):ze(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&Se("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;Oe(function(){jt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return Oe(function(){var n=Fe(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return Pe(!0!==t,O("m033")),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}();b(Nn.prototype,function(){return this.entries()});var Vn=Be("ObservableMap",Nn),Bn=[];Object.freeze(Bn);var $n=[],Un=function(){},zn=Object.prototype.hasOwnProperty,Fn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Gn=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),Kn=new Gn,Wn=!1,qn=!1,Jn=!1,Yn=ke();Yn.__mobxInstanceCount?(Yn.__mobxInstanceCount++,setTimeout(function(){Wn||qn||Jn||(Jn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):Yn.__mobxInstanceCount=1;var Xn;!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Xn||(Xn={}));var Qn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Qn||(Qn={}));var Zn=function(){function e(e){this.cause=e}return e}(),eo=function(){function e(e,t){void 0===e&&(e="Reaction@"+je()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Xn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+je(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Qn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Kn.pendingReactions.push(this),It())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(lt(),this._isScheduled=!1,gt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&l()&&f({object:this,type:"scheduled-reaction"})),ft())},e.prototype.track=function(e){lt();var t,n=l();n&&(t=Date.now(),p({object:this,type:"reaction",fn:e})),this._isRunning=!0;var o=Ot(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&kt(this),mt(o)&&this.reportExceptionInDerivation(o.cause),n&&d({time:Date.now()-t}),ft()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,o=O("m037");console.error(n||o,e),l()&&f({type:"error",message:n,error:e,object:this}),Kn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(lt(),kt(this),ft()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=Rt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Me(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Te(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+O("m038")+"\n"},e.prototype.trace=function(e){void 0===e&&(e=!1),Tt(this,e)},e}(),to=100,no=function(e){return e()},oo=Be("Reaction",eo),ro=Ut(xn.default),io=Ut(xn.structural),ao=function(e,t,n){if("string"==typeof t)return ro.apply(null,arguments);Pe("function"==typeof e,O("m011")),Pe(arguments.length<3,O("m012"));var o="object"==typeof t?t:{};o.setter="function"==typeof t?t:o.setter;var r=o.equals?o.equals:o.compareStructural||o.struct?xn.structural:xn.default;return new kn(e,o.context,r,o.name||e.name||"",o.setter)};ao.struct=io,ao.equals=Ut;var uo={allowStateChanges:E,deepEqual:B,getAtom:Qe,getDebugName:et,getDependencyTree:tt,getAdministration:Ze,getGlobalState:Ye,getObserverTree:ot,interceptReads:en,isComputingDerivation:_t,isSpyEnabled:l,onReactionError:Lt,reserveArrayBuffer:_,resetGlobalState:Xe,isolateGlobalState:qe,shareGlobalState:Je,spyReport:f,spyReportEnd:d,spyReportStart:p,setReactionScheduler:Ht},so={Reaction:eo,untracked:jt,Atom:on,BaseAtom:nn,useStrict:P,isStrictModeEnabled:A,spy:h,comparer:xn,asReference:Nt,asFlat:Bt,asStructure:Vt,asMap:$t,isModifierDescriptor:ye,isObservableObject:ue,isBoxedObservable:bn,isObservableArray:w,ObservableMap:Nn,isObservableMap:Vn,map:xe,transaction:Oe,observable:Dn,computed:ao,isObservable:se,isComputed:zt,extendObservable:le,extendShallowObservable:fe,observe:Ft,intercept:Wt,autorun:q,autorunAsync:Y,when:J,reaction:X,action:wn,isAction:N,runInAction:H,expr:Yt,toJS:Xt,createTransformer:Qt,whyRun:Mt,isArrayLike:Ue,extras:uo},co=!1;for(var lo in so)!function(e){var t=so[e];Object.defineProperty(so,e,{get:function(){return co||(co=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})}(lo);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:uo}),t.default=so}.call(t,n(24))},function(e,t){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t1?t-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:[];if("Object"===(0,g.type)(t))for(var o in t)~n.indexOf(o)||(e[o]=t[o]);return e}function l(e,t){var n=void 0===e?"undefined":b(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function f(e,t,n){if(!t)return e;var o=t.split("."),r=!1,i=e,a=!0,u=!1,s=void 0;try{for(var c,f=o[Symbol.iterator]();!(a=(c=f.next()).done);a=!0){var p=c.value;if(!l(i,p)){i=void 0,r=!0;break}i=i[p]}}catch(e){u=!0,s=e}finally{try{!a&&f.return&&f.return()}finally{if(u)throw s}}return n?r?n:i:void 0===i?"":i}function p(e,t){return t.forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);n.enumerable||(n.enumerable=!0,Object.defineProperty(e,t,n))}),e}function d(e,t,n,o){return"boolean"==typeof n&&(o=n,n=null),y(t).forEach(function(r,i){var a={get:function(){return t[r]},configurable:!0,enumerable:!0};!o&&(a.set=function(e){t[r]=e}),Object.defineProperty(e,n?n[i]:r,a)}),e}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e;var n=Object.keys(e),o={},r=!0,i=!1,a=void 0;try{for(var u,s=n[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){var c=u.value;t.indexOf(c)<0&&(o[c]=e[c])}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return o}function y(e){var t=[];for(var n in e)t.push(n);return t}function v(){function e(e){return!!e||(console.error("pathStr should not be null!"),!1)}function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"Array"===(0,g.type)(n)?(e(r),n.forEach(function(e,n){t(e,r+"["+n+"]")})):"Object"===(0,g.type)(n)?Object.keys(n).forEach(function(e){t(n[e],r?r+"."+e:e)}):(e(r),o[r]=n)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o={};return t(n),o}Object.defineProperty(t,"__esModule",{value:!0});var b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=Object.assign||function(e){for(var t=1;t-1&&e.splice(n,1),t()}else for(var o=void 0;o=e.shift();)o()}}function u(e){return function(t){e.__cml_cbCollection__.push(t)}}function s(e,t){function n(t){"Function"===(0,w.type)(e.setData)&&e.setData(t,l(e))}var o=!1,r=void 0;return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("Function"===(0,w.type)(i.schedule)){e.__cml_reaction__=i;var a=e.__cml_originOptions__[t.propsName],u=(0,_.enumerableKeys)(a),s=(0,_.deleteProperties)(e.__cml_ob_data__,u),l=(0,g.default)(s),f=void 0;o?(f=(0,P.default)(l,r),c("beforeUpdate",e,l,r,f)):(o=!0,f=l),n(f),r=h({},l)}}}function c(e,t){var n=t.__cml_originOptions__;if("function"==typeof n[e]){for(var o=arguments.length,r=Array(o>2?o-2:0),i=2;i=0;r--)e.$watch(t,o[r]);else e.$watch(t,o)})}}},{key:"addPageHooks",value:function(){var e=this.context,t=e.__cml_originOptions__;x.default.get(this.platform+".page.hooks").forEach(function(n){"function"==typeof t[n]&&(e[n]=t[n])})}},{key:"start",value:function(e){if(this.context){var t=this.context,n=d(t.$setData,e);t.__cml_disposerList__.push(n)}}},{key:"destory",value:function(){if(this.context){a(this.context.__cml_disposerList__)()}}}]),e}();t.default=A},function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],n=this.data;return e.split(".").forEach(function(e){e&&void 0!==n&&(n=n[e])}),void 0!==n?n:t}},{key:"set",value:function(e,t){if(void 0===t)this.data=e;else if(e=String(e||"").trim()){var n=e.split("."),r=n.pop(),i=this.data||{};n.forEach(function(e){var t=i[e];if("object"===(void 0===t?"undefined":o(t)))i=i[e];else{if(void 0!==t)throw new Error("forbidden to set property["+e+"] of ["+t+"] data");i=i[e]={}}}),i[r]=t}}}]),e}();t.default=i},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=o(r),a=n(25),u=o(a),s=u.default.getInstance(),c={wx:{instance:s,props:"properties"},alipay:{instance:s,props:"props"},baidu:{instance:s,props:"properties"}};t.default=new i.default(c)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=n(45),r=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=r.default},function(e,t){function n(e){return Object.prototype.toString.call(e).slice(8,-1)}function o(e){if("Array"===n(e)){var t={};return e.forEach(function(e){t[e]=e}),t}return e}function r(e,t){var n=void 0===e?"undefined":u(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function i(e,t,n){if(!t)return e;var o=t.split("."),i=!1,a=e,u=!0,s=!1,c=void 0;try{for(var l,f=o[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var p=l.value;if(!r(a,p)){a=void 0,i=!0;break}a=a[p]}}catch(e){s=!0,c=e}finally{try{!u&&f.return&&f.return()}finally{if(s)throw c}}return n?i?n:a:void 0===a?"":a}function a(e,t,n,o,r){return"boolean"==typeof o&&(r=o,o=null),n.forEach(function(n,i){var a={get:function(){return t[n]},configurable:!0,enumerable:!0};!r&&(a.set=function(e){t[n]=e}),Object.defineProperty(e,o?o[i]:n,a)}),e}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.type=n,t.normalizeMap=o,t.isExistAttr=r,t.getByPath=i,t.proxy=a},function(e,t,n){n(3),e.exports=n(12)},function(e,t,n){function o(e){return i.default.createApp(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createApp=o;var r=n(16),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n-1?(0,p.mergeHooks)(t,o,r):"data"===r?(0,p.mergeData)(t,o,r):n(r)?(0,p.mergeSimpleProps)(t,o,r):"watch"===r?(0,p.mergeWatch)(t,o,r):"mixins"!==r&&(0,p.mergeDefault)(t,o,r)},n=function(t){return new RegExp("computed|methods|proto|"+e.propsName).test(t)},o={};!function e(n,o){if(o.mixins){var r=!0,i=!1,a=void 0;try{for(var u,s=o.mixins[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){e(n,u.value)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}}t(n,o)}(o,this.options),this.options=o}},{key:"transformHooks",value:function(){if(this.hooks&&this.hooks.length){var e=this;this.hooks.forEach(function(t){var n=e.options[t];n&&(e.options[t]=function(){for(var e=void 0,t=arguments.length,o=Array(t),r=0;r3&&void 0!==arguments[3])||arguments[3];if(void 0===t&&(t=!0),void 0===n&&(n=[]),t&&null===n&&(n=[]),t&&null!==e&&"object"===(void 0===e?"undefined":r(e)))for(var l=0,f=n.length;l1&&void 0!==arguments[1])||arguments[1],u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n&&null===u&&(u=[]),n&&null!==e&&"object"===(void 0===e?"undefined":i(e)))for(var s=0,c=u.length;s=o)for(var i in t){var a=e[i];void 0===a?e[i]="":r(a,t[i])}}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length&&t.forEach(function(t,n){r(e[n],t)})}function i(e,t,n,o){if(!f.extras.deepEqual(e,t))if("Object"===(0,l.type)(e)&&"Object"===(0,l.type)(t)){var r=Object.keys(e).length,s=Object.keys(t).length;if(r>=s)for(var c in e){var p=e[c],d=t[c];i(p,d,u(n,c),o)}else a(e,n,o)}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length?e.forEach(function(e,r){i(e,t[r],u(n,r,"array"),o)}):a(e,n,o)}function a(e,t,n){void 0!==e&&(n[t]=e)}function u(e,t,n){return"array"===n?e+"["+t+"]":c(t)?e+"["+t+"]":e?e+"."+t:t}function s(e){var t=Number(e);return t!==t}function c(e){return!s(Number(e))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var l=n(0),f=n(1)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Page=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d);t.Page=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="baidu";var o=new h.default({polyHooks:l.default.get("baidu.page.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{options:n.options,type:"page",builtinMixins:{onLoad:function(){o.setContext(this).init().start("page-view-render")},onReady:function(){o.setContext(this).initRefs()},onUnload:function(){o.setContext(this).destory()}},needResolveAttrs:["methods"],hooks:l.default.get("baidu.page.hooks"),hooksMap:l.default.get("baidu.page.hooksMap"),polyHooks:l.default.get("baidu.page.polyHooks"),usedHooks:l.default.get("baidu.page.usedHooks")}),__CML__GLOBAL.Page(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d);t.Component=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="baidu";var o=new h.default({polyHooks:l.default.get("baidu.component.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{type:"component",builtinMixins:{created:function(){o.setContext(this).init()},attached:function(){o.setContext(this).start("component-view-render")},ready:function(){o.setContext(this).initRefs()},detached:function(){o.setContext(this).destory()}},hooks:l.default.get("baidu.component.hooks"),hooksMap:l.default.get("baidu.component.hooksMap"),polyHooks:l.default.get("baidu.component.polyHooks"),usedHooks:l.default.get("baidu.component.usedHooks"),needPropsHandler:!0,needTransformProperties:!0}),__CML__GLOBAL.Component(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return i.default.createPage(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createPage=o;var r=n(39),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};r.default.bootstrap.call(r.default,e)},getInfo:r.default.getInfo}},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?n-1:0),r=1;r1?n-1:0),r=1;r '' +_.disappearCssComment = function (content) { + var commentReg = /\/\*[\s\S]*?\*\//g; + return content.replace(commentReg, function (match) { + return ''; + }); +}; +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex).trim(); + var value = declaration.slice(colonIndex + 1).trim(); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/* eslint-disable */ +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + // 原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js": +/***/ (function(module, exports, __webpack_require__) { + + +var _ = module.exports = {}; +var utils = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js"); +_.eventProxyName = '_cmlEventProxy'; +_.modelEventProxyName = '_cmlModelEventProxy'; // c-model v-model的事件代理 +_.inlineStatementEventProxy = '_cmlInlineStatementEventProxy'; // 内联语句的事件代理 +_.eventEmitName = '$cmlEmit'; // 触发事件的方法 +_.styleParseName = '$cmlStyle'; // 提供各端处理style属性的方法 weex中处理成对象,wx中处理成字符串,web中不处理 +_.styleProxyName = '_cmlStyleProxy'; // 提供代理 weex和web端处理style +_.mergeStyleName = '$cmlMergeStyle'; +_.animationProxy = '_animationCb'; +_.weexClassProxy = '_weexClassProxy'; +_.merge = function (target, fromObj) { + Object.keys(fromObj).forEach(function (key) { + target[key] = fromObj[key]; + }); +}; + +_.isType = function (obj, type) { + return Object.prototype.toString.call(obj).slice(8, -1) === type; +}; + +_.mergeStyle = function () { + // 可以接受字符串或者对象 + function styleToObj(str) { + var obj = {}; + str.split(';').filter(function (item) { + return !!item.trim(); + }).forEach(function (item) { + var _utils$getStyleKeyVal = utils.getStyleKeyValue(item), + key = _utils$getStyleKeyVal.key, + value = _utils$getStyleKeyVal.value; + + key = key.replace(/\s+/, ''); + value = value.replace(/\s+/, ''); + obj[key] = value; + }); + return obj; + } + var arr = []; + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + args.forEach(function (arg) { + if (typeof arg === 'string') { + arr.push(styleToObj(arg)); + } else if (Object.prototype.toString.call(arg) === '[object Object]') { + arr.push(arg); + } + }); + var resultObj = Object.assign.apply(Object, arr); + + var resultStr = ''; + Object.keys(resultObj).forEach(function (key) { + resultStr += key + ':' + resultObj[key] + ';'; + }); + return resultStr; +}; +_.trim = function (value) { + return value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); +}; +_.isReactive = function (value) { + var reg = /(?:^'([^']*?)'$)/; + return _.trim(value).match(reg); +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js": +/***/ (function(module, exports) { + +var _ = module.exports = {}; + +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex); + var value = declaration.slice(colonIndex + 1); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +var _methods; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var common = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js"); +var wxStyleHandle = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/proxy/proxyMiniapp.js"); + +var deepClone = function deepClone(obj) { + if (obj.toString().slice(8, -1) !== "Object") { + return obj; + } + var res = {}; + Object.keys(obj).forEach(function (key) { + res[key] = deepClone(obj[key]); + }); + return res; +}; + +var _ = module.exports = { deepClone: deepClone }; + +common.merge(_, common); + +_.mixins = { + methods: (_methods = {}, _defineProperty(_methods, _.inlineStatementEventProxy, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + var argsStr = dataset && dataset.args; + var argsArr = []; + // 由于百度对于 data-arg="" 在dataset.arg = true 值和微信端不一样所以需要重新处理下这部分逻辑 + if (argsStr && typeof argsStr === 'string') { + argsArr = argsStr.split(',').reduce(function (result, item, index) { + var arg = dataset['arg' + index]; + if (arg === "$event") { + var newEvent = getNewEvent(e); + result.push(newEvent); + } else { + // 这里的值微信已经计算好了;到dateset的时候已经是计算的结果 比如msg = 'sss' data-arg1="{{msg + 1}}" + // dataset[arg1] = 'sss1' + result.push(dataset['arg' + index]); + } + return result; + }, []); + } + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + this[originFuncName].apply(this, _toConsumableArray(argsArr)); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.modelEventProxyName, function (e) { + var dataset = e.currentTarget && e.currentTarget.dataset; + var modelKey = dataset && dataset.modelkey; + if (modelKey) { + this[modelKey] = e.detail.value; + } + }), _defineProperty(_methods, _.eventProxyName, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + var newEvent = getNewEvent(e); + this[originFuncName](newEvent); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.styleParseName, function (content) { + var res = ''; + if (_.isType(content, 'Object')) { + Object.keys(content).forEach(function (key) { + res += key + ':' + content[key] + ';'; + }); + } else if (_.isType(content, 'String')) { + res = content; + } + return wxStyleHandle(res); + }), _defineProperty(_methods, _.mergeStyleName, function () { + return _.mergeStyle.apply(_, arguments); + }), _defineProperty(_methods, _.animationProxy, function () { + var animationValue = arguments.length <= 0 ? undefined : arguments[0]; + // animationValue:{cbs:{0:cb0,1:cb1,length:2},index} + var animation = this[animationValue]; // 引用值 + if (!animation) { + return; + } + var cbs = animation.cbs, + index = animation.index; + // 配合 解决百度端动画bug + + if (cbs === undefined || index === undefined) { + return; + } + var cb = cbs[index]; + if (cb && typeof cb === 'function') { + cb(); + } + delete animation.index; + animation.index = index + 1; + }), _methods) + +}; + +function getNewEvent(e) { + var newEvent = {}; + ['type', 'timeStamp', 'target', 'currentTarget', 'detail', 'touches', 'changedTouches'].forEach(function (key) { + if (e[key]) { + if (~['target', 'currentTarget'].indexOf(key)) { + var newTarget = {}; + newTarget = { + id: e[key].id, + dataset: e[key].dataset + }; + newEvent[key] = newTarget; + } else { + newEvent[key] = e[key]; + } + } + }); + + newEvent._originEvent = e; + return newEvent; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var commonMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js"); + +var _ = module.exports = commonMixins.deepClone(commonMixins); +commonMixins.merge(_.mixins.methods, _defineProperty({}, _.eventEmitName, function (eventKey, detail) { + this.triggerEvent(eventKey, detail); + if (this.$__checkCmlEmit__) { + this.$__checkCmlEmit__(eventKey, detail); + } +})); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js": +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime-module.js": +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js": +/***/ (function(module, exports) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js": +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/cpx2px/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = cpx2px; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function cpx2px(cpx) { + if (typeof cpx !== 'number') { + console.error('Parameter must be a number'); + return; + } + var viewportWidth = _getWidth2.default.getWidth(); + var px = +(viewportWidth / 750 * cpx).toFixed(3); + return px; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getRect/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/getRect/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": { + "resData": { + "width": "Number", + "height": "Number", + "left": "Number", + "top": "Number", + "right": "Number", + "bottom": "Number" + }, + "CallBack": { + "input": ["resData"], + "output": "Undefined" + } + }, + "interfaces": { + "UserInfoInterface": { + "getRect": { + "input": ["CMLObject", "CallBack"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["UserInfoInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getRect", + value: function getRect(refObj, cb) { + var query = swan.createSelectorQuery().in(refObj.context); + query.select("#" + refObj.id).boundingClientRect(); + query.exec(function (res) { + swan.getSystemInfo({ + success: function success(systemRes) { + var windowWidth = systemRes.windowWidth; + var scale = 750 / windowWidth; + var rectObj = { + width: res[0] && res[0].width * scale || 0, + height: res[0] && res[0].height * scale || 0, + left: res[0] && res[0].left * scale || 0, + top: res[0] && res[0].top * scale || 0, + right: res[0] && res[0].right * scale || 0, + bottom: res[0] && res[0].bottom * scale || 0 + }; + cb(rectObj); + } + }); + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getRect/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = getRect; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +var _utils = __webpack_require__("./node_modules/chameleon-api/src/lib/utils.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getRect(ref, context) { + return new Promise(function (resolve, reject) { + var refObj = (0, _utils.getRefObj)(ref, context); + _index2.default.getRect(refObj, function (res) { + resolve(res); + }); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": { + "res": { + "os": "String", + "env": "String", + "viewportWidth": "Number", + "viewportHeight": "Number", + "extraParams": "CMLObject" + }, + "CallBack": { + "input": ["res"], + "output": "Undefined" + } + }, + "interfaces": { + "UserInfoInterface": { + "getSystemInfo": { + "input": ["CallBack"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["UserInfoInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getSystemInfo", + value: function getSystemInfo(cb) { + swan.getSystemInfo({ + success: function success(res) { + var os = /android/i.test(res.system) ? 'android' : 'ios'; + var viewportWidth = res.windowWidth; + var viewportHeight = res.windowHeight; + var systemInfo = { + os: os, + env: 'baidu', + viewportWidth: viewportWidth, + viewportHeight: viewportHeight, + extraParams: res || {} + }; + cb(systemInfo); + }, + fail: function fail(err) { + var systemInfo = { + os: '', + env: 'baidu', + viewportWidth: 0, + viewportHeight: 0, + extraParams: {} + }; + cb(systemInfo); + } + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.default = getSystemInfo; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +var _utils = __webpack_require__("./node_modules/chameleon-api/src/lib/utils.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getSystemInfo() { + return new Promise(function (resolve, reject) { + _index2.default.getSystemInfo(function (res) { + res.extraParams = (0, _utils.tryJsonParse)(res.extraParams); + // px2viewpx + var pxRpxRate = 750 / res.viewportWidth; + var viewportHeight = (res.viewportHeight * pxRpxRate).toFixed(3); + var viewportWidth = (res.viewportWidth * pxRpxRate).toFixed(3); + + if (res.os) { + resolve(_extends({}, res, { + viewportHeight: viewportHeight, + viewportWidth: viewportWidth + })); + } else { + reject(res); + } + }); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getWidthInterface": { + "getWidth": { + "input": [], + "output": "Number" + } + } + }, + "classes": { + "Method": ["getWidthInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getWidth", + value: function getWidth() { + var _swan$getSystemInfoSy = swan.getSystemInfoSync(), + windowWidth = _swan$getSystemInfoSy.windowWidth; + + return windowWidth; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = px2cpx; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function px2cpx(px) { + + if (typeof px !== 'number') { + console.error('Parameter must be a number'); + return; + } + + var viewportWidth = _getWidth2.default.getWidth(); + var cpx = +(750 / viewportWidth * px).toFixed(3); + return cpx; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/lib/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isFn = isFn; +exports.isStr = isStr; +exports.isNum = isNum; +exports.isObj = isObj; +exports.isArray = isArray; +exports.isUndefined = isUndefined; +exports.isEmpty = isEmpty; +exports.noop = noop; +exports.parseQuery = parseQuery; +exports.queryStringify = queryStringify; +exports.buildQueryStringUrl = buildQueryStringUrl; +exports.queryParse = queryParse; +exports.isNeedApiPrefix = isNeedApiPrefix; +exports.addApiPrefix = addApiPrefix; +exports.tryJsonParse = tryJsonParse; +exports.getQueryParamsFromUrl = getQueryParamsFromUrl; +exports.getOpenObj = getOpenObj; +exports.getUrlWithConnector = getUrlWithConnector; +exports.getRefObj = getRefObj; +exports.compareVersion = compareVersion; + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +/** + * 基础js方法的封装 + * + */ +function typeEqual(obj, type) { + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; +} + +function isFn(obj) { + return typeEqual(obj, 'Function'); +} + +function isStr(obj) { + return typeEqual(obj, 'String'); +} + +function isNum(obj) { + return typeof obj === 'number'; +} + +function isObj(obj) { + return typeEqual(obj, 'Object'); +} + +function isArray(obj) { + return typeEqual(obj, 'Array'); +} + +function isUndefined(obj) { + return typeEqual(obj, 'Undefined'); +} + +function isEmpty(obj) { + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + return false; + } + } + return true; +} + +function noop() {} + +function parseQuery(obj) { + var str = '&'; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + str += key + '=' + encodeURIComponent(obj[key]) + '&'; + } + } + return str; +} + +function queryStringify(obj) { + var strArr = []; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + strArr.push(key + '=' + encodeURIComponent(obj[key])); + } + } + return strArr.join('&'); +} + +function buildQueryStringUrl(params) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if (!url) return queryStringify(params); + var retUrl = url; + if (queryStringify(params)) { + retUrl = url.indexOf('?') > -1 ? url + '&' + queryStringify(params) : url + '?' + queryStringify(params); + } + return retUrl; +} + +function queryParse() { + var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + var arr = search.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +function isNeedApiPrefix(url) { + return !/^(https?\:\/\/)|^(\/\/)/.test(url); +} + +function addApiPrefix(url, domainkey) { + var domainMap = process.env.domainMap; + // 新版cli + if (domainMap) { + var prefix = domainMap[domainkey] || process.env.devApiPrefix; + return prefix + url; + } else { + // 老版本配置apiPrefix + if (true) { + return "http://172.24.24.111:8005" + url; + } + } +} + +function tryJsonParse(some) { + // 这里eslint提示也先别删除\[\] + if (isStr(some) && /[\{\[].*[\}\]]/.test(some)) { + some = JSON.parse(some); + } + return some; +} + +function getQueryParamsFromUrl(url) { + var arr = url.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +/** + * 获取处理后的各端打开的地址 + * @param {String} url url地址 + * @return {Object} objTreated 处理好的三端地址及对象 + */ +function getOpenObj(url) { + var webUrlWithoutQuery = url.split('?')[0]; + var queryObj = getQueryParamsFromUrl(url); + + var _queryObj$path = queryObj.path, + path = _queryObj$path === undefined ? '' : _queryObj$path, + _queryObj$envVersion = queryObj.envVersion, + envVersion = _queryObj$envVersion === undefined ? '' : _queryObj$envVersion, + _queryObj$weixin_appi = queryObj.weixin_appid, + weixin_appid = _queryObj$weixin_appi === undefined ? '' : _queryObj$weixin_appi, + _queryObj$weixin_path = queryObj.weixin_path, + weixin_path = _queryObj$weixin_path === undefined ? '' : _queryObj$weixin_path, + _queryObj$weixin_envV = queryObj.weixin_envVersion, + weixin_envVersion = _queryObj$weixin_envV === undefined ? '' : _queryObj$weixin_envV, + _queryObj$baidu_appid = queryObj.baidu_appid, + baidu_appid = _queryObj$baidu_appid === undefined ? '' : _queryObj$baidu_appid, + _queryObj$baidu_path = queryObj.baidu_path, + baidu_path = _queryObj$baidu_path === undefined ? '' : _queryObj$baidu_path, + _queryObj$baidu_envVe = queryObj.baidu_envVersion, + baidu_envVersion = _queryObj$baidu_envVe === undefined ? '' : _queryObj$baidu_envVe, + _queryObj$alipay_appi = queryObj.alipay_appid, + alipay_appid = _queryObj$alipay_appi === undefined ? '' : _queryObj$alipay_appi, + _queryObj$alipay_path = queryObj.alipay_path, + alipay_path = _queryObj$alipay_path === undefined ? '' : _queryObj$alipay_path, + _queryObj$alipay_envV = queryObj.alipay_envVersion, + alipay_envVersion = _queryObj$alipay_envV === undefined ? '' : _queryObj$alipay_envV, + _queryObj$weex_path = queryObj.weex_path, + weex_path = _queryObj$weex_path === undefined ? '' : _queryObj$weex_path, + _queryObj$cml_addr = queryObj.cml_addr, + cml_addr = _queryObj$cml_addr === undefined ? '' : _queryObj$cml_addr, + extraData = _objectWithoutProperties(queryObj, ['path', 'envVersion', 'weixin_appid', 'weixin_path', 'weixin_envVersion', 'baidu_appid', 'baidu_path', 'baidu_envVersion', 'alipay_appid', 'alipay_path', 'alipay_envVersion', 'weex_path', 'cml_addr']); + + var objTreated = { + weex: cml_addr ? webUrlWithoutQuery + '?weex_path=' + weex_path + queryStringify(extraData) + '&cml_addr=' + cml_addr : null, + web: webUrlWithoutQuery + '?' + queryStringify(extraData), + wx: { + appId: weixin_appid, + path: weixin_path || path, + extraData: extraData, + envVersion: weixin_envVersion || envVersion + }, + alipay: { + appId: alipay_appid, + path: alipay_path || path, + extraData: extraData, + envVersion: alipay_envVersion || envVersion + }, + baidu: { + appKey: baidu_appid, + path: baidu_path || path, + extraData: extraData + } + }; + return objTreated; +} + +// 获得带正确连接符的url +function getUrlWithConnector(url) { + var connector = url.includes('?') ? '&' : '?'; + return url + connector; +} + +// 获取ref的通用对象 +function getRefObj(ref, context) { + var refObj = { + webDom: '', + id: '', + weexRef: '', + context: context + }; + // 容错处理 + if (!ref) return refObj; + + // 兼容新版ref, 为字符串 + if (typeof ref == 'string') { + refObj.id = ref; + if (false) { + refObj.weexRef = context.$refs && context.$refs[ref]; + } else if (false) { + refObj.webDom = context.$refs[ref] && context.$refs[ref][0] || context.$refs[ref] && context.$refs[ref].$el || context.$refs[ref]; + } + return refObj; + } + + // 向下兼容旧版ref + if (true) { + refObj.id = ref.id; + } else if (process.env.platform === 'weex') { + refObj.weexRef = ref; + } else if (ref.$el) { + refObj.webDom = ref.$el; + } else { + refObj.webDom = ref; + } + return refObj; +} + +/** + * 比较版本号 + * @param {String} v1 版本号1 + * @param {String} symb 比较符 + * @param {String} v2 版本号2 + */ +function compareVersion(v1, symb, v2) { + v1 = parseVersion(v1); + v2 = parseVersion(v2); + if (symb.indexOf('=') !== -1 && v1 === v2) { + return true; + } + if (symb.indexOf('>') !== -1 && v1 > v2) { + return true; + } + if (symb.indexOf('<') !== -1 && v1 < v2) { + return true; + } + return false; +} + +function parseVersion() { + var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + version = version.split('.'); + version.length = 4; + var ret = []; + version.forEach(function (n) { + n = n * 1; + if (n) { + ret.push(n >= 10 ? n : '0' + n); + } else { + ret.push('00'); + } + }); + return parseInt(ret.join(''), 10); +} + +/** + * 判断targetMap中的属性是否被checkMap的属性包含,不是则抛出错误 + * @param {Object || Array} checkMap + * @param {Object} targetMap + * @returns {Boolean} + */ +var checkValue = exports.checkValue = function checkValue(check, targetMap) { + if (isObj(check) || isArray(check)) { + var checkArray = isObj(check) ? Object.keys(check) : check; + Object.keys(targetMap).forEach(function (key) { + if (!checkArray.includes(key)) { + throw Error(key + '\u503C\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u68C0\u67E5\uFF01'); + } + }); + } else { + // redLog('请传入数组或对象') + return false; + } + return true; +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.js"); + +var _index2 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.js"); + +var _index3 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js"); + +var _index4 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js"); + +var _index5 = _interopRequireDefault(_index4); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _extends({ + createApp: _index.createApp, + createPage: _index2.createPage, + createComponent: _index3.createComponent +}, _index5.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +__webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "bootstrapInterface": { + "bootstrap": { + "input": ["CMLObject"], + "output": "Undefined" + }, + "getInfo": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["bootstrapInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +/* istanbul ignore next */ + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "bootstrap", + value: function bootstrap(options) {// 小程序端启动入口为src/app/app.cml + } + }, { + key: "getInfo", + value: function getInfo() { + return {}; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* istanbul ignore next */ +exports.default = { + bootstrap: function bootstrap() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _index2.default.bootstrap.call(_index2.default, options); + }, + getInfo: _index2.default.getInfo + +}; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js": +/***/ (function(module, exports) { + +/** + * Promise.finally、Promise.done 垫片 + */ +if (typeof Promise.prototype.finally !== 'function') { + Promise.prototype.finally = function (onFinally) { + var P = this.constructor; + return this.then(function (value) { + return P.resolve(onFinally()).then(function () { + return value; + }); + }, function (reason) { + return P.resolve(onFinally()).then(function () { + throw reason; + }); + }); + }; +} + +if (typeof Promise.prototype.done === 'undefined') { + Promise.prototype.done = function (onFulfilled, onRejected) { + this.then(onFulfilled, onRejected).catch(function (error) { + setTimeout(function () { + throw error; + }, 0); + }); + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _baidu = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createAppInterface": { + "createApp": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createAppInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createApp", + value: function createApp(options) { + return new _baidu.App(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createApp = createApp; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createApp(options) { + return _index2.default.createApp(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _baidu = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createCmptInterface": { + "createComponent": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createCmptInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createComponent", + value: function createComponent(options) { + return new _baidu.Component(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createComponent = createComponent; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createComponent(options) { + return _index2.default.createComponent(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _baidu = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createPgInterface": { + "createPage": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createPgInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createPage", + value: function createPage(options) { + return new _baidu.Page(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPage = createPage; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createPage(options) { + return _index2.default.createPage(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/core/OptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _MiniOptTransformer2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js"); + +var _MiniOptTransformer3 = _interopRequireDefault(_MiniOptTransformer2); + +var _wxMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-mixins.js"); + +var _wxMixins2 = _interopRequireDefault(_wxMixins); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var OptTransformer = function (_MiniOptTransformer) { + _inherits(OptTransformer, _MiniOptTransformer); + + function OptTransformer(props) { + _classCallCheck(this, OptTransformer); + + var _this = _possibleConstructorReturn(this, (OptTransformer.__proto__ || Object.getPrototypeOf(OptTransformer)).call(this, props)); + + _this.platform = 'baidu'; + _this.baseMixins = _wxMixins2.default.mixins; + _this.init(); + return _this; + } + + return OptTransformer; +}(_MiniOptTransformer3.default); + +exports.default = OptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _instance = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/instance/index.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _instance.App; + } +}); +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _instance.Page; + } +}); +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _instance.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/instance/app.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.App = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var App = exports.App = function (_BaseCtor) { + _inherits(App, _BaseCtor); + + function App(options) { + _classCallCheck(this, App); + + var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, options)); + + _this.cmlType = 'baidu'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('baidu.app.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'app', + builtinMixins: { + onLaunch: function onLaunch() { + // 初始化 + runtimeWidget.setContext(this).init().start('app-view-render'); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('baidu.app.hooks'), + hooksMap: _lifecycle2.default.get('baidu.app.hooksMap'), + polyHooks: _lifecycle2.default.get('baidu.app.polyHooks'), + usedHooks: _lifecycle2.default.get('baidu.app.usedHooks') + }); + + __CML__GLOBAL.App(_this.options); + return _this; + } + + return App; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/instance/component.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Component = exports.Component = function (_BaseCtor) { + _inherits(Component, _BaseCtor); + + function Component(options) { + _classCallCheck(this, Component); + + var _this = _possibleConstructorReturn(this, (Component.__proto__ || Object.getPrototypeOf(Component)).call(this, options)); + + _this.cmlType = 'baidu'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('baidu.component.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'component', + builtinMixins: { + created: function created() { + // 初始化 + runtimeWidget.setContext(this).init(); + // .addPageHooks() + }, + attached: function attached() { + runtimeWidget.setContext(this).start('component-view-render'); + }, + ready: function ready() { + runtimeWidget.setContext(this).initRefs(); + }, + detached: function detached() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + hooks: _lifecycle2.default.get('baidu.component.hooks'), + hooksMap: _lifecycle2.default.get('baidu.component.hooksMap'), + polyHooks: _lifecycle2.default.get('baidu.component.polyHooks'), + usedHooks: _lifecycle2.default.get('baidu.component.usedHooks'), + needPropsHandler: true, + needTransformProperties: true + }); + + __CML__GLOBAL.Component(_this.options); + return _this; + } + + return Component; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/instance/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _app = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/instance/app.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _app.App; + } +}); + +var _page = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/instance/page.js"); + +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _page.Page; + } +}); + +var _component = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/instance/component.js"); + +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _component.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/baidu/instance/page.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Page = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/baidu/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Page = exports.Page = function (_BaseCtor) { + _inherits(Page, _BaseCtor); + + function Page(options) { + _classCallCheck(this, Page); + + var _this = _possibleConstructorReturn(this, (Page.__proto__ || Object.getPrototypeOf(Page)).call(this, options)); + + _this.cmlType = 'baidu'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('baidu.page.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + options: _this.options, + type: 'page', + builtinMixins: { + onLoad: function onLoad() { + // 初始化 + runtimeWidget.setContext(this).init().start('page-view-render'); + }, + onReady: function onReady() { + runtimeWidget.setContext(this).initRefs(); + }, + onUnload: function onUnload() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('baidu.page.hooks'), + hooksMap: _lifecycle2.default.get('baidu.page.hooksMap'), + polyHooks: _lifecycle2.default.get('baidu.page.polyHooks'), + usedHooks: _lifecycle2.default.get('baidu.page.usedHooks') + }); + + __CML__GLOBAL.Page(_this.options); + return _this; + } + + return Page; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _proto = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/proto.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var BaseCtor = function () { + function BaseCtor(options) { + _classCallCheck(this, BaseCtor); + + // 拷贝原型链上属性 + (0, _proto.copyProtoProperty)(options); + + this.options = _extends({}, options); + this.originalOptions = options; + } + + _createClass(BaseCtor, [{ + key: 'initOptTransformer', + value: function initOptTransformer(OptTransformer, config) { + var optTransformer = new OptTransformer(_extends({ + options: this.options + }, config)); + this.options = optTransformer.getOptions(); + } + }, { + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseCtor; +}(); + +exports.default = BaseCtor; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _warn = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/warn.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// options transform 基类 +var BaseOptionsTransformer = function () { + function BaseOptionsTransformer(config) { + _classCallCheck(this, BaseOptionsTransformer); + + this.type = config.type; + this.options = config.options; + this.injectMixins = config.injectMixins || []; + this.builtinMixins = config.builtinMixins; + this.hooks = config.hooks; + this.hooksMap = config.hooksMap; + this.polyHooks = config.polyHooks; + this.usedHooks = config.usedHooks; + this.platform = ''; + + if (true) { + var mix = this.options.mixins; + (0, _warn.invariant)((0, _type.type)(mix) === 'Undefined' || (0, _type.type)(mix) === "Array", "mixins expects an Array"); + } + } + + _createClass(BaseOptionsTransformer, [{ + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseOptionsTransformer; +}(); + +exports.default = BaseOptionsTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _BaseOptionsTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js"); + +var _BaseOptionsTransformer2 = _interopRequireDefault(_BaseOptionsTransformer); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _resolve = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/resolve.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +// 各种小程序options transform 基类 +var MiniOptTransformer = function (_BaseOptionsTransform) { + _inherits(MiniOptTransformer, _BaseOptionsTransform); + + function MiniOptTransformer(config) { + _classCallCheck(this, MiniOptTransformer); + + //小程序特有 + var _this = _possibleConstructorReturn(this, (MiniOptTransformer.__proto__ || Object.getPrototypeOf(MiniOptTransformer)).call(this, config)); + + _this.needPropsHandler = config.needPropsHandler; + + _this.needResolveAttrs = config.needResolveAttrs; + _this.needTransformProperties = config.needTransformProperties; + return _this; + } + + _createClass(MiniOptTransformer, [{ + key: 'init', + value: function init() { + this.propsName = this.platform ? _KEY2.default.get(this.platform + '.props') : ''; + + this.needPropsHandler && this.initProps(this.options); + // 生命周期映射 + (0, _util.transferLifecycle)(this.options, this.hooksMap); + this.handleMixins(this.options); + + // 扩展各端多态生命周期 + this.extendPolyHooks(); + + // init 顺序很重要 + // this.mergeInjectedMixins() + this.mergeBuiltinMixins(); + this.resolveOptions(); + this.transformHooks(); + this.needResolveAttrs && this.resolveAttrs(); + this.needTransformProperties && this.transformProperties(); + + if (this.platform === 'alipay') { + delete this.options['computed']; + } + } + + /** + * 处理组件props属性 + * @param {Object} vmObj 组件options + * @return {[type]} [description] + */ + + }, { + key: 'initProps', + value: function initProps(vmObj) { + var _this2 = this; + + if (!vmObj['props']) return; + + Object.getOwnPropertyNames(vmObj['props']).forEach(function (name) { + var prop = vmObj['props'][name]; + // Number: 0 + // Boolean: false + // Array: false + // String: '' + // Object: null + // null: null + function make(type) { + if (!knowType(type)) { + return; + } + + switch (type) { + case Number: + prop = vmObj['props'][name] = { + type: Number, + default: 0 + }; + break; + case Boolean: + prop = vmObj['props'][name] = { + type: Boolean, + default: false + }; + break; + case Array: + prop = vmObj['props'][name] = { + type: Array, + default: [] + }; + break; + case String: + prop = vmObj['props'][name] = { + type: String, + default: '' + }; + break; + case Object: + prop = vmObj['props'][name] = { + type: Object, + default: null + }; + break; + case null: + prop = vmObj['props'][name] = { + type: null, + default: null + }; + break; + default: + break; + } + } + + function knowType(type) { + return type === Number || type === Boolean || type === Array || type === String || type === Object || type === null; + } + + // 处理 props = { a: String, b: Boolean } + make(prop); + + if ((0, _type.type)(prop) === 'Object') { + if (_this2.platform === 'alipay') { + if (!prop.hasOwnProperty('default')) { + // alipay 处理 // 处理 props = { a: {type:String}, b: {type:Boolean} } + make(prop.type); + } + + vmObj['props'][name] = prop['default']; + } else { + (0, _util.rename)(vmObj['props'][name], 'default', 'value'); + } + } + }); + + if (this.platform !== 'alipay') { + (0, _util.rename)(vmObj, 'props', 'properties'); + } + + function check(value, type) { + + if (typeof value === 'undefined') { + console.error(prop + '\u9700\u8981\u4F20\u9ED8\u8BA4\u503C'); + return false; + } + // todo type 校验 + } + } + }, { + key: 'handleMixins', + value: function handleMixins(VMObj) { + var _this3 = this; + + if (!VMObj.mixins) return; + + var mixins = VMObj.mixins; + + mixins.forEach(function (mix) { + // 生命周期映射 + (0, _util.transferLifecycle)(mix, _this3.hooksMap); + }); + } + + /** + * 小程序端差异化生命周期 hooks mixins + */ + + }, { + key: 'extendPolyHooks', + value: function extendPolyHooks() { + var _this4 = this; + + var methods = this.options.methods; + + if (!methods) { + return; + } + + this.polyHooks.forEach(function (hook) { + if ((0, _type.type)(methods[hook]) === 'Function') { + if ((0, _type.type)(_this4.options[hook]) === 'Array') { + _this4.options[hook].push(methods[hook]); + } else { + _this4.options[hook] = [methods[hook]]; + } + delete methods[hook]; + } + }); + } + }, { + key: 'mergeInjectedMixins', + value: function mergeInjectedMixins() { + this.options.mixins = this.options.mixins ? this.options.mixins.concat(this.injectMixins) : this.injectMixins; + } + }, { + key: 'mergeBuiltinMixins', + value: function mergeBuiltinMixins() { + var btMixin = [this.baseMixins, this.builtinMixins].filter(function (item) { + return item; + }); + + this.options.mixins = this.options.mixins ? btMixin.concat(this.options.mixins) : btMixin; + } + }, { + key: 'resolveOptions', + value: function resolveOptions() { + var self = this; + var extractMixins = function extractMixins(mOptions, options) { + if (options.mixins) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = options.mixins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var mix = _step.value; + + extractMixins(mOptions, mix); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + } + mergeMixins(mOptions, options); + }; + + var mergeMixins = function mergeMixins(parent, child) { + for (var key in child) { + if (self.hooks.indexOf(key) > -1) { + (0, _resolve.mergeHooks)(parent, child, key); + } else if (key === 'data') { + (0, _resolve.mergeData)(parent, child, key); + } else if (testProps(key)) { + (0, _resolve.mergeSimpleProps)(parent, child, key); + } else if (key === 'watch') { + (0, _resolve.mergeWatch)(parent, child, key); + } else if (key !== 'mixins') { + (0, _resolve.mergeDefault)(parent, child, key); + } + } + }; + + var testProps = function testProps(key) { + var regExp = new RegExp('computed|methods|proto|' + self.propsName); + return regExp.test(key); + }; + + var newOptions = {}; + extractMixins(newOptions, this.options); + this.options = newOptions; + } + }, { + key: 'transformHooks', + value: function transformHooks() { + if (!this.hooks || !this.hooks.length) return; + var self = this; + this.hooks.forEach(function (key) { + var hooksArr = self.options[key]; + hooksArr && (self.options[key] = function () { + var result = void 0; + var asyncQuene = []; + + // 多态生命周期需要统一回调参数 + // if (self.polyHooks.indexOf(key) > -1) { + // let res = args[0] + // if (type(res) !== 'Object') { + // res = { + // 'detail': args[0] + // } + // } + // args = [res] + // } + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if ((0, _type.type)(hooksArr) === 'Function') { + result = hooksArr.apply(this, args); + } else if ((0, _type.type)(hooksArr) === 'Array') { + for (var i = 0; i < hooksArr.length; i++) { + if ((0, _type.type)(hooksArr[i]) === 'Function') { + + result = hooksArr[i].apply(this, args); + + // if (result && result.enableAsync) { + // asyncQuene = hooksArr.slice(i + 1) + // break + // } + } + } + // Promise.resolve().then(() => { + // asyncQuene.forEach(fn => { + // fn.apply(this, args) + // }) + // }) + } + return result; + }); + }); + } + }, { + key: 'resolveAttrs', + value: function resolveAttrs() { + var _this5 = this; + + if (!this.needResolveAttrs.length) return; + var keys = this.needResolveAttrs; + if ((0, _type.type)(keys) === 'String') { + keys = [keys]; + } + + keys.forEach(function (key) { + var value = _this5.options[key]; + if ((0, _type.type)(value) !== 'Object') return; + + (0, _util.extendWithIgnore)(_this5.options, value, _this5.usedHooks); + delete _this5.options[key]; + }); + } + }, { + key: 'transformProperties', + value: function transformProperties() { + var originProperties = this.options[this.propsName]; + var newProps = {}; + + (0, _util.enumerableKeys)(originProperties).forEach(function (key) { + var rawFiled = originProperties[key]; + + var rawObserver = rawFiled.observer; + var newFiled = null; + if (typeof rawFiled === 'function') { + newFiled = { + type: rawFiled + }; + } else { + newFiled = (0, _util.extend)({}, rawFiled); + } + newFiled.observer = function (value, oldValue) { + // 小程序内部数据使用了JSON.parse(JSON.stringify(x))的方式,导致每次引用都会变化 + if (_mobx.extras.deepEqual(value, oldValue)) return; + this[key] = value; + typeof rawObserver === 'function' && rawObserver.call(this, value, oldValue); + }; + newProps[key] = newFiled; + }); + + this.options[this.propsName] = newProps; + } + }]); + + return MiniOptTransformer; +}(_BaseOptionsTransformer2.default); + +exports.default = MiniOptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _toJS = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/toJS.js"); + +var _toJS2 = _interopRequireDefault(_toJS); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +var _diff = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/diff.js"); + +var _diff2 = _interopRequireDefault(_diff); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var RuntimeWidget = function () { + function RuntimeWidget(config) { + _classCallCheck(this, RuntimeWidget); + + this.platform = config.platform || ''; + this.options = config.options; + this.polyHooks = config.polyHooks; + + this.propsName = _KEY2.default.get(this.platform + '.props'); + this.instance = _KEY2.default.get(this.platform + '.instance'); + } + + _createClass(RuntimeWidget, [{ + key: 'setOptions', + value: function setOptions(options) { + this.options = options; + } + }, { + key: 'setContext', + value: function setContext(context) { + this.context = context; + return this; + } + }, { + key: 'init', + value: function init() { + // 属性 + this.initData(); + + // 方法 + this.initInterface(); + + // 数据劫持 + this.proxyHandler(); + + // watch 属性mobx转换 + this.watchesHandler(); + return this; + } + }, { + key: 'initData', + value: function initData() { + if (!this.context) return; + var context = this.context; + context.__cml_originOptions__ = this.options; + // 清理函数列表 + context.__cml_disposerList__ = []; + // update后,回调函数收集器 + context.__cml_cbCollection__ = []; + + context['$cmlPolyHooks'] = this.polyHooks; + + // effect computed + context.__cml_computed__ = transformComputed(context); + + if (this.platform === 'alipay') { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.props, context.__cml_computed__); + } else { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.__cml_computed__); + } + } + + /** + * **给小程序增加refs功能** + * + * 在cml编译阶段给所有带有ref属性的元素添加 class="_cml_ref_lmc_" + * 通过在Page的onLoad阶段以及comoponent的attached阶段初始化当前实例的$refs (执行时机选定标准: 可以通过createSelectorQuery选取元素之后) + * $refs只提供id, 不提供其他属性, $refs本身初始化是在onLoad阶段, 此时获得的节点数据(例如top), 并不会随页面滚动进行变化. 所以意义不大 + * 通过this.$refs.ref获取元素class后在interface内部通过wxApi实时获取各元素信息 + */ + + }, { + key: 'initRefs', + value: function initRefs() { + if (!this.context) return; + var context = this.context; + var query = this.platform === 'alipay' ? this.instance.createSelectorQuery() : this.instance.createSelectorQuery().in(context); + + query.selectAll('._cml_ref_lmc_').boundingClientRect(); + query.exec(function (res) { + context.$refs = {}; + var doms = res[0]; + if (!doms) { + return; + } + for (var i = 0; i < doms.length; i++) { + var refItem = doms[i]; + context.$refs[refItem.id] = { + id: refItem.id + }; + } + }); + return this; + } + }, { + key: 'initInterface', + value: function initInterface() { + if (!this.context) return; + var context = this.context; + // 构造 watch 能力 + context.$watch = watchFnFactory(context); + + // 构造 updated callback 收集能力 + context.$collect = updatedCbFactory(context); + + // 构造数据更新能力 + context.$setData = setDataFactory(context, this); + + // 构造强制更新能力 + context.$forceUpdate = forceUpdateFactory(context); + } + }, { + key: 'proxyHandler', + value: function proxyHandler() { + if (!this.context) return; + var context = this.context; + context.__cml_ob_data__ = (0, _mobx.observable)(context.__cml_data__); + + var origComputed = context.__cml_originOptions__.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + /* 计算属性在mobx里面是不可枚举的,所以篡改下*/ + (0, _util.enumerable)(context.__cml_ob_data__, origComputedKeys); + + (0, _util.proxy)(context, context.__cml_ob_data__); + } + + /** + * watch 属性转换 + * @param {Object} context 上下文 + * @return {[type]} [description] + */ + + }, { + key: 'watchesHandler', + value: function watchesHandler() { + if (!this.context) return; + var context = this.context; + var options = context.__cml_originOptions__; + + var watches = options.watch; + + if ((0, _type.type)(watches) !== 'Object') { + return; + } + + (0, _util.enumerableKeys)(watches).forEach(function (key) { + var handler = watches[key]; + if ((0, _type.type)(handler) === 'Array') { + // mobx的reaction执行是倒序的,顾为保证watch正常次序,需倒序注册 + for (var i = handler.length - 1; i >= 0; i--) { + context.$watch(key, handler[i]); + } + } else { + context.$watch(key, handler); + } + }); + } + }, { + key: 'addPageHooks', + value: function addPageHooks() { + var context = this.context; + var originOptions = context.__cml_originOptions__; + // 使用createComponent创建page时,页面的事件直接写在options里是不生效的,必须注入到this上 + _lifecycle2.default.get(this.platform + '.page.hooks').forEach(function (key) { + if (typeof originOptions[key] === 'function') { + context[key] = originOptions[key]; + } + }); + } + /** + * 启动器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'start', + value: function start(name) { + if (!this.context) return; + var context = this.context; + // 渲染更新监听 + var disposer = autorunThrottle(context.$setData, name); + + context.__cml_disposerList__.push(disposer); + } + + /** + * 销毁器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'destory', + value: function destory() { + if (!this.context) return; + var context = this.context; + disposerFactory(context.__cml_disposerList__)(); + } + }]); + + return RuntimeWidget; +}(); + +/** + * watch 工厂函数 + * @param {[type]} context [description] + * @return {function} vm.$watch + */ + + +exports.default = RuntimeWidget; +function watchFnFactory(context) { + return function (expr, handler) { + var callback = handler.handler || handler; + var exprType = typeof expr === 'undefined' ? 'undefined' : _typeof(expr); + var curVal = void 0; + var oldVal = void 0; + if (!/^function|string$/.test(exprType)) { + console.warn(new Error('watch expression must be a string or function')); + return; + } + if (typeof callback !== 'function') { + console.warn(new Error('watch callback must be a function')); + return; + } + + /** + * [computed description] + * @return {[type]} [description] + */ + function dataExprFn() { + oldVal = curVal; + curVal = exprType === 'string' ? (0, _util.getByPath)(context, expr) : expr.call(context); + if (handler.deep) { + curVal = (0, _toJS2.default)(curVal, false); + } else if ((0, _mobx.isObservableArray)(curVal)) { + // 强制访问,让数组被观察 + curVal.peek(); + } + return curVal; + } + + function sideEffect(curVal, reaction) { + callback.call(context, curVal, oldVal); + } + + var options = { + fireImmediately: !!handler.immediate, + delay: handler.sync ? 0 : 1 + + // 返回清理函数 + };var disposer = (0, _mobx.reaction)(dataExprFn, sideEffect, options); + + context.__cml_disposerList__.push(disposer); + return disposerFactory(context.__cml_disposerList__, disposer); + }; +} +/** + * 清理函数构造工厂 + * @param {array} disposerList 清理函数列表 + * @param {function} disposer 清理函数 + * @return {function} 清理函数包装方法 + */ +function disposerFactory(disposerList, disposer) { + return function () { + if (disposer) { + var index = disposerList.indexOf(disposer); + index > -1 && disposerList.splice(index, 1); + disposer(); + } else { + var _disposer = void 0; + while (_disposer = disposerList.shift()) { + _disposer(); + } + } + }; +} + +/** + * 更新后回调 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function updatedCbFactory(context) { + return function (cb) { + context.__cml_cbCollection__.push(cb); + }; +} + +/** + * 设置数据工厂函数 + * @param {[type]} context [description] + */ +function setDataFactory(context, self) { + var _cached = false; + var cacheData = void 0; + + return function () { + var reaction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if ((0, _type.type)(reaction.schedule) !== 'Function') { + return; + } + // 缓存reaction + context.__cml_reaction__ = reaction; + + var properties = context.__cml_originOptions__[self.propsName]; + var propKeys = (0, _util.enumerableKeys)(properties); + + var obData = (0, _util.deleteProperties)(context.__cml_ob_data__, propKeys); + + // setData 的数据不包括 props + var data = (0, _toJS2.default)(obData); + + var diffV = void 0; + if (_cached) { + diffV = (0, _diff2.default)(data, cacheData); + + // emit 'beforeUpdate' hook ,第一次不触发 + emit('beforeUpdate', context, data, cacheData, diffV); + } else { + _cached = true; + diffV = data; + } + + update(diffV); + cacheData = _extends({}, data); + }; + + function update(diff) { + if ((0, _type.type)(context.setData) === 'Function') { + context.setData(diff, walkUpdatedCb(context)); + } + } +} + +function emit(name, context) { + var cmlVM = context.__cml_originOptions__; + + if (typeof cmlVM[name] === 'function') { + for (var _len = arguments.length, data = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + data[_key - 2] = arguments[_key]; + } + + cmlVM[name].apply(context, data); + } +} + +/** + * 执行更新后回调列表 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function walkUpdatedCb(context) { + // emit 'updated' hook + emit('updated', context); + + var cb = void 0; + var pendingList = context.__cml_cbCollection__.slice(0); + context.__cml_cbCollection__.length = 0; + while (cb = pendingList.shift()) { + typeof cb === 'function' && cb.apply(context); + } +} + +/** + * forceUpdate 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function forceUpdateFactory(context) { + return function (data, cb) { + + var dataType = (0, _type.type)(data); + if (dataType === 'Function') { + cb = data; + data = null; + } else if (dataType === 'Object') { + (0, _util.extend)(context.__cml_ob_data__, data); + } + + (0, _type.type)(cb) === 'Function' && context.$collect(cb); + + context.__cml_reaction__.dependenciesState = 2; + context.__cml_reaction__.schedule(); + }; +} + +/** + * computed 属性mobx转换 + * @param {Object} computedExpr 组件实例computed集合 + * @param {Object} context 上下文 + * @return {Object} 转换后computed + */ +function transformComputed(context) { + var options = context.__cml_originOptions__; + + var origComputed = options.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + + var newComputed = {}; + origComputedKeys.forEach(function (key) { + newComputed[key] = (0, _mobx.computed)(origComputed[key], { context: context }); + }); + + return newComputed; +} + +/** + * [autorunThrottle description] + * @param {[type]} fnc [description] + * @param {[type]} name [description] + * @return {function} unwatch函数 + */ +function autorunThrottle(fnc, name) { + // 首次同步执行,之后异步处理 + var isScheduled = false; + var first = true; + var r = new _mobx.Reaction(name, function () { + + if (!isScheduled) { + isScheduled = true; + if (first) { + reactionRunner(); + first = false; + } else { + setTimeout(reactionRunner, 0); + } + } + }); + function reactionRunner() { + isScheduled = false; + if (!r.isDisposed) { + r.track(function () { + + fnc(r); + }); + } + } + r.schedule(); + return r.getDisposer(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/KEY.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +var _api = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/api.interface"); + +var _api2 = _interopRequireDefault(_api); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var instanceAPI = _api2.default.getInstance(); + +var KEY = { + wx: { + instance: instanceAPI, + props: 'properties' + }, + alipay: { + instance: instanceAPI, + props: 'props' + }, + baidu: { + instance: instanceAPI, + props: 'properties' + } +}; + +exports.default = new _config2.default(KEY); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/api.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/platform/common/util/api.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getInstanceInterface": { + "getInstance": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["getInstanceInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getInstance", + value: function getInstance() { + return swan; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/config.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Config = function () { + function Config(data) { + _classCallCheck(this, Config); + + this.data = data; + } + + _createClass(Config, [{ + key: 'get', + value: function get() { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var def = arguments[1]; + + var result = this.data; + path.split('.').forEach(function (key) { + if (key && typeof result !== 'undefined') { + result = result[key]; + } + }); + if (typeof result !== 'undefined') { + return result; + } else { + return def; + } + } + }, { + key: 'set', + value: function set(path, value) { + if (typeof value === 'undefined') { + this.data = path; + } else { + path = String(path || '').trim(); + if (path) { + var paths = path.split('.'); + var last = paths.pop(); + var data = this.data || {}; + paths.forEach(function (key) { + var type = data[key]; + if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object') { + data = data[key]; + } else if (typeof type === 'undefined') { + data = data[key] = {}; + } else { + throw new Error('forbidden to set property[' + key + '] of [' + type + '] data'); + } + }); + data[last] = value; + } + } + } + }]); + + return Config; +}(); + +exports.default = Config; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/diff.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = diff; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function diff(current, old) { + var out = {}; + prefill(current, old); + iDiff(current, old, '', out); + + if (Object.keys(out).length === 1 && out[''] !== undefined) { + out = out['']; + } + + // console.log('diff------:', out) + return out; +} + +function prefill(current, old) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in old) { + var curVal = current[key]; + if (curVal === undefined) { + current[key] = ''; + } else { + prefill(curVal, old[key]); + } + } + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array') { + if (current.length >= old.length) { + old.forEach(function (item, index) { + prefill(current[index], item); + }); + } + } +} + +function iDiff(current, old, path, result) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in current) { + var curVal = current[key]; + var oldVal = old[key]; + + iDiff(curVal, oldVal, getPath(path, key), result); + } + } else { + update(current, path, result); + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array' && current.length >= old.length) { + current.forEach(function (item, index) { + iDiff(item, old[index], getPath(path, index, 'array'), result); + }); + } else { + update(current, path, result); + } +} + +function update(item, path, collection) { + if (item !== undefined) { + collection[path] = item; + } +} + +function getPath(pathStr, key, type) { + if (type === 'array') { + return pathStr + '[' + key + ']'; + } + + return isNum(key) ? pathStr + '[' + key + ']' : pathStr ? pathStr + '.' + key : key; +} + +function isNaN(value) { + var n = Number(value); + return n !== n; +} + +function isNum(value) { + return !isNaN(Number(value)); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var LIFECYCLE = { + web: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'], + hooksMap: { + 'viewappear': 'beforeRouteEnter', + 'viewdisappear': 'beforeRouteLeave' + }, + polyHooks: ['beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'] + }, + weex: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + }, + wx: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onShow', 'onReady', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached', 'moved'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: ['moved'] + } + }, + alipay: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'] + }, + component: { + hooks: ['didMount', 'didUnmount'], + hooksMap: { + 'beforeCreate': 'didMount', + 'created': 'didMount', + 'beforeMount': 'didMount', + 'mounted': 'didMount', + 'beforeDestroy': 'didUnmount', + 'destroyed': 'didUnmount' + }, + usedHooks: ['didMount', 'didUnmount'], + polyHooks: [] + } + }, + baidu: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: [] + } + }, + cml: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + } +}; + +exports.default = new _config2.default(LIFECYCLE); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/proto.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + //原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/resolve.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDefault = mergeDefault; +exports.mergeHooks = mergeHooks; +exports.mergeSimpleProps = mergeSimpleProps; +exports.mergeData = mergeData; +exports.mergeWatch = mergeWatch; + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function mergeDefault(parent, child, key) { + parent[key] = child[key]; +} + +function mergeHooks(parent, child, key) { + + var hasKeyParent = parent.hasOwnProperty(key); + var isArrayChild = (0, _type.type)(child[key]) === 'Array'; + + if (!hasKeyParent && !isArrayChild) { + parent[key] = [child[key]]; + } else if (!hasKeyParent && isArrayChild) { + parent[key] = child[key]; + } else if (hasKeyParent && !isArrayChild) { + parent[key].push(child[key]); + } else if (hasKeyParent && isArrayChild) { + parent[key] = parent[key].concat(child[key]); + } +} + +function mergeSimpleProps(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + if (!parentVal) { + parent[key] = parentVal = {}; + } + (0, _util.extend)(parentVal, childVal); +} + +function mergeData(parent, child, key) { + var childVal = child[key]; + if (!parent[key]) { + parent[key] = {}; + } + (0, _util.merge)(parent[key], childVal); +} + +function mergeWatch(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + var ret = []; + if (!parentVal) { + parent[key] = parentVal = {}; + } + Object.keys(childVal).forEach(function (key) { + if (key in parentVal) { + parentVal[key] = (0, _type.type)(parentVal[key]) !== 'Array' ? [parentVal[key], childVal[key]] : parentVal[key].concat([childVal[key]]); + } else { + parentVal[key] = childVal[key]; + } + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/style.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.styleHandle = styleHandle; +exports.pxTransform = pxTransform; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function styleHandle(source) { + var detectCycles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var __alreadySeen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + function cache(value) { + if (detectCycles) { + __alreadySeen.push([source, value]); + } + return value; + } + + if (detectCycles && __alreadySeen === null) { + __alreadySeen = []; + } + + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) { + return __alreadySeen[i][1]; + } + } + } + + if ((0, _type.type)(source) === 'Array') { + var res = cache([]); + var toAdd = source.map(function (value) { + return styleHandle(value, detectCycles, __alreadySeen); + }); + + res.length = toAdd.length; + for (var _i = 0, _l = toAdd.length; _i < _l; _i++) { + res[_i] = toAdd[_i]; + } + + return res; + } else if ((0, _type.type)(source) === 'Object') { + var _res = cache({}); + for (var key in source) { + _res[key] = styleHandle(source[key], detectCycles, __alreadySeen); + } + return _res; + } else if ((0, _type.type)(source) === 'String') { + return pxTransform(source); + } else { + return source; + } +} + +function pxTransform(s) { + if (!~s.indexOf('cpx')) { + return s; + } + + return s.replace(/(([\s:(]|^)-?)(\d*\.?\d+)cpx/ig, function (m) { + return m.replace('cpx', 'rpx'); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/toJS.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.default = toJS; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _style = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/style.js"); + +function toJS(source, detectCycles, __alreadySeen) { + var needPxTransfer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + if (detectCycles === void 0) { + detectCycles = true; + } + if (__alreadySeen === void 0) { + __alreadySeen = []; + } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) __alreadySeen.push([source, value]); + return value; + } + + if (detectCycles && __alreadySeen === null) __alreadySeen = []; + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) return __alreadySeen[i][1]; + } + } + + if ((0, _mobx.isObservable)(source)) { + if ((0, _mobx.isObservableArray)(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) { + res[i] = toAdd[i]; + }return res; + } + if ((0, _mobx.isObservableObject)(source)) { + var res = cache({}); + for (var key in source) { + res[key] = toJS(source[key], detectCycles, __alreadySeen); + }return res; + } + if ((0, _mobx.isObservableMap)(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { + return res_1[key] = toJS(value, detectCycles, __alreadySeen); + }); + return res_1; + } + if ((0, _mobx.isBoxedObservable)(source)) return toJS(source.get(), detectCycles, __alreadySeen); + } else { + if ((0, _type.type)(source) === 'Array') { + var _res = cache([]); + var _toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + + _res.length = _toAdd.length; + for (var _i = 0, _l = _toAdd.length; _i < _l; _i++) { + _res[_i] = _toAdd[_i]; + } + + return _res; + } else if ((0, _type.type)(source) === 'Object') { + var _res2 = cache({}); + for (var _key in source) { + _res2[_key] = toJS(source[_key], detectCycles, __alreadySeen); + } + return _res2; + } else if ((0, _type.type)(source) === 'String') { + // cpx to rpx + return needPxTransfer ? (0, _style.pxTransform)(source) : source; + } else { + return source; + } + } +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/type.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.isObject = isObject; +exports.isPlainObject = isPlainObject; + +var toString = Object.prototype.toString; + +function type(n) { + return toString.call(n).slice(8, -1); +} + +/** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ +function isObject(obj) { + return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; +} + +/** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ +function isPlainObject(obj) { + return type(obj) === 'Object'; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/util.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.propToFn = propToFn; +exports.transferLifecycle = transferLifecycle; +exports.rename = rename; +exports.normalizeMap = normalizeMap; +exports.merge = merge; +exports.extend = extend; +exports.extendWithIgnore = extendWithIgnore; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.enumerable = enumerable; +exports.proxy = proxy; +exports.deleteProperties = deleteProperties; +exports.enumerableKeys = enumerableKeys; +exports.flatten = flatten; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +// transfer 对象的`${name}`属性值 to function +function propToFn(obj, name) { + if (obj && (0, _type.isObject)(obj[name])) { + var _temp = obj[name]; + + if ((0, _type.isPlainObject)(_temp)) { + obj[name] = function () { + return _extends({}, _temp); + }; + } else { + obj[name] = function () { + return _temp; + }; + } + } +} + +/** + * 生命周期映射 + * @param {Object} VMObj vm对象 + * @param {Object} hooksMap 映射表 + * @return {Object} 修改后值 + */ +function transferLifecycle(VMObj, hooksMap) { + if (!hooksMap) { + return; + } + + var _hooksTemp = []; + var _mapTemp = {}; + // 将生命周期 键名 处理成 [`$_${key}`] + Object.keys(hooksMap).forEach(function (key) { + var uniKey = '$_' + key; + _hooksTemp.push(uniKey); + _mapTemp[uniKey] = hooksMap[key]; + + if (VMObj.hasOwnProperty(key)) { + VMObj[uniKey] = VMObj[key]; + delete VMObj[key]; + } + }); + + _hooksTemp.forEach(function (uniKey) { + var mapKey = _mapTemp[uniKey]; + var hook = VMObj[uniKey]; + + if (VMObj.hasOwnProperty(uniKey) && mapKey && hook) { + if (VMObj.hasOwnProperty(mapKey)) { + if ((0, _type.type)(VMObj[mapKey]) !== 'Array') { + VMObj[mapKey] = [VMObj[mapKey], hook]; + } else { + VMObj[mapKey].push(hook); + } + } else { + VMObj[mapKey] = [hook]; + } + delete VMObj[uniKey]; + } + }); +} + +/** + * 对象键名重定义 + * @param {Object} obj 对象 + * @param {String} oldKey 原键名 + * @param {String} newKey 新键名 + * @return {Object} 新对象 + */ +function rename(obj, oldKey, newKey) { + Object.getOwnPropertyNames(obj).forEach(function (key) { + if (key === oldKey) { + obj[newKey] = obj[key]; + delete obj[key]; + return obj; + } + }); + return obj; +} + +function normalizeMap(arr) { + if ((0, _type.type)(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function merge(to, from) { + if (!from) return to; + var key = void 0, + toVal = void 0, + fromVal = void 0; + var keys = Object.keys(from); + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + toVal = to[key]; + fromVal = from[key]; + if ((0, _type.type)(toVal) === 'Object' && (0, _type.type)(fromVal) === 'Object') { + merge(toVal, fromVal); + } else { + to[key] = fromVal; + } + } + return to; +} + +function extend(target) { + for (var _len = arguments.length, froms = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + froms[_key - 1] = arguments[_key]; + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = froms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var from = _step.value; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + target[key] = from[key]; + } + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return target; +} + +function extendWithIgnore(target, from) { + var ignore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + if (!~ignore.indexOf(key)) { + target[key] = from[key]; + } + } + } + return target; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = path[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var key = _step2.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function enumerable(target, keys) { + keys.forEach(function (key) { + var descriptor = Object.getOwnPropertyDescriptor(target, key); + if (!descriptor.enumerable) { + descriptor.enumerable = true; + Object.defineProperty(target, key, descriptor); + } + }); + return target; +} + +function proxy(target, source, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + enumerableKeys(source).forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +function deleteProperties(source) { + var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + if (!props.length) return source; + var sourceKeys = Object.keys(source); + var newData = {}; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = sourceKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var key = _step3.value; + + if (props.indexOf(key) < 0) { + newData[key] = source[key]; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + return newData; +} + +function enumerableKeys(obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + } + return keys; +} + +function flatten() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + + function check(str) { + if (!str) { + console.error('pathStr should not be null!'); + return false; + } + return true; + } + + function flattenRe(d) { + var pathStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if ((0, _type.type)(d) === 'Array') { + check(pathStr); + + d.forEach(function (item, i) { + var path = pathStr + '[' + i + ']'; + flattenRe(item, path); + }); + } else if ((0, _type.type)(d) === 'Object') { + Object.keys(d).forEach(function (k) { + var v = d[k]; + var path = pathStr ? pathStr + '.' + k : k; + flattenRe(v, path); + }); + } else { + check(pathStr); + ret[pathStr] = d; + } + } + + var ret = {}; + flattenRe(obj); + + return ret; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/warn.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fail = fail; +exports.invariant = invariant; +exports.deprecated = deprecated; +var OBFUSCATED_ERROR = exports.OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is an production build."; + +function fail(message) { + invariant(false, message); + throw "X"; // unreachable +} + +function invariant(check, message) { + if (!check) throw new Error("[chameleon-runtime] " + (message || OBFUSCATED_ERROR)); +} + +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; + +function deprecated(msg, thing) { + if (false) return false; + if (thing) { + return deprecated("'" + msg + "', use '" + thing + "' instead."); + } + if (deprecatedMessages.indexOf(msg) !== -1) return false; + deprecatedMessages.push(msg); + console.error("[chameleon-runtime] Deprecated: " + msg); + return true; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.js"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _index2.default; + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _baidu = __webpack_require__("./node_modules/chameleon-store/src/platform/baidu/index.js"); + +var _baidu2 = _interopRequireDefault(_baidu); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-store/src/interfaces/createStore/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createStoreInterface": { + "createStore": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createStoreInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createStore", + value: function createStore(options) { + return (0, _baidu2.default)(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createStore(options) { + return _index2.default.createStore(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/baidu/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mini = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/index.js"); + +var _mini2 = _interopRequireDefault(_mini); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _mini2.default; + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +var _mapStore = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/mapStore.js"); + +var _mapStore2 = _interopRequireDefault(_mapStore); + +var _transform = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/transform.js"); + +var _merge = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/merge.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function Store(options) { + options = (0, _merge.mergeDeps)(options); + this.getters = {}; + this.mutations = {}; + this.actions = {}; + this.state = this.registerModule('', options).state; + Object.assign(this, (0, _mapStore2.default)(this)); +} + +Store.prototype.dispatch = function (type) { + var action = (0, _util.getByPath)(this.actions, type); + if (!action) { + return Promise.reject(new Error('unknown action type: ' + type)); + } else { + for (var _len = arguments.length, payload = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + payload[_key - 1] = arguments[_key]; + } + + return action.apply(undefined, payload); + } +}; + +Store.prototype.commit = function (type) { + var mutation = (0, _util.getByPath)(this.mutations, type); + if (!mutation) { + console.warn(new Error('unknown mutation type: ' + type)); + } else { + for (var _len2 = arguments.length, payload = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + payload[_key2 - 1] = arguments[_key2]; + } + + return mutation.apply(undefined, payload); + } +}; + +Store.prototype.registerModule = function (path, module) { + var _this = this; + + var reactiveModuleOption = { + state: module.state || {} + }; + var reactiveModule = (0, _mobx.observable)(reactiveModuleOption); + if (module.getters) { + (0, _mobx.extendObservable)(reactiveModule, { + getters: (0, _transform.transformGetters)(module.getters, reactiveModule, this) + }); + // 使用proxy,保证store.getters的属性是可观察的 + (0, _util.proxy)(this.getters, reactiveModule.getters, Object.keys(module.getters), true); + } + if (module.mutations) { + Object.assign(this.mutations, (0, _transform.transformMutations)(module.mutations, reactiveModule, this)); + } + if (module.actions) { + Object.assign(this.actions, (0, _transform.transformActions)(module.actions, reactiveModule, this)); + } + if (module.modules) { + var childs = module.modules; + Object.keys(childs).forEach(function (key) { + (0, _mobx.extendObservable)(reactiveModule.state, _defineProperty({}, key, _this.registerModule('', childs[key]).state)); + }); + } + return reactiveModule; +}; + +function createStore() { + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return new (Function.prototype.bind.apply(Store, [null].concat(args)))(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/mapStore.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (store) { + return { + mapGetters: mapFactory('getters', store), + mapMutations: mapFactory('mutations', store), + mapActions: mapFactory('actions', store), + mapState: function mapState(maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + Object.keys(maps).forEach(function (key) { + var value = maps[key]; + result[key] = function () { + if (typeof value === 'function') { + return value.call(this, store.state, store.getters); + } else if (typeof value === 'string') { + return (0, _util.getByPath)(store.state, value); + } + }; + }); + return result; + } + }; +}; + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +function mapFactory(type, store) { + return function (maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + + var _loop = function _loop(key) { + result[key] = function (payload) { + var value = maps[key]; + if (type === 'mutations') { + return store.commit(value, payload); + } else if (type === 'actions') { + return store.dispatch(value, payload); + } else { + var getterVal = (0, _util.getByPath)(store.getters, value, '__NOTFOUND__'); + if (getterVal === '__NOTFOUND__') { + console.warn(new Error('not found getter named [' + value + ']')); + return ''; + } else { + return getterVal === undefined ? '' : getterVal; + } + } + }; + }; + + for (var key in maps) { + _loop(key); + } + return result; + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/merge.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDeps = mergeDeps; +function mergeDeps(options) { + var stores = options.deps; + if (!stores) return options; + var mergeProps = ['state', 'getters', 'mutations', 'actions']; + Object.keys(stores).forEach(function (key) { + var store = stores[key]; + mergeProps.forEach(function (prop) { + if (options[prop] && key in options[prop]) { + console.warn(new Error('deps\'s name: [' + key + '] conflicts with ' + prop + '\'s key in current options')); + } else { + options[prop] = options[prop] || {}; + options[prop][key] = store[prop]; + } + }); + }); + delete options.deps; + return options; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/transform.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transformGetters = transformGetters; +exports.transformMutations = transformMutations; +exports.transformActions = transformActions; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function transformGetters(getters, module, store) { + var newGetters = {}; + + var _loop = function _loop(key) { + if (key in store.getters) { + console.warn(new Error('duplicate getter type: ' + key)); + } + newGetters[key] = typeof getters[key] === 'function' ? (0, _mobx.computed)(function () { + return getters[key](module.state, store.getters, store.state); + }) : getters[key]; + }; + + for (var key in getters) { + _loop(key); + } + return newGetters; +} + +function transformMutations(mutations, module, store) { + var newMutations = {}; + + var _loop2 = function _loop2(key) { + if (store.mutations[key]) { + console.warn(new Error('duplicate mutation type: ' + key)); + } + newMutations[key] = typeof mutations[key] === 'function' ? (0, _mobx.action)(function () { + for (var _len = arguments.length, payload = Array(_len), _key = 0; _key < _len; _key++) { + payload[_key] = arguments[_key]; + } + + return mutations[key].apply(mutations, [module.state].concat(payload)); + }) : mutations[key]; + }; + + for (var key in mutations) { + _loop2(key); + } + return newMutations; +} + +function transformActions(actions, module, store) { + var newActions = {}; + + var _loop3 = function _loop3(key) { + if (store.actions[key]) { + console.warn(new Error('duplicate action type: ' + key)); + } + newActions[key] = typeof actions[key] === 'function' ? function () { + for (var _len2 = arguments.length, payload = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + payload[_key2] = arguments[_key2]; + } + + return Promise.resolve().then(function () { + return actions[key].apply(actions, [{ + rootState: store.state, + state: module.state, + getters: store.getters, + dispatch: store.dispatch.bind(store), + commit: store.commit.bind(store) + }].concat(payload)); + }); + } : actions[key]; + }; + + for (var key in actions) { + _loop3(key); + } + return newActions; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.normalizeMap = normalizeMap; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.proxy = proxy; +function type(n) { + return Object.prototype.toString.call(n).slice(8, -1); +} + +function normalizeMap(arr) { + if (type(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = path[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var key = _step.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function proxy(target, source, keys, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + keys.forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +/***/ }), + +/***/ "./node_modules/mobx/lib/mobx.module.js": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extras", function() { return extras; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reaction", function() { return Reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "untracked", function() { return untracked; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDerivationState", function() { return IDerivationState; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Atom", function() { return Atom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseAtom", function() { return BaseAtom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useStrict", function() { return useStrict; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isStrictModeEnabled", function() { return isStrictModeEnabled; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spy", function() { return spy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "comparer", function() { return comparer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asReference", function() { return asReference; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asFlat", function() { return asFlat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asStructure", function() { return asStructure; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asMap", function() { return asMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isModifierDescriptor", function() { return isModifierDescriptor; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableObject", function() { return isObservableObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBoxedObservable", function() { return isObservableValue; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableArray", function() { return isObservableArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObservableMap", function() { return ObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableMap", function() { return isObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return observable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computed", function() { return computed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return isObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isComputed", function() { return isComputed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendObservable", function() { return extendObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendShallowObservable", function() { return extendShallowObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observe", function() { return observe; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intercept", function() { return intercept; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorun", function() { return autorun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorunAsync", function() { return autorunAsync; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "when", function() { return when; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reaction", function() { return reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "action", function() { return action; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAction", function() { return isAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runInAction", function() { return runInAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expr", function() { return expr; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toJS", function() { return toJS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTransformer", function() { return createTransformer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "whyRun", function() { return whyRun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trace", function() { return trace; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return isArrayLike; }); +/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +/** + * Anything that can be used to _store_ state is an Atom in mobx. Atoms have two important jobs + * + * 1) detect when they are being _used_ and report this (using reportObserved). This allows mobx to make the connection between running functions and the data they used + * 2) they should notify mobx whenever they have _changed_. This way mobx can re-run any functions (derivations) that are using this atom. + */ +var BaseAtom = (function () { + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function BaseAtom(name) { + if (name === void 0) { name = "Atom@" + getNextId(); } + this.name = name; + this.isPendingUnobservation = true; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.NOT_TRACKING; + } + BaseAtom.prototype.onBecomeUnobserved = function () { + // noop + }; + /** + * Invoke this method to notify mobx that your atom has been used somehow. + */ + BaseAtom.prototype.reportObserved = function () { + reportObserved(this); + }; + /** + * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. + */ + BaseAtom.prototype.reportChanged = function () { + startBatch(); + propagateChanged(this); + endBatch(); + }; + BaseAtom.prototype.toString = function () { + return this.name; + }; + return BaseAtom; +}()); +var Atom = (function (_super) { + __extends(Atom, _super); + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function Atom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { + if (name === void 0) { name = "Atom@" + getNextId(); } + if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } + if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } + var _this = _super.call(this, name) || this; + _this.name = name; + _this.onBecomeObservedHandler = onBecomeObservedHandler; + _this.onBecomeUnobservedHandler = onBecomeUnobservedHandler; + _this.isPendingUnobservation = false; // for effective unobserving. + _this.isBeingTracked = false; + return _this; + } + Atom.prototype.reportObserved = function () { + startBatch(); + _super.prototype.reportObserved.call(this); + if (!this.isBeingTracked) { + this.isBeingTracked = true; + this.onBecomeObservedHandler(); + } + endBatch(); + return !!globalState.trackingDerivation; + // return doesn't really give useful info, because it can be as well calling computed which calls atom (no reactions) + // also it could not trigger when calculating reaction dependent on Atom because Atom's value was cached by computed called by given reaction. + }; + Atom.prototype.onBecomeUnobserved = function () { + this.isBeingTracked = false; + this.onBecomeUnobservedHandler(); + }; + return Atom; +}(BaseAtom)); +var isAtom = createInstanceofPredicate("Atom", BaseAtom); + +function hasInterceptors(interceptable) { + return interceptable.interceptors && interceptable.interceptors.length > 0; +} +function registerInterceptor(interceptable, handler) { + var interceptors = interceptable.interceptors || (interceptable.interceptors = []); + interceptors.push(handler); + return once(function () { + var idx = interceptors.indexOf(handler); + if (idx !== -1) + interceptors.splice(idx, 1); + }); +} +function interceptChange(interceptable, change) { + var prevU = untrackedStart(); + try { + var interceptors = interceptable.interceptors; + if (interceptors) + for (var i = 0, l = interceptors.length; i < l; i++) { + change = interceptors[i](change); + invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); + if (!change) + break; + } + return change; + } + finally { + untrackedEnd(prevU); + } +} + +function hasListeners(listenable) { + return listenable.changeListeners && listenable.changeListeners.length > 0; +} +function registerListener(listenable, handler) { + var listeners = listenable.changeListeners || (listenable.changeListeners = []); + listeners.push(handler); + return once(function () { + var idx = listeners.indexOf(handler); + if (idx !== -1) + listeners.splice(idx, 1); + }); +} +function notifyListeners(listenable, change) { + var prevU = untrackedStart(); + var listeners = listenable.changeListeners; + if (!listeners) + return; + listeners = listeners.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i](change); + } + untrackedEnd(prevU); +} + +function isSpyEnabled() { + return !!globalState.spyListeners.length; +} +function spyReport(event) { + if (!globalState.spyListeners.length) + return; + var listeners = globalState.spyListeners; + for (var i = 0, l = listeners.length; i < l; i++) + listeners[i](event); +} +function spyReportStart(event) { + var change = objectAssign({}, event, { spyReportStart: true }); + spyReport(change); +} +var END_EVENT = { spyReportEnd: true }; +function spyReportEnd(change) { + if (change) + spyReport(objectAssign({}, change, END_EVENT)); + else + spyReport(END_EVENT); +} +function spy(listener) { + globalState.spyListeners.push(listener); + return once(function () { + var idx = globalState.spyListeners.indexOf(listener); + if (idx !== -1) + globalState.spyListeners.splice(idx, 1); + }); +} + +function iteratorSymbol() { + return (typeof Symbol === "function" && Symbol.iterator) || "@@iterator"; +} +var IS_ITERATING_MARKER = "__$$iterating"; +function arrayAsIterator(array) { + // returning an array for entries(), values() etc for maps was a mis-interpretation of the specs.., + // yet it is quite convenient to be able to use the response both as array directly and as iterator + // it is suboptimal, but alas... + invariant(array[IS_ITERATING_MARKER] !== true, "Illegal state: cannot recycle array as iterator"); + addHiddenFinalProp(array, IS_ITERATING_MARKER, true); + var idx = -1; + addHiddenFinalProp(array, "next", function next() { + idx++; + return { + done: idx >= this.length, + value: idx < this.length ? this[idx] : undefined + }; + }); + return array; +} +function declareIterator(prototType, iteratorFactory) { + addHiddenFinalProp(prototType, iteratorSymbol(), iteratorFactory); +} + +var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859 +// Detects bug in safari 9.1.1 (or iOS 9 safari mobile). See #364 +var safariPrototypeSetterInheritanceBug = (function () { + var v = false; + var p = {}; + Object.defineProperty(p, "0", { + set: function () { + v = true; + } + }); + Object.create(p)["0"] = 1; + return v === false; +})(); +/** + * This array buffer contains two lists of properties, so that all arrays + * can recycle their property definitions, which significantly improves performance of creating + * properties on the fly. + */ +var OBSERVABLE_ARRAY_BUFFER_SIZE = 0; +// Typescript workaround to make sure ObservableArray extends Array +var StubArray = (function () { + function StubArray() { + } + return StubArray; +}()); +function inherit(ctor, proto) { + if (typeof Object["setPrototypeOf"] !== "undefined") { + Object["setPrototypeOf"](ctor.prototype, proto); + } + else if (typeof ctor.prototype.__proto__ !== "undefined") { + ctor.prototype.__proto__ = proto; + } + else { + ctor["prototype"] = proto; + } +} +inherit(StubArray, Array.prototype); +// Weex freeze Array.prototype +// Make them writeable and configurable in prototype chain +// https://github.com/alibaba/weex/pull/1529 +if (Object.isFrozen(Array)) { + + [ + "constructor", + "push", + "shift", + "concat", + "pop", + "unshift", + "replace", + "find", + "findIndex", + "splice", + "reverse", + "sort" + ].forEach(function (key) { + Object.defineProperty(StubArray.prototype, key, { + configurable: true, + writable: true, + value: Array.prototype[key] + }); + }); +} +var ObservableArrayAdministration = (function () { + function ObservableArrayAdministration(name, enhancer, array, owned) { + this.array = array; + this.owned = owned; + this.values = []; + this.lastKnownLength = 0; + this.interceptors = null; + this.changeListeners = null; + this.atom = new BaseAtom(name || "ObservableArray@" + getNextId()); + this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); }; + } + ObservableArrayAdministration.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableArrayAdministration.prototype.dehanceValues = function (values) { + if (this.dehancer !== undefined) + return values.map(this.dehancer); + return values; + }; + ObservableArrayAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + if (fireImmediately) { + listener({ + object: this.array, + type: "splice", + index: 0, + added: this.values.slice(), + addedCount: this.values.length, + removed: [], + removedCount: 0 + }); + } + return registerListener(this, listener); + }; + ObservableArrayAdministration.prototype.getArrayLength = function () { + this.atom.reportObserved(); + return this.values.length; + }; + ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { + if (typeof newLength !== "number" || newLength < 0) + throw new Error("[mobx.array] Out of range: " + newLength); + var currentLength = this.values.length; + if (newLength === currentLength) + return; + else if (newLength > currentLength) { + var newItems = new Array(newLength - currentLength); + for (var i = 0; i < newLength - currentLength; i++) + newItems[i] = undefined; // No Array.fill everywhere... + this.spliceWithArray(currentLength, 0, newItems); + } + else + this.spliceWithArray(newLength, currentLength - newLength); + }; + // adds / removes the necessary numeric properties to this object + ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { + if (oldLength !== this.lastKnownLength) + throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?"); + this.lastKnownLength += delta; + if (delta > 0 && oldLength + delta + 1 > OBSERVABLE_ARRAY_BUFFER_SIZE) + reserveArrayBuffer(oldLength + delta + 1); + }; + ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { + var _this = this; + checkIfStateModificationsAreAllowed(this.atom); + var length = this.values.length; + if (index === undefined) + index = 0; + else if (index > length) + index = length; + else if (index < 0) + index = Math.max(0, length + index); + if (arguments.length === 1) + deleteCount = length - index; + else if (deleteCount === undefined || deleteCount === null) + deleteCount = 0; + else + deleteCount = Math.max(0, Math.min(deleteCount, length - index)); + if (newItems === undefined) + newItems = []; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this.array, + type: "splice", + index: index, + removedCount: deleteCount, + added: newItems + }); + if (!change) + return EMPTY_ARRAY; + deleteCount = change.removedCount; + newItems = change.added; + } + newItems = newItems.map(function (v) { return _this.enhancer(v, undefined); }); + var lengthDelta = newItems.length - deleteCount; + this.updateArrayLength(length, lengthDelta); // create or remove new entries + var res = this.spliceItemsIntoValues(index, deleteCount, newItems); + if (deleteCount !== 0 || newItems.length !== 0) + this.notifyArraySplice(index, newItems, res); + return this.dehanceValues(res); + }; + ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { + if (newItems.length < MAX_SPLICE_SIZE) { + return (_a = this.values).splice.apply(_a, [index, deleteCount].concat(newItems)); + } + else { + var res = this.values.slice(index, index + deleteCount); + this.values = this.values + .slice(0, index) + .concat(newItems, this.values.slice(index + deleteCount)); + return res; + } + var _a; + }; + ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "update", + index: index, + newValue: newValue, + oldValue: oldValue + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "splice", + index: index, + removed: removed, + added: added, + removedCount: removed.length, + addedCount: added.length + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + return ObservableArrayAdministration; +}()); +var ObservableArray = (function (_super) { + __extends(ObservableArray, _super); + function ObservableArray(initialValues, enhancer, name, owned) { + if (name === void 0) { name = "ObservableArray@" + getNextId(); } + if (owned === void 0) { owned = false; } + var _this = _super.call(this) || this; + var adm = new ObservableArrayAdministration(name, enhancer, _this, owned); + addHiddenFinalProp(_this, "$mobx", adm); + if (initialValues && initialValues.length) { + _this.spliceWithArray(0, 0, initialValues); + } + if (safariPrototypeSetterInheritanceBug) { + // Seems that Safari won't use numeric prototype setter untill any * numeric property is + // defined on the instance. After that it works fine, even if this property is deleted. + Object.defineProperty(adm.array, "0", ENTRY_0); + } + return _this; + } + ObservableArray.prototype.intercept = function (handler) { + return this.$mobx.intercept(handler); + }; + ObservableArray.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + return this.$mobx.observe(listener, fireImmediately); + }; + ObservableArray.prototype.clear = function () { + return this.splice(0); + }; + ObservableArray.prototype.concat = function () { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + this.$mobx.atom.reportObserved(); + return Array.prototype.concat.apply(this.peek(), arrays.map(function (a) { return (isObservableArray(a) ? a.peek() : a); })); + }; + ObservableArray.prototype.replace = function (newItems) { + return this.$mobx.spliceWithArray(0, this.$mobx.values.length, newItems); + }; + /** + * Converts this array back to a (shallow) javascript structure. + * For a deep clone use mobx.toJS + */ + ObservableArray.prototype.toJS = function () { + return this.slice(); + }; + ObservableArray.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableArray.prototype.peek = function () { + this.$mobx.atom.reportObserved(); + return this.$mobx.dehanceValues(this.$mobx.values); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find + ObservableArray.prototype.find = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var idx = this.findIndex.apply(this, arguments); + return idx === -1 ? undefined : this.get(idx); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex + ObservableArray.prototype.findIndex = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var items = this.peek(), l = items.length; + for (var i = fromIndex; i < l; i++) + if (predicate.call(thisArg, items[i], i, this)) + return i; + return -1; + }; + /* + * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) + * since these functions alter the inner structure of the array, the have side effects. + * Because the have side effects, they should not be used in computed function, + * and for that reason the do not call dependencyState.notifyObserved + */ + ObservableArray.prototype.splice = function (index, deleteCount) { + var newItems = []; + for (var _i = 2; _i < arguments.length; _i++) { + newItems[_i - 2] = arguments[_i]; + } + switch (arguments.length) { + case 0: + return []; + case 1: + return this.$mobx.spliceWithArray(index); + case 2: + return this.$mobx.spliceWithArray(index, deleteCount); + } + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.spliceWithArray = function (index, deleteCount, newItems) { + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.push = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(adm.values.length, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.pop = function () { + return this.splice(Math.max(this.$mobx.values.length - 1, 0), 1)[0]; + }; + ObservableArray.prototype.shift = function () { + return this.splice(0, 1)[0]; + }; + ObservableArray.prototype.unshift = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(0, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.reverse = function () { + // reverse by default mutates in place before returning the result + // which makes it both a 'derivation' and a 'mutation'. + // so we deviate from the default and just make it an dervitation + var clone = this.slice(); + return clone.reverse.apply(clone, arguments); + }; + ObservableArray.prototype.sort = function (compareFn) { + // sort by default mutates in place before returning the result + // which goes against all good practices. Let's not change the array in place! + var clone = this.slice(); + return clone.sort.apply(clone, arguments); + }; + ObservableArray.prototype.remove = function (value) { + var idx = this.$mobx.dehanceValues(this.$mobx.values).indexOf(value); + if (idx > -1) { + this.splice(idx, 1); + return true; + } + return false; + }; + ObservableArray.prototype.move = function (fromIndex, toIndex) { + function checkIndex(index) { + if (index < 0) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is negative"); + } + var length = this.$mobx.values.length; + if (index >= length) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is not smaller than " + length); + } + } + checkIndex.call(this, fromIndex); + checkIndex.call(this, toIndex); + if (fromIndex === toIndex) { + return; + } + var oldItems = this.$mobx.values; + var newItems; + if (fromIndex < toIndex) { + newItems = oldItems.slice(0, fromIndex).concat(oldItems.slice(fromIndex + 1, toIndex + 1), [ + oldItems[fromIndex] + ], oldItems.slice(toIndex + 1)); + } + else { + // toIndex < fromIndex + newItems = oldItems.slice(0, toIndex).concat([ + oldItems[fromIndex] + ], oldItems.slice(toIndex, fromIndex), oldItems.slice(fromIndex + 1)); + } + this.replace(newItems); + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.get = function (index) { + var impl = this.$mobx; + if (impl) { + if (index < impl.values.length) { + impl.atom.reportObserved(); + return impl.dehanceValue(impl.values[index]); + } + console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + impl + .values + .length + "). Please check length first. Out of bound indices will not be tracked by MobX"); + } + return undefined; + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.set = function (index, newValue) { + var adm = this.$mobx; + var values = adm.values; + if (index < values.length) { + // update at index in range + checkIfStateModificationsAreAllowed(adm.atom); + var oldValue = values[index]; + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: this, + index: index, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = adm.enhancer(newValue, oldValue); + var changed = newValue !== oldValue; + if (changed) { + values[index] = newValue; + adm.notifyArrayChildUpdate(index, newValue, oldValue); + } + } + else if (index === values.length) { + // add a new item + adm.spliceWithArray(index, 0, [newValue]); + } + else { + // out of bounds + throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); + } + }; + return ObservableArray; +}(StubArray)); +declareIterator(ObservableArray.prototype, function () { + return arrayAsIterator(this.slice()); +}); +Object.defineProperty(ObservableArray.prototype, "length", { + enumerable: false, + configurable: true, + get: function () { + return this.$mobx.getArrayLength(); + }, + set: function (newLength) { + this.$mobx.setArrayLength(newLength); + } +}); +[ + "every", + "filter", + "forEach", + "indexOf", + "join", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some", + "toString", + "toLocaleString" +].forEach(function (funcName) { + var baseFunc = Array.prototype[funcName]; + invariant(typeof baseFunc === "function", "Base function not defined on Array prototype: '" + funcName + "'"); + addHiddenProp(ObservableArray.prototype, funcName, function () { + return baseFunc.apply(this.peek(), arguments); + }); +}); +/** + * We don't want those to show up in `for (const key in ar)` ... + */ +makeNonEnumerable(ObservableArray.prototype, [ + "constructor", + "intercept", + "observe", + "clear", + "concat", + "get", + "replace", + "toJS", + "toJSON", + "peek", + "find", + "findIndex", + "splice", + "spliceWithArray", + "push", + "pop", + "set", + "shift", + "unshift", + "reverse", + "sort", + "remove", + "move", + "toString", + "toLocaleString" +]); +// See #364 +var ENTRY_0 = createArrayEntryDescriptor(0); +function createArrayEntryDescriptor(index) { + return { + enumerable: false, + configurable: false, + get: function () { + // TODO: Check `this`?, see #752? + return this.get(index); + }, + set: function (value) { + this.set(index, value); + } + }; +} +function createArrayBufferItem(index) { + Object.defineProperty(ObservableArray.prototype, "" + index, createArrayEntryDescriptor(index)); +} +function reserveArrayBuffer(max) { + for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max; index++) + createArrayBufferItem(index); + OBSERVABLE_ARRAY_BUFFER_SIZE = max; +} +reserveArrayBuffer(1000); +var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); +function isObservableArray(thing) { + return isObject(thing) && isObservableArrayAdministration(thing.$mobx); +} + +var UNCHANGED = {}; +var ObservableValue = (function (_super) { + __extends(ObservableValue, _super); + function ObservableValue(value, enhancer, name, notifySpy) { + if (name === void 0) { name = "ObservableValue@" + getNextId(); } + if (notifySpy === void 0) { notifySpy = true; } + var _this = _super.call(this, name) || this; + _this.enhancer = enhancer; + _this.hasUnreportedChange = false; + _this.dehancer = undefined; + _this.value = enhancer(value, undefined, name); + if (notifySpy && isSpyEnabled()) { + // only notify spy if this is a stand-alone observable + spyReport({ type: "create", object: _this, newValue: _this.value }); + } + return _this; + } + ObservableValue.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableValue.prototype.set = function (newValue) { + var oldValue = this.value; + newValue = this.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + if (notifySpy) { + spyReportStart({ + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + this.setNewValue(newValue); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableValue.prototype.prepareNewValue = function (newValue) { + checkIfStateModificationsAreAllowed(this); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this, + type: "update", + newValue: newValue + }); + if (!change) + return UNCHANGED; + newValue = change.newValue; + } + // apply modifier + newValue = this.enhancer(newValue, this.value, this.name); + return this.value !== newValue ? newValue : UNCHANGED; + }; + ObservableValue.prototype.setNewValue = function (newValue) { + var oldValue = this.value; + this.value = newValue; + this.reportChanged(); + if (hasListeners(this)) { + notifyListeners(this, { + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + }; + ObservableValue.prototype.get = function () { + this.reportObserved(); + return this.dehanceValue(this.value); + }; + ObservableValue.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableValue.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately) + listener({ + object: this, + type: "update", + newValue: this.value, + oldValue: undefined + }); + return registerListener(this, listener); + }; + ObservableValue.prototype.toJSON = function () { + return this.get(); + }; + ObservableValue.prototype.toString = function () { + return this.name + "[" + this.value + "]"; + }; + ObservableValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + return ObservableValue; +}(BaseAtom)); +ObservableValue.prototype[primitiveSymbol()] = ObservableValue.prototype.valueOf; +var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); + +var messages = { + m001: "It is not allowed to assign new values to @action fields", + m002: "`runInAction` expects a function", + m003: "`runInAction` expects a function without arguments", + m004: "autorun expects a function", + m005: "Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m006: "Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m007: "reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object", + m008: "wrapping reaction expression in `asReference` is no longer supported, use options object instead", + m009: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.", + m010: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'", + m011: "First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments", + m012: "computed takes one or two arguments if used as function", + m013: "[mobx.expr] 'expr' should only be used inside other reactive functions.", + m014: "extendObservable expected 2 or more arguments", + m015: "extendObservable expects an object as first argument", + m016: "extendObservable should not be used on maps, use map.merge instead", + m017: "all arguments of extendObservable should be objects", + m018: "extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540", + m019: "[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.", + m020: "modifiers can only be used for individual object properties", + m021: "observable expects zero or one arguments", + m022: "@observable can not be used on getters, use @computed instead", + m024: "whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.", + m025: "whyRun can only be used on reactions and computed values", + m026: "`action` can only be invoked on functions", + m028: "It is not allowed to set `useStrict` when a derivation is running", + m029: "INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row", + m030a: "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ", + m030b: "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ", + m031: "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ", + m032: "* This computation is suspended (not in use by any reaction) and won't run automatically.\n Didn't expect this computation to be suspended at this point?\n 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).", + m033: "`observe` doesn't support the fire immediately property for observable maps.", + m034: "`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead", + m035: "Cannot make the designated object observable; it is not extensible", + m036: "It is not possible to get index atoms from arrays", + m037: "Hi there! I'm sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle \"(...)\" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error(\"Oops\")` instead of `throw \"Oops\"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling \"Pause on caught exception\".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn't help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n", + m038: "Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n" +}; +function getMessage(id) { + return messages[id]; +} + +function createAction(actionName, fn) { + invariant(typeof fn === "function", getMessage("m026")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + var res = function () { + return executeAction(actionName, fn, this, arguments); + }; + res.originalFn = fn; + res.isMobxAction = true; + return res; +} +function executeAction(actionName, fn, scope, args) { + var runInfo = startAction(actionName, fn, scope, args); + try { + return fn.apply(scope, args); + } + finally { + endAction(runInfo); + } +} +function startAction(actionName, fn, scope, args) { + var notifySpy = isSpyEnabled() && !!actionName; + var startTime = 0; + if (notifySpy) { + startTime = Date.now(); + var l = (args && args.length) || 0; + var flattendArgs = new Array(l); + if (l > 0) + for (var i = 0; i < l; i++) + flattendArgs[i] = args[i]; + spyReportStart({ + type: "action", + name: actionName, + fn: fn, + object: scope, + arguments: flattendArgs + }); + } + var prevDerivation = untrackedStart(); + startBatch(); + var prevAllowStateChanges = allowStateChangesStart(true); + return { + prevDerivation: prevDerivation, + prevAllowStateChanges: prevAllowStateChanges, + notifySpy: notifySpy, + startTime: startTime + }; +} +function endAction(runInfo) { + allowStateChangesEnd(runInfo.prevAllowStateChanges); + endBatch(); + untrackedEnd(runInfo.prevDerivation); + if (runInfo.notifySpy) + spyReportEnd({ time: Date.now() - runInfo.startTime }); +} +function useStrict(strict) { + invariant(globalState.trackingDerivation === null, getMessage("m028")); + globalState.strictMode = strict; + globalState.allowStateChanges = !strict; +} +function isStrictModeEnabled() { + return globalState.strictMode; +} +function allowStateChanges(allowStateChanges, func) { + // TODO: deprecate / refactor this function in next major + // Currently only used by `@observer` + // Proposed change: remove first param, rename to `forbidStateChanges`, + // require error callback instead of the hardcoded error message now used + // Use `inAction` instead of allowStateChanges in derivation.ts to check strictMode + var prev = allowStateChangesStart(allowStateChanges); + var res; + try { + res = func(); + } + finally { + allowStateChangesEnd(prev); + } + return res; +} +function allowStateChangesStart(allowStateChanges) { + var prev = globalState.allowStateChanges; + globalState.allowStateChanges = allowStateChanges; + return prev; +} +function allowStateChangesEnd(prev) { + globalState.allowStateChanges = prev; +} + +/** + * Constructs a decorator, that normalizes the differences between + * TypeScript and Babel. Mainly caused by the fact that legacy-decorator cannot assign + * values during instance creation to properties that have a getter setter. + * + * - Sigh - + * + * Also takes care of the difference between @decorator field and @decorator(args) field, and different forms of values. + * For performance (cpu and mem) reasons the properties are always defined on the prototype (at least initially). + * This means that these properties despite being enumerable might not show up in Object.keys() (but they will show up in for...in loops). + */ +function createClassPropertyDecorator( + /** + * This function is invoked once, when the property is added to a new instance. + * When this happens is not strictly determined due to differences in TS and Babel: + * Typescript: Usually when constructing the new instance + * Babel, sometimes Typescript: during the first get / set + * Both: when calling `runLazyInitializers(instance)` + */ + onInitialize, get, set, enumerable, + /** + * Can this decorator invoked with arguments? e.g. @decorator(args) + */ + allowCustomArguments) { + function classPropertyDecorator(target, key, descriptor, customArgs, argLen) { + if (argLen === void 0) { argLen = 0; } + invariant(allowCustomArguments || quacksLikeADecorator(arguments), "This function is a decorator, but it wasn't invoked like a decorator"); + if (!descriptor) { + // typescript (except for getter / setters) + var newDescriptor = { + enumerable: enumerable, + configurable: true, + get: function () { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) + typescriptInitializeProperty(this, key, undefined, onInitialize, customArgs, descriptor); + return get.call(this, key); + }, + set: function (v) { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) { + typescriptInitializeProperty(this, key, v, onInitialize, customArgs, descriptor); + } + else { + set.call(this, key, v); + } + } + }; + if (arguments.length < 3 || (arguments.length === 5 && argLen < 3)) { + // Typescript target is ES3, so it won't define property for us + // or using Reflect.decorate polyfill, which will return no descriptor + // (see https://github.com/mobxjs/mobx/issues/333) + Object.defineProperty(target, key, newDescriptor); + } + return newDescriptor; + } + else { + // babel and typescript getter / setter props + if (!hasOwnProperty(target, "__mobxLazyInitializers")) { + addHiddenProp(target, "__mobxLazyInitializers", (target.__mobxLazyInitializers && target.__mobxLazyInitializers.slice()) || [] // support inheritance + ); + } + var value_1 = descriptor.value, initializer_1 = descriptor.initializer; + target.__mobxLazyInitializers.push(function (instance) { + onInitialize(instance, key, initializer_1 ? initializer_1.call(instance) : value_1, customArgs, descriptor); + }); + return { + enumerable: enumerable, + configurable: true, + get: function () { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + return get.call(this, key); + }, + set: function (v) { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + set.call(this, key, v); + } + }; + } + } + if (allowCustomArguments) { + /** If custom arguments are allowed, we should return a function that returns a decorator */ + return function () { + /** Direct invocation: @decorator bla */ + if (quacksLikeADecorator(arguments)) + return classPropertyDecorator.apply(null, arguments); + /** Indirect invocation: @decorator(args) bla */ + var outerArgs = arguments; + var argLen = arguments.length; + return function (target, key, descriptor) { + return classPropertyDecorator(target, key, descriptor, outerArgs, argLen); + }; + }; + } + return classPropertyDecorator; +} +function typescriptInitializeProperty(instance, key, v, onInitialize, customArgs, baseDescriptor) { + if (!hasOwnProperty(instance, "__mobxInitializedProps")) + addHiddenProp(instance, "__mobxInitializedProps", {}); + instance.__mobxInitializedProps[key] = true; + onInitialize(instance, key, v, customArgs, baseDescriptor); +} +function runLazyInitializers(instance) { + if (instance.__mobxDidRunLazyInitializers === true) + return; + if (instance.__mobxLazyInitializers) { + addHiddenProp(instance, "__mobxDidRunLazyInitializers", true); + instance.__mobxDidRunLazyInitializers && + instance.__mobxLazyInitializers.forEach(function (initializer) { return initializer(instance); }); + } +} +function quacksLikeADecorator(args) { + return (args.length === 2 || args.length === 3) && typeof args[1] === "string"; +} + +var actionFieldDecorator = createClassPropertyDecorator(function (target, key, value, args, originalDescriptor) { + var actionName = args && args.length === 1 ? args[0] : value.name || key || ""; + var wrappedAction = action(actionName, value); + addHiddenProp(target, key, wrappedAction); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, true); +var boundActionDecorator = createClassPropertyDecorator(function (target, key, value) { + defineBoundAction(target, key, value); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, false); +var action = function action(arg1, arg2, arg3, arg4) { + if (arguments.length === 1 && typeof arg1 === "function") + return createAction(arg1.name || "", arg1); + if (arguments.length === 2 && typeof arg2 === "function") + return createAction(arg1, arg2); + if (arguments.length === 1 && typeof arg1 === "string") + return namedActionDecorator(arg1); + return namedActionDecorator(arg2).apply(null, arguments); +}; +action.bound = function boundAction(arg1, arg2, arg3) { + if (typeof arg1 === "function") { + var action_1 = createAction("", arg1); + action_1.autoBind = true; + return action_1; + } + return boundActionDecorator.apply(null, arguments); +}; +function namedActionDecorator(name) { + return function (target, prop, descriptor) { + if (descriptor && typeof descriptor.value === "function") { + // TypeScript @action method() { }. Defined on proto before being decorated + // Don't use the field decorator if we are just decorating a method + descriptor.value = createAction(name, descriptor.value); + descriptor.enumerable = false; + descriptor.configurable = true; + return descriptor; + } + if (descriptor !== undefined && descriptor.get !== undefined) { + throw new Error("[mobx] action is not expected to be used with getters"); + } + // bound instance methods + return actionFieldDecorator(name).apply(this, arguments); + }; +} +function runInAction(arg1, arg2, arg3) { + var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; + var fn = typeof arg1 === "function" ? arg1 : arg2; + var scope = typeof arg1 === "function" ? arg2 : arg3; + invariant(typeof fn === "function", getMessage("m002")); + invariant(fn.length === 0, getMessage("m003")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + return executeAction(actionName, fn, scope, undefined); +} +function isAction(thing) { + return typeof thing === "function" && thing.isMobxAction === true; +} +function defineBoundAction(target, propertyName, fn) { + var res = function () { + return executeAction(propertyName, fn, target, arguments); + }; + res.isMobxAction = true; + addHiddenProp(target, propertyName, res); +} + +// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 +function deepEqual(a, b) { + return eq(a, b); +} +// Internal recursive comparison function for `isEqual`. +function eq(a, b, aStack, bStack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). + if (a === b) + return a !== 0 || 1 / a === 1 / b; + // `null` or `undefined` only equal to itself (strict comparison). + if (a == null || b == null) + return false; + // `NaN`s are equivalent, but non-reflexive. + if (a !== a) + return b !== b; + // Exhaust primitive checks + var type = typeof a; + if (type !== "function" && type !== "object" && typeof b != "object") + return false; + return deepEq(a, b, aStack, bStack); +} +var toString = Object.prototype.toString; +// Internal recursive comparison function for `isEqual`. +function deepEq(a, b, aStack, bStack) { + // Unwrap any wrapped objects. + a = unwrap(a); + b = unwrap(b); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className !== toString.call(b)) + return false; + switch (className) { + // Strings, numbers, regular expressions, dates, and booleans are compared by value. + case "[object RegExp]": + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case "[object String]": + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return "" + a === "" + b; + case "[object Number]": + // `NaN`s are equivalent, but non-reflexive. + // Object(NaN) is equivalent to NaN. + if (+a !== +a) + return +b !== +b; + // An `egal` comparison is performed for other numeric values. + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a === +b; + case "[object Symbol]": + return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)); + } + var areArrays = className === "[object Array]"; + if (!areArrays) { + if (typeof a != "object" || typeof b != "object") + return false; + // Objects with different constructors are not equivalent, but `Object`s or `Array`s + // from different frames are. + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && + !(typeof aCtor === "function" && + aCtor instanceof aCtor && + typeof bCtor === "function" && + bCtor instanceof bCtor) && + ("constructor" in a && "constructor" in b)) { + return false; + } + } + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + // Initializing stack of traversed objects. + // It's done here since we only need them for objects and arrays comparison. + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (aStack[length] === a) + return bStack[length] === b; + } + // Add the first object to the stack of traversed objects. + aStack.push(a); + bStack.push(b); + // Recursively compare objects and arrays. + if (areArrays) { + // Compare array lengths to determine if a deep comparison is necessary. + length = a.length; + if (length !== b.length) + return false; + // Deep compare the contents, ignoring non-numeric properties. + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) + return false; + } + } + else { + // Deep compare objects. + var keys = Object.keys(a), key; + length = keys.length; + // Ensure that both objects contain the same number of properties before comparing deep equality. + if (Object.keys(b).length !== length) + return false; + while (length--) { + // Deep compare each member + key = keys[length]; + if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) + return false; + } + } + // Remove the first object from the stack of traversed objects. + aStack.pop(); + bStack.pop(); + return true; +} +function unwrap(a) { + if (isObservableArray(a)) + return a.peek(); + if (isObservableMap(a)) + return a.entries(); + if (isES6Map(a)) + return iteratorToArray(a.entries()); + return a; +} +function has(a, key) { + return Object.prototype.hasOwnProperty.call(a, key); +} + +function identityComparer(a, b) { + return a === b; +} +function structuralComparer(a, b) { + return deepEqual(a, b); +} +function defaultComparer(a, b) { + return areBothNaN(a, b) || identityComparer(a, b); +} +var comparer = { + identity: identityComparer, + structural: structuralComparer, + default: defaultComparer +}; + +function autorun(arg1, arg2, arg3) { + var name, view, scope; + if (typeof arg1 === "string") { + name = arg1; + view = arg2; + scope = arg3; + } + else { + name = arg1.name || "Autorun@" + getNextId(); + view = arg1; + scope = arg2; + } + invariant(typeof view === "function", getMessage("m004")); + invariant(isAction(view) === false, getMessage("m005")); + if (scope) + view = view.bind(scope); + var reaction = new Reaction(name, function () { + this.track(reactionRunner); + }); + function reactionRunner() { + view(reaction); + } + reaction.schedule(); + return reaction.getDisposer(); +} +function when(arg1, arg2, arg3, arg4) { + var name, predicate, effect, scope; + if (typeof arg1 === "string") { + name = arg1; + predicate = arg2; + effect = arg3; + scope = arg4; + } + else { + name = "When@" + getNextId(); + predicate = arg1; + effect = arg2; + scope = arg3; + } + var disposer = autorun(name, function (r) { + if (predicate.call(scope)) { + r.dispose(); + var prevUntracked = untrackedStart(); + effect.call(scope); + untrackedEnd(prevUntracked); + } + }); + return disposer; +} +function autorunAsync(arg1, arg2, arg3, arg4) { + var name, func, delay, scope; + if (typeof arg1 === "string") { + name = arg1; + func = arg2; + delay = arg3; + scope = arg4; + } + else { + name = arg1.name || "AutorunAsync@" + getNextId(); + func = arg1; + delay = arg2; + scope = arg3; + } + invariant(isAction(func) === false, getMessage("m006")); + if (delay === void 0) + delay = 1; + if (scope) + func = func.bind(scope); + var isScheduled = false; + var r = new Reaction(name, function () { + if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + if (!r.isDisposed) + r.track(reactionRunner); + }, delay); + } + }); + function reactionRunner() { + func(r); + } + r.schedule(); + return r.getDisposer(); +} +function reaction(expression, effect, arg3) { + if (arguments.length > 3) { + fail(getMessage("m007")); + } + if (isModifierDescriptor(expression)) { + fail(getMessage("m008")); + } + var opts; + if (typeof arg3 === "object") { + opts = arg3; + } + else { + opts = {}; + } + opts.name = + opts.name || expression.name || effect.name || "Reaction@" + getNextId(); + opts.fireImmediately = arg3 === true || opts.fireImmediately === true; + opts.delay = opts.delay || 0; + opts.compareStructural = opts.compareStructural || opts.struct || false; + // TODO: creates ugly spy events, use `effect = (r) => runInAction(opts.name, () => effect(r))` instead + effect = action(opts.name, opts.context ? effect.bind(opts.context) : effect); + if (opts.context) { + expression = expression.bind(opts.context); + } + var firstTime = true; + var isScheduled = false; + var value; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + var r = new Reaction(opts.name, function () { + if (firstTime || opts.delay < 1) { + reactionRunner(); + } + else if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + reactionRunner(); + }, opts.delay); + } + }); + function reactionRunner() { + if (r.isDisposed) + return; + var changed = false; + r.track(function () { + var nextValue = expression(r); + changed = firstTime || !equals(value, nextValue); + value = nextValue; + }); + if (firstTime && opts.fireImmediately) + effect(value, r); + if (!firstTime && changed === true) + effect(value, r); + if (firstTime) + firstTime = false; + } + r.schedule(); + return r.getDisposer(); +} + +/** + * A node in the state dependency root that observes other nodes, and can be observed itself. + * + * ComputedValue will remember the result of the computation for the duration of the batch, or + * while being observed. + * + * During this time it will recompute only when one of its direct dependencies changed, + * but only when it is being accessed with `ComputedValue.get()`. + * + * Implementation description: + * 1. First time it's being accessed it will compute and remember result + * give back remembered result until 2. happens + * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. + * 3. When it's being accessed, recompute if any shallow dependency changed. + * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. + * go to step 2. either way + * + * If at any point it's outside batch and it isn't observed: reset everything and go to 1. + */ +var ComputedValue = (function () { + /** + * Create a new computed value based on a function expression. + * + * The `name` property is for debug purposes only. + * + * The `equals` property specifies the comparer function to use to determine if a newly produced + * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` + * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. + * Structural comparison can be convenient if you always produce an new aggregated object and + * don't want to notify observers if it is structurally the same. + * This is useful for working with vectors, mouse coordinates etc. + */ + function ComputedValue(derivation, scope, equals, name, setter) { + this.derivation = derivation; + this.scope = scope; + this.equals = equals; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = null; // during tracking it's an array with new observed observers + this.isPendingUnobservation = false; + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.runId = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.UP_TO_DATE; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.value = new CaughtException(null); + this.isComputing = false; // to check for cycles + this.isRunningSetter = false; + this.isTracing = TraceMode.NONE; + this.name = name || "ComputedValue@" + getNextId(); + if (setter) + this.setter = createAction(name + "-setter", setter); + } + ComputedValue.prototype.onBecomeStale = function () { + propagateMaybeChanged(this); + }; + ComputedValue.prototype.onBecomeUnobserved = function () { + clearObserving(this); + this.value = undefined; + }; + /** + * Returns the current value of this computed value. + * Will evaluate its computation first if needed. + */ + ComputedValue.prototype.get = function () { + invariant(!this.isComputing, "Cycle detected in computation " + this.name, this.derivation); + if (globalState.inBatch === 0) { + // This is an minor optimization which could be omitted to simplify the code + // The computedValue is accessed outside of any mobx stuff. Batch observing should be enough and don't need + // tracking as it will never be called again inside this batch. + startBatch(); + if (shouldCompute(this)) { + if (this.isTracing !== TraceMode.NONE) { + console.log("[mobx.trace] '" + this + .name + "' is being read outside a reactive context and doing a full recompute"); + } + this.value = this.computeValue(false); + } + endBatch(); + } + else { + reportObserved(this); + if (shouldCompute(this)) + if (this.trackAndCompute()) + propagateChangeConfirmed(this); + } + var result = this.value; + if (isCaughtException(result)) + throw result.cause; + return result; + }; + ComputedValue.prototype.peek = function () { + var res = this.computeValue(false); + if (isCaughtException(res)) + throw res.cause; + return res; + }; + ComputedValue.prototype.set = function (value) { + if (this.setter) { + invariant(!this.isRunningSetter, "The setter of computed value '" + this + .name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); + this.isRunningSetter = true; + try { + this.setter.call(this.scope, value); + } + finally { + this.isRunningSetter = false; + } + } + else + invariant(false, "[ComputedValue '" + this + .name + "'] It is not possible to assign a new value to a computed value."); + }; + ComputedValue.prototype.trackAndCompute = function () { + if (isSpyEnabled()) { + spyReport({ + object: this.scope, + type: "compute", + fn: this.derivation + }); + } + var oldValue = this.value; + var wasSuspended = + /* see #1208 */ this.dependenciesState === IDerivationState.NOT_TRACKING; + var newValue = (this.value = this.computeValue(true)); + return (wasSuspended || + isCaughtException(oldValue) || + isCaughtException(newValue) || + !this.equals(oldValue, newValue)); + }; + ComputedValue.prototype.computeValue = function (track) { + this.isComputing = true; + globalState.computationDepth++; + var res; + if (track) { + res = trackDerivedFunction(this, this.derivation, this.scope); + } + else { + try { + res = this.derivation.call(this.scope); + } + catch (e) { + res = new CaughtException(e); + } + } + globalState.computationDepth--; + this.isComputing = false; + return res; + }; + ComputedValue.prototype.observe = function (listener, fireImmediately) { + var _this = this; + var firstTime = true; + var prevValue = undefined; + return autorun(function () { + var newValue = _this.get(); + if (!firstTime || fireImmediately) { + var prevU = untrackedStart(); + listener({ + type: "update", + object: _this, + newValue: newValue, + oldValue: prevValue + }); + untrackedEnd(prevU); + } + firstTime = false; + prevValue = newValue; + }); + }; + ComputedValue.prototype.toJSON = function () { + return this.get(); + }; + ComputedValue.prototype.toString = function () { + return this.name + "[" + this.derivation.toString() + "]"; + }; + ComputedValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + ComputedValue.prototype.whyRun = function () { + var isTracking = Boolean(globalState.trackingDerivation); + var observing = unique(this.isComputing ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + var observers = unique(getObservers(this).map(function (dep) { return dep.name; })); + return ("\nWhyRun? computation '" + this.name + "':\n * Running because: " + (isTracking + ? "[active] the value of this computation is needed by a reaction" + : this.isComputing + ? "[get] The value of this computed was requested outside a reaction" + : "[idle] not running at the moment") + "\n" + + (this.dependenciesState === IDerivationState.NOT_TRACKING + ? getMessage("m032") + : " * This computation will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this.isComputing && isTracking + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n " + getMessage("m038") + "\n\n * If the outcome of this computation changes, the following observers will be re-run:\n " + joinStrings(observers) + "\n")); + }; + return ComputedValue; +}()); +ComputedValue.prototype[primitiveSymbol()] = ComputedValue.prototype.valueOf; +var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); + +var ObservableObjectAdministration = (function () { + function ObservableObjectAdministration(target, name) { + this.target = target; + this.name = name; + this.values = {}; + this.changeListeners = null; + this.interceptors = null; + } + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { + invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects."); + return registerListener(this, callback); + }; + ObservableObjectAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableObjectAdministration; +}()); +function asObservableObject(target, name) { + if (isObservableObject(target) && target.hasOwnProperty("$mobx")) + return target.$mobx; + invariant(Object.isExtensible(target), getMessage("m035")); + if (!isPlainObject(target)) + name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); + if (!name) + name = "ObservableObject@" + getNextId(); + var adm = new ObservableObjectAdministration(target, name); + addHiddenFinalProp(target, "$mobx", adm); + return adm; +} +function defineObservablePropertyFromDescriptor(adm, propName, descriptor, defaultEnhancer) { + if (adm.values[propName] && !isComputedValue(adm.values[propName])) { + // already observable property + invariant("value" in descriptor, "The property " + propName + " in " + adm.name + " is already observable, cannot redefine it as computed property"); + adm.target[propName] = descriptor.value; // the property setter will make 'value' reactive if needed. + return; + } + // not yet observable property + if ("value" in descriptor) { + // not a computed value + if (isModifierDescriptor(descriptor.value)) { + // x : ref(someValue) + var modifierDescriptor = descriptor.value; + defineObservableProperty(adm, propName, modifierDescriptor.initialValue, modifierDescriptor.enhancer); + } + else if (isAction(descriptor.value) && descriptor.value.autoBind === true) { + defineBoundAction(adm.target, propName, descriptor.value.originalFn); + } + else if (isComputedValue(descriptor.value)) { + // x: computed(someExpr) + defineComputedPropertyFromComputedValue(adm, propName, descriptor.value); + } + else { + // x: someValue + defineObservableProperty(adm, propName, descriptor.value, defaultEnhancer); + } + } + else { + // get x() { return 3 } set x(v) { } + defineComputedProperty(adm, propName, descriptor.get, descriptor.set, comparer.default, true); + } +} +function defineObservableProperty(adm, propName, newValue, enhancer) { + assertPropertyConfigurable(adm.target, propName); + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + object: adm.target, + name: propName, + type: "add", + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + var observable = (adm.values[propName] = new ObservableValue(newValue, enhancer, adm.name + "." + propName, false)); + newValue = observable.value; // observableValue might have changed it + Object.defineProperty(adm.target, propName, generateObservablePropConfig(propName)); + notifyPropertyAddition(adm, adm.target, propName, newValue); +} +function defineComputedProperty(adm, propName, getter, setter, equals, asInstanceProperty) { + if (asInstanceProperty) + assertPropertyConfigurable(adm.target, propName); + adm.values[propName] = new ComputedValue(getter, adm.target, equals, adm.name + "." + propName, setter); + if (asInstanceProperty) { + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); + } +} +function defineComputedPropertyFromComputedValue(adm, propName, computedValue) { + var name = adm.name + "." + propName; + computedValue.name = name; + if (!computedValue.scope) + computedValue.scope = adm.target; + adm.values[propName] = computedValue; + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); +} +var observablePropertyConfigs = {}; +var computedPropertyConfigs = {}; +function generateObservablePropConfig(propName) { + return (observablePropertyConfigs[propName] || + (observablePropertyConfigs[propName] = { + configurable: true, + enumerable: true, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + setPropertyValue(this, propName, v); + } + })); +} +function generateComputedPropConfig(propName) { + return (computedPropertyConfigs[propName] || + (computedPropertyConfigs[propName] = { + configurable: true, + enumerable: false, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + return this.$mobx.values[propName].set(v); + } + })); +} +function setPropertyValue(instance, name, newValue) { + var adm = instance.$mobx; + var observable = adm.values[name]; + // intercept + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: instance, + name: name, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = observable.prepareNewValue(newValue); + // notify spy & observers + if (newValue !== UNCHANGED) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "update", + object: instance, + oldValue: observable.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable.setNewValue(newValue); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); + } +} +function notifyPropertyAddition(adm, object, name, newValue) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "add", + object: object, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); +} +var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); +function isObservableObject(thing) { + if (isObject(thing)) { + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + return isObservableObjectAdministration(thing.$mobx); + } + return false; +} + +/** + * Returns true if the provided value is reactive. + * @param value object, function or array + * @param property if property is specified, checks whether value.property is reactive. + */ +function isObservable(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableArray(value) || isObservableMap(value)) + throw new Error(getMessage("m019")); + else if (isObservableObject(value)) { + var o = value.$mobx; + return o.values && !!o.values[property]; + } + return false; + } + // For first check, see #701 + return (isObservableObject(value) || + !!value.$mobx || + isAtom(value) || + isReaction(value) || + isComputedValue(value)); +} + +function createDecoratorForEnhancer(enhancer) { + invariant(!!enhancer, ":("); + return createClassPropertyDecorator(function (target, name, baseValue, _, baseDescriptor) { + assertPropertyConfigurable(target, name); + invariant(!baseDescriptor || !baseDescriptor.get, getMessage("m022")); + var adm = asObservableObject(target, undefined); + defineObservableProperty(adm, name, baseValue, enhancer); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + setPropertyValue(this, name, value); + }, true, false); +} + +function extendObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, deepEnhancer, properties); +} +function extendShallowObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, referenceEnhancer, properties); +} +function extendObservableHelper(target, defaultEnhancer, properties) { + invariant(arguments.length >= 2, getMessage("m014")); + invariant(typeof target === "object", getMessage("m015")); + invariant(!isObservableMap(target), getMessage("m016")); + properties.forEach(function (propSet) { + invariant(typeof propSet === "object", getMessage("m017")); + invariant(!isObservable(propSet), getMessage("m018")); + }); + var adm = asObservableObject(target); + var definedProps = {}; + // Note could be optimised if properties.length === 1 + for (var i = properties.length - 1; i >= 0; i--) { + var propSet = properties[i]; + for (var key in propSet) + if (definedProps[key] !== true && hasOwnProperty(propSet, key)) { + definedProps[key] = true; + if (target === propSet && !isPropertyConfigurable(target, key)) + continue; // see #111, skip non-configurable or non-writable props for `observable(object)`. + var descriptor = Object.getOwnPropertyDescriptor(propSet, key); + defineObservablePropertyFromDescriptor(adm, key, descriptor, defaultEnhancer); + } + } + return target; +} + +var deepDecorator = createDecoratorForEnhancer(deepEnhancer); +var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); +var refDecorator = createDecoratorForEnhancer(referenceEnhancer); +var deepStructDecorator = createDecoratorForEnhancer(deepStructEnhancer); +var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); +/** + * Turns an object, array or function into a reactive structure. + * @param v the value which should become observable. + */ +function createObservable(v) { + if (v === void 0) { v = undefined; } + // @observable someProp; + if (typeof arguments[1] === "string") + return deepDecorator.apply(null, arguments); + invariant(arguments.length <= 1, getMessage("m021")); + invariant(!isModifierDescriptor(v), getMessage("m020")); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + var res = deepEnhancer(v, undefined, undefined); + // this value could be converted to a new observable data structure, return it + if (res !== v) + return res; + // otherwise, just box it + return observable.box(v); +} +var observableFactories = { + box: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("box"); + return new ObservableValue(value, deepEnhancer, name); + }, + shallowBox: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowBox"); + return new ObservableValue(value, referenceEnhancer, name); + }, + array: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("array"); + return new ObservableArray(initialValues, deepEnhancer, name); + }, + shallowArray: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowArray"); + return new ObservableArray(initialValues, referenceEnhancer, name); + }, + map: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("map"); + return new ObservableMap(initialValues, deepEnhancer, name); + }, + shallowMap: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowMap"); + return new ObservableMap(initialValues, referenceEnhancer, name); + }, + object: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("object"); + var res = {}; + // convert to observable object + asObservableObject(res, name); + // add properties + extendObservable(res, props); + return res; + }, + shallowObject: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowObject"); + var res = {}; + asObservableObject(res, name); + extendShallowObservable(res, props); + return res; + }, + ref: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(referenceEnhancer, arguments[0]); + } + else { + return refDecorator.apply(null, arguments); + } + }, + shallow: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(shallowEnhancer, arguments[0]); + } + else { + return shallowDecorator.apply(null, arguments); + } + }, + deep: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepEnhancer, arguments[0]); + } + else { + return deepDecorator.apply(null, arguments); + } + }, + struct: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepStructEnhancer, arguments[0]); + } + else { + return deepStructDecorator.apply(null, arguments); + } + } +}; +var observable = createObservable; +// weird trick to keep our typings nicely with our funcs, and still extend the observable function +Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); }); +observable.deep.struct = observable.struct; +observable.ref.struct = function () { + if (arguments.length < 2) { + return createModifierDescriptor(refStructEnhancer, arguments[0]); + } + else { + return refStructDecorator.apply(null, arguments); + } +}; +function incorrectlyUsedAsDecorator(methodName) { + fail("Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); +} + +function isModifierDescriptor(thing) { + return typeof thing === "object" && thing !== null && thing.isMobxModifierDescriptor === true; +} +function createModifierDescriptor(enhancer, initialValue) { + invariant(!isModifierDescriptor(initialValue), "Modifiers cannot be nested"); + return { + isMobxModifierDescriptor: true, + initialValue: initialValue, + enhancer: enhancer + }; +} +function deepEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return observable.array(v, name); + if (isPlainObject(v)) + return observable.object(v, name); + if (isES6Map(v)) + return observable.map(v, name); + return v; +} +function shallowEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + if (v === undefined || v === null) + return v; + if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v)) + return v; + if (Array.isArray(v)) + return observable.shallowArray(v, name); + if (isPlainObject(v)) + return observable.shallowObject(v, name); + if (isES6Map(v)) + return observable.shallowMap(v, name); + return fail("The shallow modifier / decorator can only used in combination with arrays, objects and maps"); +} +function referenceEnhancer(newValue) { + // never turn into an observable + return newValue; +} +function deepStructEnhancer(v, oldValue, name) { + // don't confuse structurally compare enhancer with ref enhancer! The latter is probably + // more suited for immutable objects + if (deepEqual(v, oldValue)) + return oldValue; + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return new ObservableArray(v, deepStructEnhancer, name); + if (isES6Map(v)) + return new ObservableMap(v, deepStructEnhancer, name); + if (isPlainObject(v)) { + var res = {}; + asObservableObject(res, name); + extendObservableHelper(res, deepStructEnhancer, [v]); + return res; + } + return v; +} +function refStructEnhancer(v, oldValue, name) { + if (deepEqual(v, oldValue)) + return oldValue; + return v; +} + +/** + * During a transaction no views are updated until the end of the transaction. + * The transaction will be run synchronously nonetheless. + * + * @param action a function that updates some reactive state + * @returns any value that was returned by the 'action' parameter. + */ +function transaction(action, thisArg) { + if (thisArg === void 0) { thisArg = undefined; } + startBatch(); + try { + return action.apply(thisArg); + } + finally { + endBatch(); + } +} + +var ObservableMapMarker = {}; +var ObservableMap = (function () { + function ObservableMap(initialData, enhancer, name) { + if (enhancer === void 0) { enhancer = deepEnhancer; } + if (name === void 0) { name = "ObservableMap@" + getNextId(); } + this.enhancer = enhancer; + this.name = name; + this.$mobx = ObservableMapMarker; + this._data = Object.create(null); + this._hasMap = Object.create(null); // hasMap, not hashMap >-). + this._keys = new ObservableArray(undefined, referenceEnhancer, this.name + ".keys()", true); + this.interceptors = null; + this.changeListeners = null; + this.dehancer = undefined; + this.merge(initialData); + } + ObservableMap.prototype._has = function (key) { + return typeof this._data[key] !== "undefined"; + }; + ObservableMap.prototype.has = function (key) { + if (!this.isValidKey(key)) + return false; + key = "" + key; + if (this._hasMap[key]) + return this._hasMap[key].get(); + return this._updateHasMapEntry(key, false).get(); + }; + ObservableMap.prototype.set = function (key, value) { + this.assertValidKey(key); + key = "" + key; + var hasKey = this._has(key); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: hasKey ? "update" : "add", + object: this, + newValue: value, + name: key + }); + if (!change) + return this; + value = change.newValue; + } + if (hasKey) { + this._updateValue(key, value); + } + else { + this._addValue(key, value); + } + return this; + }; + ObservableMap.prototype.delete = function (key) { + var _this = this; + this.assertValidKey(key); + key = "" + key; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: "delete", + object: this, + name: key + }); + if (!change) + return false; + } + if (this._has(key)) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "delete", + object: this, + oldValue: this._data[key].value, + name: key + } + : null; + if (notifySpy) + spyReportStart(change); + transaction(function () { + _this._keys.remove(key); + _this._updateHasMapEntry(key, false); + var observable$$1 = _this._data[key]; + observable$$1.setNewValue(undefined); + _this._data[key] = undefined; + }); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + return true; + } + return false; + }; + ObservableMap.prototype._updateHasMapEntry = function (key, value) { + // optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore + var entry = this._hasMap[key]; + if (entry) { + entry.setNewValue(value); + } + else { + entry = this._hasMap[key] = new ObservableValue(value, referenceEnhancer, this.name + "." + key + "?", false); + } + return entry; + }; + ObservableMap.prototype._updateValue = function (name, newValue) { + var observable$$1 = this._data[name]; + newValue = observable$$1.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "update", + object: this, + oldValue: observable$$1.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable$$1.setNewValue(newValue); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableMap.prototype._addValue = function (name, newValue) { + var _this = this; + transaction(function () { + var observable$$1 = (_this._data[name] = new ObservableValue(newValue, _this.enhancer, _this.name + "." + name, false)); + newValue = observable$$1.value; // value might have been changed + _this._updateHasMapEntry(name, true); + _this._keys.push(name); + }); + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "add", + object: this, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableMap.prototype.get = function (key) { + key = "" + key; + if (this.has(key)) + return this.dehanceValue(this._data[key].get()); + return this.dehanceValue(undefined); + }; + ObservableMap.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) { + return this.dehancer(value); + } + return value; + }; + ObservableMap.prototype.keys = function () { + return arrayAsIterator(this._keys.slice()); + }; + ObservableMap.prototype.values = function () { + return arrayAsIterator(this._keys.map(this.get, this)); + }; + ObservableMap.prototype.entries = function () { + var _this = this; + return arrayAsIterator(this._keys.map(function (key) { return [key, _this.get(key)]; })); + }; + ObservableMap.prototype.forEach = function (callback, thisArg) { + var _this = this; + this.keys().forEach(function (key) { return callback.call(thisArg, _this.get(key), key, _this); }); + }; + /** Merge another object into this object, returns this. */ + ObservableMap.prototype.merge = function (other) { + var _this = this; + if (isObservableMap(other)) { + other = other.toJS(); + } + transaction(function () { + if (isPlainObject(other)) + Object.keys(other).forEach(function (key) { return _this.set(key, other[key]); }); + else if (Array.isArray(other)) + other.forEach(function (_a) { + var key = _a[0], value = _a[1]; + return _this.set(key, value); + }); + else if (isES6Map(other)) + other.forEach(function (value, key) { return _this.set(key, value); }); + else if (other !== null && other !== undefined) + fail("Cannot initialize map from " + other); + }); + return this; + }; + ObservableMap.prototype.clear = function () { + var _this = this; + transaction(function () { + untracked(function () { + _this.keys().forEach(_this.delete, _this); + }); + }); + }; + ObservableMap.prototype.replace = function (values) { + var _this = this; + transaction(function () { + // grab all the keys that are present in the new map but not present in the current map + // and delete them from the map, then merge the new map + // this will cause reactions only on changed values + var newKeys = getMapLikeKeys(values); + var oldKeys = _this.keys(); + var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; }); + missingKeys.forEach(function (k) { return _this.delete(k); }); + _this.merge(values); + }); + return this; + }; + Object.defineProperty(ObservableMap.prototype, "size", { + get: function () { + return this._keys.length; + }, + enumerable: true, + configurable: true + }); + /** + * Returns a shallow non observable object clone of this map. + * Note that the values might still be observable. For a deep clone use mobx.toJS. + */ + ObservableMap.prototype.toJS = function () { + var _this = this; + var res = {}; + this.keys().forEach(function (key) { return (res[key] = _this.get(key)); }); + return res; + }; + ObservableMap.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableMap.prototype.isValidKey = function (key) { + if (key === null || key === undefined) + return false; + if (typeof key === "string" || typeof key === "number" || typeof key === "boolean") + return true; + return false; + }; + ObservableMap.prototype.assertValidKey = function (key) { + if (!this.isValidKey(key)) + throw new Error("[mobx.map] Invalid key: '" + key + "', only strings, numbers and booleans are accepted as key in observable maps."); + }; + ObservableMap.prototype.toString = function () { + var _this = this; + return (this.name + + "[{ " + + this.keys().map(function (key) { return key + ": " + ("" + _this.get(key)); }).join(", ") + + " }]"); + }; + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableMap.prototype.observe = function (listener, fireImmediately) { + invariant(fireImmediately !== true, getMessage("m033")); + return registerListener(this, listener); + }; + ObservableMap.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableMap; +}()); +declareIterator(ObservableMap.prototype, function () { + return this.entries(); +}); +function map(initialValues) { + deprecated("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"); + return observable.map(initialValues); +} +/* 'var' fixes small-build issue */ +var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); + +var EMPTY_ARRAY = []; +Object.freeze(EMPTY_ARRAY); +function getGlobal() { + return typeof window !== "undefined" ? window : global; +} +function getNextId() { + return ++globalState.mobxGuid; +} +function fail(message, thing) { + invariant(false, message, thing); + throw "X"; // unreachable +} +function invariant(check, message, thing) { + if (!check) + throw new Error("[mobx] Invariant failed: " + message + (thing ? " in '" + thing + "'" : "")); +} +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; +function deprecated(msg) { + if (deprecatedMessages.indexOf(msg) !== -1) + return false; + deprecatedMessages.push(msg); + console.error("[mobx] Deprecated: " + msg); + return true; +} +/** + * Makes sure that the provided function is invoked at most once. + */ +function once(func) { + var invoked = false; + return function () { + if (invoked) + return; + invoked = true; + return func.apply(this, arguments); + }; +} +var noop = function () { }; +function unique(list) { + var res = []; + list.forEach(function (item) { + if (res.indexOf(item) === -1) + res.push(item); + }); + return res; +} +function joinStrings(things, limit, separator) { + if (limit === void 0) { limit = 100; } + if (separator === void 0) { separator = " - "; } + if (!things) + return ""; + var sliced = things.slice(0, limit); + return "" + sliced.join(separator) + (things.length > limit + ? " (... and " + (things.length - limit) + "more)" + : ""); +} +function isObject(value) { + return value !== null && typeof value === "object"; +} +function isPlainObject(value) { + if (value === null || typeof value !== "object") + return false; + var proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; +} +function objectAssign() { + var res = arguments[0]; + for (var i = 1, l = arguments.length; i < l; i++) { + var source = arguments[i]; + for (var key in source) + if (hasOwnProperty(source, key)) { + res[key] = source[key]; + } + } + return res; +} +var prototypeHasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwnProperty(object, propName) { + return prototypeHasOwnProperty.call(object, propName); +} +function makeNonEnumerable(object, propNames) { + for (var i = 0; i < propNames.length; i++) { + addHiddenProp(object, propNames[i], object[propNames[i]]); + } +} +function addHiddenProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: true, + configurable: true, + value: value + }); +} +function addHiddenFinalProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: false, + configurable: true, + value: value + }); +} +function isPropertyConfigurable(object, prop) { + var descriptor = Object.getOwnPropertyDescriptor(object, prop); + return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false); +} +function assertPropertyConfigurable(object, prop) { + invariant(isPropertyConfigurable(object, prop), "Cannot make property '" + prop + "' observable, it is not configurable and writable in the target object"); +} +function createInstanceofPredicate(name, clazz) { + var propName = "isMobX" + name; + clazz.prototype[propName] = true; + return function (x) { + return isObject(x) && x[propName] === true; + }; +} +function areBothNaN(a, b) { + return typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); +} +/** + * Returns whether the argument is an array, disregarding observability. + */ +function isArrayLike(x) { + return Array.isArray(x) || isObservableArray(x); +} +function isES6Map(thing) { + if (getGlobal().Map !== undefined && thing instanceof getGlobal().Map) + return true; + return false; +} +function getMapLikeKeys(map$$1) { + if (isPlainObject(map$$1)) + return Object.keys(map$$1); + if (Array.isArray(map$$1)) + return map$$1.map(function (_a) { + var key = _a[0]; + return key; + }); + if (isES6Map(map$$1)) + return Array.from(map$$1.keys()); + if (isObservableMap(map$$1)) + return map$$1.keys(); + return fail("Cannot get keys from " + map$$1); +} +function iteratorToArray(it) { + var res = []; + while (true) { + var r = it.next(); + if (r.done) + break; + res.push(r.value); + } + return res; +} +function primitiveSymbol() { + return (typeof Symbol === "function" && Symbol.toPrimitive) || "@@toPrimitive"; +} +function toPrimitive(value) { + return value === null ? null : typeof value === "object" ? "" + value : value; +} + +/** + * These values will persist if global state is reset + */ +var persistentKeys = ["mobxGuid", "resetId", "spyListeners", "strictMode", "runId"]; +var MobXGlobals = (function () { + function MobXGlobals() { + /** + * MobXGlobals version. + * MobX compatiblity with other versions loaded in memory as long as this version matches. + * It indicates that the global state still stores similar information + */ + this.version = 5; + /** + * Currently running derivation + */ + this.trackingDerivation = null; + /** + * Are we running a computation currently? (not a reaction) + */ + this.computationDepth = 0; + /** + * Each time a derivation is tracked, it is assigned a unique run-id + */ + this.runId = 0; + /** + * 'guid' for general purpose. Will be persisted amongst resets. + */ + this.mobxGuid = 0; + /** + * Are we in a batch block? (and how many of them) + */ + this.inBatch = 0; + /** + * Observables that don't have observers anymore, and are about to be + * suspended, unless somebody else accesses it in the same batch + * + * @type {IObservable[]} + */ + this.pendingUnobservations = []; + /** + * List of scheduled, not yet executed, reactions. + */ + this.pendingReactions = []; + /** + * Are we currently processing reactions? + */ + this.isRunningReactions = false; + /** + * Is it allowed to change observables at this point? + * In general, MobX doesn't allow that when running computations and React.render. + * To ensure that those functions stay pure. + */ + this.allowStateChanges = true; + /** + * If strict mode is enabled, state changes are by default not allowed + */ + this.strictMode = false; + /** + * Used by createTransformer to detect that the global state has been reset. + */ + this.resetId = 0; + /** + * Spy callbacks + */ + this.spyListeners = []; + /** + * Globally attached error handlers that react specifically to errors in reactions + */ + this.globalReactionErrorHandlers = []; + } + return MobXGlobals; +}()); +var globalState = new MobXGlobals(); +var shareGlobalStateCalled = false; +var runInIsolationCalled = false; +var warnedAboutMultipleInstances = false; +{ + var global_1 = getGlobal(); + if (!global_1.__mobxInstanceCount) { + global_1.__mobxInstanceCount = 1; + } + else { + global_1.__mobxInstanceCount++; + setTimeout(function () { + if (!shareGlobalStateCalled && !runInIsolationCalled && !warnedAboutMultipleInstances) { + warnedAboutMultipleInstances = true; + console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."); + } + }); + } +} +function isolateGlobalState() { + runInIsolationCalled = true; + getGlobal().__mobxInstanceCount--; +} +function shareGlobalState() { + // TODO: remove in 4.0; just use peer dependencies instead. + deprecated("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."); + shareGlobalStateCalled = true; + var global = getGlobal(); + var ownState = globalState; + /** + * Backward compatibility check + */ + if (global.__mobservableTrackingStack || global.__mobservableViewStack) + throw new Error("[mobx] An incompatible version of mobservable is already loaded."); + if (global.__mobxGlobal && global.__mobxGlobal.version !== ownState.version) + throw new Error("[mobx] An incompatible version of mobx is already loaded."); + if (global.__mobxGlobal) + globalState = global.__mobxGlobal; + else + global.__mobxGlobal = ownState; +} +function getGlobalState() { + return globalState; +} + +/** + * For testing purposes only; this will break the internal state of existing observables, + * but can be used to get back at a stable state after throwing errors + */ +function resetGlobalState() { + globalState.resetId++; + var defaultGlobals = new MobXGlobals(); + for (var key in defaultGlobals) + if (persistentKeys.indexOf(key) === -1) + globalState[key] = defaultGlobals[key]; + globalState.allowStateChanges = !globalState.strictMode; +} + +function getAtom(thing, property) { + if (typeof thing === "object" && thing !== null) { + if (isObservableArray(thing)) { + invariant(property === undefined, getMessage("m036")); + return thing.$mobx.atom; + } + if (isObservableMap(thing)) { + var anyThing = thing; + if (property === undefined) + return getAtom(anyThing._keys); + var observable = anyThing._data[property] || anyThing._hasMap[property]; + invariant(!!observable, "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'"); + return observable; + } + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (property && !thing.$mobx) + thing[property]; // See #1072 // TODO: remove in 4.0 + if (isObservableObject(thing)) { + if (!property) + return fail("please specify a property"); + var observable = thing.$mobx.values[property]; + invariant(!!observable, "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'"); + return observable; + } + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { + return thing; + } + } + else if (typeof thing === "function") { + if (isReaction(thing.$mobx)) { + // disposer function + return thing.$mobx; + } + } + return fail("Cannot obtain atom from " + thing); +} +function getAdministration(thing, property) { + invariant(thing, "Expecting some object"); + if (property !== undefined) + return getAdministration(getAtom(thing, property)); + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) + return thing; + if (isObservableMap(thing)) + return thing; + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (thing.$mobx) + return thing.$mobx; + invariant(false, "Cannot obtain administration from " + thing); +} +function getDebugName(thing, property) { + var named; + if (property !== undefined) + named = getAtom(thing, property); + else if (isObservableObject(thing) || isObservableMap(thing)) + named = getAdministration(thing); + else + named = getAtom(thing); // valid for arrays as well + return named.name; +} + +function getDependencyTree(thing, property) { + return nodeToDependencyTree(getAtom(thing, property)); +} +function nodeToDependencyTree(node) { + var result = { + name: node.name + }; + if (node.observing && node.observing.length > 0) + result.dependencies = unique(node.observing).map(nodeToDependencyTree); + return result; +} +function getObserverTree(thing, property) { + return nodeToObserverTree(getAtom(thing, property)); +} +function nodeToObserverTree(node) { + var result = { + name: node.name + }; + if (hasObservers(node)) + result.observers = getObservers(node).map(nodeToObserverTree); + return result; +} + +function hasObservers(observable) { + return observable.observers && observable.observers.length > 0; +} +function getObservers(observable) { + return observable.observers; +} +function addObserver(observable, node) { + // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1"); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node"); + // invariantObservers(observable); + var l = observable.observers.length; + if (l) { + // because object assignment is relatively expensive, let's not store data about index 0. + observable.observersIndexes[node.__mapid] = l; + } + observable.observers[l] = node; + if (observable.lowestObserverState > node.dependenciesState) + observable.lowestObserverState = node.dependenciesState; + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node"); +} +function removeObserver(observable, node) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node"); + // invariantObservers(observable); + if (observable.observers.length === 1) { + // deleting last observer + observable.observers.length = 0; + queueForUnobservation(observable); + } + else { + // deleting from _observersIndexes is straight forward, to delete from _observers, let's swap `node` with last element + var list = observable.observers; + var map = observable.observersIndexes; + var filler = list.pop(); // get last element, which should fill the place of `node`, so the array doesn't have holes + if (filler !== node) { + // otherwise node was the last element, which already got removed from array + var index = map[node.__mapid] || 0; // getting index of `node`. this is the only place we actually use map. + if (index) { + // map store all indexes but 0, see comment in `addObserver` + map[filler.__mapid] = index; + } + else { + delete map[filler.__mapid]; + } + list[index] = filler; + } + delete map[node.__mapid]; + } + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2"); +} +function queueForUnobservation(observable) { + if (!observable.isPendingUnobservation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables"); + observable.isPendingUnobservation = true; + globalState.pendingUnobservations.push(observable); + } +} +/** + * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. + * During a batch `onBecomeUnobserved` will be called at most once per observable. + * Avoids unnecessary recalculations. + */ +function startBatch() { + globalState.inBatch++; +} +function endBatch() { + if (--globalState.inBatch === 0) { + runReactions(); + // the batch is actually about to finish, all unobserving should happen here. + var list = globalState.pendingUnobservations; + for (var i = 0; i < list.length; i++) { + var observable = list[i]; + observable.isPendingUnobservation = false; + if (observable.observers.length === 0) { + observable.onBecomeUnobserved(); + // NOTE: onBecomeUnobserved might push to `pendingUnobservations` + } + } + globalState.pendingUnobservations = []; + } +} +function reportObserved(observable) { + var derivation = globalState.trackingDerivation; + if (derivation !== null) { + /** + * Simple optimization, give each derivation run an unique id (runId) + * Check if last time this observable was accessed the same runId is used + * if this is the case, the relation is already known + */ + if (derivation.runId !== observable.lastAccessedBy) { + observable.lastAccessedBy = derivation.runId; + derivation.newObserving[derivation.unboundDepsCount++] = observable; + } + } + else if (observable.observers.length === 0) { + queueForUnobservation(observable); + } +} +/** + * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly + * It will propagate changes to observers from previous run + * It's hard or maybe impossible (with reasonable perf) to get it right with current approach + * Hopefully self reruning autoruns aren't a feature people should depend on + * Also most basic use cases should be ok + */ +// Called by Atom when its value changes +function propagateChanged(observable) { + // invariantLOS(observable, "changed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + d.dependenciesState = IDerivationState.STALE; + } + // invariantLOS(observable, "changed end"); +} +// Called by ComputedValue when it recalculate and its value changed +function propagateChangeConfirmed(observable) { + // invariantLOS(observable, "confirmed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) + d.dependenciesState = IDerivationState.STALE; + else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date. + ) + observable.lowestObserverState = IDerivationState.UP_TO_DATE; + } + // invariantLOS(observable, "confirmed end"); +} +// Used by computed when its dependency changed, but we don't wan't to immediately recompute. +function propagateMaybeChanged(observable) { + // invariantLOS(observable, "maybe start"); + if (observable.lowestObserverState !== IDerivationState.UP_TO_DATE) + return; + observable.lowestObserverState = IDerivationState.POSSIBLY_STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + d.dependenciesState = IDerivationState.POSSIBLY_STALE; + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + } + // invariantLOS(observable, "maybe end"); +} +function logTraceInfo(derivation, observable) { + console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'"); + if (derivation.isTracing === TraceMode.BREAK) { + var lines = []; + printDepTree(getDependencyTree(derivation), lines, 1); + // prettier-ignore + new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString() : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")(); + } +} +function printDepTree(tree, lines, depth) { + if (lines.length >= 1000) { + lines.push("(and many more)"); + return; + } + lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :) + if (tree.dependencies) + tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); }); +} + +var IDerivationState; +(function (IDerivationState) { + // before being run or (outside batch and not being observed) + // at this point derivation is not holding any data about dependency tree + IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; + // no shallow dependency changed since last computation + // won't recalculate derivation + // this is what makes mobx fast + IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; + // some deep dependency changed, but don't know if shallow dependency changed + // will require to check first if UP_TO_DATE or POSSIBLY_STALE + // currently only ComputedValue will propagate POSSIBLY_STALE + // + // having this state is second big optimization: + // don't have to recompute on every dependency change, but only when it's needed + IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; + // A shallow dependency has changed since last computation and the derivation + // will need to recompute when it's needed next. + IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; +})(IDerivationState || (IDerivationState = {})); +var TraceMode; +(function (TraceMode) { + TraceMode[TraceMode["NONE"] = 0] = "NONE"; + TraceMode[TraceMode["LOG"] = 1] = "LOG"; + TraceMode[TraceMode["BREAK"] = 2] = "BREAK"; +})(TraceMode || (TraceMode = {})); +var CaughtException = (function () { + function CaughtException(cause) { + this.cause = cause; + // Empty + } + return CaughtException; +}()); +function isCaughtException(e) { + return e instanceof CaughtException; +} +/** + * Finds out whether any dependency of the derivation has actually changed. + * If dependenciesState is 1 then it will recalculate dependencies, + * if any dependency changed it will propagate it by changing dependenciesState to 2. + * + * By iterating over the dependencies in the same order that they were reported and + * stopping on the first change, all the recalculations are only called for ComputedValues + * that will be tracked by derivation. That is because we assume that if the first x + * dependencies of the derivation doesn't change then the derivation should run the same way + * up until accessing x-th dependency. + */ +function shouldCompute(derivation) { + switch (derivation.dependenciesState) { + case IDerivationState.UP_TO_DATE: + return false; + case IDerivationState.NOT_TRACKING: + case IDerivationState.STALE: + return true; + case IDerivationState.POSSIBLY_STALE: { + var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction. + var obs = derivation.observing, l = obs.length; + for (var i = 0; i < l; i++) { + var obj = obs[i]; + if (isComputedValue(obj)) { + try { + obj.get(); + } + catch (e) { + // we are not interested in the value *or* exception at this moment, but if there is one, notify all + untrackedEnd(prevUntracked); + return true; + } + // if ComputedValue `obj` actually changed it will be computed and propagated to its observers. + // and `derivation` is an observer of `obj` + if (derivation.dependenciesState === IDerivationState.STALE) { + untrackedEnd(prevUntracked); + return true; + } + } + } + changeDependenciesStateTo0(derivation); + untrackedEnd(prevUntracked); + return false; + } + } +} +function isComputingDerivation() { + return globalState.trackingDerivation !== null; // filter out actions inside computations +} +function checkIfStateModificationsAreAllowed(atom) { + var hasObservers$$1 = atom.observers.length > 0; + // Should never be possible to change an observed observable from inside computed, see #798 + if (globalState.computationDepth > 0 && hasObservers$$1) + fail(getMessage("m031") + atom.name); + // Should not be possible to change observed state outside strict mode, except during initialization, see #563 + if (!globalState.allowStateChanges && hasObservers$$1) + fail(getMessage(globalState.strictMode ? "m030a" : "m030b") + atom.name); +} +/** + * Executes the provided function `f` and tracks which observables are being accessed. + * The tracking information is stored on the `derivation` object and the derivation is registered + * as observer of any of the accessed observables. + */ +function trackDerivedFunction(derivation, f, context) { + // pre allocate array allocation + room for variation in deps + // array will be trimmed by bindDependencies + changeDependenciesStateTo0(derivation); + derivation.newObserving = new Array(derivation.observing.length + 100); + derivation.unboundDepsCount = 0; + derivation.runId = ++globalState.runId; + var prevTracking = globalState.trackingDerivation; + globalState.trackingDerivation = derivation; + var result; + try { + result = f.call(context); + } + catch (e) { + result = new CaughtException(e); + } + globalState.trackingDerivation = prevTracking; + bindDependencies(derivation); + return result; +} +/** + * diffs newObserving with observing. + * update observing to be newObserving with unique observables + * notify observers that become observed/unobserved + */ +function bindDependencies(derivation) { + // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1"); + var prevObserving = derivation.observing; + var observing = (derivation.observing = derivation.newObserving); + var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE; + // Go through all new observables and check diffValue: (this list can contain duplicates): + // 0: first occurrence, change to 1 and keep it + // 1: extra occurrence, drop it + var i0 = 0, l = derivation.unboundDepsCount; + for (var i = 0; i < l; i++) { + var dep = observing[i]; + if (dep.diffValue === 0) { + dep.diffValue = 1; + if (i0 !== i) + observing[i0] = dep; + i0++; + } + // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined, + // not hitting the condition + if (dep.dependenciesState > lowestNewObservingDerivationState) { + lowestNewObservingDerivationState = dep.dependenciesState; + } + } + observing.length = i0; + derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614) + // Go through all old observables and check diffValue: (it is unique after last bindDependencies) + // 0: it's not in new observables, unobserve it + // 1: it keeps being observed, don't want to notify it. change to 0 + l = prevObserving.length; + while (l--) { + var dep = prevObserving[l]; + if (dep.diffValue === 0) { + removeObserver(dep, derivation); + } + dep.diffValue = 0; + } + // Go through all new observables and check diffValue: (now it should be unique) + // 0: it was set to 0 in last loop. don't need to do anything. + // 1: it wasn't observed, let's observe it. set back to 0 + while (i0--) { + var dep = observing[i0]; + if (dep.diffValue === 1) { + dep.diffValue = 0; + addObserver(dep, derivation); + } + } + // Some new observed derivations may become stale during this derivation computation + // so they have had no chance to propagate staleness (#916) + if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) { + derivation.dependenciesState = lowestNewObservingDerivationState; + derivation.onBecomeStale(); + } +} +function clearObserving(derivation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch"); + var obs = derivation.observing; + derivation.observing = []; + var i = obs.length; + while (i--) + removeObserver(obs[i], derivation); + derivation.dependenciesState = IDerivationState.NOT_TRACKING; +} +function untracked(action) { + var prev = untrackedStart(); + var res = action(); + untrackedEnd(prev); + return res; +} +function untrackedStart() { + var prev = globalState.trackingDerivation; + globalState.trackingDerivation = null; + return prev; +} +function untrackedEnd(prev) { + globalState.trackingDerivation = prev; +} +/** + * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 + * + */ +function changeDependenciesStateTo0(derivation) { + if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) + return; + derivation.dependenciesState = IDerivationState.UP_TO_DATE; + var obs = derivation.observing; + var i = obs.length; + while (i--) + obs[i].lowestObserverState = IDerivationState.UP_TO_DATE; +} + +function log(msg) { + console.log(msg); + return msg; +} +function whyRun(thing, prop) { + deprecated("`whyRun` is deprecated in favor of `trace`"); + thing = getAtomFromArgs(arguments); + if (!thing) + return log(getMessage("m024")); + if (isComputedValue(thing) || isReaction(thing)) + return log(thing.whyRun()); + return fail(getMessage("m025")); +} +function trace() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var enterBreakPoint = false; + if (typeof args[args.length - 1] === "boolean") + enterBreakPoint = args.pop(); + var derivation = getAtomFromArgs(args); + if (!derivation) { + return fail("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly"); + } + if (derivation.isTracing === TraceMode.NONE) { + console.log("[mobx.trace] '" + derivation.name + "' tracing enabled"); + } + derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG; +} +function getAtomFromArgs(args) { + switch (args.length) { + case 0: + return globalState.trackingDerivation; + case 1: + return getAtom(args[0]); + case 2: + return getAtom(args[0], args[1]); + } +} + +var Reaction = (function () { + function Reaction(name, onInvalidate) { + if (name === void 0) { name = "Reaction@" + getNextId(); } + this.name = name; + this.onInvalidate = onInvalidate; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = []; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.diffValue = 0; + this.runId = 0; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.isDisposed = false; + this._isScheduled = false; + this._isTrackPending = false; + this._isRunning = false; + this.isTracing = TraceMode.NONE; + } + Reaction.prototype.onBecomeStale = function () { + this.schedule(); + }; + Reaction.prototype.schedule = function () { + if (!this._isScheduled) { + this._isScheduled = true; + globalState.pendingReactions.push(this); + runReactions(); + } + }; + Reaction.prototype.isScheduled = function () { + return this._isScheduled; + }; + /** + * internal, use schedule() if you intend to kick off a reaction + */ + Reaction.prototype.runReaction = function () { + if (!this.isDisposed) { + startBatch(); + this._isScheduled = false; + if (shouldCompute(this)) { + this._isTrackPending = true; + this.onInvalidate(); + if (this._isTrackPending && isSpyEnabled()) { + // onInvalidate didn't trigger track right away.. + spyReport({ + object: this, + type: "scheduled-reaction" + }); + } + } + endBatch(); + } + }; + Reaction.prototype.track = function (fn) { + startBatch(); + var notify = isSpyEnabled(); + var startTime; + if (notify) { + startTime = Date.now(); + spyReportStart({ + object: this, + type: "reaction", + fn: fn + }); + } + this._isRunning = true; + var result = trackDerivedFunction(this, fn, undefined); + this._isRunning = false; + this._isTrackPending = false; + if (this.isDisposed) { + // disposed during last run. Clean up everything that was bound after the dispose call. + clearObserving(this); + } + if (isCaughtException(result)) + this.reportExceptionInDerivation(result.cause); + if (notify) { + spyReportEnd({ + time: Date.now() - startTime + }); + } + endBatch(); + }; + Reaction.prototype.reportExceptionInDerivation = function (error) { + var _this = this; + if (this.errorHandler) { + this.errorHandler(error, this); + return; + } + var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this; + var messageToUser = getMessage("m037"); + console.error(message || messageToUser /* latter will not be true, make sure uglify doesn't remove */, error); + /** If debugging brought you here, please, read the above message :-). Tnx! */ + if (isSpyEnabled()) { + spyReport({ + type: "error", + message: message, + error: error, + object: this + }); + } + globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); }); + }; + Reaction.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + if (!this._isRunning) { + // if disposed while running, clean up later. Maybe not optimal, but rare case + startBatch(); + clearObserving(this); + endBatch(); + } + } + }; + Reaction.prototype.getDisposer = function () { + var r = this.dispose.bind(this); + r.$mobx = this; + r.onError = registerErrorHandler; + return r; + }; + Reaction.prototype.toString = function () { + return "Reaction[" + this.name + "]"; + }; + Reaction.prototype.whyRun = function () { + var observing = unique(this._isRunning ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + return "\nWhyRun? reaction '" + this.name + "':\n * Status: [" + (this.isDisposed + ? "stopped" + : this._isRunning ? "running" : this.isScheduled() ? "scheduled" : "idle") + "]\n * This reaction will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this._isRunning + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n\t" + getMessage("m038") + "\n"; + }; + Reaction.prototype.trace = function (enterBreakPoint) { + if (enterBreakPoint === void 0) { enterBreakPoint = false; } + trace(this, enterBreakPoint); + }; + return Reaction; +}()); +function registerErrorHandler(handler) { + invariant(this && this.$mobx && isReaction(this.$mobx), "Invalid `this`"); + invariant(!this.$mobx.errorHandler, "Only one onErrorHandler can be registered"); + this.$mobx.errorHandler = handler; +} +function onReactionError(handler) { + globalState.globalReactionErrorHandlers.push(handler); + return function () { + var idx = globalState.globalReactionErrorHandlers.indexOf(handler); + if (idx >= 0) + globalState.globalReactionErrorHandlers.splice(idx, 1); + }; +} +/** + * Magic number alert! + * Defines within how many times a reaction is allowed to re-trigger itself + * until it is assumed that this is gonna be a never ending loop... + */ +var MAX_REACTION_ITERATIONS = 100; +var reactionScheduler = function (f) { return f(); }; +function runReactions() { + // Trampolining, if runReactions are already running, new reactions will be picked up + if (globalState.inBatch > 0 || globalState.isRunningReactions) + return; + reactionScheduler(runReactionsHelper); +} +function runReactionsHelper() { + globalState.isRunningReactions = true; + var allReactions = globalState.pendingReactions; + var iterations = 0; + // While running reactions, new reactions might be triggered. + // Hence we work with two variables and check whether + // we converge to no remaining reactions after a while. + while (allReactions.length > 0) { + if (++iterations === MAX_REACTION_ITERATIONS) { + console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + + (" Probably there is a cycle in the reactive function: " + allReactions[0])); + allReactions.splice(0); // clear reactions + } + var remainingReactions = allReactions.splice(0); + for (var i = 0, l = remainingReactions.length; i < l; i++) + remainingReactions[i].runReaction(); + } + globalState.isRunningReactions = false; +} +var isReaction = createInstanceofPredicate("Reaction", Reaction); +function setReactionScheduler(fn) { + var baseScheduler = reactionScheduler; + reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); }; +} + +function asReference(value) { + deprecated("asReference is deprecated, use observable.ref instead"); + return observable.ref(value); +} +function asStructure(value) { + deprecated("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."); + return observable.struct(value); +} +function asFlat(value) { + deprecated("asFlat is deprecated, use observable.shallow instead"); + return observable.shallow(value); +} +function asMap(data) { + deprecated("asMap is deprecated, use observable.map or observable.shallowMap instead"); + return observable.map(data || {}); +} + +function createComputedDecorator(equals) { + return createClassPropertyDecorator(function (target, name, _, __, originalDescriptor) { + invariant(typeof originalDescriptor !== "undefined", getMessage("m009")); + invariant(typeof originalDescriptor.get === "function", getMessage("m010")); + var adm = asObservableObject(target, ""); + defineComputedProperty(adm, name, originalDescriptor.get, originalDescriptor.set, equals, false); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + this.$mobx.values[name].set(value); + }, false, false); +} +var computedDecorator = createComputedDecorator(comparer.default); +var computedStructDecorator = createComputedDecorator(comparer.structural); +/** + * Decorator for class properties: @computed get value() { return expr; }. + * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; + */ +var computed = function computed(arg1, arg2, arg3) { + if (typeof arg2 === "string") { + return computedDecorator.apply(null, arguments); + } + invariant(typeof arg1 === "function", getMessage("m011")); + invariant(arguments.length < 3, getMessage("m012")); + var opts = typeof arg2 === "object" ? arg2 : {}; + opts.setter = typeof arg2 === "function" ? arg2 : opts.setter; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + return new ComputedValue(arg1, opts.context, equals, opts.name || arg1.name || "", opts.setter); +}; +computed.struct = computedStructDecorator; +computed.equals = createComputedDecorator; + +function isComputed(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableObject(value) === false) + return false; + if (!value.$mobx.values[property]) + return false; + var atom = getAtom(value, property); + return isComputedValue(atom); + } + return isComputedValue(value); +} + +function observe(thing, propOrCb, cbOrFire, fireImmediately) { + if (typeof cbOrFire === "function") + return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately); + else + return observeObservable(thing, propOrCb, cbOrFire); +} +function observeObservable(thing, listener, fireImmediately) { + return getAdministration(thing).observe(listener, fireImmediately); +} +function observeObservableProperty(thing, property, listener, fireImmediately) { + return getAdministration(thing, property).observe(listener, fireImmediately); +} + +function intercept(thing, propOrHandler, handler) { + if (typeof handler === "function") + return interceptProperty(thing, propOrHandler, handler); + else + return interceptInterceptable(thing, propOrHandler); +} +function interceptInterceptable(thing, handler) { + return getAdministration(thing).intercept(handler); +} +function interceptProperty(thing, property, handler) { + return getAdministration(thing, property).intercept(handler); +} + +/** + * expr can be used to create temporarily views inside views. + * This can be improved to improve performance if a value changes often, but usually doesn't affect the outcome of an expression. + * + * In the following example the expression prevents that a component is rerender _each time_ the selection changes; + * instead it will only rerenders when the current todo is (de)selected. + * + * reactiveComponent((props) => { + * const todo = props.todo; + * const isSelected = mobx.expr(() => props.viewState.selection === todo); + * return
{todo.title}
+ * }); + * + */ +function expr(expr, scope) { + if (!isComputingDerivation()) + console.warn(getMessage("m013")); + // optimization: would be more efficient if the expr itself wouldn't be evaluated first on the next change, but just a 'changed' signal would be fired + return computed(expr, { context: scope }).get(); +} + +function toJS(source, detectCycles, __alreadySeen) { + if (detectCycles === void 0) { detectCycles = true; } + if (__alreadySeen === void 0) { __alreadySeen = []; } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) + __alreadySeen.push([source, value]); + return value; + } + if (isObservable(source)) { + if (detectCycles && __alreadySeen === null) + __alreadySeen = []; + if (detectCycles && source !== null && typeof source === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) + if (__alreadySeen[i][0] === source) + return __alreadySeen[i][1]; + } + if (isObservableArray(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { return toJS(value, detectCycles, __alreadySeen); }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) + res[i] = toAdd[i]; + return res; + } + if (isObservableObject(source)) { + var res = cache({}); + for (var key in source) + res[key] = toJS(source[key], detectCycles, __alreadySeen); + return res; + } + if (isObservableMap(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { return (res_1[key] = toJS(value, detectCycles, __alreadySeen)); }); + return res_1; + } + if (isObservableValue(source)) + return toJS(source.get(), detectCycles, __alreadySeen); + } + return source; +} + +function createTransformer(transformer, onCleanup) { + invariant(typeof transformer === "function" && transformer.length < 2, "createTransformer expects a function that accepts one argument"); + // Memoizes: object id -> reactive view that applies transformer to the object + var objectCache = {}; + // If the resetId changes, we will clear the object cache, see #163 + // This construction is used to avoid leaking refs to the objectCache directly + var resetId = globalState.resetId; + // Local transformer class specifically for this transformer + var Transformer = (function (_super) { + __extends(Transformer, _super); + function Transformer(sourceIdentifier, sourceObject) { + var _this = _super.call(this, function () { return transformer(sourceObject); }, undefined, comparer.default, "Transformer-" + transformer.name + "-" + sourceIdentifier, undefined) || this; + _this.sourceIdentifier = sourceIdentifier; + _this.sourceObject = sourceObject; + return _this; + } + Transformer.prototype.onBecomeUnobserved = function () { + var lastValue = this.value; + _super.prototype.onBecomeUnobserved.call(this); + delete objectCache[this.sourceIdentifier]; + if (onCleanup) + onCleanup(lastValue, this.sourceObject); + }; + return Transformer; + }(ComputedValue)); + return function (object) { + if (resetId !== globalState.resetId) { + objectCache = {}; + resetId = globalState.resetId; + } + var identifier = getMemoizationId(object); + var reactiveTransformer = objectCache[identifier]; + if (reactiveTransformer) + return reactiveTransformer.get(); + // Not in cache; create a reactive view + reactiveTransformer = objectCache[identifier] = new Transformer(identifier, object); + return reactiveTransformer.get(); + }; +} +function getMemoizationId(object) { + if (typeof object === "string" || typeof object === "number") + return object; + if (object === null || typeof object !== "object") + throw new Error("[mobx] transform expected some kind of object or primitive value, got: " + object); + var tid = object.$transformId; + if (tid === undefined) { + tid = getNextId(); + addHiddenProp(object, "$transformId", tid); + } + return tid; +} + +function interceptReads(thing, propOrHandler, handler) { + var target; + if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { + target = getAdministration(thing); + } + else if (isObservableObject(thing)) { + if (typeof propOrHandler !== "string") + return fail("InterceptReads can only be used with a specific property, not with an object in general"); + target = getAdministration(thing, propOrHandler); + } + else { + return fail("Expected observable map, object or array as first array"); + } + if (target.dehancer !== undefined) + return fail("An intercept reader was already established"); + target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler; + return function () { + target.dehancer = undefined; + }; +} + +/** + * (c) Michel Weststrate 2015 - 2016 + * MIT Licensed + * + * Welcome to the mobx sources! To get an global overview of how MobX internally works, + * this is a good place to start: + * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 + * + * Source folders: + * =============== + * + * - api/ Most of the public static methods exposed by the module can be found here. + * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. + * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. + * - utils/ Utility stuff. + * + */ +var extras = { + allowStateChanges: allowStateChanges, + deepEqual: deepEqual, + getAtom: getAtom, + getDebugName: getDebugName, + getDependencyTree: getDependencyTree, + getAdministration: getAdministration, + getGlobalState: getGlobalState, + getObserverTree: getObserverTree, + interceptReads: interceptReads, + isComputingDerivation: isComputingDerivation, + isSpyEnabled: isSpyEnabled, + onReactionError: onReactionError, + reserveArrayBuffer: reserveArrayBuffer, + resetGlobalState: resetGlobalState, + isolateGlobalState: isolateGlobalState, + shareGlobalState: shareGlobalState, + spyReport: spyReport, + spyReportEnd: spyReportEnd, + spyReportStart: spyReportStart, + setReactionScheduler: setReactionScheduler +}; +var everything = { + Reaction: Reaction, + untracked: untracked, + Atom: Atom, + BaseAtom: BaseAtom, + useStrict: useStrict, + isStrictModeEnabled: isStrictModeEnabled, + spy: spy, + comparer: comparer, + asReference: asReference, + asFlat: asFlat, + asStructure: asStructure, + asMap: asMap, + isModifierDescriptor: isModifierDescriptor, + isObservableObject: isObservableObject, + isBoxedObservable: isObservableValue, + isObservableArray: isObservableArray, + ObservableMap: ObservableMap, + isObservableMap: isObservableMap, + map: map, + transaction: transaction, + observable: observable, + computed: computed, + isObservable: isObservable, + isComputed: isComputed, + extendObservable: extendObservable, + extendShallowObservable: extendShallowObservable, + observe: observe, + intercept: intercept, + autorun: autorun, + autorunAsync: autorunAsync, + when: when, + reaction: reaction, + action: action, + isAction: isAction, + runInAction: runInAction, + expr: expr, + toJS: toJS, + createTransformer: createTransformer, + whyRun: whyRun, + isArrayLike: isArrayLike, + extras: extras +}; +var warnedAboutDefaultExport = false; +var _loop_1 = function (p) { + var val = everything[p]; + Object.defineProperty(everything, p, { + get: function () { + if (!warnedAboutDefaultExport) { + warnedAboutDefaultExport = true; + console.warn("Using default export (`import mobx from 'mobx'`) is deprecated " + + "and won’t work in mobx@4.0.0\n" + + "Use `import * as mobx from 'mobx'` instead"); + } + return val; + } + }); +}; +for (var p in everything) { + _loop_1(p); +} +if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") { + __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: spy, extras: extras }); +} + +/* harmony default export */ __webpack_exports__["default"] = (everything); + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ 0: +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__("./node_modules/chameleon-runtime/index.js"); +module.exports = __webpack_require__("./node_modules/chameleon-store/index.js"); + + +/***/ }) + +},[0]); \ No newline at end of file diff --git a/dist/baidu/static/js/components/polyScroller/polyScroller.js b/dist/baidu/static/js/components/polyScroller/polyScroller.js index 4074ea6..93e144f 100644 --- a/dist/baidu/static/js/components/polyScroller/polyScroller.js +++ b/dist/baidu/static/js/components/polyScroller/polyScroller.js @@ -1 +1,320 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([3],{64:function(e,n,t){t(65),t(66)},65:function(e,n){},66:function(e,n,t){function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t(3),u=function(e){return e&&e.__esModule?e:{default:e}}(o),f=function e(){a(this,e)};n.default=new f,n.default=u.default.createComponent(n.default).getOptions()}},[64]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([8],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/src/components/polyScroller/polyScroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "PolyScrollerInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "PolyScroller": ["PolyScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var PolyScroller = function PolyScroller() { + _classCallCheck(this, PolyScroller); +}; + +exports.default = __CML__WRAPPER__(new PolyScroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/components/polyScroller/polyScroller.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.baidu.cml"); + + +/***/ }) + +},["./src/components/polyScroller/polyScroller.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/manifest.js b/dist/baidu/static/js/manifest.js index 29561ab..167ce52 100644 --- a/dist/baidu/static/js/manifest.js +++ b/dist/baidu/static/js/manifest.js @@ -1 +1,103 @@ -var __CML__GLOBAL={};!function(r){function t(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return r[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e=__CML__GLOBAL.webpackJsonp;__CML__GLOBAL.webpackJsonp=function(n,u,c){for(var p,f,a,_=0,i=[];_ 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Button = function Button() { + _classCallCheck(this, Button); + + this.props = { + text: { + type: String, + default: "" + }, + size: { + type: String, + default: "stretch" + }, + width: { + type: Number, + default: -1 + }, + type: { + type: String, + default: "blue" + }, + disabled: { + type: Boolean, + default: false + }, + btnStyle: { + type: String, + default: "" + }, + textStyle: { + type: String, + default: "" + }, + textStyleDisabled: { + type: String, + default: "" + }, + disabledStyle: { + type: String, + default: "" + }, + btnHoverStyle: { + type: String, + default: '' + }, + textHoverStyle: { + type: String, + default: '' + }, + openType: { + type: String, + default: "" + }, + lang: { + type: String, + default: "en" + }, + sessionFrom: { + type: String, + default: "" + }, + sendMessageTitle: { + type: String, + default: "当前标题" + }, + sendMessagePath: { + type: String, + default: "当前分享路径" + }, + sendMessageImg: { + type: String, + default: "截图" + }, + showMessageCard: { + type: Boolean, + default: false + }, + appParameter: { + type: String, + default: "" + } + }; + this.data = { + hover: false + }; + this.computed = { + hasWidth: function hasWidth() { + return this.width !== -1; + }, + btnClasses: function btnClasses() { + return (0, _util.transCls)('cml-view cml-btn', this); + }, + textClasses: function textClasses() { + return (0, _util.transCls)('btn-text', this); + }, + mrBtnStyle: function mrBtnStyle() { + var disabled = this.disabled, + btnStyle = this.btnStyle, + disabledStyle = this.disabledStyle, + hover = this.hover, + btnHoverStyle = this.btnHoverStyle, + hasWidth = this.hasWidth, + width = this.width; + + var style = disabled ? btnStyle + ";" + disabledStyle : hover ? btnStyle + ";" + btnHoverStyle : btnStyle; + + if (hasWidth) { + style = "width:" + width + "cpx;" + style; + } + + return style; + }, + mrTextStyle: function mrTextStyle() { + var disabled = this.disabled, + textStyle = this.textStyle, + textStyleDisabled = this.textStyleDisabled, + hover = this.hover, + textHoverStyle = this.textHoverStyle; + + return disabled ? textStyle + ";" + textStyleDisabled : hover ? textStyle + ";" + textHoverStyle : textStyle; + } + }; + this.methods = { + onclick: function onclick(e) { + var type = this.type, + disabled = this.disabled; + + if (disabled) return; + this.$cmlEmit('onclick', { + type: type, + disabled: disabled + }); + }, + touchstart: function touchstart(e) { + this.hover = true; + }, + touchend: function touchend(e) { + this.hover = false; + }, + getuserinfo: function getuserinfo(e) { + this.$cmlEmit('getuserinfo', e.detail); + }, + contact: function contact(e) { + this.$cmlEmit('contact'); + }, + getphonenumber: function getphonenumber(e) { + this.$cmlEmit('getphonenumber', { + errMsg: e.detail.errMsg, + encryptedData: e.detail.encryptedData || '', + //包括敏感数据在内的完整用户信息的加密数据 + iv: e.detail.iv || '' //加密算法的初始向量 + + }); + }, + error: function error(e) { + this.$cmlEmit('error', { + errMsg: e.detail.errMsg + }); + }, + opensetting: function opensetting(e) { + this.$cmlEmit('opensetting'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Button()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/button.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.baidu.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transCls = transCls; +function transCls(base, ctx) { + var type = ctx.type, + disabled = ctx.disabled, + size = ctx.size, + hover = ctx.hover, + hasWidth = ctx.hasWidth; + + + var classList = [base]; + + if (hover) { + classList.push(base + '-active'); + } + + if (!!~'red|orange|white|green'.indexOf(type)) { + classList.push(base + '-' + type); + + if (hover) { + classList.push(base + '-' + type + '-active'); + } + + if (disabled) { + classList.push(base + '-' + type + '-disable'); + } + } + + if (!!~'full|big|medium|small|stretch|auto'.indexOf(size) && !hasWidth) { + classList.push(base + '-' + size); + } + + if (disabled) { + classList.push(base + '-disable'); + } + + return classList.join(' '); +} + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/button/button.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..ebff749 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,312 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([23],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CCarouselItemInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarouselItem": ["CCarouselItemInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarouselItem = function CCarouselItem() { + _classCallCheck(this, CCarouselItem); +}; + +exports.default = __CML__WRAPPER__(new CCarouselItem()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..959dc6c --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,367 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([22],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel/carousel.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": { + "current": "Number" + } + }, + "interfaces": { + "CCarouselInterface": { + "autoplay": "Boolean", + "interval": "Number", + "circular": "Boolean", + "current": "Number", + "indicatorDots": "Boolean", + "indicatorColor": "String", + "indicatorActiveColor": "String", + "change": { + "input": ["EventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarousel": ["CCarouselInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarousel = function CCarousel() { + _classCallCheck(this, CCarousel); + + this.props = { + autoplay: { + type: Boolean, + default: false + }, + interval: { + type: Number, + default: 5000 + }, + current: { + type: Number, + default: 0 + }, + indicatorDots: { + type: Boolean, + default: false + }, + indicatorColor: { + type: String, + default: '#cccccc' + }, + indicatorActiveColor: { + type: String, + default: '#000000' + }, + circular: { + type: Boolean, + default: false + } + }; +}; + +exports.default = __CML__WRAPPER__(new CCarousel()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel/carousel.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..e175fb3 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,144 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([2],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Checkbox = function () { + function Checkbox() { + _classCallCheck(this, Checkbox); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + } + }; + this.data = { + checkedImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png"), + uncheckImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png"), + innerChecked: false + }; + this.computed = { + checkStyle: function checkStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + checkImg: function checkImg() { + return this.innerChecked ? this.checkedImg : this.uncheckImg; + }, + checkClass: function checkClass() { + if (this.disabled) { + return 'cml-checkbox-disabled'; + } + return this.innerChecked ? 'cml-checkbox-checked' : 'cml-checkbox-uncheck'; + } + }; + this.watch = { + checked: function checked(newChecked) { + this.innerChecked = newChecked; + } + }; + this.methods = { + changeCheck: function changeCheck() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('changeevent', value); + this.$cmlEmit('change', value); + } + }; + } + + _createClass(Checkbox, [{ + key: 'created', + value: function created() { + var checked = this.checked; + + this.innerChecked = checked; + } + }]); + + return Checkbox; +}(); + +exports.default = new Checkbox(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/selected_520dcc8.png"; + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/unselected_4e38c39.png"; + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/input/input.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..08ff3b3 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,592 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([6],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _utils = __webpack_require__("./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js"); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/input/input.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + }, + "blurEventDetail": {}, + "focusEventDetail": {}, + "confirEventDetail": {} + }, + "interfaces": { + "InputInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "type": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "maxValue": "Number", + "minValue": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Input": ["InputInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Input = function () { + function Input() { + _classCallCheck(this, Input); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + value: { + type: String, + default: '' + }, + //input的类型 + type: { + type: String, + default: 'text' //枚举值 text number password + + }, + //input的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用input输入 + disabled: { + type: Boolean, + default: false + }, + //控制input是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#bebebe' + }, + maxValue: { + //type=number 最大值 + type: Number, + default: 9007199254740991 + }, + minValue: { + //type=number 最小值 + type: Number, + default: -9007199254740991 + } + }; + this.data = { + inputValue: "" + }; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor + ";"; + }, + isInputNumber: function isInputNumber() { + return this.type === 'number'; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {}, + value: function value(newVal, oldVal) { + this.inputValue = newVal; + } + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.handleDetail(e); + this.$cmlEmit('input', { + value: this.inputValue + }); + this.$cmlEmit('inputevent', { + value: this.inputValue + }); + }, + blurEvent: function blurEvent(e) { + this.handleDetail(e); + this.$cmlEmit('blurevent', { + value: this.inputValue + }); + this.$cmlEmit('blur', { + value: this.inputValue + }); + }, + focusEvent: function focusEvent(e) { + this.handleDetail(e); + this.$cmlEmit('focusevent', { + value: this.inputValue + }); + this.$cmlEmit('focus', { + value: this.inputValue + }); + }, + confirmEvent: function confirmEvent(e) { + this.handleDetail(e); + this.$cmlEmit('confirmevent', { + value: this.inputValue + }); + this.$cmlEmit('confirm', { + value: this.inputValue + }); + }, + handleDetail: function handleDetail(e) { + if (!e) { + return ''; + } + + var value = e.detail.value; + + if (this.isInputNumber) { + value = (0, _utils.getValBetweenMaxAndMin)(value, this.maxValue, this.minValue); + } + + return this.inputValue = value || ''; + } + }; + } + + _createClass(Input, [{ + key: "mounted", + value: function mounted() { + this.inputValue = this.value; + } + }]); + + return Input; +}(); + +exports.default = __CML__WRAPPER__(new Input()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index2 = _interopRequireDefault(_index); + +exports.str2obj = str2obj; +exports.pxTransform = pxTransform; +exports.cmlStyleTransfer = cmlStyleTransfer; +exports.getValBetweenMaxAndMin = getValBetweenMaxAndMin; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function str2obj(str) { + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + var classValue = String(classObj[1]).replace(/(^\s*)|(\s*)$/g, ""); + obj[className] = classValue; + }); + return obj; +} + +function pxTransform(s) { + if (!s) return ''; + if (!!~s.indexOf('cpx')) { + return s.replace(/(-?\d*\.?\d*)cpx/ig, function (matchs, $1) { + return (0, _index2.default)(Number($1)) + 'px'; + }); + } + return s; +} + +function cmlStyleTransfer(str) { + if (!str) return {}; + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + if (className) { + var classValue = pxTransform(String(classObj[1]).replace(/(^\s*)|(\s*)$/g, "")); + obj[className] = classValue; + } + }); + return obj; +} + +function getValBetweenMaxAndMin(value, maxValue, minValue) { + if (isNaN(Number(value))) { + return ''; + } + if (isNaN(maxValue) || isNaN(minValue)) { + return value; + } + if (maxValue != Infinity && maxValue <= Number(value)) { + value = String(maxValue); + } + if (minValue != -Infinity && minValue >= Number(value)) { + value = String(minValue); + } + return value; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/input/input.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..2129910 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([21],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CAside = function CAside() { + _classCallCheck(this, CAside); + + this.props = { + asideStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'width:200cpx;' + }; + this.computed = { + mergeAsideStyle: function mergeAsideStyle() { + return this.defaultStyle + this.asideStyle; + } + }; +}; + +exports.default = new CAside(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..089ca87 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,84 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([20],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CCol = function CCol() { + _classCallCheck(this, CCol); + + this.props = { + width: { + type: Number, + default: 0 + }, + height: { + type: Number, + default: 0 + }, + backgroundColor: { + type: String, + default: '' + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + colStyle: function colStyle() { + var style = ''; + if (this.height) { + style = 'height:' + this.height + 'cpx;'; + } + if (this.width) { + style += 'width:' + this.width + 'cpx;'; + } + if (this.backgroundColor) { + style += 'background-color:' + this.backgroundColor + ';'; + } + if (this.margin) { + var mr = this.margin / 2; + style += 'margin-right:' + mr + 'cpx;margin-left:' + mr + 'cpx;'; + } + return style; + } + }; +}; + +exports.default = new CCol(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..37d792d --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,70 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([19],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CContainer = function CContainer() { + _classCallCheck(this, CContainer); + + this.props = { + direction: { + type: String, + default: 'row' + } + }; + this.computed = { + isVertical: function isVertical() { + if (this.direction === 'column') { + return true; + } else if (this.direction === 'row') { + return false; + } + }, + containerStyle: function containerStyle() { + var finalStyle = ''; + + if (this.isVertical) { + finalStyle = "flex-direction:column"; + } + return finalStyle; + } + }; +}; + +exports.default = new CContainer(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..a611090 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([18],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CFoot = function CFoot() { + _classCallCheck(this, CFoot); + + this.props = { + footStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeFootStyle: function mergeFootStyle() { + return this.defaultStyle + this.footStyle; + } + }; +}; + +exports.default = new CFoot(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..af1a12f --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([17],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CHead = function CHead() { + _classCallCheck(this, CHead); + + this.props = { + headStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeHeadStyle: function mergeHeadStyle() { + return this.defaultStyle + this.headStyle; + } + }; +}; + +exports.default = new CHead(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..7556725 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,59 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([16],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CMain = function CMain() { + _classCallCheck(this, CMain); + + this.props = { + mainStyle: { + type: String, + default: '' + } + }; + this.data = {}; + this.computed = { + mergeMainStyle: function mergeMainStyle() { + return this.mainStyle; + } + }; +}; + +exports.default = new CMain(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..6bc3cf7 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,89 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([15],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CRow = function CRow() { + _classCallCheck(this, CRow); + + this.props = { + // start/end/center/space-around/space-between + justify: { + type: String, + default: 'center' + }, + // top/middle/bottom + align: { + type: String, + default: 'middle' + }, + height: { + type: Number, + default: 0 + }, + wrap: { + type: Boolean, + default: false + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + rowClass: function rowClass() { + return 'flex-row-' + this.justify + '-' + this.align; + }, + rowStyle: function rowStyle() { + var style = ''; + if (this.height) { + style += 'height:' + this.height + 'cpx;'; + } + if (this.wrap) { + style += 'flex-wrap:wrap;'; + } + if (this.margin) { + style += 'margin:' + this.margin / 2 + 'cpx 0;'; + } + return style; + } + }; +}; + +exports.default = new CRow(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/list/list.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..8577397 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,476 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([14],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _index5 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index6 = _interopRequireDefault(_index5); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/list/list.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollDetail": { + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number", + "deltaX": "Number", + "deltaY": "Number" + }, + "bottomDetail": { + "direction": "String" + } + }, + "interfaces": { + "ListInterface": { + "bottomOffset": "Number", + "toElement": "String", + "bounce": "Boolean", + "height": "Number", + "cstyle": "String", + "onscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["bottomDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "List": ["ListInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var List = function () { + function List() { + _classCallCheck(this, List); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + toElement: { + type: String, + default: '' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + } + }; + this.data = { + cmtstyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "cpx;"; + } + + return this.cmtstyle + this.cstyle; + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index6.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + this.$cmlEmit('scrolltobottom', { + 'direction': 'bottom' + }); + } + }; + } + + _createClass(List, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var rectData, windowRect, height; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (_this2.height) { + _context.next = 3; + break; + } + + console.error('list组件必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.height === -1)) { + _context.next = 12; + break; + } + + _context.next = 6; + return (0, _index4.default)('c-list', _this2); + + case 6: + rectData = _context.sent; + _context.next = 9; + return (0, _index2.default)(); + + case 9: + windowRect = _context.sent; + height = windowRect.viewportHeight - rectData.top; + + _this2.cmtstyle = "height:" + height + "cpx;"; + + case 12: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return List; +}(); + +exports.default = __CML__WRAPPER__(new List()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/list/list.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/page/page.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..f8a71cb --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,740 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([3],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/page/page.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CPageInterface": { + "title": "String", + "back": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CPage": ["CPageInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CPage = function () { + function CPage() { + _classCallCheck(this, CPage); + + this.props = { + title: { + required: true, + type: String, + default: '' + } + }; + this.watch = { + title: function title(v) { + this.setTitle(v); + } + }; + this.methods = { + setTitle: function setTitle(v) { + (0, _index2.default)(v); + } + }; + } + + _createClass(CPage, [{ + key: "created", + value: function created() { + this.setTitle(this.title); + } + }]); + + return CPage; +}(); + +exports.default = __CML__WRAPPER__(new CPage()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/setTitle/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "setTitleInterface": { + "setTitle": { + "input": ["String"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["setTitleInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "setTitle", + value: function setTitle(title) { + swan.setNavigationBarTitle({ + title: title + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = setTitle; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function setTitle() { + var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _index2.default.setTitle(title); +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/page/page.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..34b495a --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,137 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([13],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Radio = function () { + function Radio() { + _classCallCheck(this, Radio); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + }, + color: { + type: String, + default: '#fc9153' + } + }; + this.data = { + innerChecked: false + }; + this.computed = { + radioStyle: function radioStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + radioInnerStyle: function radioInnerStyle() { + var style = ''; + if (this.innerChecked) { + style += 'border:10cpx solid ' + this.color + ';'; + } else { + style += 'border:1px solid #ccc;'; + } + + return style; + }, + radioClass: function radioClass() { + if (this.disabled) { + return this.innerChecked ? 'cml-radio-selected-disabled' : 'cml-radio-unselect-disabled'; + } + return this.innerChecked ? 'cml-radio-selected' : 'cml-radio-unselect'; + } + }; + this.watch = { + checked: function checked(val) { + this.innerChecked = val; + } + }; + this.methods = { + changeSelect: function changeSelect() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('change', value); + this.$cmlEmit('changeevent', value); + } + }; + } + + _createClass(Radio, [{ + key: 'mounted', + value: function mounted() { + this.innerChecked = this.checked; + } + }]); + + return Radio; +}(); + +exports.default = new Radio(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/radio/radio.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..55a2c77 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,434 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([4],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _richHandle = __webpack_require__("./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js"); + +var _richHandle2 = _interopRequireDefault(_richHandle); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/richtext/richtext.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "richConfig": { + "color": "String", + "font_size": "Number", + "start": "Number", + "end": "Number" + }, + "richMessageArray": ["richConfig"], + "richData": { + "message": "String", + "rich_message": "richMessageArray" + } + }, + "interfaces": { + "RichtextInterface": { + "richData": "richData" + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Richtext": ["RichtextInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Richtext = function Richtext() { + _classCallCheck(this, Richtext); + + this.props = { + richData: { + type: Object, + default: { + message: '', + rich_message: [{ + color: '', + font_size: 0, + start: 0, + end: 0 + }] + } + } + }; + this.computed = { + richList: function richList() { + var richList = (0, _richHandle2.default)(this.richData); + richList = richList.map(function (item) { + if (item.color && item.font_size) { + item.style = "color:" + item.color + ";font-size:" + item.font_size + "cpx;"; + } else { + item.style = ''; + } + + return item; + }); + return richList; + } + }; +}; + +exports.default = __CML__WRAPPER__(new Richtext()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = richHandle; +function richHandle(richData) { + var richConf = richData.rich_message, + richTexts = richData.message.split(''); + //切割文本 + richTexts = richTexts.map(function (item) { + return { + text: item, + index: -1 + }; + }); + // 过滤错误配置 + richConf = richConf.filter(function (item) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + return !isNaN(start) && !isNaN(end) && start <= end; + }); + // 遍历获取文本对应样式index + richConf.forEach(function (item, index) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + start = start < 0 ? 0 : start; + end = end > richTexts.length - 1 ? richTexts.length - 1 : end; + for (var i = start; i <= end; i++) { + richTexts[i].index = index; + } + }); + var start = 0, + end = richTexts.length; + var richList = []; + while (start < end) { + var i = start; + var rIndex = richTexts[i].index; + var conf = rIndex === -1 ? null : richConf[rIndex]; + var ri = { + font_size: conf && conf.font_size, + color: conf && conf.color, + text: '' + }; + for (; i < end; i++) { + if (richTexts[i].index !== rIndex) { + break; + } + ri.text += richTexts[i].text; + } + richList.push(ri); + start = i; + } + + return richList; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/richtext/richtext.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..8f8b9cd --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,527 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([12],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _index5 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index6 = _interopRequireDefault(_index5); + +var _index7 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index8 = _interopRequireDefault(_index7); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/scroller/scroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollEventDetail": { + "deltaX": "Number", + "deltaY": "Number", + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number" + }, + "scrolltobottomEventDetail": { + "direction": "String" + } + }, + "interfaces": { + "ScrollerInterface": { + "cstyle": "String", + "bottomOffset": "Number", + "scrollDirection": "String", + "bounce": "Boolean", + "height": "Number", + "width": "Number", + "scrollTop": "Number", + "scrollLeft": "Number", + "onscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["scrolltobottomEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Scroller": ["ScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Scroller = function () { + function Scroller() { + _classCallCheck(this, Scroller); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + scrollDirection: { + // 可选为 horizontal 或者 vertical,默认值为 vertical 。定义滚动的方向。 + type: String, + default: 'vertical' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + }, + width: { + type: Number, + default: 0 + }, + scrollTop: { + type: Number, + default: 0 + }, + scrollLeft: { + type: Number, + default: 0 + } + }; + this.data = { + cmtStyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.scrollDirection === 'vertical') { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "rpx;"; + } + } else { + if (this.width >= 0) { + return this.cstyle + ";width:" + this.width + "rpx;white-space:nowrap;"; + } + } // 没有传递的情况 + + + return this.cmtStyle + this.cstyle; + }, + scrollTopPx: function scrollTopPx() { + // scroll-top仅支持px + return (0, _index8.default)(this.scrollTop); + }, + scrollLeftPx: function scrollLeftPx() { + return (0, _index8.default)(this.scrollLeft); + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index6.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + this.$cmlEmit('scrolltobottom', { + direction: 'bottom' + }); + } + }; + } + + _createClass(Scroller, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var rectData, windowRect, height, width; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(_this2.scrollDirection === 'vertical' && !_this2.height)) { + _context.next = 3; + break; + } + + console.error('纵向滚动必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.scrollDirection !== 'vertical' && !_this2.width)) { + _context.next = 6; + break; + } + + console.error('横向滚动必须传递宽度属性'); + return _context.abrupt("return"); + + case 6: + if (!(_this2.height === -1 || _this2.width === -1)) { + _context.next = 14; + break; + } + + _context.next = 9; + return (0, _index4.default)('c-scroller', _this2); + + case 9: + rectData = _context.sent; + _context.next = 12; + return (0, _index2.default)(); + + case 12: + windowRect = _context.sent; + + + if (_this2.scrollDirection === 'vertical') { + height = windowRect.viewportHeight - rectData.top; + + _this2.cmtStyle = "height:" + height + "cpx;"; + } else { + width = windowRect.viewportWidth - rectData.left; + + _this2.cmtStyle = "width:" + width + "cpx;white-space:nowrap;"; + } + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return Scroller; +}(); + +exports.default = __CML__WRAPPER__(new Scroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/scroller/scroller.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..774e9d4 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,366 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([11],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/switch/switch.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "valueDetail": { + "value": "Boolean" + } + }, + "interfaces": { + "SwitchInterface": { + "checked": "Boolean", + "disabled": "Boolean", + "label": "String", + "opencolor": "String", + "changeevent": { + "input": ["valueDetail"], + "output": "Undefined" + }, + "change": { + "input": ["valueDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Switch": ["SwitchInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Switch = function Switch() { + _classCallCheck(this, Switch); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String, + default: '' + }, + disabled: { + type: Boolean, + default: false + }, + opencolor: { + type: String, + default: '#fc9153' + } + }; + this.methods = { + switchChange: function switchChange(e) { + this.$cmlEmit('change', { + value: e.detail.checked + }); + this.$cmlEmit('changeevent', { + value: e.detail.checked + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Switch()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/switch/switch.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..e2b784c --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,465 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([10],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/textarea/textarea.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + } + }, + "interfaces": { + "TextareaInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "rows": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Textarea": ["TextareaInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; +/* +event: cinput cblur cfocus cconfirm +*/ +var Textarea = function Textarea() { + _classCallCheck(this, Textarea); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + //textarea的内容 + value: { + type: String, + default: '' + }, + //textarea的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用textarea输入 + disabled: { + type: Boolean, + default: false + }, + //控制textarea是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#666' + }, + rows: { + type: Number, + default: 2 + } + }; + this.data = {}; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {} + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.$cmlEmit('input', { + value: e.detail.value || '' + }); + this.$cmlEmit('inputevent', { + value: e.detail.value || '' + }); + }, + blurEvent: function blurEvent(e) { + this.$cmlEmit('blur', { + value: e.detail.value || '' + }); + this.$cmlEmit('blurevent', { + value: e.detail.value || '' + }); + }, + focusEvent: function focusEvent(e) { + this.$cmlEmit('focus', { + value: e.detail.value || '' + }); + this.$cmlEmit('focusevent', { + value: e.detail.value || '' + }); + }, + confirmEvent: function confirmEvent(e) { + this.$cmlEmit('confirm', { + value: e.detail.value || '' + }); + this.$cmlEmit('confirmevent', { + value: e.detail.value || '' + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Textarea()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/textarea/textarea.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/npm/chameleon-ui-builtin/components/video/video.js b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..08709b6 --- /dev/null +++ b/dist/baidu/static/js/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,407 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([9],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/video/video.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": {} + }, + "interfaces": { + "VideoInterface": { + "controls": "Boolean", + "autoplay": "Boolean", + "loop": "Boolean", + "src": "String", + "cstyle": "String", + "customstart": { + "input": ["Undefined"], + "output": "Undefined" + }, + "custompause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfinish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfail": { + "input": ["Undefined"], + "output": "Undefined" + }, + "start": { + "input": ["Undefined"], + "output": "Undefined" + }, + "pause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "finish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "fail": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Video": ["VideoInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Video = function Video() { + _classCallCheck(this, Video); + + this.props = { + controls: { + type: Boolean, + default: false + }, + autoplay: { + type: Boolean, + default: false + }, + loop: { + type: Boolean, + default: false + }, + src: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + } + }; + this.computed = { + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cstyle; + } + }; + this.methods = { + onstart: function onstart(e) { + this.$cmlEmit('start'); + this.$cmlEmit('customstart'); + }, + onpause: function onpause(e) { + this.$cmlEmit('pause'); + this.$cmlEmit('custompause'); + }, + onfinish: function onfinish(e) { + this.$cmlEmit('finish'); + this.$cmlEmit('customfinish'); + }, + onfail: function onfail(e) { + this.$cmlEmit('fail'); + this.$cmlEmit('customfail'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Video()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/video/video.baidu.cml"]); \ No newline at end of file diff --git a/dist/baidu/static/js/pages/index/index.js b/dist/baidu/static/js/pages/index/index.js index e7e7739..7a8f7bc 100644 --- a/dist/baidu/static/js/pages/index/index.js +++ b/dist/baidu/static/js/pages/index/index.js @@ -1 +1,50 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([2],{61:function(e,t,n){n(62),n(63)},62:function(e,t){},63:function(e,t,n){function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=n(3),f=function(e){return e&&e.__esModule?e:{default:e}}(u),i=function e(){a(this,e),this.data={list:["0","1","2","3","4","5","6","7","8","9"]}};t.default=new i,t.default=f.default.createPage(t.default).getOptions()}},[61]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([7],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Row = function Row() { + _classCallCheck(this, Row); + + this.data = { + list: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + }; +}; + +exports.default = new Row(); + + +exports.default = _chameleonRuntime2.default.createPage(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/baidu/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"baidu\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=baidu&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); + + +/***/ }) + +},["./src/pages/index/index.cml"]); \ No newline at end of file diff --git a/dist/wx/components/polyScroller/polyScroller.wxss b/dist/wx/components/polyScroller/polyScroller.wxss index db6dd41..116cee8 100644 --- a/dist/wx/components/polyScroller/polyScroller.wxss +++ b/dist/wx/components/polyScroller/polyScroller.wxss @@ -1 +1,143 @@ -.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-base,.cml-base:after,.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}page{height:100%}.cml-view,page{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-text,.cml-view,page{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-text{display:block;white-space:pre-wrap;word-wrap:break-word;overflow:hidden}.cml-border-1px,.cml-border-bottom-1px,.cml-border-left-1px,.cml-border-right-1px,.cml-border-top-1px{position:relative}.cml-border-1px:after,.cml-border-bottom-1px:after,.cml-border-left-1px:before,.cml-border-right-1px:after,.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-border-none:after,.cml-border-none:before{display:none}.cml-c-button{-webkit-align-self:stretch;align-self:stretch} \ No newline at end of file +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/button/button.js b/dist/wx/npm/chameleon-ui-builtin/components/button/button.js new file mode 100644 index 0000000..7027445 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/button/button.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/button/button.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/button/button.json b/dist/wx/npm/chameleon-ui-builtin/components/button/button.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/button/button.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxml b/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxml new file mode 100644 index 0000000..7adbedd --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxss b/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxss new file mode 100644 index 0000000..5191c39 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/button/button.wxss @@ -0,0 +1,288 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-btn { + display: -webkit-box; + display: -webkit-flex; + display: flex; + padding: 0 30rpx; + height: 88rpx; + line-height: 88rpx; + background: #4a4c5b; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + border-radius: 4rpx; + font-size: 32rpx; + color: #fff; +} + +.cml-btn-active { + background: #444654; +} + +.cml-btn:after { + border: none; +} + +.cml-btn-orange { + background: #fc9153; +} + +.cml-btn-orange-active { + background: #e8864c; +} + +.cml-btn-green { + background: #50a050; +} + +.cml-btn-green-active { + background: #57a957; +} + +.cml-btn-red { + background: #db2a36; +} + +.cml-btn-red-active { + background: #ea2e3b; +} + +.cml-btn-disable { + background: #ccc; +} + +.cml-btn-disable:active { + background: #ccc; +} + +.cml-btn-white { + color: #666; + background: #FFFFFF; + border: 1rpx solid #A5A5A5; +} + +.cml-btn-white-active { + background: #e8e8e8; +} + +.cml-btn-white-disable, +.cml-btn-white:disabled { + color: #fff; + background: #ccc; + border: 0; +} + +.cml-btn-white-disable:active, +.cml-btn-white:disabled:active { + background: #ccc; +} + +.cml-btn-full { + width: 702rpx; + height: 88rpx; +} + +.cml-btn-big { + width: 339rpx; + height: 70rpx; +} + +.cml-btn-medium { + width: 218rpx; + height: 60rpx; +} + +.cml-btn-small { + width: 157rpx; + height: 44rpx; +} + +.cml-btn-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-btn-auto { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.btn-text { + text-align: center; + vertical-align: middle; + text-overflow: ellipsis; + white-space: nowrap; + outline: none; + font-size: 36rpx; + color: #ffffff; +} + +.btn-text-white { + color: #666; +} + +.btn-text-white-disable { + color: #fff; +} + +.btn-text-full { + font-size: 36rpx; +} + +.btn-text-big { + font-size: 32rpx; +} + +.btn-text-medium { + font-size: 28rpx; +} + +.btn-text-small { + font-size: 24rpx; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..08d4150 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json b/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.wxml b/dist/wx/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.wxml new file mode 100644 index 0000000..e69de29 diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..055aa6a --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.json b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxml b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxml new file mode 100644 index 0000000..e69de29 diff --git a/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxss b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxss new file mode 100644 index 0000000..116cee8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/carousel/carousel.wxss @@ -0,0 +1,143 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..51d57e2 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.json b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxml b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxml new file mode 100644 index 0000000..d6ad8ad --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxml @@ -0,0 +1,10 @@ + + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxss b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxss new file mode 100644 index 0000000..3db901d --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/checkbox/checkbox.wxss @@ -0,0 +1,204 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-checkbox { + margin: 10rpx; +} + +.cml-checkbox-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-checkbox-checked { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-checkbox-uncheck { + width: 32rpx; + height: 32rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.cml-checkbox-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} + +.inner-icon { + width: 32rpx; + height: 32rpx; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/input/input.js b/dist/wx/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..999c8fe --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/input/input.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/input/input.json b/dist/wx/npm/chameleon-ui-builtin/components/input/input.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/input/input.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxml b/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxml new file mode 100644 index 0000000..fe6d606 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxss b/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxss new file mode 100644 index 0000000..cbd5746 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/input/input.wxss @@ -0,0 +1,156 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.input-wrap { + font-size: 33rpx; + height: 80rpx; + line-height: 80rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + border: 1rpx solid #999; + border-radius: 8rpx; + text-align: left; + background-color: #fff; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..2ab3b73 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxml new file mode 100644 index 0000000..7d76930 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxss new file mode 100644 index 0000000..26dda31 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/aside/aside.wxss @@ -0,0 +1,154 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-aside { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #d3dce6; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..1a8c010 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/col/col.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxml new file mode 100644 index 0000000..8440e61 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxss new file mode 100644 index 0000000..116cee8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/col/col.wxss @@ -0,0 +1,143 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..207a677 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/container/container.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxml new file mode 100644 index 0000000..8743e94 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxss new file mode 100644 index 0000000..dd4253e --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/container/container.wxss @@ -0,0 +1,156 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-container { + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..6a8a99f --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxml new file mode 100644 index 0000000..8ddca90 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxss new file mode 100644 index 0000000..b586b2d --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/foot/foot.wxss @@ -0,0 +1,154 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-foot { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..06983eb --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/head/head.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxml new file mode 100644 index 0000000..1ac8d7b --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxss new file mode 100644 index 0000000..2862bc6 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/head/head.wxss @@ -0,0 +1,154 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-head { + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #b3c0d1; + color: #333; + line-height: 60rpx; + -webkit-flex-shrink: 0; + flex-shrink: 0; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..1d3339f --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/main/main.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxml new file mode 100644 index 0000000..8340676 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxss new file mode 100644 index 0000000..c3fb98f --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/main/main.wxss @@ -0,0 +1,154 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.c-main { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + flex: 1; + background-color: #e9eef3; + color: #333; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..25d59d6 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../../static/js/common.js') +require('../../../../../static/js/npm/chameleon-ui-builtin/components/layout/row/row.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.json b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxml b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxml new file mode 100644 index 0000000..d94d47e --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxss b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxss new file mode 100644 index 0000000..d20143d --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/layout/row/row.wxss @@ -0,0 +1,380 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.flex-row-start-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-end-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-center-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-space-between-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-space-around-top { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flex-row-start-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-end-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-center-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-space-between-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-space-around-middle { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.flex-row-start-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-end-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-center-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-space-between-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flex-row-space-around-bottom { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/list/list.js b/dist/wx/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..8073000 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/list/list.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/list/list.json b/dist/wx/npm/chameleon-ui-builtin/components/list/list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/list/list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxml b/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxml new file mode 100644 index 0000000..487b554 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxss b/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxss new file mode 100644 index 0000000..116cee8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/list/list.wxss @@ -0,0 +1,143 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/page/page.js b/dist/wx/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..7a60280 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/page/page.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/page/page.json b/dist/wx/npm/chameleon-ui-builtin/components/page/page.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/page/page.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxml b/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxml new file mode 100644 index 0000000..29276ec --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxss b/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxss new file mode 100644 index 0000000..6afc184 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/page/page.wxss @@ -0,0 +1,153 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.page { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..f1d0c62 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/radio/radio.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.json b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxml b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxml new file mode 100644 index 0000000..484b0cd --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxml @@ -0,0 +1,9 @@ + + + + + + + {{label}} + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxss b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxss new file mode 100644 index 0000000..7a626f8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/radio/radio.wxss @@ -0,0 +1,202 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-radio { + margin: 10rpx; +} + +.cml-radio-wrap { + padding: 11rpx 0; + word-break: break-word; + word-wrap: break-word; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + line-height: 1.5; + position: relative; +} + +.cml-radio-selected { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; +} + +.cml-radio-selected-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 100rpx; + box-sizing: border-box; + opacity: 0.5; +} + +.cml-radio-unselect { + width: 32rpx; + height: 32rpx; + border: 1px solid #ccc; + border-radius: 20rpx; + box-sizing: border-box; +} + +.cml-radio-unselect-disabled { + width: 32rpx; + height: 32rpx; + border-radius: 20rpx; + background: #ccc; + box-sizing: border-box; +} + +.cml-radio-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..9549bcc --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.json b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxml b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxml new file mode 100644 index 0000000..3911af3 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxml @@ -0,0 +1,3 @@ + + {{item.text}} + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxss b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxss new file mode 100644 index 0000000..2336521 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/richtext/richtext.wxss @@ -0,0 +1,153 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.rich-text { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..422eb40 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.json b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxml b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxml new file mode 100644 index 0000000..183452a --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxss b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxss new file mode 100644 index 0000000..116cee8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/scroller/scroller.wxss @@ -0,0 +1,143 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..4203283 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/switch/switch.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.json b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxml b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxml new file mode 100644 index 0000000..6b8244a --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxml @@ -0,0 +1,4 @@ + + + {{label}} + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxss b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxss new file mode 100644 index 0000000..0064ebd --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/switch/switch.wxss @@ -0,0 +1,153 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.cml-switch-disabled { + opacity: 0.5; +} + +.cml-switch-label { + color: #666; + font-weight: 400; + font-size: 32rpx; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..ea53823 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.json b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxml b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxml new file mode 100644 index 0000000..659461c --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxml @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxss b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxss new file mode 100644 index 0000000..7048a64 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/textarea/textarea.wxss @@ -0,0 +1,157 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.textarea-wrap { + font-size: 40rpx; + height: 150rpx; + line-height: 50rpx; + padding-left: 20rpx; + padding-right: 20rpx; + color: #000; + text-align: left; + background-color: #fff; + width: auto; + border: 1rpx solid #999; + border-radius: 8rpx; +} diff --git a/dist/wx/npm/chameleon-ui-builtin/components/video/video.js b/dist/wx/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..499ac17 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,4 @@ +var __CML__GLOBAL = require('../../../../static/js/manifest.js') +__CML__GLOBAL.Component = Component; +require('../../../../static/js/common.js') +require('../../../../static/js/npm/chameleon-ui-builtin/components/video/video.js') diff --git a/dist/wx/npm/chameleon-ui-builtin/components/video/video.json b/dist/wx/npm/chameleon-ui-builtin/components/video/video.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/video/video.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxml b/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxml new file mode 100644 index 0000000..0890237 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxml @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxss b/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxss new file mode 100644 index 0000000..116cee8 --- /dev/null +++ b/dist/wx/npm/chameleon-ui-builtin/components/video/video.wxss @@ -0,0 +1,143 @@ +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} diff --git a/dist/wx/pages/index/index.wxss b/dist/wx/pages/index/index.wxss index 184b3ee..582c792 100644 --- a/dist/wx/pages/index/index.wxss +++ b/dist/wx/pages/index/index.wxss @@ -1 +1,614 @@ -.cml-base{text-align:left;font-size:32rpx;letter-spacing:1rpx;font-family:BlinkMacSystemFont,Source Sans Pro,Helvetica Neue,Helvetica,Arial,sans-serif}.cml-base,.cml-base:after,.cml-base:before{box-sizing:border-box;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}page{height:100%}.cml-view,page{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch;-webkit-align-content:flex-start;align-content:flex-start}.cml-text,.cml-view,page{box-sizing:border-box;position:relative;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0;-webkit-flex-basis:auto;flex-basis:auto;border:0 solid #000;margin:0;padding:0;min-width:0}.cml-text{display:block;white-space:pre-wrap;word-wrap:break-word;overflow:hidden}.cml-border-1px,.cml-border-bottom-1px,.cml-border-left-1px,.cml-border-right-1px,.cml-border-top-1px{position:relative}.cml-border-1px:after,.cml-border-bottom-1px:after,.cml-border-left-1px:before,.cml-border-right-1px:after,.cml-border-top-1px:before{content:"";display:block;position:absolute;-webkit-transform-origin:0 0;transform-origin:0 0;box-sizing:border-box;z-index:2}.cml-border-1px:after{border:1rpx solid #ccc;left:0;top:0;width:100%;height:100%;-webkit-transform-origin:0 0;transform-origin:0 0}.cml-border-top-1px:before{border-top:1rpx solid #ccc;left:0;top:0;width:100%}.cml-border-right-1px:after{border-right:1rpx solid #ccc;top:0;right:0;height:100%;-webkit-transform-origin:right 0;transform-origin:right 0}.cml-border-bottom-1px:after{border-bottom:1rpx solid #ccc;left:0;bottom:0;width:100%;-webkit-transform-origin:0 bottom;transform-origin:0 bottom}.cml-border-left-1px:before{border-left:1rpx solid #ccc;top:0;left:0;height:100%}.cml-border-none:after,.cml-border-none:before{display:none}.cml-c-button{-webkit-align-self:stretch;align-self:stretch}.flex-page{background-color:#f8f8f8}.flex-header{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:40rpx;height:200rpx}.flex-header__title{color:#333;font-size:40rpx;font-weight:700;height:60rpx;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row;background-color:#faebd7}.flex-panel__title{margin:2rpx;box-shadow:0 3px 5px #888;background-color:#d3d3d3;position:-webkit-sticky;position:sticky;top:0;z-index:999}.flex-panel__content{margin-top:20rpx;overflow:hidden}.flex-panel__content-main{background-color:#789}.weight_700{font-weight:700}.flex-body{background:#fff;box-shadow:0 10rpx 300rpx 0 rgba(0,0,0,.11)}.flex-panel{padding-top:60rpx}.flex-item__title{background-color:#faebd7}.item{margin:8rpx;border:2rpx solid #fff}.item-block{height:60rpx;width:100rpx;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.item-block,.item-wrap{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.item-wrap{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.item-text-inner{color:#fff}.item-text{width:44rpx;height:44rpx;border:2rpx solid #fff;border-radius:22rpx;color:#fff;text-align:center}.border-none{border:0}.row{-webkit-box-direction:normal;-webkit-flex-direction:row;flex-direction:row}.row,.row-reverse{-webkit-box-orient:horizontal}.row-reverse{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.column-reverse,.row-reverse{-webkit-box-direction:reverse}.column-reverse{-webkit-box-orient:vertical;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.nowrap{-webkit-flex-wrap:nowrap;flex-wrap:nowrap}.wrap{-webkit-flex-wrap:wrap;flex-wrap:wrap}.wrap-reverse{-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse}.justify-flex-start{-webkit-box-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start}.justify-flex-end{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.justify-center{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.justify-space-between{-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.justify-space-around{-webkit-justify-content:space-around;justify-content:space-around}.align-flex-start{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.align-flex-end{-webkit-box-align:end;-webkit-align-items:flex-end;align-items:flex-end}.align-center{-webkit-box-align:center;-webkit-align-items:center;align-items:center}.align-baseline{-webkit-box-align:baseline;-webkit-align-items:baseline;align-items:baseline}.align-stretch{-webkit-box-align:stretch;-webkit-align-items:stretch;align-items:stretch}.align-content-flex-start{-webkit-align-content:flex-start;align-content:flex-start}.align-content-flex-end{-webkit-align-content:flex-end;align-content:flex-end}.align-content-center{-webkit-align-content:center;align-content:center}.align-content-space-between{-webkit-align-content:space-between;align-content:space-between}.align-content-space-around{-webkit-align-content:space-around;align-content:space-around}.align-content-stretch{-webkit-align-content:stretch;align-content:stretch}.order_0{-webkit-box-ordinal-group:1;-webkit-order:0;order:0}.order_1{-webkit-box-ordinal-group:2;-webkit-order:1;order:1}.order_2{-webkit-box-ordinal-group:3;-webkit-order:2;order:2}.order_3{-webkit-box-ordinal-group:4;-webkit-order:3;order:3}.order_4{-webkit-box-ordinal-group:5;-webkit-order:4;order:4}.order_-1{-webkit-box-ordinal-group:0;-webkit-order:-1;order:-1}.flex-grow_0{-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.flex-grow_1{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.flex-grow_2{-webkit-box-flex:2;-webkit-flex-grow:2;flex-grow:2}.flex-shrink_0{-webkit-flex-shrink:0;flex-shrink:0}.flex-shrink_1{-webkit-flex-shrink:1;flex-shrink:1}.flex-shrink_2{-webkit-flex-shrink:2;flex-shrink:2}.flex-basis_auto{-webkit-flex-basis:auto;flex-basis:auto}.flex-basis_25{-webkit-flex-basis:187.5rpx;flex-basis:187.5rpx}.flex-basis_50{-webkit-flex-basis:375rpx;flex-basis:375rpx}.align-self-flex-start{-webkit-align-self:auto;align-self:auto;-webkit-align-self:flex-start;align-self:flex-start}.align-self-flex-end{-webkit-align-self:flex-end;align-self:flex-end}.align-self-center{-webkit-align-self:center;align-self:center}.align-self-baseline{-webkit-align-self:baseline;align-self:baseline}.align-self-stretch{-webkit-align-self:stretch;align-self:stretch}.antiquewhite{background-color:#faebd7}.lightpink{background-color:#ffb6c1}.lightskyblue{background-color:#87cefa}.silver{background-color:silver}.darkseagreen{background-color:#8fbc8f}.lightslategrey{background-color:#789}.cadetblue{background-color:#5f9ea0}.lightgray{background-color:#d3d3d3}.color-white{color:#fff}.color-brown{color:brown}.h_240{height:240rpx}.h_200{height:200rpx}.h_120{height:120rpx}.h_100{height:100rpx}.h_80{height:80rpx}.h_60{height:60rpx}.h_40{height:40rpx}.w_200{width:200rpx}.w_120{width:120rpx}.w_80{width:80rpx}.w_60{width:60rpx}.w_40{width:40rpx} \ No newline at end of file +.cml-base { + text-align: left; + font-size: 32rpx; + letter-spacing: 1rpx; + font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.cml-base, +.cml-base::before, +.cml-base::after { + box-sizing: border-box; + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; + -ms-text-size-adjust: none; + text-size-adjust: none; +} + +page { + height: 100%; +} + +page, .cml-view { + display: -webkit-box; + display: -webkit-flex; + display: flex; + box-sizing: border-box; + position: relative; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-flex-shrink: 0; + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + -webkit-align-content: flex-start; + align-content: flex-start; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-text { + display: block; + box-sizing: border-box; + position: relative; + white-space: pre-wrap; /* not using 'pre': support auto line feed. 保留空白符序列,但是正常地进行换行 */ + word-wrap: break-word; /* 在长单词或 URL 地址内部进行换行。 */ + overflow: hidden; /* it'll be clipped if the height is not high enough. */ + + -webkit-flex-shrink: 0; + + flex-shrink: 0; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + -webkit-flex-basis: auto; + flex-basis: auto; + border: 0 solid black; + margin: 0; + padding: 0; + min-width: 0; +} + +.cml-border-1px, +.cml-border-top-1px, +.cml-border-right-1px, +.cml-border-bottom-1px, +.cml-border-left-1px { + position: relative; +} + +.cml-border-top-1px:before, +.cml-border-left-1px:before, +.cml-border-1px:after, +.cml-border-right-1px:after, +.cml-border-bottom-1px:after { + content: ""; + display: block; + position: absolute; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + box-sizing: border-box; + z-index: 2; +} + +.cml-border-1px:after { + border: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; + height: 100%; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.cml-border-top-1px:before { + border-top: 1rpx solid #ccc; + left: 0; + top: 0; + width: 100%; +} + +.cml-border-right-1px:after { + border-right: 1rpx solid #ccc; + top: 0; + right: 0; + height: 100%; + -webkit-transform-origin: right 0; + transform-origin: right 0; +} + +.cml-border-bottom-1px:after { + border-bottom: 1rpx solid #ccc; + left: 0; + bottom: 0; + width: 100%; + -webkit-transform-origin: 0 bottom; + transform-origin: 0 bottom; +} + +.cml-border-left-1px:before { + border-left: 1rpx solid #ccc; + top: 0; + left: 0; + height: 100%; +} + +.cml-border-none:before, .cml-border-none:after { + display: none; +} + +.cml-c-button { + -webkit-align-self: stretch; + align-self: stretch; +} + +.flex-page { + background-color: #f8f8f8; +} + +.flex-header { + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + padding: 40rpx; + height: 200rpx; +} + +.flex-header__title { + color: #333; + font-size: 40rpx; + font-weight: 700; + height: 60rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + background-color: antiquewhite; +} + +.flex-panel__title { + margin: 2rpx; + box-shadow: 0px 3px 5px #888888; + background-color: lightgray; + /* + * https://stackoverflow.com/questions/47095596/body-overflow-x-hidden-breaks-position-sticky + */ + position: -webkit-sticky; + position: sticky; + top: 0; + z-index: 999; +} + +.flex-panel__content { + margin-top: 20rpx; + overflow: hidden; +} + +.flex-panel__content-main { + background-color: lightslategrey; +} + +.weight_700 { + font-weight: 700; +} + +.flex-body { + background: #fff; + box-shadow: 0 10rpx 300rpx 0 rgba(0, 0, 0, 0.11); +} + +.flex-panel { + padding-top: 60rpx; +} + +.flex-item__title { + background-color: antiquewhite; +} + +.item { + margin: 8rpx; + border: 2rpx solid #fff; +} + +.item-block { + height: 60rpx; + width: 100rpx; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.item-wrap { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.item-text-inner { + color: #fff; +} + +.item-text { + width: 44rpx; + height: 44rpx; + border: 2rpx solid #fff; + border-radius: 22rpx; + color: #fff; + text-align: center; +} + +.border-none { + border: 0; +} + +/** flex-direction **/ + +.row { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + flex-direction: row; +} + +.row-reverse { + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -webkit-flex-direction: row-reverse; + flex-direction: row-reverse; +} + +.column-reverse { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -webkit-flex-direction: column-reverse; + flex-direction: column-reverse; +} + +/** flex-wrap **/ + +.nowrap { + -webkit-flex-wrap: nowrap; + flex-wrap: nowrap; + /* default */ +} + +.wrap { + -webkit-flex-wrap: wrap; + flex-wrap: wrap; +} + +.wrap-reverse { + -webkit-flex-wrap: wrap-reverse; + flex-wrap: wrap-reverse; +} + +/** justify-content **/ + +.justify-flex-start { + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + /* default */ +} + +.justify-flex-end { + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.justify-center { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.justify-space-between { + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + justify-content: space-between; +} + +.justify-space-around { + -webkit-justify-content: space-around; + justify-content: space-around; +} + +/** align-items **/ + +.align-flex-start { + -webkit-box-align: start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.align-flex-end { + -webkit-box-align: end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.align-center { + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; +} + +.align-baseline { + -webkit-box-align: baseline; + -webkit-align-items: baseline; + align-items: baseline; +} + +.align-stretch { + -webkit-box-align: stretch; + -webkit-align-items: stretch; + align-items: stretch; + /* default */ +} + +/** align-content **/ + +.align-content-flex-start { + -webkit-align-content: flex-start; + align-content: flex-start; + /* default */ +} + +.align-content-flex-end { + -webkit-align-content: flex-end; + align-content: flex-end; +} + +.align-content-center { + -webkit-align-content: center; + align-content: center; +} + +.align-content-space-between { + -webkit-align-content: space-between; + align-content: space-between; +} + +.align-content-space-around { + -webkit-align-content: space-around; + align-content: space-around; +} + +.align-content-stretch { + -webkit-align-content: stretch; + align-content: stretch; +} + +/* order */ + +.order_0 { + -webkit-box-ordinal-group: 1; + -webkit-order: 0; + order: 0; + /* default */ +} + +.order_1 { + -webkit-box-ordinal-group: 2; + -webkit-order: 1; + order: 1; +} + +.order_2 { + -webkit-box-ordinal-group: 3; + -webkit-order: 2; + order: 2; +} + +.order_3 { + -webkit-box-ordinal-group: 4; + -webkit-order: 3; + order: 3; +} + +.order_4 { + -webkit-box-ordinal-group: 5; + -webkit-order: 4; + order: 4; +} + +.order_-1 { + -webkit-box-ordinal-group: 0; + -webkit-order: -1; + order: -1; +} + +/* flex-grow */ + +.flex-grow_0 { + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + flex-grow: 0; + /* default */ +} + +.flex-grow_1 { + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + flex-grow: 1; +} + +.flex-grow_2 { + -webkit-box-flex: 2; + -webkit-flex-grow: 2; + flex-grow: 2; +} + +/* flex-shrink */ + +.flex-shrink_0 { + -webkit-flex-shrink: 0; + flex-shrink: 0; +} + +.flex-shrink_1 { + -webkit-flex-shrink: 1; + flex-shrink: 1; + /* default */ +} + +.flex-shrink_2 { + -webkit-flex-shrink: 2; + flex-shrink: 2; +} + +/* flex-basis */ + +.flex-basis_auto { + -webkit-flex-basis: auto; + flex-basis: auto; + /* default */ +} + +.flex-basis_25 { + -webkit-flex-basis: 187.5rpx; + flex-basis: 187.5rpx; + /* 750cpx屏幕的25 %*/ +} + +.flex-basis_50 { + -webkit-flex-basis: 375rpx; + flex-basis: 375rpx; + /* 750cpx屏幕的50 %*/ +} + +/** align-self **/ + +.align-self-flex-start { + -webkit-align-self: auto; + align-self: auto; + /* default , inherit parent */ +} + +.align-self-flex-start { + -webkit-align-self: flex-start; + align-self: flex-start; +} + +.align-self-flex-end { + -webkit-align-self: flex-end; + align-self: flex-end; +} + +.align-self-center { + -webkit-align-self: center; + align-self: center; +} + +.align-self-baseline { + -webkit-align-self: baseline; + align-self: baseline; +} + +.align-self-stretch { + -webkit-align-self: stretch; + align-self: stretch; +} + +.antiquewhite { + background-color: antiquewhite; +} + +.lightpink { + background-color: lightpink; +} + +.lightskyblue { + background-color: lightskyblue; +} + +.silver { + background-color: silver; +} + +.darkseagreen { + background-color: darkseagreen; +} + +.lightslategrey { + background-color: lightslategrey; +} + +.cadetblue { + background-color: cadetblue; +} + +.lightgray { + background-color: lightgray; +} + +.color-white { + color: white; +} + +.color-brown { + color: brown; +} + +.h_240 { + height: 240rpx; +} + +.h_200 { + height: 200rpx; +} + +.h_120 { + height: 120rpx; +} + +.h_100 { + height: 100rpx; +} + +.h_80 { + height: 80rpx; +} + +.h_60 { + height: 60rpx; +} + +.h_40 { + height: 40rpx; +} + +.w_200 { + width: 200rpx; +} + +.w_120 { + width: 120rpx; +} + +.w_80 { + width: 80rpx; +} + +.w_60 { + width: 60rpx; +} + +.w_40 { + width: 40rpx; +} diff --git a/dist/wx/static/img/selected_520dcc8.png b/dist/wx/static/img/selected_520dcc8.png new file mode 100644 index 0000000000000000000000000000000000000000..27456e61caa75a448c2d75ae8ddaaf530b5d1217 GIT binary patch literal 1721 zcmV;q21fabP)fN55 zeQ(ds?yS9+?&+znu5Ws#AJw%Wn)Jh&S8o+-*9H`d2dRk|0>%JEp8(M-5PEg9fXf2K zGJ;qFgfx|nZFQJkEz!XFiwx` za)mlB1P&O5%}rs^k>VJPr_Kd!ClD~s9NezfR^LX%(Vz`CQV#&;WLNhjjD3F9R*y9> zzB}@aQfii9Z?|nMOnHL-mj<{|>g_W&dZmr9n;4o@uKGG^ShksMP)dBmHrX)L)x($= z?^1YmhDP0&Y?QZ3mPYkYC2Svq_{p_eZPo;)5%?}w;8*lWAFZV<()$3H9RYhGp8Ttt z9aUdx?%53i%Y@V+Y%ALw7?@wY#Nw76})-3Rn$s(0CCD0PmV}OK4lB79TUXJ z_G;jqTP9RbMVJqRVdZ%0FikZGN0OIqq1g+=j2fF>&AlB{DxCiaTr+vtv+pZ`&%_mActs`N3#LVwE|+ zvCYG3x@?#|>o=BJdC-da3!~0A3pU3UlYAl&HKb|3$*^?bfibC%KTL}erp<nq=uKnr-1 zUiYfd8aAGMoi_qTrH0Ljv$o4cQ@`GnS!r6*C-3#v$;$HYoCS2$ zusO1{)G-y7oCV@_K(`63kPcjtI)H?>P6ZIQ7uBEzyeT94X8joS(AP!h)=M;nQV>OA z=mMP~J?<9>lm|HPZ0UIxUOfF@rTVQJpi0^YxJc`U9eUwG)C(m7K?=(Bv|mkRuw;Z` z)WAA4h&tMDT;O~KXq*|oSKS0_Peoumd=&{c!;D;%?O}?8;?N+UOk>$1XbroD=g8}D zXJd+k)n+ym>!pEN4aY$RQ&*vufqw5mzhYR#`zlB_z1Yu2y`BGMriU(uefmHvD)NJ) zlW(QfIautNNO=RY*TZZE2YrQYPPDM4Oa;Ik;YK|&7dCWM`snqYEsokN0A|B3g=7Q#Qu+IkNR@Hr2TW`N%_QyfB8x!OUw4K5te;&j2v}8nd`Ps$yRN1 z6+^26!$@+S!uj@X2xx+Jx;po=%~g1_OUr5k?5}eAU>CnC)#ReQr(a{Xacu7IT6Pqy zv}y_K2sadO(VDpGn^8+oSoe7qM}GCA&P4K^dUaX>vr;@cv_~nNB@f(|dK+nmoStWe z9EFLb)uzX~r+B!h3B8{h)Z49Qz|_*oZEG7WVOg(r5BrUw-hRSGaXb`niC=N0Jb5i> z5IsiY%K1tnwaOa;Hp(d&b%(3mDe^S$p;tZB;21J6L;mD51bPDEDca37_6r5rn1H7a z-K{dKqo~v%E$&$HNVy<8y64R1-L%t48Y-~g5S$55-pSo!|}JBSD3e8g$N P00000NkvXXu0mjf(>pa7 literal 0 HcmV?d00001 diff --git a/dist/wx/static/img/unselected_4e38c39.png b/dist/wx/static/img/unselected_4e38c39.png new file mode 100644 index 0000000000000000000000000000000000000000..a0a72b3b03cc6769943fa2faf746f5317dbcc20c GIT binary patch literal 1672 zcmV;326y?1P)tt!(Myq3NGcgxqWky_ka-Y?~eeRZ2p8vxqC= zpKFMzhtRaNDLpi?aK+|SP@L(>5Cf)=o4Q+D}Ll*0*{d{L<>=Sp@ zxBh$k?7-~ry*Kk_zMq+SGxO%nMk;p64Gs=IPtr}1NaX0s%1Rx!4*M$C5*#O#E$8!? zdCnhmJdK^kPH`>M+uQq0adz58b~3^7@$r`z78X86^hc!IfPJo%^a1~e`zEnBs;jH7 zwYRtbSxP#E?%5IGk&%&imY0`50q}h?i76w*E@2+v@8TbE{wNlU%|@fq`FK38nytuY zvkC4?iQ*rsr27%0n=>XBkM2mO;*Ap;?f*n zLGW#w<($3l%aCpjfG0?!4d24eRW^YP*Uxu%ci-`qpeJ%kzz8}F*Z^W$ZCY8*FVp-6 zlF8%~Px{+FB(FoHeTKYFlUQ5{a(kZa41e z=;)g~^Ot~bCaq zq-twxds|vs7B#ynw%7RaJG07Wdai z!lD}ms%AZ~GsHa>6jtu8hYpl(0XYeMB{Px}VFMPE*u*GSGx31_hCm5u3mdRwa*PI;g}ZBj<_K(IYr%_Qfu=bh z5|h|0V}4CbU*9N!TLe_G*wq&nV3^K`No?-xr>S89($+7^QX;3dfkemU?8G1zF*r7J z?4azXFD>)L?QR(tRF>89&8O zy=&7~rM3pSNabejwx&w4@cHzPSN|Gd1puo~YYyAYr^a*M$mMV>&C+fe)^))DZ+TEH z+Px9|lvISbsH==;Zw0+}rBPa?8Lj<=_IHS3U6XcTJkJ9hr|{bJb<=%)bKya0$R)y!dGw;{0hE^0d;w;E{dJvs%Q2f|q` z_YiXgZ?+z8w%=0ieN%U!HkW!!gXW`dKK$E{ zEz8K6zwux%F`4+;T-nCYmU`)}rcaH(LflrwY6D4l|EN`{KzPozStf9Q#rqd~P+CjJ S$XEIR0000mNZ2G literal 0 HcmV?d00001 diff --git a/dist/wx/static/js/app.js b/dist/wx/static/js/app.js index a716fc2..71ab045 100644 --- a/dist/wx/static/js/app.js +++ b/dist/wx/static/js/app.js @@ -1 +1,158 @@ -var __CML__GLOBAL=require("./manifest.js");__CML__GLOBAL.webpackJsonp([1],{52:function(e,t,n){n(53),n(54)},53:function(e,t){},54:function(e,t,n){function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0}function i(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=St();try{var o=e.interceptors;if(o)for(var r=0,i=o.length;r0}function s(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),Ee(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function c(e,t){var n=St(),o=e.changeListeners;if(o){o=o.slice();for(var r=0,i=o.length;r=this.length,value:t0,"actions should have valid names, got: '"+e+"'");var n=function(){return k(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function k(e,t,n,o){var r=j(e,t,n,o);try{return t.apply(n,o)}finally{S(r)}}function j(e,t,n,o){var r=l()&&!!e,i=0;if(r){i=Date.now();var a=o&&o.length||0,u=new Array(a);if(a>0)for(var s=0;s",r="function"==typeof e?e:t,i="function"==typeof e?t:n;return Pe("function"==typeof r,O("m002")),Pe(0===r.length,O("m003")),Pe("string"==typeof o&&o.length>0,"actions should have valid names, got: '"+o+"'"),k(o,r,i,void 0)}function N(e){return"function"==typeof e&&!0===e.isMobxAction}function V(e,t,n){var o=function(){return k(t,n,e,arguments)};o.isMobxAction=!0,De(e,t,o)}function B(e,t){return $(e,t)}function $(e,t,n,o){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var r=typeof e;return("function"===r||"object"===r||"object"==typeof t)&&U(e,t,n,o)}function U(e,t,n,o){e=z(e),t=z(t);var r=On.call(e);if(r!==On.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var i="[object Array]"===r;if(!i){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,u=t.constructor;if(a!==u&&!("function"==typeof a&&a instanceof a&&"function"==typeof u&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],o=o||[];for(var s=n.length;s--;)if(n[s]===e)return o[s]===t;if(n.push(e),o.push(t),i){if((s=e.length)!==t.length)return!1;for(;s--;)if(!$(e[s],t[s],n,o))return!1}else{var c,l=Object.keys(e);if(s=l.length,Object.keys(t).length!==s)return!1;for(;s--;)if(c=l[s],!F(t,c)||!$(e[c],t[c],n,o))return!1}return n.pop(),o.pop(),!0}function z(e){return w(e)?e.peek():Vn(e)?e.entries():ze(e)?Ge(e.entries()):e}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e,t){return e===t}function K(e,t){return B(e,t)}function W(e,t){return $e(e,t)||G(e,t)}function q(e,t,n){function o(){i(u)}var r,i,a;"string"==typeof e?(r=e,i=t,a=n):(r=e.name||"Autorun@"+je(),i=e,a=t),Pe("function"==typeof i,O("m004")),Pe(!1===N(i),O("m005")),a&&(i=i.bind(a));var u=new eo(r,function(){this.track(o)});return u.schedule(),u.getDisposer()}function J(e,t,n,o){var r,i,a,u;return"string"==typeof e?(r=e,i=t,a=n,u=o):(r="When@"+je(),i=e,a=t,u=n),q(r,function(e){if(i.call(u)){e.dispose();var t=St();a.call(u),Pt(t)}})}function Y(e,t,n,o){function r(){a(l)}var i,a,u,s;"string"==typeof e?(i=e,a=t,u=n,s=o):(i=e.name||"AutorunAsync@"+je(),a=e,u=t,s=n),Pe(!1===N(a),O("m006")),void 0===u&&(u=1),s&&(a=a.bind(s));var c=!1,l=new eo(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(r)},u))});return l.schedule(),l.getDisposer()}function X(e,t,n){function o(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!s(i,t),i=t}),a&&r.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&Se(O("m007")),ye(e)&&Se(O("m008"));var r;r="object"==typeof n?n:{},r.name=r.name||e.name||t.name||"Reaction@"+je(),r.fireImmediately=!0===n||!0===r.fireImmediately,r.delay=r.delay||0,r.compareStructural=r.compareStructural||r.struct||!1,t=wn(r.name,r.context?t.bind(r.context):t),r.context&&(e=e.bind(r.context));var i,a=!0,u=!1,s=r.equals?r.equals:r.compareStructural||r.struct?xn.structural:xn.default,c=new eo(r.name,function(){a||r.delay<1?o():u||(u=!0,setTimeout(function(){u=!1,o()},r.delay))});return c.schedule(),c.getDisposer()}function Q(e,t){if(ue(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;Pe(Object.isExtensible(e),O("m035")),Re(e)||(t=(e.constructor.name||"ObservableObject")+"@"+je()),t||(t="ObservableObject@"+je());var n=new Sn(e,t);return He(e,"$mobx",n),n}function Z(e,t,n,o){if(e.values[t]&&!jn(e.values[t]))return Pe("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ye(n.value)){var r=n.value;ee(e,t,r.initialValue,r.enhancer)}else N(n.value)&&!0===n.value.autoBind?V(e.target,t,n.value.originalFn):jn(n.value)?ne(e,t,n.value):ee(e,t,n.value,o);else te(e,t,n.get,n.set,xn.default,!0)}function ee(e,t,n,o){if(Ve(e.target,t),r(e)){var i=a(e,{object:e.target,name:t,type:"add",newValue:n});if(!i)return;n=i.newValue}n=(e.values[t]=new vn(n,o,e.name+"."+t,!1)).value,Object.defineProperty(e.target,t,oe(t)),ae(e,e.target,t,n)}function te(e,t,n,o,r,i){i&&Ve(e.target,t),e.values[t]=new kn(n,e.target,r,e.name+"."+t,o),i&&Object.defineProperty(e.target,t,re(t))}function ne(e,t,n){var o=e.name+"."+t;n.name=o,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,re(t))}function oe(e){return Pn[e]||(Pn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){ie(this,e,t)}})}function re(e){return An[e]||(An[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function ie(e,t,n){var o=e.$mobx,i=o.values[t];if(r(o)){var s=a(o,{type:"update",object:e,name:t,newValue:n});if(!s)return;n=s.newValue}if((n=i.prepareNewValue(n))!==yn){var f=u(o),h=l(),s=f||h?{type:"update",object:e,oldValue:i.value,name:t,newValue:n}:null;h&&p(s),i.setNewValue(n),f&&c(o,s),h&&d()}}function ae(e,t,n,o){var r=u(e),i=l(),a=r||i?{type:"add",object:t,name:n,newValue:o}:null;i&&p(a),r&&c(e,a),i&&d()}function ue(e){return!!Ce(e)&&(L(e),En(e.$mobx))}function se(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(w(e)||Vn(e))throw new Error(O("m019"));if(ue(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ue(e)||!!e.$mobx||rn(e)||oo(e)||jn(e)}function ce(e){return Pe(!!e,":("),C(function(t,n,o,r,i){Ve(t,n),Pe(!i||!i.get,O("m022")),ee(Q(t,void 0),n,o,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){ie(this,e,t)},!0,!1)}function le(e){for(var t=[],n=1;n=2,O("m014")),Pe("object"==typeof e,O("m015")),Pe(!Vn(e),O("m016")),n.forEach(function(e){Pe("object"==typeof e,O("m017")),Pe(!se(e),O("m018"))});for(var o=Q(e),r={},i=n.length-1;i>=0;i--){var a=n[i];for(var u in a)if(!0!==r[u]&&Ie(a,u)){if(r[u]=!0,e===a&&!Ne(e,u))continue;var s=Object.getOwnPropertyDescriptor(a,u);Z(o,u,s,t)}}return e}function de(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Mn.apply(null,arguments);if(Pe(arguments.length<=1,O("m021")),Pe(!ye(e),O("m020")),se(e))return e;var t=be(e,void 0,void 0);return t!==e?t:Dn.box(e)}function he(e){Se("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ye(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ve(e,t){return Pe(!ye(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function be(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),se(e)?e:Array.isArray(e)?Dn.array(e,n):Re(e)?Dn.object(e,n):ze(e)?Dn.map(e,n):e}function me(e,t,n){return ye(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ue(e)||w(e)||Vn(e)?e:Array.isArray(e)?Dn.shallowArray(e,n):Re(e)?Dn.shallowObject(e,n):ze(e)?Dn.shallowMap(e,n):Se("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function ge(e){return e}function _e(e,t,n){if(B(e,t))return t;if(se(e))return e;if(Array.isArray(e))return new pn(e,_e,n);if(ze(e))return new Nn(e,_e,n);if(Re(e)){var o={};return Q(o,n),pe(o,_e,[e]),o}return e}function we(e,t,n){return B(e,t)?t:e}function Oe(e,t){void 0===t&&(t=void 0),lt();try{return e.apply(t)}finally{ft()}}function xe(e){return Ae("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Dn.map(e)}function ke(){return"undefined"!=typeof window?window:e}function je(){return++Kn.mobxGuid}function Se(e,t){throw Pe(!1,e,t),"X"}function Pe(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Ae(e){return-1===$n.indexOf(e)&&($n.push(e),console.error("[mobx] Deprecated: "+e),!0)}function Ee(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Me(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Te(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Ce(e){return null!==e&&"object"==typeof e}function Re(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Le(){for(var e=arguments[0],t=1,n=arguments.length;t0&&(t.dependencies=Me(e.observing).map(nt)),t}function ot(e,t){return rt(Qe(e,t))}function rt(e){var t={name:e.name};return it(e)&&(t.observers=at(e).map(rt)),t}function it(e){return e.observers&&e.observers.length>0}function at(e){return e.observers}function ut(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function st(e,t){if(1===e.observers.length)e.observers.length=0,ct(e);else{var n=e.observers,o=e.observersIndexes,r=n.pop();if(r!==t){var i=o[t.__mapid]||0;i?o[r.__mapid]=i:delete o[r.__mapid],n[i]=r}delete o[t.__mapid]}}function ct(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Kn.pendingUnobservations.push(e))}function lt(){Kn.inBatch++}function ft(){if(0==--Kn.inBatch){It();for(var e=Kn.pendingUnobservations,t=0;t=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return bt(e,t,n+1)})}function mt(e){return e instanceof Zn}function gt(e){switch(e.dependenciesState){case Xn.UP_TO_DATE:return!1;case Xn.NOT_TRACKING:case Xn.STALE:return!0;case Xn.POSSIBLY_STALE:for(var t=St(),n=e.observing,o=n.length,r=0;r0;Kn.computationDepth>0&&t&&Se(O("m031")+e.name),!Kn.allowStateChanges&&t&&Se(O(Kn.strictMode?"m030a":"m030b")+e.name)}function Ot(e,t,n){At(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Kn.runId;var o=Kn.trackingDerivation;Kn.trackingDerivation=e;var r;try{r=t.call(n)}catch(e){r=new Zn(e)}return Kn.trackingDerivation=o,xt(e),r}function xt(e){for(var t=e.observing,n=e.observing=e.newObserving,o=Xn.UP_TO_DATE,r=0,i=e.unboundDepsCount,a=0;ao&&(o=u.dependenciesState)}for(n.length=r,e.newObserving=null,i=t.length;i--;){var u=t[i];0===u.diffValue&&st(u,e),u.diffValue=0}for(;r--;){var u=n[r];1===u.diffValue&&(u.diffValue=0,ut(u,e))}o!==Xn.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function kt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState=Xn.NOT_TRACKING}function jt(e){var t=St(),n=e();return Pt(t),n}function St(){var e=Kn.trackingDerivation;return Kn.trackingDerivation=null,e}function Pt(e){Kn.trackingDerivation=e}function At(e){if(e.dependenciesState!==Xn.UP_TO_DATE){e.dependenciesState=Xn.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Xn.UP_TO_DATE}}function Et(e){return console.log(e),e}function Mt(e,t){return Ae("`whyRun` is deprecated in favor of `trace`"),e=Ct(arguments),e?jn(e)||oo(e)?Et(e.whyRun()):Se(O("m025")):Et(O("m024"))}function Tt(){for(var e=[],t=0;t=0&&Kn.globalReactionErrorHandlers.splice(t,1)}}function It(){Kn.inBatch>0||Kn.isRunningReactions||no(Dt)}function Dt(){Kn.isRunningReactions=!0;for(var e=Kn.pendingReactions,t=0;e.length>0;){++t===to&&(console.error("Reaction doesn't converge to a stable state after "+to+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),o=0,r=n.length;ot){for(var n=new Array(e-t),o=0;o0&&e+t+1>cn&&_(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var o=this;wt(this.atom);var i=this.values.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:void 0===t||null===t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=[]),r(this)){var u=a(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!u)return Bn;t=u.removedCount,n=u.added}n=n.map(function(e){return o.enhancer(e,void 0)});var s=n.length-t;this.updateArrayLength(i,s);var c=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(r=this.values).splice.apply(r,[e,t].concat(n));var o=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),o;var r},e.prototype.notifyArrayChildUpdate=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e.prototype.notifyArraySplice=function(e,t,n){var o=!this.owned&&l(),r=u(this),i=r||o?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;o&&p(i),this.atom.reportChanged(),r&&c(this,i),o&&d()},e}(),pn=function(e){function t(t,n,o,r){void 0===o&&(o="ObservableArray@"+je()),void 0===r&&(r=!1);var i=e.call(this)||this,a=new fn(o,n,i,r);return He(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),sn&&Object.defineProperty(a.array,"0",dn),i}return o(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var o,r=this.$mobx.values;o=e";De(e,t,wn(i,n))},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!0),_n=C(function(e,t,n){V(e,t,n)},function(e){return this[e]},function(){Pe(!1,O("m001"))},!1,!1),wn=function(e,t,n,o){return 1===arguments.length&&"function"==typeof e?x(e.name||"",e):2===arguments.length&&"function"==typeof t?x(e,t):1===arguments.length&&"string"==typeof e?D(e):D(t).apply(null,arguments)};wn.bound=function(e,t,n){if("function"==typeof e){var o=x("",e);return o.autoBind=!0,o}return _n.apply(null,arguments)};var On=Object.prototype.toString,xn={identity:G,structural:K,default:W},kn=function(){function e(e,t,n,o,r){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=Xn.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Xn.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+je(),this.value=new Zn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Qn.NONE,this.name=o||"ComputedValue@"+je(),r&&(this.setter=x(o+"-setter",r))}return e.prototype.onBecomeStale=function(){yt(this)},e.prototype.onBecomeUnobserved=function(){kt(this),this.value=void 0},e.prototype.get=function(){Pe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Kn.inBatch?(lt(),gt(this)&&(this.isTracing!==Qn.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),ft()):(pt(this),gt(this)&&this.trackAndCompute()&&ht(this));var e=this.value;if(mt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(mt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){Pe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else Pe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){l()&&f({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===Xn.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||mt(e)||mt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,Kn.computationDepth++;var t;if(e)t=Ot(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Zn(e)}return Kn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,o=!0,r=void 0;return q(function(){var i=n.get();if(!o||t){var a=St();e({type:"update",object:n,newValue:i,oldValue:r}),Pt(a)}o=!1,r=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return We(this.get())},e.prototype.whyRun=function(){var e=Boolean(Kn.trackingDerivation),t=Me(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Me(at(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===Xn.NOT_TRACKING?O("m032"):" * This computation will re-run if any of the following observables changes:\n "+Te(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+O("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Te(n)+"\n")},e}();kn.prototype[Ke()]=kn.prototype.valueOf;var jn=Be("ComputedValue",kn),Sn=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return Pe(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}(),Pn={},An={},En=Be("ObservableObjectAdministration",Sn),Mn=ce(be),Tn=ce(me),Cn=ce(ge),Rn=ce(_e),Ln=ce(we),In={box:function(e,t){return arguments.length>2&&he("box"),new vn(e,be,t)},shallowBox:function(e,t){return arguments.length>2&&he("shallowBox"),new vn(e,ge,t)},array:function(e,t){return arguments.length>2&&he("array"),new pn(e,be,t)},shallowArray:function(e,t){return arguments.length>2&&he("shallowArray"),new pn(e,ge,t)},map:function(e,t){return arguments.length>2&&he("map"),new Nn(e,be,t)},shallowMap:function(e,t){return arguments.length>2&&he("shallowMap"),new Nn(e,ge,t)},object:function(e,t){arguments.length>2&&he("object");var n={};return Q(n,t),le(n,e),n},shallowObject:function(e,t){arguments.length>2&&he("shallowObject");var n={};return Q(n,t),fe(n,e),n},ref:function(){return arguments.length<2?ve(ge,arguments[0]):Cn.apply(null,arguments)},shallow:function(){return arguments.length<2?ve(me,arguments[0]):Tn.apply(null,arguments)},deep:function(){return arguments.length<2?ve(be,arguments[0]):Mn.apply(null,arguments)},struct:function(){return arguments.length<2?ve(_e,arguments[0]):Rn.apply(null,arguments)}},Dn=de;Object.keys(In).forEach(function(e){return Dn[e]=In[e]}),Dn.deep.struct=Dn.struct,Dn.ref.struct=function(){return arguments.length<2?ve(we,arguments[0]):Ln.apply(null,arguments)};var Hn={},Nn=function(){function e(e,t,n){void 0===t&&(t=be),void 0===n&&(n="ObservableMap@"+je()),this.enhancer=t,this.name=n,this.$mobx=Hn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new pn(void 0,ge,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,t){this.assertValidKey(e),e=""+e;var n=this._has(e);if(r(this)){var o=a(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!o)return this;t=o.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(this.assertValidKey(e),e=""+e,r(this)){var n=a(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var o=l(),i=u(this),n=i||o?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return o&&p(n),Oe(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data[e].setNewValue(void 0),t._data[e]=void 0}),i&&c(this,n),o&&d(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new vn(t,ge,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==yn){var o=l(),r=u(this),i=r||o?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;o&&p(i),n.setNewValue(t),r&&c(this,i),o&&d()}},e.prototype._addValue=function(e,t){var n=this;Oe(function(){var o=n._data[e]=new vn(t,n.enhancer,n.name+"."+e,!1);t=o.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var o=l(),r=u(this),i=r||o?{type:"add",object:this,name:e,newValue:t}:null;o&&p(i),r&&c(this,i),o&&d()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return v(this._keys.slice())},e.prototype.values=function(){return v(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return v(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(o){return e.call(t,n.get(o),o,n)})},e.prototype.merge=function(e){var t=this;return Vn(e)&&(e=e.toJS()),Oe(function(){Re(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],o=e[1];return t.set(n,o)}):ze(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&Se("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;Oe(function(){jt(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return Oe(function(){var n=Fe(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return Pe(!0!==t,O("m033")),s(this,e)},e.prototype.intercept=function(e){return i(this,e)},e}();b(Nn.prototype,function(){return this.entries()});var Vn=Be("ObservableMap",Nn),Bn=[];Object.freeze(Bn);var $n=[],Un=function(){},zn=Object.prototype.hasOwnProperty,Fn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Gn=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),Kn=new Gn,Wn=!1,qn=!1,Jn=!1,Yn=ke();Yn.__mobxInstanceCount?(Yn.__mobxInstanceCount++,setTimeout(function(){Wn||qn||Jn||(Jn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):Yn.__mobxInstanceCount=1;var Xn;!function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Xn||(Xn={}));var Qn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Qn||(Qn={}));var Zn=function(){function e(e){this.cause=e}return e}(),eo=function(){function e(e,t){void 0===e&&(e="Reaction@"+je()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=Xn.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+je(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Qn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Kn.pendingReactions.push(this),It())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(lt(),this._isScheduled=!1,gt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&l()&&f({object:this,type:"scheduled-reaction"})),ft())},e.prototype.track=function(e){lt();var t,n=l();n&&(t=Date.now(),p({object:this,type:"reaction",fn:e})),this._isRunning=!0;var o=Ot(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&kt(this),mt(o)&&this.reportExceptionInDerivation(o.cause),n&&d({time:Date.now()-t}),ft()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,o=O("m037");console.error(n||o,e),l()&&f({type:"error",message:n,error:e,object:this}),Kn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(lt(),kt(this),ft()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=Rt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Me(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Te(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+O("m038")+"\n"},e.prototype.trace=function(e){void 0===e&&(e=!1),Tt(this,e)},e}(),to=100,no=function(e){return e()},oo=Be("Reaction",eo),ro=Ut(xn.default),io=Ut(xn.structural),ao=function(e,t,n){if("string"==typeof t)return ro.apply(null,arguments);Pe("function"==typeof e,O("m011")),Pe(arguments.length<3,O("m012"));var o="object"==typeof t?t:{};o.setter="function"==typeof t?t:o.setter;var r=o.equals?o.equals:o.compareStructural||o.struct?xn.structural:xn.default;return new kn(e,o.context,r,o.name||e.name||"",o.setter)};ao.struct=io,ao.equals=Ut;var uo={allowStateChanges:E,deepEqual:B,getAtom:Qe,getDebugName:et,getDependencyTree:tt,getAdministration:Ze,getGlobalState:Ye,getObserverTree:ot,interceptReads:en,isComputingDerivation:_t,isSpyEnabled:l,onReactionError:Lt,reserveArrayBuffer:_,resetGlobalState:Xe,isolateGlobalState:qe,shareGlobalState:Je,spyReport:f,spyReportEnd:d,spyReportStart:p,setReactionScheduler:Ht},so={Reaction:eo,untracked:jt,Atom:on,BaseAtom:nn,useStrict:P,isStrictModeEnabled:A,spy:h,comparer:xn,asReference:Nt,asFlat:Bt,asStructure:Vt,asMap:$t,isModifierDescriptor:ye,isObservableObject:ue,isBoxedObservable:bn,isObservableArray:w,ObservableMap:Nn,isObservableMap:Vn,map:xe,transaction:Oe,observable:Dn,computed:ao,isObservable:se,isComputed:zt,extendObservable:le,extendShallowObservable:fe,observe:Ft,intercept:Wt,autorun:q,autorunAsync:Y,when:J,reaction:X,action:wn,isAction:N,runInAction:H,expr:Yt,toJS:Xt,createTransformer:Qt,whyRun:Mt,isArrayLike:Ue,extras:uo},co=!1;for(var lo in so)!function(e){var t=so[e];Object.defineProperty(so,e,{get:function(){return co||(co=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})}(lo);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:h,extras:uo}),t.default=so}.call(t,n(24))},function(e,t){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t1?t-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:[];if("Object"===(0,g.type)(t))for(var o in t)~n.indexOf(o)||(e[o]=t[o]);return e}function l(e,t){var n=void 0===e?"undefined":b(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function f(e,t,n){if(!t)return e;var o=t.split("."),r=!1,i=e,a=!0,u=!1,s=void 0;try{for(var c,f=o[Symbol.iterator]();!(a=(c=f.next()).done);a=!0){var p=c.value;if(!l(i,p)){i=void 0,r=!0;break}i=i[p]}}catch(e){u=!0,s=e}finally{try{!a&&f.return&&f.return()}finally{if(u)throw s}}return n?r?n:i:void 0===i?"":i}function p(e,t){return t.forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);n.enumerable||(n.enumerable=!0,Object.defineProperty(e,t,n))}),e}function d(e,t,n,o){return"boolean"==typeof n&&(o=n,n=null),y(t).forEach(function(r,i){var a={get:function(){return t[r]},configurable:!0,enumerable:!0};!o&&(a.set=function(e){t[r]=e}),Object.defineProperty(e,n?n[i]:r,a)}),e}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e;var n=Object.keys(e),o={},r=!0,i=!1,a=void 0;try{for(var u,s=n[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){var c=u.value;t.indexOf(c)<0&&(o[c]=e[c])}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return o}function y(e){var t=[];for(var n in e)t.push(n);return t}function v(){function e(e){return!!e||(console.error("pathStr should not be null!"),!1)}function t(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"Array"===(0,g.type)(n)?(e(r),n.forEach(function(e,n){t(e,r+"["+n+"]")})):"Object"===(0,g.type)(n)?Object.keys(n).forEach(function(e){t(n[e],r?r+"."+e:e)}):(e(r),o[r]=n)}var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o={};return t(n),o}Object.defineProperty(t,"__esModule",{value:!0});var b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=Object.assign||function(e){for(var t=1;t-1&&e.splice(n,1),t()}else for(var o=void 0;o=e.shift();)o()}}function u(e){return function(t){e.__cml_cbCollection__.push(t)}}function s(e,t){function n(t){"Function"===(0,w.type)(e.setData)&&e.setData(t,l(e))}var o=!1,r=void 0;return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("Function"===(0,w.type)(i.schedule)){e.__cml_reaction__=i;var a=e.__cml_originOptions__[t.propsName],u=(0,_.enumerableKeys)(a),s=(0,_.deleteProperties)(e.__cml_ob_data__,u),l=(0,g.default)(s),f=void 0;o?(f=(0,P.default)(l,r),c("beforeUpdate",e,l,r,f)):(o=!0,f=l),n(f),r=h({},l)}}}function c(e,t){var n=t.__cml_originOptions__;if("function"==typeof n[e]){for(var o=arguments.length,r=Array(o>2?o-2:0),i=2;i=0;r--)e.$watch(t,o[r]);else e.$watch(t,o)})}}},{key:"addPageHooks",value:function(){var e=this.context,t=e.__cml_originOptions__;x.default.get(this.platform+".page.hooks").forEach(function(n){"function"==typeof t[n]&&(e[n]=t[n])})}},{key:"start",value:function(e){if(this.context){var t=this.context,n=d(t.$setData,e);t.__cml_disposerList__.push(n)}}},{key:"destory",value:function(){if(this.context){a(this.context.__cml_disposerList__)()}}}]),e}();t.default=A},function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],n=this.data;return e.split(".").forEach(function(e){e&&void 0!==n&&(n=n[e])}),void 0!==n?n:t}},{key:"set",value:function(e,t){if(void 0===t)this.data=e;else if(e=String(e||"").trim()){var n=e.split("."),r=n.pop(),i=this.data||{};n.forEach(function(e){var t=i[e];if("object"===(void 0===t?"undefined":o(t)))i=i[e];else{if(void 0!==t)throw new Error("forbidden to set property["+e+"] of ["+t+"] data");i=i[e]={}}}),i[r]=t}}}]),e}();t.default=i},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=o(r),a=n(25),u=o(a),s=u.default.getInstance(),c={wx:{instance:s,props:"properties"},alipay:{instance:s,props:"props"},baidu:{instance:s,props:"properties"}};t.default=new i.default(c)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var o=n(45),r=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=r.default},function(e,t){function n(e){return Object.prototype.toString.call(e).slice(8,-1)}function o(e){if("Array"===n(e)){var t={};return e.forEach(function(e){t[e]=e}),t}return e}function r(e,t){var n=void 0===e?"undefined":u(e);return!(null===e||void 0===e)&&("object"===n||"function"===n?t in e:void 0!==e[t])}function i(e,t,n){if(!t)return e;var o=t.split("."),i=!1,a=e,u=!0,s=!1,c=void 0;try{for(var l,f=o[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var p=l.value;if(!r(a,p)){a=void 0,i=!0;break}a=a[p]}}catch(e){s=!0,c=e}finally{try{!u&&f.return&&f.return()}finally{if(s)throw c}}return n?i?n:a:void 0===a?"":a}function a(e,t,n,o,r){return"boolean"==typeof o&&(r=o,o=null),n.forEach(function(n,i){var a={get:function(){return t[n]},configurable:!0,enumerable:!0};!r&&(a.set=function(e){t[n]=e}),Object.defineProperty(e,o?o[i]:n,a)}),e}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.type=n,t.normalizeMap=o,t.isExistAttr=r,t.getByPath=i,t.proxy=a},function(e,t,n){n(3),e.exports=n(12)},function(e,t,n){function o(e){return i.default.createApp(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createApp=o;var r=n(16),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e,n=t.__proto__;return n.constructor!==Object&&Object.getOwnPropertyNames(n).forEach(function(e){/constructor|prototype|length/gi.test(e)||t.hasOwnProperty(e)||(t[e]=n[e])}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.copyProtoProperty=n},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n-1?(0,p.mergeHooks)(t,o,r):"data"===r?(0,p.mergeData)(t,o,r):n(r)?(0,p.mergeSimpleProps)(t,o,r):"watch"===r?(0,p.mergeWatch)(t,o,r):"mixins"!==r&&(0,p.mergeDefault)(t,o,r)},n=function(t){return new RegExp("computed|methods|proto|"+e.propsName).test(t)},o={};!function e(n,o){if(o.mixins){var r=!0,i=!1,a=void 0;try{for(var u,s=o.mixins[Symbol.iterator]();!(r=(u=s.next()).done);r=!0){e(n,u.value)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}}t(n,o)}(o,this.options),this.options=o}},{key:"transformHooks",value:function(){if(this.hooks&&this.hooks.length){var e=this;this.hooks.forEach(function(t){var n=e.options[t];n&&(e.options[t]=function(){for(var e=void 0,t=arguments.length,o=Array(t),r=0;r3&&void 0!==arguments[3])||arguments[3];if(void 0===t&&(t=!0),void 0===n&&(n=[]),t&&null===n&&(n=[]),t&&null!==e&&"object"===(void 0===e?"undefined":r(e)))for(var l=0,f=n.length;l1&&void 0!==arguments[1])||arguments[1],u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n&&null===u&&(u=[]),n&&null!==e&&"object"===(void 0===e?"undefined":i(e)))for(var s=0,c=u.length;s=o)for(var i in t){var a=e[i];void 0===a?e[i]="":r(a,t[i])}}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length&&t.forEach(function(t,n){r(e[n],t)})}function i(e,t,n,o){if(!f.extras.deepEqual(e,t))if("Object"===(0,l.type)(e)&&"Object"===(0,l.type)(t)){var r=Object.keys(e).length,s=Object.keys(t).length;if(r>=s)for(var c in e){var p=e[c],d=t[c];i(p,d,u(n,c),o)}else a(e,n,o)}else"Array"===(0,l.type)(e)&&"Array"===(0,l.type)(t)&&e.length>=t.length?e.forEach(function(e,r){i(e,t[r],u(n,r,"array"),o)}):a(e,n,o)}function a(e,t,n){void 0!==e&&(n[t]=e)}function u(e,t,n){return"array"===n?e+"["+t+"]":c(t)?e+"["+t+"]":e?e+"."+t:t}function s(e){var t=Number(e);return t!==t}function c(e){return!s(Number(e))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var l=n(0),f=n(1)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Page=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d);t.Page=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="wx";var o=new h.default({polyHooks:l.default.get("wx.page.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{options:n.options,type:"page",builtinMixins:{onLoad:function(){o.setContext(this).init().initRefs().start("page-view-render")},onUnload:function(){o.setContext(this).destory()}},needResolveAttrs:["methods"],hooks:l.default.get("wx.page.hooks"),hooksMap:l.default.get("wx.page.hooksMap"),polyHooks:l.default.get("wx.page.polyHooks"),usedHooks:l.default.get("wx.page.usedHooks")}),__CML__GLOBAL.Page(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var u=n(6),s=o(u),c=n(4),l=o(c),f=n(7),p=o(f),d=n(9),h=o(d);t.Component=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.cmlType="wx";var o=new h.default({polyHooks:l.default.get("wx.component.polyHooks"),platform:n.cmlType,options:n.options});return n.initOptTransformer(p.default,{type:"component",builtinMixins:{created:function(){o.setContext(this).init()},attached:function(){o.setContext(this).start("component-view-render")},ready:function(){o.setContext(this).initRefs()},detached:function(){o.setContext(this).destory()}},hooks:l.default.get("wx.component.hooks"),hooksMap:l.default.get("wx.component.hooksMap"),polyHooks:l.default.get("wx.component.polyHooks"),usedHooks:l.default.get("wx.component.usedHooks"),needPropsHandler:!0,needTransformProperties:!0}),n.options.options={multipleSlots:!0},__CML__GLOBAL.Component(n.options),n}return a(t,e),t}(s.default)},function(e,t,n){function o(e){return i.default.createPage(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.createPage=o;var r=n(39),i=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};r.default.bootstrap.call(r.default,e)},getInfo:r.default.getInfo}},function(e,t,n){function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?n-1:0),r=1;r1?n-1:0),r=1;r '' +_.disappearCssComment = function (content) { + var commentReg = /\/\*[\s\S]*?\*\//g; + return content.replace(commentReg, function (match) { + return ''; + }); +}; +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex).trim(); + var value = declaration.slice(colonIndex + 1).trim(); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/* eslint-disable */ +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + // 原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js": +/***/ (function(module, exports, __webpack_require__) { + + +var _ = module.exports = {}; +var utils = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js"); +_.eventProxyName = '_cmlEventProxy'; +_.modelEventProxyName = '_cmlModelEventProxy'; // c-model v-model的事件代理 +_.inlineStatementEventProxy = '_cmlInlineStatementEventProxy'; // 内联语句的事件代理 +_.eventEmitName = '$cmlEmit'; // 触发事件的方法 +_.styleParseName = '$cmlStyle'; // 提供各端处理style属性的方法 weex中处理成对象,wx中处理成字符串,web中不处理 +_.styleProxyName = '_cmlStyleProxy'; // 提供代理 weex和web端处理style +_.mergeStyleName = '$cmlMergeStyle'; +_.animationProxy = '_animationCb'; +_.weexClassProxy = '_weexClassProxy'; +_.merge = function (target, fromObj) { + Object.keys(fromObj).forEach(function (key) { + target[key] = fromObj[key]; + }); +}; + +_.isType = function (obj, type) { + return Object.prototype.toString.call(obj).slice(8, -1) === type; +}; + +_.mergeStyle = function () { + // 可以接受字符串或者对象 + function styleToObj(str) { + var obj = {}; + str.split(';').filter(function (item) { + return !!item.trim(); + }).forEach(function (item) { + var _utils$getStyleKeyVal = utils.getStyleKeyValue(item), + key = _utils$getStyleKeyVal.key, + value = _utils$getStyleKeyVal.value; + + key = key.replace(/\s+/, ''); + value = value.replace(/\s+/, ''); + obj[key] = value; + }); + return obj; + } + var arr = []; + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + args.forEach(function (arg) { + if (typeof arg === 'string') { + arr.push(styleToObj(arg)); + } else if (Object.prototype.toString.call(arg) === '[object Object]') { + arr.push(arg); + } + }); + var resultObj = Object.assign.apply(Object, arr); + + var resultStr = ''; + Object.keys(resultObj).forEach(function (key) { + resultStr += key + ':' + resultObj[key] + ';'; + }); + return resultStr; +}; +_.trim = function (value) { + return value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); +}; +_.isReactive = function (value) { + var reg = /(?:^'([^']*?)'$)/; + return _.trim(value).match(reg); +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/utils.js": +/***/ (function(module, exports) { + +var _ = module.exports = {}; + +_.getStyleKeyValue = function (declaration) { + var colonIndex = declaration.indexOf(':'); + var key = declaration.slice(0, colonIndex); + var value = declaration.slice(colonIndex + 1); + return { + key: key, value: value + }; +}; + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +var _methods; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +var common = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/common.js"); +var wxStyleHandle = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/proxy/proxyMiniapp.js"); + +var deepClone = function deepClone(obj) { + if (obj.toString().slice(8, -1) !== "Object") { + return obj; + } + var res = {}; + Object.keys(obj).forEach(function (key) { + res[key] = deepClone(obj[key]); + }); + return res; +}; + +var _ = module.exports = { deepClone: deepClone }; + +common.merge(_, common); + +_.mixins = { + methods: (_methods = {}, _defineProperty(_methods, _.inlineStatementEventProxy, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + var argsStr = dataset && dataset.args; + var argsArr = []; + // 由于百度对于 data-arg="" 在dataset.arg = true 值和微信端不一样所以需要重新处理下这部分逻辑 + if (argsStr && typeof argsStr === 'string') { + argsArr = argsStr.split(',').reduce(function (result, item, index) { + var arg = dataset['arg' + index]; + if (arg === "$event") { + var newEvent = getNewEvent(e); + result.push(newEvent); + } else { + // 这里的值微信已经计算好了;到dateset的时候已经是计算的结果 比如msg = 'sss' data-arg1="{{msg + 1}}" + // dataset[arg1] = 'sss1' + result.push(dataset['arg' + index]); + } + return result; + }, []); + } + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + this[originFuncName].apply(this, _toConsumableArray(argsArr)); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.modelEventProxyName, function (e) { + var dataset = e.currentTarget && e.currentTarget.dataset; + var modelKey = dataset && dataset.modelkey; + if (modelKey) { + this[modelKey] = e.detail.value; + } + }), _defineProperty(_methods, _.eventProxyName, function (e) { + var dataset = e.currentTarget.dataset; + + var originFuncName = dataset && dataset['event' + e.type]; + if (originFuncName && this[originFuncName] && _.isType(this[originFuncName], 'Function')) { + var newEvent = getNewEvent(e); + this[originFuncName](newEvent); + } else { + console.log('can not find method ' + originFuncName); + } + }), _defineProperty(_methods, _.styleParseName, function (content) { + var res = ''; + if (_.isType(content, 'Object')) { + Object.keys(content).forEach(function (key) { + res += key + ':' + content[key] + ';'; + }); + } else if (_.isType(content, 'String')) { + res = content; + } + return wxStyleHandle(res); + }), _defineProperty(_methods, _.mergeStyleName, function () { + return _.mergeStyle.apply(_, arguments); + }), _defineProperty(_methods, _.animationProxy, function () { + var animationValue = arguments.length <= 0 ? undefined : arguments[0]; + // animationValue:{cbs:{0:cb0,1:cb1,length:2},index} + var animation = this[animationValue]; // 引用值 + if (!animation) { + return; + } + var cbs = animation.cbs, + index = animation.index; + // 配合 解决百度端动画bug + + if (cbs === undefined || index === undefined) { + return; + } + var cb = cbs[index]; + if (cb && typeof cb === 'function') { + cb(); + } + delete animation.index; + animation.index = index + 1; + }), _methods) + +}; + +function getNewEvent(e) { + var newEvent = {}; + ['type', 'timeStamp', 'target', 'currentTarget', 'detail', 'touches', 'changedTouches'].forEach(function (key) { + if (e[key]) { + if (~['target', 'currentTarget'].indexOf(key)) { + var newTarget = {}; + newTarget = { + id: e[key].id, + dataset: e[key].dataset + }; + newEvent[key] = newTarget; + } else { + newEvent[key] = e[key]; + } + } + }); + + newEvent._originEvent = e; + return newEvent; +} + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-mixins.js": +/***/ (function(module, exports, __webpack_require__) { + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var commonMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-alipay-common-mixins.js"); + +var _ = module.exports = commonMixins.deepClone(commonMixins); +commonMixins.merge(_.mixins.methods, _defineProperty({}, _.eventEmitName, function (eventKey, detail) { + this.triggerEvent(eventKey, detail); + if (this.$__checkCmlEmit__) { + this.$__checkCmlEmit__(eventKey, detail); + } +})); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js": +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime-module.js": +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/regenerator-runtime/runtime.js": +/***/ (function(module, exports) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); + + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js": +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/cpx2px/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = cpx2px; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function cpx2px(cpx) { + if (typeof cpx !== 'number') { + console.error('Parameter must be a number'); + return; + } + var viewportWidth = _getWidth2.default.getWidth(); + var px = +(viewportWidth / 750 * cpx).toFixed(3); + return px; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getRect/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/getRect/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": { + "resData": { + "width": "Number", + "height": "Number", + "left": "Number", + "top": "Number", + "right": "Number", + "bottom": "Number" + }, + "CallBack": { + "input": ["resData"], + "output": "Undefined" + } + }, + "interfaces": { + "UserInfoInterface": { + "getRect": { + "input": ["CMLObject", "CallBack"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["UserInfoInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getRect", + value: function getRect(refObj, cb) { + var query = wx.createSelectorQuery().in(refObj.context); + query.select("#" + refObj.id).boundingClientRect(); + query.exec(function (res) { + wx.getSystemInfo({ + success: function success(systemRes) { + var windowWidth = systemRes.windowWidth; + var scale = 750 / windowWidth; + var rectObj = { + width: res[0] && res[0].width * scale || 0, + height: res[0] && res[0].height * scale || 0, + left: res[0] && res[0].left * scale || 0, + top: res[0] && res[0].top * scale || 0, + right: res[0] && res[0].right * scale || 0, + bottom: res[0] && res[0].bottom * scale || 0 + }; + cb(rectObj); + } + }); + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getRect/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = getRect; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +var _utils = __webpack_require__("./node_modules/chameleon-api/src/lib/utils.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getRect(ref, context) { + return new Promise(function (resolve, reject) { + var refObj = (0, _utils.getRefObj)(ref, context); + _index2.default.getRect(refObj, function (res) { + resolve(res); + }); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": { + "res": { + "os": "String", + "env": "String", + "viewportWidth": "Number", + "viewportHeight": "Number", + "extraParams": "CMLObject" + }, + "CallBack": { + "input": ["res"], + "output": "Undefined" + } + }, + "interfaces": { + "UserInfoInterface": { + "getSystemInfo": { + "input": ["CallBack"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["UserInfoInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getSystemInfo", + value: function getSystemInfo(cb) { + wx.getSystemInfo({ + success: function success(res) { + var os = /android/i.test(res.system) ? 'android' : 'ios'; + var viewportWidth = res.windowWidth; + var viewportHeight = res.windowHeight; + var systemInfo = { + os: os, + env: 'wx', + viewportWidth: viewportWidth, + viewportHeight: viewportHeight, + extraParams: res || {} + }; + cb(systemInfo); + }, + fail: function fail(err) { + var systemInfo = { + os: '', + env: 'wx', + viewportWidth: 0, + viewportHeight: 0, + extraParams: {} + }; + cb(systemInfo); + } + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.default = getSystemInfo; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +var _utils = __webpack_require__("./node_modules/chameleon-api/src/lib/utils.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getSystemInfo() { + return new Promise(function (resolve, reject) { + _index2.default.getSystemInfo(function (res) { + res.extraParams = (0, _utils.tryJsonParse)(res.extraParams); + // px2viewpx + var pxRpxRate = 750 / res.viewportWidth; + var viewportHeight = (res.viewportHeight * pxRpxRate).toFixed(3); + var viewportWidth = (res.viewportWidth * pxRpxRate).toFixed(3); + + if (res.os) { + resolve(_extends({}, res, { + viewportHeight: viewportHeight, + viewportWidth: viewportWidth + })); + } else { + reject(res); + } + }); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getWidthInterface": { + "getWidth": { + "input": [], + "output": "Number" + } + } + }, + "classes": { + "Method": ["getWidthInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getWidth", + value: function getWidth() { + var _wx$getSystemInfoSync = wx.getSystemInfoSync(), + windowWidth = _wx$getSystemInfoSync.windowWidth; + + return windowWidth; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/px2cpx/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = px2cpx; + +var _getWidth = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/getWidth.interface"); + +var _getWidth2 = _interopRequireDefault(_getWidth); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function px2cpx(px) { + + if (typeof px !== 'number') { + console.error('Parameter must be a number'); + return; + } + + var viewportWidth = _getWidth2.default.getWidth(); + var cpx = +(750 / viewportWidth * px).toFixed(3); + return cpx; +} + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/lib/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isFn = isFn; +exports.isStr = isStr; +exports.isNum = isNum; +exports.isObj = isObj; +exports.isArray = isArray; +exports.isUndefined = isUndefined; +exports.isEmpty = isEmpty; +exports.noop = noop; +exports.parseQuery = parseQuery; +exports.queryStringify = queryStringify; +exports.buildQueryStringUrl = buildQueryStringUrl; +exports.queryParse = queryParse; +exports.isNeedApiPrefix = isNeedApiPrefix; +exports.addApiPrefix = addApiPrefix; +exports.tryJsonParse = tryJsonParse; +exports.getQueryParamsFromUrl = getQueryParamsFromUrl; +exports.getOpenObj = getOpenObj; +exports.getUrlWithConnector = getUrlWithConnector; +exports.getRefObj = getRefObj; +exports.compareVersion = compareVersion; + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +/** + * 基础js方法的封装 + * + */ +function typeEqual(obj, type) { + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; +} + +function isFn(obj) { + return typeEqual(obj, 'Function'); +} + +function isStr(obj) { + return typeEqual(obj, 'String'); +} + +function isNum(obj) { + return typeof obj === 'number'; +} + +function isObj(obj) { + return typeEqual(obj, 'Object'); +} + +function isArray(obj) { + return typeEqual(obj, 'Array'); +} + +function isUndefined(obj) { + return typeEqual(obj, 'Undefined'); +} + +function isEmpty(obj) { + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + return false; + } + } + return true; +} + +function noop() {} + +function parseQuery(obj) { + var str = '&'; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + str += key + '=' + encodeURIComponent(obj[key]) + '&'; + } + } + return str; +} + +function queryStringify(obj) { + var strArr = []; + var keys = null; + if (obj && Object.keys(obj).length > 0) { + keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + strArr.push(key + '=' + encodeURIComponent(obj[key])); + } + } + return strArr.join('&'); +} + +function buildQueryStringUrl(params) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if (!url) return queryStringify(params); + var retUrl = url; + if (queryStringify(params)) { + retUrl = url.indexOf('?') > -1 ? url + '&' + queryStringify(params) : url + '?' + queryStringify(params); + } + return retUrl; +} + +function queryParse() { + var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + var arr = search.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +function isNeedApiPrefix(url) { + return !/^(https?\:\/\/)|^(\/\/)/.test(url); +} + +function addApiPrefix(url, domainkey) { + var domainMap = process.env.domainMap; + // 新版cli + if (domainMap) { + var prefix = domainMap[domainkey] || process.env.devApiPrefix; + return prefix + url; + } else { + // 老版本配置apiPrefix + if (true) { + return "http://172.24.24.111:8005" + url; + } + } +} + +function tryJsonParse(some) { + // 这里eslint提示也先别删除\[\] + if (isStr(some) && /[\{\[].*[\}\]]/.test(some)) { + some = JSON.parse(some); + } + return some; +} + +function getQueryParamsFromUrl(url) { + var arr = url.split(/(\?|&)/); + var parmsObj = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i].indexOf('=') !== -1) { + var keyValue = arr[i].match(/([^=]*)=(.*)/); + parmsObj[keyValue[1]] = decodeURIComponent(keyValue[2]); + } + } + return parmsObj; +} + +/** + * 获取处理后的各端打开的地址 + * @param {String} url url地址 + * @return {Object} objTreated 处理好的三端地址及对象 + */ +function getOpenObj(url) { + var webUrlWithoutQuery = url.split('?')[0]; + var queryObj = getQueryParamsFromUrl(url); + + var _queryObj$path = queryObj.path, + path = _queryObj$path === undefined ? '' : _queryObj$path, + _queryObj$envVersion = queryObj.envVersion, + envVersion = _queryObj$envVersion === undefined ? '' : _queryObj$envVersion, + _queryObj$weixin_appi = queryObj.weixin_appid, + weixin_appid = _queryObj$weixin_appi === undefined ? '' : _queryObj$weixin_appi, + _queryObj$weixin_path = queryObj.weixin_path, + weixin_path = _queryObj$weixin_path === undefined ? '' : _queryObj$weixin_path, + _queryObj$weixin_envV = queryObj.weixin_envVersion, + weixin_envVersion = _queryObj$weixin_envV === undefined ? '' : _queryObj$weixin_envV, + _queryObj$baidu_appid = queryObj.baidu_appid, + baidu_appid = _queryObj$baidu_appid === undefined ? '' : _queryObj$baidu_appid, + _queryObj$baidu_path = queryObj.baidu_path, + baidu_path = _queryObj$baidu_path === undefined ? '' : _queryObj$baidu_path, + _queryObj$baidu_envVe = queryObj.baidu_envVersion, + baidu_envVersion = _queryObj$baidu_envVe === undefined ? '' : _queryObj$baidu_envVe, + _queryObj$alipay_appi = queryObj.alipay_appid, + alipay_appid = _queryObj$alipay_appi === undefined ? '' : _queryObj$alipay_appi, + _queryObj$alipay_path = queryObj.alipay_path, + alipay_path = _queryObj$alipay_path === undefined ? '' : _queryObj$alipay_path, + _queryObj$alipay_envV = queryObj.alipay_envVersion, + alipay_envVersion = _queryObj$alipay_envV === undefined ? '' : _queryObj$alipay_envV, + _queryObj$weex_path = queryObj.weex_path, + weex_path = _queryObj$weex_path === undefined ? '' : _queryObj$weex_path, + _queryObj$cml_addr = queryObj.cml_addr, + cml_addr = _queryObj$cml_addr === undefined ? '' : _queryObj$cml_addr, + extraData = _objectWithoutProperties(queryObj, ['path', 'envVersion', 'weixin_appid', 'weixin_path', 'weixin_envVersion', 'baidu_appid', 'baidu_path', 'baidu_envVersion', 'alipay_appid', 'alipay_path', 'alipay_envVersion', 'weex_path', 'cml_addr']); + + var objTreated = { + weex: cml_addr ? webUrlWithoutQuery + '?weex_path=' + weex_path + queryStringify(extraData) + '&cml_addr=' + cml_addr : null, + web: webUrlWithoutQuery + '?' + queryStringify(extraData), + wx: { + appId: weixin_appid, + path: weixin_path || path, + extraData: extraData, + envVersion: weixin_envVersion || envVersion + }, + alipay: { + appId: alipay_appid, + path: alipay_path || path, + extraData: extraData, + envVersion: alipay_envVersion || envVersion + }, + baidu: { + appKey: baidu_appid, + path: baidu_path || path, + extraData: extraData + } + }; + return objTreated; +} + +// 获得带正确连接符的url +function getUrlWithConnector(url) { + var connector = url.includes('?') ? '&' : '?'; + return url + connector; +} + +// 获取ref的通用对象 +function getRefObj(ref, context) { + var refObj = { + webDom: '', + id: '', + weexRef: '', + context: context + }; + // 容错处理 + if (!ref) return refObj; + + // 兼容新版ref, 为字符串 + if (typeof ref == 'string') { + refObj.id = ref; + if (false) { + refObj.weexRef = context.$refs && context.$refs[ref]; + } else if (false) { + refObj.webDom = context.$refs[ref] && context.$refs[ref][0] || context.$refs[ref] && context.$refs[ref].$el || context.$refs[ref]; + } + return refObj; + } + + // 向下兼容旧版ref + if (true) { + refObj.id = ref.id; + } else if (process.env.platform === 'weex') { + refObj.weexRef = ref; + } else if (ref.$el) { + refObj.webDom = ref.$el; + } else { + refObj.webDom = ref; + } + return refObj; +} + +/** + * 比较版本号 + * @param {String} v1 版本号1 + * @param {String} symb 比较符 + * @param {String} v2 版本号2 + */ +function compareVersion(v1, symb, v2) { + v1 = parseVersion(v1); + v2 = parseVersion(v2); + if (symb.indexOf('=') !== -1 && v1 === v2) { + return true; + } + if (symb.indexOf('>') !== -1 && v1 > v2) { + return true; + } + if (symb.indexOf('<') !== -1 && v1 < v2) { + return true; + } + return false; +} + +function parseVersion() { + var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + version = version.split('.'); + version.length = 4; + var ret = []; + version.forEach(function (n) { + n = n * 1; + if (n) { + ret.push(n >= 10 ? n : '0' + n); + } else { + ret.push('00'); + } + }); + return parseInt(ret.join(''), 10); +} + +/** + * 判断targetMap中的属性是否被checkMap的属性包含,不是则抛出错误 + * @param {Object || Array} checkMap + * @param {Object} targetMap + * @returns {Boolean} + */ +var checkValue = exports.checkValue = function checkValue(check, targetMap) { + if (isObj(check) || isArray(check)) { + var checkArray = isObj(check) ? Object.keys(check) : check; + Object.keys(targetMap).forEach(function (key) { + if (!checkArray.includes(key)) { + throw Error(key + '\u503C\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u68C0\u67E5\uFF01'); + } + }); + } else { + // redLog('请传入数组或对象') + return false; + } + return true; +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.js"); + +var _index2 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.js"); + +var _index3 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js"); + +var _index4 = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js"); + +var _index5 = _interopRequireDefault(_index4); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _extends({ + createApp: _index.createApp, + createPage: _index2.createPage, + createComponent: _index3.createComponent +}, _index5.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +__webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "bootstrapInterface": { + "bootstrap": { + "input": ["CMLObject"], + "output": "Undefined" + }, + "getInfo": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["bootstrapInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +/* istanbul ignore next */ + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "bootstrap", + value: function bootstrap(options) {// 小程序端启动入口为src/app/app.cml + } + }, { + key: "getInfo", + value: function getInfo() { + return {}; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/bootstrap/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* istanbul ignore next */ +exports.default = { + bootstrap: function bootstrap() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _index2.default.bootstrap.call(_index2.default, options); + }, + getInfo: _index2.default.getInfo + +}; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/bootstrap/shim.js": +/***/ (function(module, exports) { + +/** + * Promise.finally、Promise.done 垫片 + */ +if (typeof Promise.prototype.finally !== 'function') { + Promise.prototype.finally = function (onFinally) { + var P = this.constructor; + return this.then(function (value) { + return P.resolve(onFinally()).then(function () { + return value; + }); + }, function (reason) { + return P.resolve(onFinally()).then(function () { + throw reason; + }); + }); + }; +} + +if (typeof Promise.prototype.done === 'undefined') { + Promise.prototype.done = function (onFulfilled, onRejected) { + this.then(onFulfilled, onRejected).catch(function (error) { + setTimeout(function () { + throw error; + }, 0); + }); + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _wx = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createAppInterface": { + "createApp": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createAppInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createApp", + value: function createApp(options) { + return new _wx.App(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createApp/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createApp = createApp; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createApp/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createApp(options) { + return _index2.default.createApp(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _wx = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createCmptInterface": { + "createComponent": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createCmptInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createComponent", + value: function createComponent(options) { + return new _wx.Component(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createComponent/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createComponent = createComponent; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createComponent/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createComponent(options) { + return _index2.default.createComponent(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _wx = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/index.js"); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createPgInterface": { + "createPage": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createPgInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createPage", + value: function createPage(options) { + return new _wx.Page(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/interfaces/createPage/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPage = createPage; + +var _index = __webpack_require__("./node_modules/chameleon-runtime/src/interfaces/createPage/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createPage(options) { + return _index2.default.createPage(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _proto = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/proto.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var BaseCtor = function () { + function BaseCtor(options) { + _classCallCheck(this, BaseCtor); + + // 拷贝原型链上属性 + (0, _proto.copyProtoProperty)(options); + + this.options = _extends({}, options); + this.originalOptions = options; + } + + _createClass(BaseCtor, [{ + key: 'initOptTransformer', + value: function initOptTransformer(OptTransformer, config) { + var optTransformer = new OptTransformer(_extends({ + options: this.options + }, config)); + this.options = optTransformer.getOptions(); + } + }, { + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseCtor; +}(); + +exports.default = BaseCtor; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _warn = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/warn.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// options transform 基类 +var BaseOptionsTransformer = function () { + function BaseOptionsTransformer(config) { + _classCallCheck(this, BaseOptionsTransformer); + + this.type = config.type; + this.options = config.options; + this.injectMixins = config.injectMixins || []; + this.builtinMixins = config.builtinMixins; + this.hooks = config.hooks; + this.hooksMap = config.hooksMap; + this.polyHooks = config.polyHooks; + this.usedHooks = config.usedHooks; + this.platform = ''; + + if (true) { + var mix = this.options.mixins; + (0, _warn.invariant)((0, _type.type)(mix) === 'Undefined' || (0, _type.type)(mix) === "Array", "mixins expects an Array"); + } + } + + _createClass(BaseOptionsTransformer, [{ + key: 'getOptions', + value: function getOptions() { + return this.options; + } + }]); + + return BaseOptionsTransformer; +}(); + +exports.default = BaseOptionsTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _BaseOptionsTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseOptionsTransformer.js"); + +var _BaseOptionsTransformer2 = _interopRequireDefault(_BaseOptionsTransformer); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _resolve = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/resolve.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +// 各种小程序options transform 基类 +var MiniOptTransformer = function (_BaseOptionsTransform) { + _inherits(MiniOptTransformer, _BaseOptionsTransform); + + function MiniOptTransformer(config) { + _classCallCheck(this, MiniOptTransformer); + + //小程序特有 + var _this = _possibleConstructorReturn(this, (MiniOptTransformer.__proto__ || Object.getPrototypeOf(MiniOptTransformer)).call(this, config)); + + _this.needPropsHandler = config.needPropsHandler; + + _this.needResolveAttrs = config.needResolveAttrs; + _this.needTransformProperties = config.needTransformProperties; + return _this; + } + + _createClass(MiniOptTransformer, [{ + key: 'init', + value: function init() { + this.propsName = this.platform ? _KEY2.default.get(this.platform + '.props') : ''; + + this.needPropsHandler && this.initProps(this.options); + // 生命周期映射 + (0, _util.transferLifecycle)(this.options, this.hooksMap); + this.handleMixins(this.options); + + // 扩展各端多态生命周期 + this.extendPolyHooks(); + + // init 顺序很重要 + // this.mergeInjectedMixins() + this.mergeBuiltinMixins(); + this.resolveOptions(); + this.transformHooks(); + this.needResolveAttrs && this.resolveAttrs(); + this.needTransformProperties && this.transformProperties(); + + if (this.platform === 'alipay') { + delete this.options['computed']; + } + } + + /** + * 处理组件props属性 + * @param {Object} vmObj 组件options + * @return {[type]} [description] + */ + + }, { + key: 'initProps', + value: function initProps(vmObj) { + var _this2 = this; + + if (!vmObj['props']) return; + + Object.getOwnPropertyNames(vmObj['props']).forEach(function (name) { + var prop = vmObj['props'][name]; + // Number: 0 + // Boolean: false + // Array: false + // String: '' + // Object: null + // null: null + function make(type) { + if (!knowType(type)) { + return; + } + + switch (type) { + case Number: + prop = vmObj['props'][name] = { + type: Number, + default: 0 + }; + break; + case Boolean: + prop = vmObj['props'][name] = { + type: Boolean, + default: false + }; + break; + case Array: + prop = vmObj['props'][name] = { + type: Array, + default: [] + }; + break; + case String: + prop = vmObj['props'][name] = { + type: String, + default: '' + }; + break; + case Object: + prop = vmObj['props'][name] = { + type: Object, + default: null + }; + break; + case null: + prop = vmObj['props'][name] = { + type: null, + default: null + }; + break; + default: + break; + } + } + + function knowType(type) { + return type === Number || type === Boolean || type === Array || type === String || type === Object || type === null; + } + + // 处理 props = { a: String, b: Boolean } + make(prop); + + if ((0, _type.type)(prop) === 'Object') { + if (_this2.platform === 'alipay') { + if (!prop.hasOwnProperty('default')) { + // alipay 处理 // 处理 props = { a: {type:String}, b: {type:Boolean} } + make(prop.type); + } + + vmObj['props'][name] = prop['default']; + } else { + (0, _util.rename)(vmObj['props'][name], 'default', 'value'); + } + } + }); + + if (this.platform !== 'alipay') { + (0, _util.rename)(vmObj, 'props', 'properties'); + } + + function check(value, type) { + + if (typeof value === 'undefined') { + console.error(prop + '\u9700\u8981\u4F20\u9ED8\u8BA4\u503C'); + return false; + } + // todo type 校验 + } + } + }, { + key: 'handleMixins', + value: function handleMixins(VMObj) { + var _this3 = this; + + if (!VMObj.mixins) return; + + var mixins = VMObj.mixins; + + mixins.forEach(function (mix) { + // 生命周期映射 + (0, _util.transferLifecycle)(mix, _this3.hooksMap); + }); + } + + /** + * 小程序端差异化生命周期 hooks mixins + */ + + }, { + key: 'extendPolyHooks', + value: function extendPolyHooks() { + var _this4 = this; + + var methods = this.options.methods; + + if (!methods) { + return; + } + + this.polyHooks.forEach(function (hook) { + if ((0, _type.type)(methods[hook]) === 'Function') { + if ((0, _type.type)(_this4.options[hook]) === 'Array') { + _this4.options[hook].push(methods[hook]); + } else { + _this4.options[hook] = [methods[hook]]; + } + delete methods[hook]; + } + }); + } + }, { + key: 'mergeInjectedMixins', + value: function mergeInjectedMixins() { + this.options.mixins = this.options.mixins ? this.options.mixins.concat(this.injectMixins) : this.injectMixins; + } + }, { + key: 'mergeBuiltinMixins', + value: function mergeBuiltinMixins() { + var btMixin = [this.baseMixins, this.builtinMixins].filter(function (item) { + return item; + }); + + this.options.mixins = this.options.mixins ? btMixin.concat(this.options.mixins) : btMixin; + } + }, { + key: 'resolveOptions', + value: function resolveOptions() { + var self = this; + var extractMixins = function extractMixins(mOptions, options) { + if (options.mixins) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = options.mixins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var mix = _step.value; + + extractMixins(mOptions, mix); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + } + mergeMixins(mOptions, options); + }; + + var mergeMixins = function mergeMixins(parent, child) { + for (var key in child) { + if (self.hooks.indexOf(key) > -1) { + (0, _resolve.mergeHooks)(parent, child, key); + } else if (key === 'data') { + (0, _resolve.mergeData)(parent, child, key); + } else if (testProps(key)) { + (0, _resolve.mergeSimpleProps)(parent, child, key); + } else if (key === 'watch') { + (0, _resolve.mergeWatch)(parent, child, key); + } else if (key !== 'mixins') { + (0, _resolve.mergeDefault)(parent, child, key); + } + } + }; + + var testProps = function testProps(key) { + var regExp = new RegExp('computed|methods|proto|' + self.propsName); + return regExp.test(key); + }; + + var newOptions = {}; + extractMixins(newOptions, this.options); + this.options = newOptions; + } + }, { + key: 'transformHooks', + value: function transformHooks() { + if (!this.hooks || !this.hooks.length) return; + var self = this; + this.hooks.forEach(function (key) { + var hooksArr = self.options[key]; + hooksArr && (self.options[key] = function () { + var result = void 0; + var asyncQuene = []; + + // 多态生命周期需要统一回调参数 + // if (self.polyHooks.indexOf(key) > -1) { + // let res = args[0] + // if (type(res) !== 'Object') { + // res = { + // 'detail': args[0] + // } + // } + // args = [res] + // } + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if ((0, _type.type)(hooksArr) === 'Function') { + result = hooksArr.apply(this, args); + } else if ((0, _type.type)(hooksArr) === 'Array') { + for (var i = 0; i < hooksArr.length; i++) { + if ((0, _type.type)(hooksArr[i]) === 'Function') { + + result = hooksArr[i].apply(this, args); + + // if (result && result.enableAsync) { + // asyncQuene = hooksArr.slice(i + 1) + // break + // } + } + } + // Promise.resolve().then(() => { + // asyncQuene.forEach(fn => { + // fn.apply(this, args) + // }) + // }) + } + return result; + }); + }); + } + }, { + key: 'resolveAttrs', + value: function resolveAttrs() { + var _this5 = this; + + if (!this.needResolveAttrs.length) return; + var keys = this.needResolveAttrs; + if ((0, _type.type)(keys) === 'String') { + keys = [keys]; + } + + keys.forEach(function (key) { + var value = _this5.options[key]; + if ((0, _type.type)(value) !== 'Object') return; + + (0, _util.extendWithIgnore)(_this5.options, value, _this5.usedHooks); + delete _this5.options[key]; + }); + } + }, { + key: 'transformProperties', + value: function transformProperties() { + var originProperties = this.options[this.propsName]; + var newProps = {}; + + (0, _util.enumerableKeys)(originProperties).forEach(function (key) { + var rawFiled = originProperties[key]; + + var rawObserver = rawFiled.observer; + var newFiled = null; + if (typeof rawFiled === 'function') { + newFiled = { + type: rawFiled + }; + } else { + newFiled = (0, _util.extend)({}, rawFiled); + } + newFiled.observer = function (value, oldValue) { + // 小程序内部数据使用了JSON.parse(JSON.stringify(x))的方式,导致每次引用都会变化 + if (_mobx.extras.deepEqual(value, oldValue)) return; + this[key] = value; + typeof rawObserver === 'function' && rawObserver.call(this, value, oldValue); + }; + newProps[key] = newFiled; + }); + + this.options[this.propsName] = newProps; + } + }]); + + return MiniOptTransformer; +}(_BaseOptionsTransformer2.default); + +exports.default = MiniOptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _toJS = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/toJS.js"); + +var _toJS2 = _interopRequireDefault(_toJS); + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _KEY = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/KEY.js"); + +var _KEY2 = _interopRequireDefault(_KEY); + +var _diff = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/diff.js"); + +var _diff2 = _interopRequireDefault(_diff); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var RuntimeWidget = function () { + function RuntimeWidget(config) { + _classCallCheck(this, RuntimeWidget); + + this.platform = config.platform || ''; + this.options = config.options; + this.polyHooks = config.polyHooks; + + this.propsName = _KEY2.default.get(this.platform + '.props'); + this.instance = _KEY2.default.get(this.platform + '.instance'); + } + + _createClass(RuntimeWidget, [{ + key: 'setOptions', + value: function setOptions(options) { + this.options = options; + } + }, { + key: 'setContext', + value: function setContext(context) { + this.context = context; + return this; + } + }, { + key: 'init', + value: function init() { + // 属性 + this.initData(); + + // 方法 + this.initInterface(); + + // 数据劫持 + this.proxyHandler(); + + // watch 属性mobx转换 + this.watchesHandler(); + return this; + } + }, { + key: 'initData', + value: function initData() { + if (!this.context) return; + var context = this.context; + context.__cml_originOptions__ = this.options; + // 清理函数列表 + context.__cml_disposerList__ = []; + // update后,回调函数收集器 + context.__cml_cbCollection__ = []; + + context['$cmlPolyHooks'] = this.polyHooks; + + // effect computed + context.__cml_computed__ = transformComputed(context); + + if (this.platform === 'alipay') { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.props, context.__cml_computed__); + } else { + context.__cml_data__ = (0, _util.extend)({}, context.data, context.__cml_computed__); + } + } + + /** + * **给小程序增加refs功能** + * + * 在cml编译阶段给所有带有ref属性的元素添加 class="_cml_ref_lmc_" + * 通过在Page的onLoad阶段以及comoponent的attached阶段初始化当前实例的$refs (执行时机选定标准: 可以通过createSelectorQuery选取元素之后) + * $refs只提供id, 不提供其他属性, $refs本身初始化是在onLoad阶段, 此时获得的节点数据(例如top), 并不会随页面滚动进行变化. 所以意义不大 + * 通过this.$refs.ref获取元素class后在interface内部通过wxApi实时获取各元素信息 + */ + + }, { + key: 'initRefs', + value: function initRefs() { + if (!this.context) return; + var context = this.context; + var query = this.platform === 'alipay' ? this.instance.createSelectorQuery() : this.instance.createSelectorQuery().in(context); + + query.selectAll('._cml_ref_lmc_').boundingClientRect(); + query.exec(function (res) { + context.$refs = {}; + var doms = res[0]; + if (!doms) { + return; + } + for (var i = 0; i < doms.length; i++) { + var refItem = doms[i]; + context.$refs[refItem.id] = { + id: refItem.id + }; + } + }); + return this; + } + }, { + key: 'initInterface', + value: function initInterface() { + if (!this.context) return; + var context = this.context; + // 构造 watch 能力 + context.$watch = watchFnFactory(context); + + // 构造 updated callback 收集能力 + context.$collect = updatedCbFactory(context); + + // 构造数据更新能力 + context.$setData = setDataFactory(context, this); + + // 构造强制更新能力 + context.$forceUpdate = forceUpdateFactory(context); + } + }, { + key: 'proxyHandler', + value: function proxyHandler() { + if (!this.context) return; + var context = this.context; + context.__cml_ob_data__ = (0, _mobx.observable)(context.__cml_data__); + + var origComputed = context.__cml_originOptions__.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + /* 计算属性在mobx里面是不可枚举的,所以篡改下*/ + (0, _util.enumerable)(context.__cml_ob_data__, origComputedKeys); + + (0, _util.proxy)(context, context.__cml_ob_data__); + } + + /** + * watch 属性转换 + * @param {Object} context 上下文 + * @return {[type]} [description] + */ + + }, { + key: 'watchesHandler', + value: function watchesHandler() { + if (!this.context) return; + var context = this.context; + var options = context.__cml_originOptions__; + + var watches = options.watch; + + if ((0, _type.type)(watches) !== 'Object') { + return; + } + + (0, _util.enumerableKeys)(watches).forEach(function (key) { + var handler = watches[key]; + if ((0, _type.type)(handler) === 'Array') { + // mobx的reaction执行是倒序的,顾为保证watch正常次序,需倒序注册 + for (var i = handler.length - 1; i >= 0; i--) { + context.$watch(key, handler[i]); + } + } else { + context.$watch(key, handler); + } + }); + } + }, { + key: 'addPageHooks', + value: function addPageHooks() { + var context = this.context; + var originOptions = context.__cml_originOptions__; + // 使用createComponent创建page时,页面的事件直接写在options里是不生效的,必须注入到this上 + _lifecycle2.default.get(this.platform + '.page.hooks').forEach(function (key) { + if (typeof originOptions[key] === 'function') { + context[key] = originOptions[key]; + } + }); + } + /** + * 启动器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'start', + value: function start(name) { + if (!this.context) return; + var context = this.context; + // 渲染更新监听 + var disposer = autorunThrottle(context.$setData, name); + + context.__cml_disposerList__.push(disposer); + } + + /** + * 销毁器 + * @param {[type]} context [description] + * @return {[type]} [description] + */ + + }, { + key: 'destory', + value: function destory() { + if (!this.context) return; + var context = this.context; + disposerFactory(context.__cml_disposerList__)(); + } + }]); + + return RuntimeWidget; +}(); + +/** + * watch 工厂函数 + * @param {[type]} context [description] + * @return {function} vm.$watch + */ + + +exports.default = RuntimeWidget; +function watchFnFactory(context) { + return function (expr, handler) { + var callback = handler.handler || handler; + var exprType = typeof expr === 'undefined' ? 'undefined' : _typeof(expr); + var curVal = void 0; + var oldVal = void 0; + if (!/^function|string$/.test(exprType)) { + console.warn(new Error('watch expression must be a string or function')); + return; + } + if (typeof callback !== 'function') { + console.warn(new Error('watch callback must be a function')); + return; + } + + /** + * [computed description] + * @return {[type]} [description] + */ + function dataExprFn() { + oldVal = curVal; + curVal = exprType === 'string' ? (0, _util.getByPath)(context, expr) : expr.call(context); + if (handler.deep) { + curVal = (0, _toJS2.default)(curVal, false); + } else if ((0, _mobx.isObservableArray)(curVal)) { + // 强制访问,让数组被观察 + curVal.peek(); + } + return curVal; + } + + function sideEffect(curVal, reaction) { + callback.call(context, curVal, oldVal); + } + + var options = { + fireImmediately: !!handler.immediate, + delay: handler.sync ? 0 : 1 + + // 返回清理函数 + };var disposer = (0, _mobx.reaction)(dataExprFn, sideEffect, options); + + context.__cml_disposerList__.push(disposer); + return disposerFactory(context.__cml_disposerList__, disposer); + }; +} +/** + * 清理函数构造工厂 + * @param {array} disposerList 清理函数列表 + * @param {function} disposer 清理函数 + * @return {function} 清理函数包装方法 + */ +function disposerFactory(disposerList, disposer) { + return function () { + if (disposer) { + var index = disposerList.indexOf(disposer); + index > -1 && disposerList.splice(index, 1); + disposer(); + } else { + var _disposer = void 0; + while (_disposer = disposerList.shift()) { + _disposer(); + } + } + }; +} + +/** + * 更新后回调 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function updatedCbFactory(context) { + return function (cb) { + context.__cml_cbCollection__.push(cb); + }; +} + +/** + * 设置数据工厂函数 + * @param {[type]} context [description] + */ +function setDataFactory(context, self) { + var _cached = false; + var cacheData = void 0; + + return function () { + var reaction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if ((0, _type.type)(reaction.schedule) !== 'Function') { + return; + } + // 缓存reaction + context.__cml_reaction__ = reaction; + + var properties = context.__cml_originOptions__[self.propsName]; + var propKeys = (0, _util.enumerableKeys)(properties); + + var obData = (0, _util.deleteProperties)(context.__cml_ob_data__, propKeys); + + // setData 的数据不包括 props + var data = (0, _toJS2.default)(obData); + + var diffV = void 0; + if (_cached) { + diffV = (0, _diff2.default)(data, cacheData); + + // emit 'beforeUpdate' hook ,第一次不触发 + emit('beforeUpdate', context, data, cacheData, diffV); + } else { + _cached = true; + diffV = data; + } + + update(diffV); + cacheData = _extends({}, data); + }; + + function update(diff) { + if ((0, _type.type)(context.setData) === 'Function') { + context.setData(diff, walkUpdatedCb(context)); + } + } +} + +function emit(name, context) { + var cmlVM = context.__cml_originOptions__; + + if (typeof cmlVM[name] === 'function') { + for (var _len = arguments.length, data = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + data[_key - 2] = arguments[_key]; + } + + cmlVM[name].apply(context, data); + } +} + +/** + * 执行更新后回调列表 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function walkUpdatedCb(context) { + // emit 'updated' hook + emit('updated', context); + + var cb = void 0; + var pendingList = context.__cml_cbCollection__.slice(0); + context.__cml_cbCollection__.length = 0; + while (cb = pendingList.shift()) { + typeof cb === 'function' && cb.apply(context); + } +} + +/** + * forceUpdate 工厂函数 + * @param {[type]} context [description] + * @return {[type]} [description] + */ +function forceUpdateFactory(context) { + return function (data, cb) { + + var dataType = (0, _type.type)(data); + if (dataType === 'Function') { + cb = data; + data = null; + } else if (dataType === 'Object') { + (0, _util.extend)(context.__cml_ob_data__, data); + } + + (0, _type.type)(cb) === 'Function' && context.$collect(cb); + + context.__cml_reaction__.dependenciesState = 2; + context.__cml_reaction__.schedule(); + }; +} + +/** + * computed 属性mobx转换 + * @param {Object} computedExpr 组件实例computed集合 + * @param {Object} context 上下文 + * @return {Object} 转换后computed + */ +function transformComputed(context) { + var options = context.__cml_originOptions__; + + var origComputed = options.computed; + var origComputedKeys = origComputed ? (0, _util.enumerableKeys)(origComputed) : []; + + var newComputed = {}; + origComputedKeys.forEach(function (key) { + newComputed[key] = (0, _mobx.computed)(origComputed[key], { context: context }); + }); + + return newComputed; +} + +/** + * [autorunThrottle description] + * @param {[type]} fnc [description] + * @param {[type]} name [description] + * @return {function} unwatch函数 + */ +function autorunThrottle(fnc, name) { + // 首次同步执行,之后异步处理 + var isScheduled = false; + var first = true; + var r = new _mobx.Reaction(name, function () { + + if (!isScheduled) { + isScheduled = true; + if (first) { + reactionRunner(); + first = false; + } else { + setTimeout(reactionRunner, 0); + } + } + }); + function reactionRunner() { + isScheduled = false; + if (!r.isDisposed) { + r.track(function () { + + fnc(r); + }); + } + } + r.schedule(); + return r.getDisposer(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/KEY.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +var _api = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/api.interface"); + +var _api2 = _interopRequireDefault(_api); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var instanceAPI = _api2.default.getInstance(); + +var KEY = { + wx: { + instance: instanceAPI, + props: 'properties' + }, + alipay: { + instance: instanceAPI, + props: 'props' + }, + baidu: { + instance: instanceAPI, + props: 'properties' + } +}; + +exports.default = new _config2.default(KEY); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/api.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-runtime/src/platform/common/util/api.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "getInstanceInterface": { + "getInstance": { + "input": [], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["getInstanceInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "getInstance", + value: function getInstance() { + return wx; + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/config.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Config = function () { + function Config(data) { + _classCallCheck(this, Config); + + this.data = data; + } + + _createClass(Config, [{ + key: 'get', + value: function get() { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var def = arguments[1]; + + var result = this.data; + path.split('.').forEach(function (key) { + if (key && typeof result !== 'undefined') { + result = result[key]; + } + }); + if (typeof result !== 'undefined') { + return result; + } else { + return def; + } + } + }, { + key: 'set', + value: function set(path, value) { + if (typeof value === 'undefined') { + this.data = path; + } else { + path = String(path || '').trim(); + if (path) { + var paths = path.split('.'); + var last = paths.pop(); + var data = this.data || {}; + paths.forEach(function (key) { + var type = data[key]; + if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object') { + data = data[key]; + } else if (typeof type === 'undefined') { + data = data[key] = {}; + } else { + throw new Error('forbidden to set property[' + key + '] of [' + type + '] data'); + } + }); + data[last] = value; + } + } + } + }]); + + return Config; +}(); + +exports.default = Config; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/diff.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = diff; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function diff(current, old) { + var out = {}; + prefill(current, old); + iDiff(current, old, '', out); + + if (Object.keys(out).length === 1 && out[''] !== undefined) { + out = out['']; + } + + // console.log('diff------:', out) + return out; +} + +function prefill(current, old) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in old) { + var curVal = current[key]; + if (curVal === undefined) { + current[key] = ''; + } else { + prefill(curVal, old[key]); + } + } + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array') { + if (current.length >= old.length) { + old.forEach(function (item, index) { + prefill(current[index], item); + }); + } + } +} + +function iDiff(current, old, path, result) { + if (_mobx.extras.deepEqual(current, old)) return; + + if ((0, _type.type)(current) === 'Object' && (0, _type.type)(old) === 'Object') { + var curLength = Object.keys(current).length; + var oldLength = Object.keys(old).length; + + if (curLength >= oldLength) { + for (var key in current) { + var curVal = current[key]; + var oldVal = old[key]; + + iDiff(curVal, oldVal, getPath(path, key), result); + } + } else { + update(current, path, result); + } + } else if ((0, _type.type)(current) === 'Array' && (0, _type.type)(old) === 'Array' && current.length >= old.length) { + current.forEach(function (item, index) { + iDiff(item, old[index], getPath(path, index, 'array'), result); + }); + } else { + update(current, path, result); + } +} + +function update(item, path, collection) { + if (item !== undefined) { + collection[path] = item; + } +} + +function getPath(pathStr, key, type) { + if (type === 'array') { + return pathStr + '[' + key + ']'; + } + + return isNum(key) ? pathStr + '[' + key + ']' : pathStr ? pathStr + '.' + key : key; +} + +function isNaN(value) { + var n = Number(value); + return n !== n; +} + +function isNum(value) { + return !isNaN(Number(value)); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _config = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/config.js"); + +var _config2 = _interopRequireDefault(_config); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var LIFECYCLE = { + web: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'], + hooksMap: { + 'viewappear': 'beforeRouteEnter', + 'viewdisappear': 'beforeRouteLeave' + }, + polyHooks: ['beforeRouteEnter', 'beforeRouteLeave', 'beforeRouteUpdate'] + }, + weex: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + }, + wx: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onShow', 'onReady', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached', 'moved'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: ['moved'] + } + }, + alipay: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onTitleClick', 'onPageScroll', 'onTabItemTap', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'] + }, + component: { + hooks: ['didMount', 'didUnmount'], + hooksMap: { + 'beforeCreate': 'didMount', + 'created': 'didMount', + 'beforeMount': 'didMount', + 'mounted': 'didMount', + 'beforeDestroy': 'didUnmount', + 'destroyed': 'didUnmount' + }, + usedHooks: ['didMount', 'didUnmount'], + polyHooks: [] + } + }, + baidu: { + app: { + hooks: ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound'], + hooksMap: { + 'beforeCreate': 'onLaunch', + 'created': 'onLaunch', + 'beforeMount': 'onLaunch', + 'mounted': 'onShow', + 'beforeDestroy': 'onHide', + 'destroyed': 'onHide' + }, + usedHooks: ['onLaunch', 'onShow', 'onHide'], + polyHooks: ['onError', 'onPageNotFound'] + }, + page: { + hooks: ['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'], + hooksMap: { + 'beforeCreate': 'onLoad', + 'created': 'onLoad', + 'beforeMount': 'onLoad', + 'mounted': 'onShow', + 'beforeDestroy': 'onUnload', + 'destroyed': 'onUnload' + + }, + usedHooks: ['onLoad', 'onShow', 'onUnload'], + polyHooks: ['onReady', 'onHide', 'onForceReLaunch', 'onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'] + }, + component: { + hooks: ['created', 'attached', 'ready', 'detached'], + hooksMap: { + 'beforeCreate': 'created', + 'created': 'attached', + 'beforeMount': 'attached', + 'mounted': 'ready', + 'beforeDestroy': 'detached', + 'destroyed': 'detached' + }, + usedHooks: ['created', 'attached', 'ready', 'detached'], + polyHooks: [] + } + }, + cml: { + hooks: ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'viewappear', 'viewdisappear'] + } +}; + +exports.default = new _config2.default(LIFECYCLE); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/proto.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.copyProtoProperty = copyProtoProperty; +/** + * 原型上的方法放到对象上 + * @param {Object} obj 待添加属性对象 + * @param {Object} proto 差异方法 + * @return {Object} 修改后值 + */ +function copyProtoProperty() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var EXPORT_OBJ = obj; + var EXPORT_PROTO = EXPORT_OBJ.__proto__; + + if (EXPORT_PROTO.constructor !== Object) { + Object.getOwnPropertyNames(EXPORT_PROTO).forEach(function (key) { + if (!/constructor|prototype|length/ig.test(key)) { + //原型上有自身没有的属性 放到自身上 + if (!EXPORT_OBJ.hasOwnProperty(key)) { + EXPORT_OBJ[key] = EXPORT_PROTO[key]; + } + } + }); + } + + return EXPORT_OBJ; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/resolve.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDefault = mergeDefault; +exports.mergeHooks = mergeHooks; +exports.mergeSimpleProps = mergeSimpleProps; +exports.mergeData = mergeData; +exports.mergeWatch = mergeWatch; + +var _util = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/util.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function mergeDefault(parent, child, key) { + parent[key] = child[key]; +} + +function mergeHooks(parent, child, key) { + + var hasKeyParent = parent.hasOwnProperty(key); + var isArrayChild = (0, _type.type)(child[key]) === 'Array'; + + if (!hasKeyParent && !isArrayChild) { + parent[key] = [child[key]]; + } else if (!hasKeyParent && isArrayChild) { + parent[key] = child[key]; + } else if (hasKeyParent && !isArrayChild) { + parent[key].push(child[key]); + } else if (hasKeyParent && isArrayChild) { + parent[key] = parent[key].concat(child[key]); + } +} + +function mergeSimpleProps(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + if (!parentVal) { + parent[key] = parentVal = {}; + } + (0, _util.extend)(parentVal, childVal); +} + +function mergeData(parent, child, key) { + var childVal = child[key]; + if (!parent[key]) { + parent[key] = {}; + } + (0, _util.merge)(parent[key], childVal); +} + +function mergeWatch(parent, child, key) { + var parentVal = parent[key]; + var childVal = child[key]; + var ret = []; + if (!parentVal) { + parent[key] = parentVal = {}; + } + Object.keys(childVal).forEach(function (key) { + if (key in parentVal) { + parentVal[key] = (0, _type.type)(parentVal[key]) !== 'Array' ? [parentVal[key], childVal[key]] : parentVal[key].concat([childVal[key]]); + } else { + parentVal[key] = childVal[key]; + } + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/style.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.styleHandle = styleHandle; +exports.pxTransform = pxTransform; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +function styleHandle(source) { + var detectCycles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var __alreadySeen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + function cache(value) { + if (detectCycles) { + __alreadySeen.push([source, value]); + } + return value; + } + + if (detectCycles && __alreadySeen === null) { + __alreadySeen = []; + } + + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) { + return __alreadySeen[i][1]; + } + } + } + + if ((0, _type.type)(source) === 'Array') { + var res = cache([]); + var toAdd = source.map(function (value) { + return styleHandle(value, detectCycles, __alreadySeen); + }); + + res.length = toAdd.length; + for (var _i = 0, _l = toAdd.length; _i < _l; _i++) { + res[_i] = toAdd[_i]; + } + + return res; + } else if ((0, _type.type)(source) === 'Object') { + var _res = cache({}); + for (var key in source) { + _res[key] = styleHandle(source[key], detectCycles, __alreadySeen); + } + return _res; + } else if ((0, _type.type)(source) === 'String') { + return pxTransform(source); + } else { + return source; + } +} + +function pxTransform(s) { + if (!~s.indexOf('cpx')) { + return s; + } + + return s.replace(/(([\s:(]|^)-?)(\d*\.?\d+)cpx/ig, function (m) { + return m.replace('cpx', 'rpx'); + }); +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/toJS.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.default = toJS; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +var _style = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/style.js"); + +function toJS(source, detectCycles, __alreadySeen) { + var needPxTransfer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + if (detectCycles === void 0) { + detectCycles = true; + } + if (__alreadySeen === void 0) { + __alreadySeen = []; + } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) __alreadySeen.push([source, value]); + return value; + } + + if (detectCycles && __alreadySeen === null) __alreadySeen = []; + if (detectCycles && source !== null && (typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) return __alreadySeen[i][1]; + } + } + + if ((0, _mobx.isObservable)(source)) { + if ((0, _mobx.isObservableArray)(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) { + res[i] = toAdd[i]; + }return res; + } + if ((0, _mobx.isObservableObject)(source)) { + var res = cache({}); + for (var key in source) { + res[key] = toJS(source[key], detectCycles, __alreadySeen); + }return res; + } + if ((0, _mobx.isObservableMap)(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { + return res_1[key] = toJS(value, detectCycles, __alreadySeen); + }); + return res_1; + } + if ((0, _mobx.isBoxedObservable)(source)) return toJS(source.get(), detectCycles, __alreadySeen); + } else { + if ((0, _type.type)(source) === 'Array') { + var _res = cache([]); + var _toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + + _res.length = _toAdd.length; + for (var _i = 0, _l = _toAdd.length; _i < _l; _i++) { + _res[_i] = _toAdd[_i]; + } + + return _res; + } else if ((0, _type.type)(source) === 'Object') { + var _res2 = cache({}); + for (var _key in source) { + _res2[_key] = toJS(source[_key], detectCycles, __alreadySeen); + } + return _res2; + } else if ((0, _type.type)(source) === 'String') { + // cpx to rpx + return needPxTransfer ? (0, _style.pxTransform)(source) : source; + } else { + return source; + } + } +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/type.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.isObject = isObject; +exports.isPlainObject = isPlainObject; + +var toString = Object.prototype.toString; + +function type(n) { + return toString.call(n).slice(8, -1); +} + +/** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ +function isObject(obj) { + return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; +} + +/** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ +function isPlainObject(obj) { + return type(obj) === 'Object'; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/util.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.propToFn = propToFn; +exports.transferLifecycle = transferLifecycle; +exports.rename = rename; +exports.normalizeMap = normalizeMap; +exports.merge = merge; +exports.extend = extend; +exports.extendWithIgnore = extendWithIgnore; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.enumerable = enumerable; +exports.proxy = proxy; +exports.deleteProperties = deleteProperties; +exports.enumerableKeys = enumerableKeys; +exports.flatten = flatten; + +var _type = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/type.js"); + +// transfer 对象的`${name}`属性值 to function +function propToFn(obj, name) { + if (obj && (0, _type.isObject)(obj[name])) { + var _temp = obj[name]; + + if ((0, _type.isPlainObject)(_temp)) { + obj[name] = function () { + return _extends({}, _temp); + }; + } else { + obj[name] = function () { + return _temp; + }; + } + } +} + +/** + * 生命周期映射 + * @param {Object} VMObj vm对象 + * @param {Object} hooksMap 映射表 + * @return {Object} 修改后值 + */ +function transferLifecycle(VMObj, hooksMap) { + if (!hooksMap) { + return; + } + + var _hooksTemp = []; + var _mapTemp = {}; + // 将生命周期 键名 处理成 [`$_${key}`] + Object.keys(hooksMap).forEach(function (key) { + var uniKey = '$_' + key; + _hooksTemp.push(uniKey); + _mapTemp[uniKey] = hooksMap[key]; + + if (VMObj.hasOwnProperty(key)) { + VMObj[uniKey] = VMObj[key]; + delete VMObj[key]; + } + }); + + _hooksTemp.forEach(function (uniKey) { + var mapKey = _mapTemp[uniKey]; + var hook = VMObj[uniKey]; + + if (VMObj.hasOwnProperty(uniKey) && mapKey && hook) { + if (VMObj.hasOwnProperty(mapKey)) { + if ((0, _type.type)(VMObj[mapKey]) !== 'Array') { + VMObj[mapKey] = [VMObj[mapKey], hook]; + } else { + VMObj[mapKey].push(hook); + } + } else { + VMObj[mapKey] = [hook]; + } + delete VMObj[uniKey]; + } + }); +} + +/** + * 对象键名重定义 + * @param {Object} obj 对象 + * @param {String} oldKey 原键名 + * @param {String} newKey 新键名 + * @return {Object} 新对象 + */ +function rename(obj, oldKey, newKey) { + Object.getOwnPropertyNames(obj).forEach(function (key) { + if (key === oldKey) { + obj[newKey] = obj[key]; + delete obj[key]; + return obj; + } + }); + return obj; +} + +function normalizeMap(arr) { + if ((0, _type.type)(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function merge(to, from) { + if (!from) return to; + var key = void 0, + toVal = void 0, + fromVal = void 0; + var keys = Object.keys(from); + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + toVal = to[key]; + fromVal = from[key]; + if ((0, _type.type)(toVal) === 'Object' && (0, _type.type)(fromVal) === 'Object') { + merge(toVal, fromVal); + } else { + to[key] = fromVal; + } + } + return to; +} + +function extend(target) { + for (var _len = arguments.length, froms = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + froms[_key - 1] = arguments[_key]; + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = froms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var from = _step.value; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + target[key] = from[key]; + } + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return target; +} + +function extendWithIgnore(target, from) { + var ignore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + if ((0, _type.type)(from) === 'Object') { + // for in 能遍历原型链上的属性 + for (var key in from) { + if (!~ignore.indexOf(key)) { + target[key] = from[key]; + } + } + } + return target; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = path[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var key = _step2.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function enumerable(target, keys) { + keys.forEach(function (key) { + var descriptor = Object.getOwnPropertyDescriptor(target, key); + if (!descriptor.enumerable) { + descriptor.enumerable = true; + Object.defineProperty(target, key, descriptor); + } + }); + return target; +} + +function proxy(target, source, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + enumerableKeys(source).forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +function deleteProperties(source) { + var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + if (!props.length) return source; + var sourceKeys = Object.keys(source); + var newData = {}; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = sourceKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var key = _step3.value; + + if (props.indexOf(key) < 0) { + newData[key] = source[key]; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + return newData; +} + +function enumerableKeys(obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + } + return keys; +} + +function flatten() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + + function check(str) { + if (!str) { + console.error('pathStr should not be null!'); + return false; + } + return true; + } + + function flattenRe(d) { + var pathStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + if ((0, _type.type)(d) === 'Array') { + check(pathStr); + + d.forEach(function (item, i) { + var path = pathStr + '[' + i + ']'; + flattenRe(item, path); + }); + } else if ((0, _type.type)(d) === 'Object') { + Object.keys(d).forEach(function (k) { + var v = d[k]; + var path = pathStr ? pathStr + '.' + k : k; + flattenRe(v, path); + }); + } else { + check(pathStr); + ret[pathStr] = d; + } + } + + var ret = {}; + flattenRe(obj); + + return ret; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/common/util/warn.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fail = fail; +exports.invariant = invariant; +exports.deprecated = deprecated; +var OBFUSCATED_ERROR = exports.OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is an production build."; + +function fail(message) { + invariant(false, message); + throw "X"; // unreachable +} + +function invariant(check, message) { + if (!check) throw new Error("[chameleon-runtime] " + (message || OBFUSCATED_ERROR)); +} + +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; + +function deprecated(msg, thing) { + if (false) return false; + if (thing) { + return deprecated("'" + msg + "', use '" + thing + "' instead."); + } + if (deprecatedMessages.indexOf(msg) !== -1) return false; + deprecatedMessages.push(msg); + console.error("[chameleon-runtime] Deprecated: " + msg); + return true; +} + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/core/OptTransformer.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _MiniOptTransformer2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/MiniOptTransformer.js"); + +var _MiniOptTransformer3 = _interopRequireDefault(_MiniOptTransformer2); + +var _wxMixins = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-mixins/wx-mixins.js"); + +var _wxMixins2 = _interopRequireDefault(_wxMixins); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var OptTransformer = function (_MiniOptTransformer) { + _inherits(OptTransformer, _MiniOptTransformer); + + function OptTransformer(config) { + _classCallCheck(this, OptTransformer); + + var _this = _possibleConstructorReturn(this, (OptTransformer.__proto__ || Object.getPrototypeOf(OptTransformer)).call(this, config)); + + _this.platform = 'wx'; + _this.baseMixins = _wxMixins2.default.mixins; + _this.init(); + return _this; + } + + return OptTransformer; +}(_MiniOptTransformer3.default); + +exports.default = OptTransformer; + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _instance = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/instance/index.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _instance.App; + } +}); +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _instance.Page; + } +}); +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _instance.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/instance/app.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.App = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var App = exports.App = function (_BaseCtor) { + _inherits(App, _BaseCtor); + + function App(options) { + _classCallCheck(this, App); + + var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, options)); + + _this.cmlType = 'wx'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('wx.app.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'app', + builtinMixins: { + onLaunch: function onLaunch() { + // 初始化 + runtimeWidget.setContext(this).init().start('app-view-render'); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('wx.app.hooks'), + hooksMap: _lifecycle2.default.get('wx.app.hooksMap'), + polyHooks: _lifecycle2.default.get('wx.app.polyHooks'), + usedHooks: _lifecycle2.default.get('wx.app.usedHooks') + }); + + __CML__GLOBAL.App(_this.options); + return _this; + } + + return App; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/instance/component.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Component = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Component = exports.Component = function (_BaseCtor) { + _inherits(Component, _BaseCtor); + + function Component(options) { + _classCallCheck(this, Component); + + var _this = _possibleConstructorReturn(this, (Component.__proto__ || Object.getPrototypeOf(Component)).call(this, options)); + + _this.cmlType = 'wx'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('wx.component.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + type: 'component', + builtinMixins: { + created: function created() { + // 初始化 + runtimeWidget.setContext(this).init(); + // .addPageHooks() + }, + attached: function attached() { + runtimeWidget.setContext(this).start('component-view-render'); + }, + ready: function ready() { + runtimeWidget.setContext(this).initRefs(); + }, + detached: function detached() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + hooks: _lifecycle2.default.get('wx.component.hooks'), + hooksMap: _lifecycle2.default.get('wx.component.hooksMap'), + polyHooks: _lifecycle2.default.get('wx.component.polyHooks'), + usedHooks: _lifecycle2.default.get('wx.component.usedHooks'), + needPropsHandler: true, + needTransformProperties: true + }); + + _this.options['options'] = { + multipleSlots: true // 在组件定义时的选项中启用多slot支持 + }; + + __CML__GLOBAL.Component(_this.options); + return _this; + } + + return Component; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/instance/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _app = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/instance/app.js"); + +Object.defineProperty(exports, 'App', { + enumerable: true, + get: function get() { + return _app.App; + } +}); + +var _page = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/instance/page.js"); + +Object.defineProperty(exports, 'Page', { + enumerable: true, + get: function get() { + return _page.Page; + } +}); + +var _component = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/instance/component.js"); + +Object.defineProperty(exports, 'Component', { + enumerable: true, + get: function get() { + return _component.Component; + } +}); + +/***/ }), + +/***/ "./node_modules/chameleon-runtime/src/platform/wx/instance/page.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Page = undefined; + +var _BaseCtor2 = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/BaseCtor.js"); + +var _BaseCtor3 = _interopRequireDefault(_BaseCtor2); + +var _lifecycle = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/util/lifecycle.js"); + +var _lifecycle2 = _interopRequireDefault(_lifecycle); + +var _OptTransformer = __webpack_require__("./node_modules/chameleon-runtime/src/platform/wx/core/OptTransformer.js"); + +var _OptTransformer2 = _interopRequireDefault(_OptTransformer); + +var _RuntimeWidget = __webpack_require__("./node_modules/chameleon-runtime/src/platform/common/proto/RuntimeWidget.js"); + +var _RuntimeWidget2 = _interopRequireDefault(_RuntimeWidget); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Page = exports.Page = function (_BaseCtor) { + _inherits(Page, _BaseCtor); + + function Page(options) { + _classCallCheck(this, Page); + + var _this = _possibleConstructorReturn(this, (Page.__proto__ || Object.getPrototypeOf(Page)).call(this, options)); + + _this.cmlType = 'wx'; + + var runtimeWidget = new _RuntimeWidget2.default({ + polyHooks: _lifecycle2.default.get('wx.page.polyHooks'), + platform: _this.cmlType, + options: _this.options + }); + + _this.initOptTransformer(_OptTransformer2.default, { + options: _this.options, + type: 'page', + builtinMixins: { + onLoad: function onLoad() { + // 初始化 + runtimeWidget.setContext(this).init().initRefs().start('page-view-render'); + }, + onUnload: function onUnload() { + // stop + runtimeWidget.setContext(this).destory(); + } + }, + needResolveAttrs: ['methods'], + hooks: _lifecycle2.default.get('wx.page.hooks'), + hooksMap: _lifecycle2.default.get('wx.page.hooksMap'), + polyHooks: _lifecycle2.default.get('wx.page.polyHooks'), + usedHooks: _lifecycle2.default.get('wx.page.usedHooks') + }); + + __CML__GLOBAL.Page(_this.options); + return _this; + } + + return Page; +}(_BaseCtor3.default); + +/***/ }), + +/***/ "./node_modules/chameleon-store/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.js"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _index2.default; + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _wx = __webpack_require__("./node_modules/chameleon-store/src/platform/wx/index.js"); + +var _wx2 = _interopRequireDefault(_wx); + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-store/src/interfaces/createStore/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "createStoreInterface": { + "createStore": { + "input": ["CMLObject"], + "output": "CMLObject" + } + } + }, + "classes": { + "Method": ["createStoreInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; +// 定义模块的interface + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "createStore", + value: function createStore(options) { + return (0, _wx2.default)(options); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/interfaces/createStore/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _index = __webpack_require__("./node_modules/chameleon-store/src/interfaces/createStore/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createStore(options) { + return _index2.default.createStore(options); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = createStore; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +var _mapStore = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/mapStore.js"); + +var _mapStore2 = _interopRequireDefault(_mapStore); + +var _transform = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/transform.js"); + +var _merge = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/merge.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function Store(options) { + options = (0, _merge.mergeDeps)(options); + this.getters = {}; + this.mutations = {}; + this.actions = {}; + this.state = this.registerModule('', options).state; + Object.assign(this, (0, _mapStore2.default)(this)); +} + +Store.prototype.dispatch = function (type) { + var action = (0, _util.getByPath)(this.actions, type); + if (!action) { + return Promise.reject(new Error('unknown action type: ' + type)); + } else { + for (var _len = arguments.length, payload = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + payload[_key - 1] = arguments[_key]; + } + + return action.apply(undefined, payload); + } +}; + +Store.prototype.commit = function (type) { + var mutation = (0, _util.getByPath)(this.mutations, type); + if (!mutation) { + console.warn(new Error('unknown mutation type: ' + type)); + } else { + for (var _len2 = arguments.length, payload = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + payload[_key2 - 1] = arguments[_key2]; + } + + return mutation.apply(undefined, payload); + } +}; + +Store.prototype.registerModule = function (path, module) { + var _this = this; + + var reactiveModuleOption = { + state: module.state || {} + }; + var reactiveModule = (0, _mobx.observable)(reactiveModuleOption); + if (module.getters) { + (0, _mobx.extendObservable)(reactiveModule, { + getters: (0, _transform.transformGetters)(module.getters, reactiveModule, this) + }); + // 使用proxy,保证store.getters的属性是可观察的 + (0, _util.proxy)(this.getters, reactiveModule.getters, Object.keys(module.getters), true); + } + if (module.mutations) { + Object.assign(this.mutations, (0, _transform.transformMutations)(module.mutations, reactiveModule, this)); + } + if (module.actions) { + Object.assign(this.actions, (0, _transform.transformActions)(module.actions, reactiveModule, this)); + } + if (module.modules) { + var childs = module.modules; + Object.keys(childs).forEach(function (key) { + (0, _mobx.extendObservable)(reactiveModule.state, _defineProperty({}, key, _this.registerModule('', childs[key]).state)); + }); + } + return reactiveModule; +}; + +function createStore() { + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return new (Function.prototype.bind.apply(Store, [null].concat(args)))(); +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/mapStore.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (store) { + return { + mapGetters: mapFactory('getters', store), + mapMutations: mapFactory('mutations', store), + mapActions: mapFactory('actions', store), + mapState: function mapState(maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + Object.keys(maps).forEach(function (key) { + var value = maps[key]; + result[key] = function () { + if (typeof value === 'function') { + return value.call(this, store.state, store.getters); + } else if (typeof value === 'string') { + return (0, _util.getByPath)(store.state, value); + } + }; + }); + return result; + } + }; +}; + +var _util = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/util.js"); + +function mapFactory(type, store) { + return function (maps) { + maps = (0, _util.normalizeMap)(maps); + var result = {}; + + var _loop = function _loop(key) { + result[key] = function (payload) { + var value = maps[key]; + if (type === 'mutations') { + return store.commit(value, payload); + } else if (type === 'actions') { + return store.dispatch(value, payload); + } else { + var getterVal = (0, _util.getByPath)(store.getters, value, '__NOTFOUND__'); + if (getterVal === '__NOTFOUND__') { + console.warn(new Error('not found getter named [' + value + ']')); + return ''; + } else { + return getterVal === undefined ? '' : getterVal; + } + } + }; + }; + + for (var key in maps) { + _loop(key); + } + return result; + }; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/merge.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeDeps = mergeDeps; +function mergeDeps(options) { + var stores = options.deps; + if (!stores) return options; + var mergeProps = ['state', 'getters', 'mutations', 'actions']; + Object.keys(stores).forEach(function (key) { + var store = stores[key]; + mergeProps.forEach(function (prop) { + if (options[prop] && key in options[prop]) { + console.warn(new Error('deps\'s name: [' + key + '] conflicts with ' + prop + '\'s key in current options')); + } else { + options[prop] = options[prop] || {}; + options[prop][key] = store[prop]; + } + }); + }); + delete options.deps; + return options; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/transform.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transformGetters = transformGetters; +exports.transformMutations = transformMutations; +exports.transformActions = transformActions; + +var _mobx = __webpack_require__("./node_modules/mobx/lib/mobx.module.js"); + +function transformGetters(getters, module, store) { + var newGetters = {}; + + var _loop = function _loop(key) { + if (key in store.getters) { + console.warn(new Error('duplicate getter type: ' + key)); + } + newGetters[key] = typeof getters[key] === 'function' ? (0, _mobx.computed)(function () { + return getters[key](module.state, store.getters, store.state); + }) : getters[key]; + }; + + for (var key in getters) { + _loop(key); + } + return newGetters; +} + +function transformMutations(mutations, module, store) { + var newMutations = {}; + + var _loop2 = function _loop2(key) { + if (store.mutations[key]) { + console.warn(new Error('duplicate mutation type: ' + key)); + } + newMutations[key] = typeof mutations[key] === 'function' ? (0, _mobx.action)(function () { + for (var _len = arguments.length, payload = Array(_len), _key = 0; _key < _len; _key++) { + payload[_key] = arguments[_key]; + } + + return mutations[key].apply(mutations, [module.state].concat(payload)); + }) : mutations[key]; + }; + + for (var key in mutations) { + _loop2(key); + } + return newMutations; +} + +function transformActions(actions, module, store) { + var newActions = {}; + + var _loop3 = function _loop3(key) { + if (store.actions[key]) { + console.warn(new Error('duplicate action type: ' + key)); + } + newActions[key] = typeof actions[key] === 'function' ? function () { + for (var _len2 = arguments.length, payload = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + payload[_key2] = arguments[_key2]; + } + + return Promise.resolve().then(function () { + return actions[key].apply(actions, [{ + rootState: store.state, + state: module.state, + getters: store.getters, + dispatch: store.dispatch.bind(store), + commit: store.commit.bind(store) + }].concat(payload)); + }); + } : actions[key]; + }; + + for (var key in actions) { + _loop3(key); + } + return newActions; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/common/mini/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +exports.type = type; +exports.normalizeMap = normalizeMap; +exports.isExistAttr = isExistAttr; +exports.getByPath = getByPath; +exports.proxy = proxy; +function type(n) { + return Object.prototype.toString.call(n).slice(8, -1); +} + +function normalizeMap(arr) { + if (type(arr) === 'Array') { + var map = {}; + arr.forEach(function (value) { + map[value] = value; + }); + return map; + } + return arr; +} + +function isExistAttr(obj, attr) { + var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + var isNullOrUndefined = obj === null || obj === undefined; + if (isNullOrUndefined) { + return false; + } else if (type === 'object' || type === 'function') { + return attr in obj; + } else { + return obj[attr] !== undefined; + } +} + +function getByPath(data, pathStr, notExistOutput) { + if (!pathStr) return data; + var path = pathStr.split('.'); + var notExist = false; + var value = data; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = path[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var key = _step.value; + + if (isExistAttr(value, key)) { + value = value[key]; + } else { + value = undefined; + notExist = true; + break; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (notExistOutput) { + return notExist ? notExistOutput : value; + } else { + // 小程序setData时不允许undefined数据 + return value === undefined ? '' : value; + } +} + +function proxy(target, source, keys, mapKeys, readonly) { + if (typeof mapKeys === 'boolean') { + readonly = mapKeys; + mapKeys = null; + } + keys.forEach(function (key, index) { + var descriptor = { + get: function get() { + return source[key]; + }, + + configurable: true, + enumerable: true + }; + !readonly && (descriptor.set = function (val) { + source[key] = val; + }); + Object.defineProperty(target, mapKeys ? mapKeys[index] : key, descriptor); + }); + return target; +} + +/***/ }), + +/***/ "./node_modules/chameleon-store/src/platform/wx/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mini = __webpack_require__("./node_modules/chameleon-store/src/platform/common/mini/index.js"); + +var _mini2 = _interopRequireDefault(_mini); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _mini2.default; + +/***/ }), + +/***/ "./node_modules/mobx/lib/mobx.module.js": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extras", function() { return extras; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reaction", function() { return Reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "untracked", function() { return untracked; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDerivationState", function() { return IDerivationState; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Atom", function() { return Atom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseAtom", function() { return BaseAtom; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useStrict", function() { return useStrict; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isStrictModeEnabled", function() { return isStrictModeEnabled; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spy", function() { return spy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "comparer", function() { return comparer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asReference", function() { return asReference; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asFlat", function() { return asFlat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asStructure", function() { return asStructure; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asMap", function() { return asMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isModifierDescriptor", function() { return isModifierDescriptor; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableObject", function() { return isObservableObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBoxedObservable", function() { return isObservableValue; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableArray", function() { return isObservableArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObservableMap", function() { return ObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservableMap", function() { return isObservableMap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return observable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computed", function() { return computed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return isObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isComputed", function() { return isComputed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendObservable", function() { return extendObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendShallowObservable", function() { return extendShallowObservable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observe", function() { return observe; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intercept", function() { return intercept; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorun", function() { return autorun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autorunAsync", function() { return autorunAsync; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "when", function() { return when; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reaction", function() { return reaction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "action", function() { return action; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAction", function() { return isAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runInAction", function() { return runInAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expr", function() { return expr; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toJS", function() { return toJS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTransformer", function() { return createTransformer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "whyRun", function() { return whyRun; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trace", function() { return trace; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return isArrayLike; }); +/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +/** + * Anything that can be used to _store_ state is an Atom in mobx. Atoms have two important jobs + * + * 1) detect when they are being _used_ and report this (using reportObserved). This allows mobx to make the connection between running functions and the data they used + * 2) they should notify mobx whenever they have _changed_. This way mobx can re-run any functions (derivations) that are using this atom. + */ +var BaseAtom = (function () { + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function BaseAtom(name) { + if (name === void 0) { name = "Atom@" + getNextId(); } + this.name = name; + this.isPendingUnobservation = true; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.NOT_TRACKING; + } + BaseAtom.prototype.onBecomeUnobserved = function () { + // noop + }; + /** + * Invoke this method to notify mobx that your atom has been used somehow. + */ + BaseAtom.prototype.reportObserved = function () { + reportObserved(this); + }; + /** + * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. + */ + BaseAtom.prototype.reportChanged = function () { + startBatch(); + propagateChanged(this); + endBatch(); + }; + BaseAtom.prototype.toString = function () { + return this.name; + }; + return BaseAtom; +}()); +var Atom = (function (_super) { + __extends(Atom, _super); + /** + * Create a new atom. For debugging purposes it is recommended to give it a name. + * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. + */ + function Atom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { + if (name === void 0) { name = "Atom@" + getNextId(); } + if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } + if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } + var _this = _super.call(this, name) || this; + _this.name = name; + _this.onBecomeObservedHandler = onBecomeObservedHandler; + _this.onBecomeUnobservedHandler = onBecomeUnobservedHandler; + _this.isPendingUnobservation = false; // for effective unobserving. + _this.isBeingTracked = false; + return _this; + } + Atom.prototype.reportObserved = function () { + startBatch(); + _super.prototype.reportObserved.call(this); + if (!this.isBeingTracked) { + this.isBeingTracked = true; + this.onBecomeObservedHandler(); + } + endBatch(); + return !!globalState.trackingDerivation; + // return doesn't really give useful info, because it can be as well calling computed which calls atom (no reactions) + // also it could not trigger when calculating reaction dependent on Atom because Atom's value was cached by computed called by given reaction. + }; + Atom.prototype.onBecomeUnobserved = function () { + this.isBeingTracked = false; + this.onBecomeUnobservedHandler(); + }; + return Atom; +}(BaseAtom)); +var isAtom = createInstanceofPredicate("Atom", BaseAtom); + +function hasInterceptors(interceptable) { + return interceptable.interceptors && interceptable.interceptors.length > 0; +} +function registerInterceptor(interceptable, handler) { + var interceptors = interceptable.interceptors || (interceptable.interceptors = []); + interceptors.push(handler); + return once(function () { + var idx = interceptors.indexOf(handler); + if (idx !== -1) + interceptors.splice(idx, 1); + }); +} +function interceptChange(interceptable, change) { + var prevU = untrackedStart(); + try { + var interceptors = interceptable.interceptors; + if (interceptors) + for (var i = 0, l = interceptors.length; i < l; i++) { + change = interceptors[i](change); + invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); + if (!change) + break; + } + return change; + } + finally { + untrackedEnd(prevU); + } +} + +function hasListeners(listenable) { + return listenable.changeListeners && listenable.changeListeners.length > 0; +} +function registerListener(listenable, handler) { + var listeners = listenable.changeListeners || (listenable.changeListeners = []); + listeners.push(handler); + return once(function () { + var idx = listeners.indexOf(handler); + if (idx !== -1) + listeners.splice(idx, 1); + }); +} +function notifyListeners(listenable, change) { + var prevU = untrackedStart(); + var listeners = listenable.changeListeners; + if (!listeners) + return; + listeners = listeners.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i](change); + } + untrackedEnd(prevU); +} + +function isSpyEnabled() { + return !!globalState.spyListeners.length; +} +function spyReport(event) { + if (!globalState.spyListeners.length) + return; + var listeners = globalState.spyListeners; + for (var i = 0, l = listeners.length; i < l; i++) + listeners[i](event); +} +function spyReportStart(event) { + var change = objectAssign({}, event, { spyReportStart: true }); + spyReport(change); +} +var END_EVENT = { spyReportEnd: true }; +function spyReportEnd(change) { + if (change) + spyReport(objectAssign({}, change, END_EVENT)); + else + spyReport(END_EVENT); +} +function spy(listener) { + globalState.spyListeners.push(listener); + return once(function () { + var idx = globalState.spyListeners.indexOf(listener); + if (idx !== -1) + globalState.spyListeners.splice(idx, 1); + }); +} + +function iteratorSymbol() { + return (typeof Symbol === "function" && Symbol.iterator) || "@@iterator"; +} +var IS_ITERATING_MARKER = "__$$iterating"; +function arrayAsIterator(array) { + // returning an array for entries(), values() etc for maps was a mis-interpretation of the specs.., + // yet it is quite convenient to be able to use the response both as array directly and as iterator + // it is suboptimal, but alas... + invariant(array[IS_ITERATING_MARKER] !== true, "Illegal state: cannot recycle array as iterator"); + addHiddenFinalProp(array, IS_ITERATING_MARKER, true); + var idx = -1; + addHiddenFinalProp(array, "next", function next() { + idx++; + return { + done: idx >= this.length, + value: idx < this.length ? this[idx] : undefined + }; + }); + return array; +} +function declareIterator(prototType, iteratorFactory) { + addHiddenFinalProp(prototType, iteratorSymbol(), iteratorFactory); +} + +var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859 +// Detects bug in safari 9.1.1 (or iOS 9 safari mobile). See #364 +var safariPrototypeSetterInheritanceBug = (function () { + var v = false; + var p = {}; + Object.defineProperty(p, "0", { + set: function () { + v = true; + } + }); + Object.create(p)["0"] = 1; + return v === false; +})(); +/** + * This array buffer contains two lists of properties, so that all arrays + * can recycle their property definitions, which significantly improves performance of creating + * properties on the fly. + */ +var OBSERVABLE_ARRAY_BUFFER_SIZE = 0; +// Typescript workaround to make sure ObservableArray extends Array +var StubArray = (function () { + function StubArray() { + } + return StubArray; +}()); +function inherit(ctor, proto) { + if (typeof Object["setPrototypeOf"] !== "undefined") { + Object["setPrototypeOf"](ctor.prototype, proto); + } + else if (typeof ctor.prototype.__proto__ !== "undefined") { + ctor.prototype.__proto__ = proto; + } + else { + ctor["prototype"] = proto; + } +} +inherit(StubArray, Array.prototype); +// Weex freeze Array.prototype +// Make them writeable and configurable in prototype chain +// https://github.com/alibaba/weex/pull/1529 +if (Object.isFrozen(Array)) { + + [ + "constructor", + "push", + "shift", + "concat", + "pop", + "unshift", + "replace", + "find", + "findIndex", + "splice", + "reverse", + "sort" + ].forEach(function (key) { + Object.defineProperty(StubArray.prototype, key, { + configurable: true, + writable: true, + value: Array.prototype[key] + }); + }); +} +var ObservableArrayAdministration = (function () { + function ObservableArrayAdministration(name, enhancer, array, owned) { + this.array = array; + this.owned = owned; + this.values = []; + this.lastKnownLength = 0; + this.interceptors = null; + this.changeListeners = null; + this.atom = new BaseAtom(name || "ObservableArray@" + getNextId()); + this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); }; + } + ObservableArrayAdministration.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableArrayAdministration.prototype.dehanceValues = function (values) { + if (this.dehancer !== undefined) + return values.map(this.dehancer); + return values; + }; + ObservableArrayAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + if (fireImmediately) { + listener({ + object: this.array, + type: "splice", + index: 0, + added: this.values.slice(), + addedCount: this.values.length, + removed: [], + removedCount: 0 + }); + } + return registerListener(this, listener); + }; + ObservableArrayAdministration.prototype.getArrayLength = function () { + this.atom.reportObserved(); + return this.values.length; + }; + ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { + if (typeof newLength !== "number" || newLength < 0) + throw new Error("[mobx.array] Out of range: " + newLength); + var currentLength = this.values.length; + if (newLength === currentLength) + return; + else if (newLength > currentLength) { + var newItems = new Array(newLength - currentLength); + for (var i = 0; i < newLength - currentLength; i++) + newItems[i] = undefined; // No Array.fill everywhere... + this.spliceWithArray(currentLength, 0, newItems); + } + else + this.spliceWithArray(newLength, currentLength - newLength); + }; + // adds / removes the necessary numeric properties to this object + ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { + if (oldLength !== this.lastKnownLength) + throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?"); + this.lastKnownLength += delta; + if (delta > 0 && oldLength + delta + 1 > OBSERVABLE_ARRAY_BUFFER_SIZE) + reserveArrayBuffer(oldLength + delta + 1); + }; + ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { + var _this = this; + checkIfStateModificationsAreAllowed(this.atom); + var length = this.values.length; + if (index === undefined) + index = 0; + else if (index > length) + index = length; + else if (index < 0) + index = Math.max(0, length + index); + if (arguments.length === 1) + deleteCount = length - index; + else if (deleteCount === undefined || deleteCount === null) + deleteCount = 0; + else + deleteCount = Math.max(0, Math.min(deleteCount, length - index)); + if (newItems === undefined) + newItems = []; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this.array, + type: "splice", + index: index, + removedCount: deleteCount, + added: newItems + }); + if (!change) + return EMPTY_ARRAY; + deleteCount = change.removedCount; + newItems = change.added; + } + newItems = newItems.map(function (v) { return _this.enhancer(v, undefined); }); + var lengthDelta = newItems.length - deleteCount; + this.updateArrayLength(length, lengthDelta); // create or remove new entries + var res = this.spliceItemsIntoValues(index, deleteCount, newItems); + if (deleteCount !== 0 || newItems.length !== 0) + this.notifyArraySplice(index, newItems, res); + return this.dehanceValues(res); + }; + ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { + if (newItems.length < MAX_SPLICE_SIZE) { + return (_a = this.values).splice.apply(_a, [index, deleteCount].concat(newItems)); + } + else { + var res = this.values.slice(index, index + deleteCount); + this.values = this.values + .slice(0, index) + .concat(newItems, this.values.slice(index + deleteCount)); + return res; + } + var _a; + }; + ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "update", + index: index, + newValue: newValue, + oldValue: oldValue + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + object: this.array, + type: "splice", + index: index, + removed: removed, + added: added, + removedCount: removed.length, + addedCount: added.length + } + : null; + if (notifySpy) + spyReportStart(change); + this.atom.reportChanged(); + // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + return ObservableArrayAdministration; +}()); +var ObservableArray = (function (_super) { + __extends(ObservableArray, _super); + function ObservableArray(initialValues, enhancer, name, owned) { + if (name === void 0) { name = "ObservableArray@" + getNextId(); } + if (owned === void 0) { owned = false; } + var _this = _super.call(this) || this; + var adm = new ObservableArrayAdministration(name, enhancer, _this, owned); + addHiddenFinalProp(_this, "$mobx", adm); + if (initialValues && initialValues.length) { + _this.spliceWithArray(0, 0, initialValues); + } + if (safariPrototypeSetterInheritanceBug) { + // Seems that Safari won't use numeric prototype setter untill any * numeric property is + // defined on the instance. After that it works fine, even if this property is deleted. + Object.defineProperty(adm.array, "0", ENTRY_0); + } + return _this; + } + ObservableArray.prototype.intercept = function (handler) { + return this.$mobx.intercept(handler); + }; + ObservableArray.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { fireImmediately = false; } + return this.$mobx.observe(listener, fireImmediately); + }; + ObservableArray.prototype.clear = function () { + return this.splice(0); + }; + ObservableArray.prototype.concat = function () { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + this.$mobx.atom.reportObserved(); + return Array.prototype.concat.apply(this.peek(), arrays.map(function (a) { return (isObservableArray(a) ? a.peek() : a); })); + }; + ObservableArray.prototype.replace = function (newItems) { + return this.$mobx.spliceWithArray(0, this.$mobx.values.length, newItems); + }; + /** + * Converts this array back to a (shallow) javascript structure. + * For a deep clone use mobx.toJS + */ + ObservableArray.prototype.toJS = function () { + return this.slice(); + }; + ObservableArray.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableArray.prototype.peek = function () { + this.$mobx.atom.reportObserved(); + return this.$mobx.dehanceValues(this.$mobx.values); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find + ObservableArray.prototype.find = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var idx = this.findIndex.apply(this, arguments); + return idx === -1 ? undefined : this.get(idx); + }; + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex + ObservableArray.prototype.findIndex = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { fromIndex = 0; } + var items = this.peek(), l = items.length; + for (var i = fromIndex; i < l; i++) + if (predicate.call(thisArg, items[i], i, this)) + return i; + return -1; + }; + /* + * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) + * since these functions alter the inner structure of the array, the have side effects. + * Because the have side effects, they should not be used in computed function, + * and for that reason the do not call dependencyState.notifyObserved + */ + ObservableArray.prototype.splice = function (index, deleteCount) { + var newItems = []; + for (var _i = 2; _i < arguments.length; _i++) { + newItems[_i - 2] = arguments[_i]; + } + switch (arguments.length) { + case 0: + return []; + case 1: + return this.$mobx.spliceWithArray(index); + case 2: + return this.$mobx.spliceWithArray(index, deleteCount); + } + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.spliceWithArray = function (index, deleteCount, newItems) { + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.push = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(adm.values.length, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.pop = function () { + return this.splice(Math.max(this.$mobx.values.length - 1, 0), 1)[0]; + }; + ObservableArray.prototype.shift = function () { + return this.splice(0, 1)[0]; + }; + ObservableArray.prototype.unshift = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(0, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.reverse = function () { + // reverse by default mutates in place before returning the result + // which makes it both a 'derivation' and a 'mutation'. + // so we deviate from the default and just make it an dervitation + var clone = this.slice(); + return clone.reverse.apply(clone, arguments); + }; + ObservableArray.prototype.sort = function (compareFn) { + // sort by default mutates in place before returning the result + // which goes against all good practices. Let's not change the array in place! + var clone = this.slice(); + return clone.sort.apply(clone, arguments); + }; + ObservableArray.prototype.remove = function (value) { + var idx = this.$mobx.dehanceValues(this.$mobx.values).indexOf(value); + if (idx > -1) { + this.splice(idx, 1); + return true; + } + return false; + }; + ObservableArray.prototype.move = function (fromIndex, toIndex) { + function checkIndex(index) { + if (index < 0) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is negative"); + } + var length = this.$mobx.values.length; + if (index >= length) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is not smaller than " + length); + } + } + checkIndex.call(this, fromIndex); + checkIndex.call(this, toIndex); + if (fromIndex === toIndex) { + return; + } + var oldItems = this.$mobx.values; + var newItems; + if (fromIndex < toIndex) { + newItems = oldItems.slice(0, fromIndex).concat(oldItems.slice(fromIndex + 1, toIndex + 1), [ + oldItems[fromIndex] + ], oldItems.slice(toIndex + 1)); + } + else { + // toIndex < fromIndex + newItems = oldItems.slice(0, toIndex).concat([ + oldItems[fromIndex] + ], oldItems.slice(toIndex, fromIndex), oldItems.slice(fromIndex + 1)); + } + this.replace(newItems); + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.get = function (index) { + var impl = this.$mobx; + if (impl) { + if (index < impl.values.length) { + impl.atom.reportObserved(); + return impl.dehanceValue(impl.values[index]); + } + console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + impl + .values + .length + "). Please check length first. Out of bound indices will not be tracked by MobX"); + } + return undefined; + }; + // See #734, in case property accessors are unreliable... + ObservableArray.prototype.set = function (index, newValue) { + var adm = this.$mobx; + var values = adm.values; + if (index < values.length) { + // update at index in range + checkIfStateModificationsAreAllowed(adm.atom); + var oldValue = values[index]; + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: this, + index: index, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = adm.enhancer(newValue, oldValue); + var changed = newValue !== oldValue; + if (changed) { + values[index] = newValue; + adm.notifyArrayChildUpdate(index, newValue, oldValue); + } + } + else if (index === values.length) { + // add a new item + adm.spliceWithArray(index, 0, [newValue]); + } + else { + // out of bounds + throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); + } + }; + return ObservableArray; +}(StubArray)); +declareIterator(ObservableArray.prototype, function () { + return arrayAsIterator(this.slice()); +}); +Object.defineProperty(ObservableArray.prototype, "length", { + enumerable: false, + configurable: true, + get: function () { + return this.$mobx.getArrayLength(); + }, + set: function (newLength) { + this.$mobx.setArrayLength(newLength); + } +}); +[ + "every", + "filter", + "forEach", + "indexOf", + "join", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some", + "toString", + "toLocaleString" +].forEach(function (funcName) { + var baseFunc = Array.prototype[funcName]; + invariant(typeof baseFunc === "function", "Base function not defined on Array prototype: '" + funcName + "'"); + addHiddenProp(ObservableArray.prototype, funcName, function () { + return baseFunc.apply(this.peek(), arguments); + }); +}); +/** + * We don't want those to show up in `for (const key in ar)` ... + */ +makeNonEnumerable(ObservableArray.prototype, [ + "constructor", + "intercept", + "observe", + "clear", + "concat", + "get", + "replace", + "toJS", + "toJSON", + "peek", + "find", + "findIndex", + "splice", + "spliceWithArray", + "push", + "pop", + "set", + "shift", + "unshift", + "reverse", + "sort", + "remove", + "move", + "toString", + "toLocaleString" +]); +// See #364 +var ENTRY_0 = createArrayEntryDescriptor(0); +function createArrayEntryDescriptor(index) { + return { + enumerable: false, + configurable: false, + get: function () { + // TODO: Check `this`?, see #752? + return this.get(index); + }, + set: function (value) { + this.set(index, value); + } + }; +} +function createArrayBufferItem(index) { + Object.defineProperty(ObservableArray.prototype, "" + index, createArrayEntryDescriptor(index)); +} +function reserveArrayBuffer(max) { + for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max; index++) + createArrayBufferItem(index); + OBSERVABLE_ARRAY_BUFFER_SIZE = max; +} +reserveArrayBuffer(1000); +var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); +function isObservableArray(thing) { + return isObject(thing) && isObservableArrayAdministration(thing.$mobx); +} + +var UNCHANGED = {}; +var ObservableValue = (function (_super) { + __extends(ObservableValue, _super); + function ObservableValue(value, enhancer, name, notifySpy) { + if (name === void 0) { name = "ObservableValue@" + getNextId(); } + if (notifySpy === void 0) { notifySpy = true; } + var _this = _super.call(this, name) || this; + _this.enhancer = enhancer; + _this.hasUnreportedChange = false; + _this.dehancer = undefined; + _this.value = enhancer(value, undefined, name); + if (notifySpy && isSpyEnabled()) { + // only notify spy if this is a stand-alone observable + spyReport({ type: "create", object: _this, newValue: _this.value }); + } + return _this; + } + ObservableValue.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) + return this.dehancer(value); + return value; + }; + ObservableValue.prototype.set = function (newValue) { + var oldValue = this.value; + newValue = this.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + if (notifySpy) { + spyReportStart({ + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + this.setNewValue(newValue); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableValue.prototype.prepareNewValue = function (newValue) { + checkIfStateModificationsAreAllowed(this); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this, + type: "update", + newValue: newValue + }); + if (!change) + return UNCHANGED; + newValue = change.newValue; + } + // apply modifier + newValue = this.enhancer(newValue, this.value, this.name); + return this.value !== newValue ? newValue : UNCHANGED; + }; + ObservableValue.prototype.setNewValue = function (newValue) { + var oldValue = this.value; + this.value = newValue; + this.reportChanged(); + if (hasListeners(this)) { + notifyListeners(this, { + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + }; + ObservableValue.prototype.get = function () { + this.reportObserved(); + return this.dehanceValue(this.value); + }; + ObservableValue.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableValue.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately) + listener({ + object: this, + type: "update", + newValue: this.value, + oldValue: undefined + }); + return registerListener(this, listener); + }; + ObservableValue.prototype.toJSON = function () { + return this.get(); + }; + ObservableValue.prototype.toString = function () { + return this.name + "[" + this.value + "]"; + }; + ObservableValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + return ObservableValue; +}(BaseAtom)); +ObservableValue.prototype[primitiveSymbol()] = ObservableValue.prototype.valueOf; +var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); + +var messages = { + m001: "It is not allowed to assign new values to @action fields", + m002: "`runInAction` expects a function", + m003: "`runInAction` expects a function without arguments", + m004: "autorun expects a function", + m005: "Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m006: "Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + m007: "reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object", + m008: "wrapping reaction expression in `asReference` is no longer supported, use options object instead", + m009: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.", + m010: "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'", + m011: "First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments", + m012: "computed takes one or two arguments if used as function", + m013: "[mobx.expr] 'expr' should only be used inside other reactive functions.", + m014: "extendObservable expected 2 or more arguments", + m015: "extendObservable expects an object as first argument", + m016: "extendObservable should not be used on maps, use map.merge instead", + m017: "all arguments of extendObservable should be objects", + m018: "extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540", + m019: "[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.", + m020: "modifiers can only be used for individual object properties", + m021: "observable expects zero or one arguments", + m022: "@observable can not be used on getters, use @computed instead", + m024: "whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.", + m025: "whyRun can only be used on reactions and computed values", + m026: "`action` can only be invoked on functions", + m028: "It is not allowed to set `useStrict` when a derivation is running", + m029: "INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row", + m030a: "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ", + m030b: "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ", + m031: "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ", + m032: "* This computation is suspended (not in use by any reaction) and won't run automatically.\n Didn't expect this computation to be suspended at this point?\n 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).", + m033: "`observe` doesn't support the fire immediately property for observable maps.", + m034: "`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead", + m035: "Cannot make the designated object observable; it is not extensible", + m036: "It is not possible to get index atoms from arrays", + m037: "Hi there! I'm sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle \"(...)\" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error(\"Oops\")` instead of `throw \"Oops\"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling \"Pause on caught exception\".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn't help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n", + m038: "Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n" +}; +function getMessage(id) { + return messages[id]; +} + +function createAction(actionName, fn) { + invariant(typeof fn === "function", getMessage("m026")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + var res = function () { + return executeAction(actionName, fn, this, arguments); + }; + res.originalFn = fn; + res.isMobxAction = true; + return res; +} +function executeAction(actionName, fn, scope, args) { + var runInfo = startAction(actionName, fn, scope, args); + try { + return fn.apply(scope, args); + } + finally { + endAction(runInfo); + } +} +function startAction(actionName, fn, scope, args) { + var notifySpy = isSpyEnabled() && !!actionName; + var startTime = 0; + if (notifySpy) { + startTime = Date.now(); + var l = (args && args.length) || 0; + var flattendArgs = new Array(l); + if (l > 0) + for (var i = 0; i < l; i++) + flattendArgs[i] = args[i]; + spyReportStart({ + type: "action", + name: actionName, + fn: fn, + object: scope, + arguments: flattendArgs + }); + } + var prevDerivation = untrackedStart(); + startBatch(); + var prevAllowStateChanges = allowStateChangesStart(true); + return { + prevDerivation: prevDerivation, + prevAllowStateChanges: prevAllowStateChanges, + notifySpy: notifySpy, + startTime: startTime + }; +} +function endAction(runInfo) { + allowStateChangesEnd(runInfo.prevAllowStateChanges); + endBatch(); + untrackedEnd(runInfo.prevDerivation); + if (runInfo.notifySpy) + spyReportEnd({ time: Date.now() - runInfo.startTime }); +} +function useStrict(strict) { + invariant(globalState.trackingDerivation === null, getMessage("m028")); + globalState.strictMode = strict; + globalState.allowStateChanges = !strict; +} +function isStrictModeEnabled() { + return globalState.strictMode; +} +function allowStateChanges(allowStateChanges, func) { + // TODO: deprecate / refactor this function in next major + // Currently only used by `@observer` + // Proposed change: remove first param, rename to `forbidStateChanges`, + // require error callback instead of the hardcoded error message now used + // Use `inAction` instead of allowStateChanges in derivation.ts to check strictMode + var prev = allowStateChangesStart(allowStateChanges); + var res; + try { + res = func(); + } + finally { + allowStateChangesEnd(prev); + } + return res; +} +function allowStateChangesStart(allowStateChanges) { + var prev = globalState.allowStateChanges; + globalState.allowStateChanges = allowStateChanges; + return prev; +} +function allowStateChangesEnd(prev) { + globalState.allowStateChanges = prev; +} + +/** + * Constructs a decorator, that normalizes the differences between + * TypeScript and Babel. Mainly caused by the fact that legacy-decorator cannot assign + * values during instance creation to properties that have a getter setter. + * + * - Sigh - + * + * Also takes care of the difference between @decorator field and @decorator(args) field, and different forms of values. + * For performance (cpu and mem) reasons the properties are always defined on the prototype (at least initially). + * This means that these properties despite being enumerable might not show up in Object.keys() (but they will show up in for...in loops). + */ +function createClassPropertyDecorator( + /** + * This function is invoked once, when the property is added to a new instance. + * When this happens is not strictly determined due to differences in TS and Babel: + * Typescript: Usually when constructing the new instance + * Babel, sometimes Typescript: during the first get / set + * Both: when calling `runLazyInitializers(instance)` + */ + onInitialize, get, set, enumerable, + /** + * Can this decorator invoked with arguments? e.g. @decorator(args) + */ + allowCustomArguments) { + function classPropertyDecorator(target, key, descriptor, customArgs, argLen) { + if (argLen === void 0) { argLen = 0; } + invariant(allowCustomArguments || quacksLikeADecorator(arguments), "This function is a decorator, but it wasn't invoked like a decorator"); + if (!descriptor) { + // typescript (except for getter / setters) + var newDescriptor = { + enumerable: enumerable, + configurable: true, + get: function () { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) + typescriptInitializeProperty(this, key, undefined, onInitialize, customArgs, descriptor); + return get.call(this, key); + }, + set: function (v) { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) { + typescriptInitializeProperty(this, key, v, onInitialize, customArgs, descriptor); + } + else { + set.call(this, key, v); + } + } + }; + if (arguments.length < 3 || (arguments.length === 5 && argLen < 3)) { + // Typescript target is ES3, so it won't define property for us + // or using Reflect.decorate polyfill, which will return no descriptor + // (see https://github.com/mobxjs/mobx/issues/333) + Object.defineProperty(target, key, newDescriptor); + } + return newDescriptor; + } + else { + // babel and typescript getter / setter props + if (!hasOwnProperty(target, "__mobxLazyInitializers")) { + addHiddenProp(target, "__mobxLazyInitializers", (target.__mobxLazyInitializers && target.__mobxLazyInitializers.slice()) || [] // support inheritance + ); + } + var value_1 = descriptor.value, initializer_1 = descriptor.initializer; + target.__mobxLazyInitializers.push(function (instance) { + onInitialize(instance, key, initializer_1 ? initializer_1.call(instance) : value_1, customArgs, descriptor); + }); + return { + enumerable: enumerable, + configurable: true, + get: function () { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + return get.call(this, key); + }, + set: function (v) { + if (this.__mobxDidRunLazyInitializers !== true) + runLazyInitializers(this); + set.call(this, key, v); + } + }; + } + } + if (allowCustomArguments) { + /** If custom arguments are allowed, we should return a function that returns a decorator */ + return function () { + /** Direct invocation: @decorator bla */ + if (quacksLikeADecorator(arguments)) + return classPropertyDecorator.apply(null, arguments); + /** Indirect invocation: @decorator(args) bla */ + var outerArgs = arguments; + var argLen = arguments.length; + return function (target, key, descriptor) { + return classPropertyDecorator(target, key, descriptor, outerArgs, argLen); + }; + }; + } + return classPropertyDecorator; +} +function typescriptInitializeProperty(instance, key, v, onInitialize, customArgs, baseDescriptor) { + if (!hasOwnProperty(instance, "__mobxInitializedProps")) + addHiddenProp(instance, "__mobxInitializedProps", {}); + instance.__mobxInitializedProps[key] = true; + onInitialize(instance, key, v, customArgs, baseDescriptor); +} +function runLazyInitializers(instance) { + if (instance.__mobxDidRunLazyInitializers === true) + return; + if (instance.__mobxLazyInitializers) { + addHiddenProp(instance, "__mobxDidRunLazyInitializers", true); + instance.__mobxDidRunLazyInitializers && + instance.__mobxLazyInitializers.forEach(function (initializer) { return initializer(instance); }); + } +} +function quacksLikeADecorator(args) { + return (args.length === 2 || args.length === 3) && typeof args[1] === "string"; +} + +var actionFieldDecorator = createClassPropertyDecorator(function (target, key, value, args, originalDescriptor) { + var actionName = args && args.length === 1 ? args[0] : value.name || key || ""; + var wrappedAction = action(actionName, value); + addHiddenProp(target, key, wrappedAction); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, true); +var boundActionDecorator = createClassPropertyDecorator(function (target, key, value) { + defineBoundAction(target, key, value); +}, function (key) { + return this[key]; +}, function () { + invariant(false, getMessage("m001")); +}, false, false); +var action = function action(arg1, arg2, arg3, arg4) { + if (arguments.length === 1 && typeof arg1 === "function") + return createAction(arg1.name || "", arg1); + if (arguments.length === 2 && typeof arg2 === "function") + return createAction(arg1, arg2); + if (arguments.length === 1 && typeof arg1 === "string") + return namedActionDecorator(arg1); + return namedActionDecorator(arg2).apply(null, arguments); +}; +action.bound = function boundAction(arg1, arg2, arg3) { + if (typeof arg1 === "function") { + var action_1 = createAction("", arg1); + action_1.autoBind = true; + return action_1; + } + return boundActionDecorator.apply(null, arguments); +}; +function namedActionDecorator(name) { + return function (target, prop, descriptor) { + if (descriptor && typeof descriptor.value === "function") { + // TypeScript @action method() { }. Defined on proto before being decorated + // Don't use the field decorator if we are just decorating a method + descriptor.value = createAction(name, descriptor.value); + descriptor.enumerable = false; + descriptor.configurable = true; + return descriptor; + } + if (descriptor !== undefined && descriptor.get !== undefined) { + throw new Error("[mobx] action is not expected to be used with getters"); + } + // bound instance methods + return actionFieldDecorator(name).apply(this, arguments); + }; +} +function runInAction(arg1, arg2, arg3) { + var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; + var fn = typeof arg1 === "function" ? arg1 : arg2; + var scope = typeof arg1 === "function" ? arg2 : arg3; + invariant(typeof fn === "function", getMessage("m002")); + invariant(fn.length === 0, getMessage("m003")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + return executeAction(actionName, fn, scope, undefined); +} +function isAction(thing) { + return typeof thing === "function" && thing.isMobxAction === true; +} +function defineBoundAction(target, propertyName, fn) { + var res = function () { + return executeAction(propertyName, fn, target, arguments); + }; + res.isMobxAction = true; + addHiddenProp(target, propertyName, res); +} + +// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 +function deepEqual(a, b) { + return eq(a, b); +} +// Internal recursive comparison function for `isEqual`. +function eq(a, b, aStack, bStack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). + if (a === b) + return a !== 0 || 1 / a === 1 / b; + // `null` or `undefined` only equal to itself (strict comparison). + if (a == null || b == null) + return false; + // `NaN`s are equivalent, but non-reflexive. + if (a !== a) + return b !== b; + // Exhaust primitive checks + var type = typeof a; + if (type !== "function" && type !== "object" && typeof b != "object") + return false; + return deepEq(a, b, aStack, bStack); +} +var toString = Object.prototype.toString; +// Internal recursive comparison function for `isEqual`. +function deepEq(a, b, aStack, bStack) { + // Unwrap any wrapped objects. + a = unwrap(a); + b = unwrap(b); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className !== toString.call(b)) + return false; + switch (className) { + // Strings, numbers, regular expressions, dates, and booleans are compared by value. + case "[object RegExp]": + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case "[object String]": + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return "" + a === "" + b; + case "[object Number]": + // `NaN`s are equivalent, but non-reflexive. + // Object(NaN) is equivalent to NaN. + if (+a !== +a) + return +b !== +b; + // An `egal` comparison is performed for other numeric values. + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a === +b; + case "[object Symbol]": + return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)); + } + var areArrays = className === "[object Array]"; + if (!areArrays) { + if (typeof a != "object" || typeof b != "object") + return false; + // Objects with different constructors are not equivalent, but `Object`s or `Array`s + // from different frames are. + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && + !(typeof aCtor === "function" && + aCtor instanceof aCtor && + typeof bCtor === "function" && + bCtor instanceof bCtor) && + ("constructor" in a && "constructor" in b)) { + return false; + } + } + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + // Initializing stack of traversed objects. + // It's done here since we only need them for objects and arrays comparison. + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (aStack[length] === a) + return bStack[length] === b; + } + // Add the first object to the stack of traversed objects. + aStack.push(a); + bStack.push(b); + // Recursively compare objects and arrays. + if (areArrays) { + // Compare array lengths to determine if a deep comparison is necessary. + length = a.length; + if (length !== b.length) + return false; + // Deep compare the contents, ignoring non-numeric properties. + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) + return false; + } + } + else { + // Deep compare objects. + var keys = Object.keys(a), key; + length = keys.length; + // Ensure that both objects contain the same number of properties before comparing deep equality. + if (Object.keys(b).length !== length) + return false; + while (length--) { + // Deep compare each member + key = keys[length]; + if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) + return false; + } + } + // Remove the first object from the stack of traversed objects. + aStack.pop(); + bStack.pop(); + return true; +} +function unwrap(a) { + if (isObservableArray(a)) + return a.peek(); + if (isObservableMap(a)) + return a.entries(); + if (isES6Map(a)) + return iteratorToArray(a.entries()); + return a; +} +function has(a, key) { + return Object.prototype.hasOwnProperty.call(a, key); +} + +function identityComparer(a, b) { + return a === b; +} +function structuralComparer(a, b) { + return deepEqual(a, b); +} +function defaultComparer(a, b) { + return areBothNaN(a, b) || identityComparer(a, b); +} +var comparer = { + identity: identityComparer, + structural: structuralComparer, + default: defaultComparer +}; + +function autorun(arg1, arg2, arg3) { + var name, view, scope; + if (typeof arg1 === "string") { + name = arg1; + view = arg2; + scope = arg3; + } + else { + name = arg1.name || "Autorun@" + getNextId(); + view = arg1; + scope = arg2; + } + invariant(typeof view === "function", getMessage("m004")); + invariant(isAction(view) === false, getMessage("m005")); + if (scope) + view = view.bind(scope); + var reaction = new Reaction(name, function () { + this.track(reactionRunner); + }); + function reactionRunner() { + view(reaction); + } + reaction.schedule(); + return reaction.getDisposer(); +} +function when(arg1, arg2, arg3, arg4) { + var name, predicate, effect, scope; + if (typeof arg1 === "string") { + name = arg1; + predicate = arg2; + effect = arg3; + scope = arg4; + } + else { + name = "When@" + getNextId(); + predicate = arg1; + effect = arg2; + scope = arg3; + } + var disposer = autorun(name, function (r) { + if (predicate.call(scope)) { + r.dispose(); + var prevUntracked = untrackedStart(); + effect.call(scope); + untrackedEnd(prevUntracked); + } + }); + return disposer; +} +function autorunAsync(arg1, arg2, arg3, arg4) { + var name, func, delay, scope; + if (typeof arg1 === "string") { + name = arg1; + func = arg2; + delay = arg3; + scope = arg4; + } + else { + name = arg1.name || "AutorunAsync@" + getNextId(); + func = arg1; + delay = arg2; + scope = arg3; + } + invariant(isAction(func) === false, getMessage("m006")); + if (delay === void 0) + delay = 1; + if (scope) + func = func.bind(scope); + var isScheduled = false; + var r = new Reaction(name, function () { + if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + if (!r.isDisposed) + r.track(reactionRunner); + }, delay); + } + }); + function reactionRunner() { + func(r); + } + r.schedule(); + return r.getDisposer(); +} +function reaction(expression, effect, arg3) { + if (arguments.length > 3) { + fail(getMessage("m007")); + } + if (isModifierDescriptor(expression)) { + fail(getMessage("m008")); + } + var opts; + if (typeof arg3 === "object") { + opts = arg3; + } + else { + opts = {}; + } + opts.name = + opts.name || expression.name || effect.name || "Reaction@" + getNextId(); + opts.fireImmediately = arg3 === true || opts.fireImmediately === true; + opts.delay = opts.delay || 0; + opts.compareStructural = opts.compareStructural || opts.struct || false; + // TODO: creates ugly spy events, use `effect = (r) => runInAction(opts.name, () => effect(r))` instead + effect = action(opts.name, opts.context ? effect.bind(opts.context) : effect); + if (opts.context) { + expression = expression.bind(opts.context); + } + var firstTime = true; + var isScheduled = false; + var value; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + var r = new Reaction(opts.name, function () { + if (firstTime || opts.delay < 1) { + reactionRunner(); + } + else if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + reactionRunner(); + }, opts.delay); + } + }); + function reactionRunner() { + if (r.isDisposed) + return; + var changed = false; + r.track(function () { + var nextValue = expression(r); + changed = firstTime || !equals(value, nextValue); + value = nextValue; + }); + if (firstTime && opts.fireImmediately) + effect(value, r); + if (!firstTime && changed === true) + effect(value, r); + if (firstTime) + firstTime = false; + } + r.schedule(); + return r.getDisposer(); +} + +/** + * A node in the state dependency root that observes other nodes, and can be observed itself. + * + * ComputedValue will remember the result of the computation for the duration of the batch, or + * while being observed. + * + * During this time it will recompute only when one of its direct dependencies changed, + * but only when it is being accessed with `ComputedValue.get()`. + * + * Implementation description: + * 1. First time it's being accessed it will compute and remember result + * give back remembered result until 2. happens + * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. + * 3. When it's being accessed, recompute if any shallow dependency changed. + * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. + * go to step 2. either way + * + * If at any point it's outside batch and it isn't observed: reset everything and go to 1. + */ +var ComputedValue = (function () { + /** + * Create a new computed value based on a function expression. + * + * The `name` property is for debug purposes only. + * + * The `equals` property specifies the comparer function to use to determine if a newly produced + * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` + * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. + * Structural comparison can be convenient if you always produce an new aggregated object and + * don't want to notify observers if it is structurally the same. + * This is useful for working with vectors, mouse coordinates etc. + */ + function ComputedValue(derivation, scope, equals, name, setter) { + this.derivation = derivation; + this.scope = scope; + this.equals = equals; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = null; // during tracking it's an array with new observed observers + this.isPendingUnobservation = false; + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.runId = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.UP_TO_DATE; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.value = new CaughtException(null); + this.isComputing = false; // to check for cycles + this.isRunningSetter = false; + this.isTracing = TraceMode.NONE; + this.name = name || "ComputedValue@" + getNextId(); + if (setter) + this.setter = createAction(name + "-setter", setter); + } + ComputedValue.prototype.onBecomeStale = function () { + propagateMaybeChanged(this); + }; + ComputedValue.prototype.onBecomeUnobserved = function () { + clearObserving(this); + this.value = undefined; + }; + /** + * Returns the current value of this computed value. + * Will evaluate its computation first if needed. + */ + ComputedValue.prototype.get = function () { + invariant(!this.isComputing, "Cycle detected in computation " + this.name, this.derivation); + if (globalState.inBatch === 0) { + // This is an minor optimization which could be omitted to simplify the code + // The computedValue is accessed outside of any mobx stuff. Batch observing should be enough and don't need + // tracking as it will never be called again inside this batch. + startBatch(); + if (shouldCompute(this)) { + if (this.isTracing !== TraceMode.NONE) { + console.log("[mobx.trace] '" + this + .name + "' is being read outside a reactive context and doing a full recompute"); + } + this.value = this.computeValue(false); + } + endBatch(); + } + else { + reportObserved(this); + if (shouldCompute(this)) + if (this.trackAndCompute()) + propagateChangeConfirmed(this); + } + var result = this.value; + if (isCaughtException(result)) + throw result.cause; + return result; + }; + ComputedValue.prototype.peek = function () { + var res = this.computeValue(false); + if (isCaughtException(res)) + throw res.cause; + return res; + }; + ComputedValue.prototype.set = function (value) { + if (this.setter) { + invariant(!this.isRunningSetter, "The setter of computed value '" + this + .name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); + this.isRunningSetter = true; + try { + this.setter.call(this.scope, value); + } + finally { + this.isRunningSetter = false; + } + } + else + invariant(false, "[ComputedValue '" + this + .name + "'] It is not possible to assign a new value to a computed value."); + }; + ComputedValue.prototype.trackAndCompute = function () { + if (isSpyEnabled()) { + spyReport({ + object: this.scope, + type: "compute", + fn: this.derivation + }); + } + var oldValue = this.value; + var wasSuspended = + /* see #1208 */ this.dependenciesState === IDerivationState.NOT_TRACKING; + var newValue = (this.value = this.computeValue(true)); + return (wasSuspended || + isCaughtException(oldValue) || + isCaughtException(newValue) || + !this.equals(oldValue, newValue)); + }; + ComputedValue.prototype.computeValue = function (track) { + this.isComputing = true; + globalState.computationDepth++; + var res; + if (track) { + res = trackDerivedFunction(this, this.derivation, this.scope); + } + else { + try { + res = this.derivation.call(this.scope); + } + catch (e) { + res = new CaughtException(e); + } + } + globalState.computationDepth--; + this.isComputing = false; + return res; + }; + ComputedValue.prototype.observe = function (listener, fireImmediately) { + var _this = this; + var firstTime = true; + var prevValue = undefined; + return autorun(function () { + var newValue = _this.get(); + if (!firstTime || fireImmediately) { + var prevU = untrackedStart(); + listener({ + type: "update", + object: _this, + newValue: newValue, + oldValue: prevValue + }); + untrackedEnd(prevU); + } + firstTime = false; + prevValue = newValue; + }); + }; + ComputedValue.prototype.toJSON = function () { + return this.get(); + }; + ComputedValue.prototype.toString = function () { + return this.name + "[" + this.derivation.toString() + "]"; + }; + ComputedValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + ComputedValue.prototype.whyRun = function () { + var isTracking = Boolean(globalState.trackingDerivation); + var observing = unique(this.isComputing ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + var observers = unique(getObservers(this).map(function (dep) { return dep.name; })); + return ("\nWhyRun? computation '" + this.name + "':\n * Running because: " + (isTracking + ? "[active] the value of this computation is needed by a reaction" + : this.isComputing + ? "[get] The value of this computed was requested outside a reaction" + : "[idle] not running at the moment") + "\n" + + (this.dependenciesState === IDerivationState.NOT_TRACKING + ? getMessage("m032") + : " * This computation will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this.isComputing && isTracking + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n " + getMessage("m038") + "\n\n * If the outcome of this computation changes, the following observers will be re-run:\n " + joinStrings(observers) + "\n")); + }; + return ComputedValue; +}()); +ComputedValue.prototype[primitiveSymbol()] = ComputedValue.prototype.valueOf; +var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); + +var ObservableObjectAdministration = (function () { + function ObservableObjectAdministration(target, name) { + this.target = target; + this.name = name; + this.values = {}; + this.changeListeners = null; + this.interceptors = null; + } + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { + invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects."); + return registerListener(this, callback); + }; + ObservableObjectAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableObjectAdministration; +}()); +function asObservableObject(target, name) { + if (isObservableObject(target) && target.hasOwnProperty("$mobx")) + return target.$mobx; + invariant(Object.isExtensible(target), getMessage("m035")); + if (!isPlainObject(target)) + name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); + if (!name) + name = "ObservableObject@" + getNextId(); + var adm = new ObservableObjectAdministration(target, name); + addHiddenFinalProp(target, "$mobx", adm); + return adm; +} +function defineObservablePropertyFromDescriptor(adm, propName, descriptor, defaultEnhancer) { + if (adm.values[propName] && !isComputedValue(adm.values[propName])) { + // already observable property + invariant("value" in descriptor, "The property " + propName + " in " + adm.name + " is already observable, cannot redefine it as computed property"); + adm.target[propName] = descriptor.value; // the property setter will make 'value' reactive if needed. + return; + } + // not yet observable property + if ("value" in descriptor) { + // not a computed value + if (isModifierDescriptor(descriptor.value)) { + // x : ref(someValue) + var modifierDescriptor = descriptor.value; + defineObservableProperty(adm, propName, modifierDescriptor.initialValue, modifierDescriptor.enhancer); + } + else if (isAction(descriptor.value) && descriptor.value.autoBind === true) { + defineBoundAction(adm.target, propName, descriptor.value.originalFn); + } + else if (isComputedValue(descriptor.value)) { + // x: computed(someExpr) + defineComputedPropertyFromComputedValue(adm, propName, descriptor.value); + } + else { + // x: someValue + defineObservableProperty(adm, propName, descriptor.value, defaultEnhancer); + } + } + else { + // get x() { return 3 } set x(v) { } + defineComputedProperty(adm, propName, descriptor.get, descriptor.set, comparer.default, true); + } +} +function defineObservableProperty(adm, propName, newValue, enhancer) { + assertPropertyConfigurable(adm.target, propName); + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + object: adm.target, + name: propName, + type: "add", + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + var observable = (adm.values[propName] = new ObservableValue(newValue, enhancer, adm.name + "." + propName, false)); + newValue = observable.value; // observableValue might have changed it + Object.defineProperty(adm.target, propName, generateObservablePropConfig(propName)); + notifyPropertyAddition(adm, adm.target, propName, newValue); +} +function defineComputedProperty(adm, propName, getter, setter, equals, asInstanceProperty) { + if (asInstanceProperty) + assertPropertyConfigurable(adm.target, propName); + adm.values[propName] = new ComputedValue(getter, adm.target, equals, adm.name + "." + propName, setter); + if (asInstanceProperty) { + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); + } +} +function defineComputedPropertyFromComputedValue(adm, propName, computedValue) { + var name = adm.name + "." + propName; + computedValue.name = name; + if (!computedValue.scope) + computedValue.scope = adm.target; + adm.values[propName] = computedValue; + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); +} +var observablePropertyConfigs = {}; +var computedPropertyConfigs = {}; +function generateObservablePropConfig(propName) { + return (observablePropertyConfigs[propName] || + (observablePropertyConfigs[propName] = { + configurable: true, + enumerable: true, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + setPropertyValue(this, propName, v); + } + })); +} +function generateComputedPropConfig(propName) { + return (computedPropertyConfigs[propName] || + (computedPropertyConfigs[propName] = { + configurable: true, + enumerable: false, + get: function () { + return this.$mobx.values[propName].get(); + }, + set: function (v) { + return this.$mobx.values[propName].set(v); + } + })); +} +function setPropertyValue(instance, name, newValue) { + var adm = instance.$mobx; + var observable = adm.values[name]; + // intercept + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: instance, + name: name, + newValue: newValue + }); + if (!change) + return; + newValue = change.newValue; + } + newValue = observable.prepareNewValue(newValue); + // notify spy & observers + if (newValue !== UNCHANGED) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "update", + object: instance, + oldValue: observable.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable.setNewValue(newValue); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); + } +} +function notifyPropertyAddition(adm, object, name, newValue) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy + ? { + type: "add", + object: object, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(adm, change); + if (notifySpy) + spyReportEnd(); +} +var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); +function isObservableObject(thing) { + if (isObject(thing)) { + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + return isObservableObjectAdministration(thing.$mobx); + } + return false; +} + +/** + * Returns true if the provided value is reactive. + * @param value object, function or array + * @param property if property is specified, checks whether value.property is reactive. + */ +function isObservable(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableArray(value) || isObservableMap(value)) + throw new Error(getMessage("m019")); + else if (isObservableObject(value)) { + var o = value.$mobx; + return o.values && !!o.values[property]; + } + return false; + } + // For first check, see #701 + return (isObservableObject(value) || + !!value.$mobx || + isAtom(value) || + isReaction(value) || + isComputedValue(value)); +} + +function createDecoratorForEnhancer(enhancer) { + invariant(!!enhancer, ":("); + return createClassPropertyDecorator(function (target, name, baseValue, _, baseDescriptor) { + assertPropertyConfigurable(target, name); + invariant(!baseDescriptor || !baseDescriptor.get, getMessage("m022")); + var adm = asObservableObject(target, undefined); + defineObservableProperty(adm, name, baseValue, enhancer); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + setPropertyValue(this, name, value); + }, true, false); +} + +function extendObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, deepEnhancer, properties); +} +function extendShallowObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, referenceEnhancer, properties); +} +function extendObservableHelper(target, defaultEnhancer, properties) { + invariant(arguments.length >= 2, getMessage("m014")); + invariant(typeof target === "object", getMessage("m015")); + invariant(!isObservableMap(target), getMessage("m016")); + properties.forEach(function (propSet) { + invariant(typeof propSet === "object", getMessage("m017")); + invariant(!isObservable(propSet), getMessage("m018")); + }); + var adm = asObservableObject(target); + var definedProps = {}; + // Note could be optimised if properties.length === 1 + for (var i = properties.length - 1; i >= 0; i--) { + var propSet = properties[i]; + for (var key in propSet) + if (definedProps[key] !== true && hasOwnProperty(propSet, key)) { + definedProps[key] = true; + if (target === propSet && !isPropertyConfigurable(target, key)) + continue; // see #111, skip non-configurable or non-writable props for `observable(object)`. + var descriptor = Object.getOwnPropertyDescriptor(propSet, key); + defineObservablePropertyFromDescriptor(adm, key, descriptor, defaultEnhancer); + } + } + return target; +} + +var deepDecorator = createDecoratorForEnhancer(deepEnhancer); +var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); +var refDecorator = createDecoratorForEnhancer(referenceEnhancer); +var deepStructDecorator = createDecoratorForEnhancer(deepStructEnhancer); +var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); +/** + * Turns an object, array or function into a reactive structure. + * @param v the value which should become observable. + */ +function createObservable(v) { + if (v === void 0) { v = undefined; } + // @observable someProp; + if (typeof arguments[1] === "string") + return deepDecorator.apply(null, arguments); + invariant(arguments.length <= 1, getMessage("m021")); + invariant(!isModifierDescriptor(v), getMessage("m020")); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + var res = deepEnhancer(v, undefined, undefined); + // this value could be converted to a new observable data structure, return it + if (res !== v) + return res; + // otherwise, just box it + return observable.box(v); +} +var observableFactories = { + box: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("box"); + return new ObservableValue(value, deepEnhancer, name); + }, + shallowBox: function (value, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowBox"); + return new ObservableValue(value, referenceEnhancer, name); + }, + array: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("array"); + return new ObservableArray(initialValues, deepEnhancer, name); + }, + shallowArray: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowArray"); + return new ObservableArray(initialValues, referenceEnhancer, name); + }, + map: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("map"); + return new ObservableMap(initialValues, deepEnhancer, name); + }, + shallowMap: function (initialValues, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowMap"); + return new ObservableMap(initialValues, referenceEnhancer, name); + }, + object: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("object"); + var res = {}; + // convert to observable object + asObservableObject(res, name); + // add properties + extendObservable(res, props); + return res; + }, + shallowObject: function (props, name) { + if (arguments.length > 2) + incorrectlyUsedAsDecorator("shallowObject"); + var res = {}; + asObservableObject(res, name); + extendShallowObservable(res, props); + return res; + }, + ref: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(referenceEnhancer, arguments[0]); + } + else { + return refDecorator.apply(null, arguments); + } + }, + shallow: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(shallowEnhancer, arguments[0]); + } + else { + return shallowDecorator.apply(null, arguments); + } + }, + deep: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepEnhancer, arguments[0]); + } + else { + return deepDecorator.apply(null, arguments); + } + }, + struct: function () { + if (arguments.length < 2) { + // although ref creates actually a modifier descriptor, the type of the resultig properties + // of the object is `T` in the end, when the descriptors are interpreted + return createModifierDescriptor(deepStructEnhancer, arguments[0]); + } + else { + return deepStructDecorator.apply(null, arguments); + } + } +}; +var observable = createObservable; +// weird trick to keep our typings nicely with our funcs, and still extend the observable function +Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); }); +observable.deep.struct = observable.struct; +observable.ref.struct = function () { + if (arguments.length < 2) { + return createModifierDescriptor(refStructEnhancer, arguments[0]); + } + else { + return refStructDecorator.apply(null, arguments); + } +}; +function incorrectlyUsedAsDecorator(methodName) { + fail("Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); +} + +function isModifierDescriptor(thing) { + return typeof thing === "object" && thing !== null && thing.isMobxModifierDescriptor === true; +} +function createModifierDescriptor(enhancer, initialValue) { + invariant(!isModifierDescriptor(initialValue), "Modifiers cannot be nested"); + return { + isMobxModifierDescriptor: true, + initialValue: initialValue, + enhancer: enhancer + }; +} +function deepEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return observable.array(v, name); + if (isPlainObject(v)) + return observable.object(v, name); + if (isES6Map(v)) + return observable.map(v, name); + return v; +} +function shallowEnhancer(v, _, name) { + if (isModifierDescriptor(v)) + fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + if (v === undefined || v === null) + return v; + if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v)) + return v; + if (Array.isArray(v)) + return observable.shallowArray(v, name); + if (isPlainObject(v)) + return observable.shallowObject(v, name); + if (isES6Map(v)) + return observable.shallowMap(v, name); + return fail("The shallow modifier / decorator can only used in combination with arrays, objects and maps"); +} +function referenceEnhancer(newValue) { + // never turn into an observable + return newValue; +} +function deepStructEnhancer(v, oldValue, name) { + // don't confuse structurally compare enhancer with ref enhancer! The latter is probably + // more suited for immutable objects + if (deepEqual(v, oldValue)) + return oldValue; + // it is an observable already, done + if (isObservable(v)) + return v; + // something that can be converted and mutated? + if (Array.isArray(v)) + return new ObservableArray(v, deepStructEnhancer, name); + if (isES6Map(v)) + return new ObservableMap(v, deepStructEnhancer, name); + if (isPlainObject(v)) { + var res = {}; + asObservableObject(res, name); + extendObservableHelper(res, deepStructEnhancer, [v]); + return res; + } + return v; +} +function refStructEnhancer(v, oldValue, name) { + if (deepEqual(v, oldValue)) + return oldValue; + return v; +} + +/** + * During a transaction no views are updated until the end of the transaction. + * The transaction will be run synchronously nonetheless. + * + * @param action a function that updates some reactive state + * @returns any value that was returned by the 'action' parameter. + */ +function transaction(action, thisArg) { + if (thisArg === void 0) { thisArg = undefined; } + startBatch(); + try { + return action.apply(thisArg); + } + finally { + endBatch(); + } +} + +var ObservableMapMarker = {}; +var ObservableMap = (function () { + function ObservableMap(initialData, enhancer, name) { + if (enhancer === void 0) { enhancer = deepEnhancer; } + if (name === void 0) { name = "ObservableMap@" + getNextId(); } + this.enhancer = enhancer; + this.name = name; + this.$mobx = ObservableMapMarker; + this._data = Object.create(null); + this._hasMap = Object.create(null); // hasMap, not hashMap >-). + this._keys = new ObservableArray(undefined, referenceEnhancer, this.name + ".keys()", true); + this.interceptors = null; + this.changeListeners = null; + this.dehancer = undefined; + this.merge(initialData); + } + ObservableMap.prototype._has = function (key) { + return typeof this._data[key] !== "undefined"; + }; + ObservableMap.prototype.has = function (key) { + if (!this.isValidKey(key)) + return false; + key = "" + key; + if (this._hasMap[key]) + return this._hasMap[key].get(); + return this._updateHasMapEntry(key, false).get(); + }; + ObservableMap.prototype.set = function (key, value) { + this.assertValidKey(key); + key = "" + key; + var hasKey = this._has(key); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: hasKey ? "update" : "add", + object: this, + newValue: value, + name: key + }); + if (!change) + return this; + value = change.newValue; + } + if (hasKey) { + this._updateValue(key, value); + } + else { + this._addValue(key, value); + } + return this; + }; + ObservableMap.prototype.delete = function (key) { + var _this = this; + this.assertValidKey(key); + key = "" + key; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: "delete", + object: this, + name: key + }); + if (!change) + return false; + } + if (this._has(key)) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "delete", + object: this, + oldValue: this._data[key].value, + name: key + } + : null; + if (notifySpy) + spyReportStart(change); + transaction(function () { + _this._keys.remove(key); + _this._updateHasMapEntry(key, false); + var observable$$1 = _this._data[key]; + observable$$1.setNewValue(undefined); + _this._data[key] = undefined; + }); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + return true; + } + return false; + }; + ObservableMap.prototype._updateHasMapEntry = function (key, value) { + // optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore + var entry = this._hasMap[key]; + if (entry) { + entry.setNewValue(value); + } + else { + entry = this._hasMap[key] = new ObservableValue(value, referenceEnhancer, this.name + "." + key + "?", false); + } + return entry; + }; + ObservableMap.prototype._updateValue = function (name, newValue) { + var observable$$1 = this._data[name]; + newValue = observable$$1.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "update", + object: this, + oldValue: observable$$1.value, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + observable$$1.setNewValue(newValue); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + } + }; + ObservableMap.prototype._addValue = function (name, newValue) { + var _this = this; + transaction(function () { + var observable$$1 = (_this._data[name] = new ObservableValue(newValue, _this.enhancer, _this.name + "." + name, false)); + newValue = observable$$1.value; // value might have been changed + _this._updateHasMapEntry(name, true); + _this._keys.push(name); + }); + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy + ? { + type: "add", + object: this, + name: name, + newValue: newValue + } + : null; + if (notifySpy) + spyReportStart(change); + if (notify) + notifyListeners(this, change); + if (notifySpy) + spyReportEnd(); + }; + ObservableMap.prototype.get = function (key) { + key = "" + key; + if (this.has(key)) + return this.dehanceValue(this._data[key].get()); + return this.dehanceValue(undefined); + }; + ObservableMap.prototype.dehanceValue = function (value) { + if (this.dehancer !== undefined) { + return this.dehancer(value); + } + return value; + }; + ObservableMap.prototype.keys = function () { + return arrayAsIterator(this._keys.slice()); + }; + ObservableMap.prototype.values = function () { + return arrayAsIterator(this._keys.map(this.get, this)); + }; + ObservableMap.prototype.entries = function () { + var _this = this; + return arrayAsIterator(this._keys.map(function (key) { return [key, _this.get(key)]; })); + }; + ObservableMap.prototype.forEach = function (callback, thisArg) { + var _this = this; + this.keys().forEach(function (key) { return callback.call(thisArg, _this.get(key), key, _this); }); + }; + /** Merge another object into this object, returns this. */ + ObservableMap.prototype.merge = function (other) { + var _this = this; + if (isObservableMap(other)) { + other = other.toJS(); + } + transaction(function () { + if (isPlainObject(other)) + Object.keys(other).forEach(function (key) { return _this.set(key, other[key]); }); + else if (Array.isArray(other)) + other.forEach(function (_a) { + var key = _a[0], value = _a[1]; + return _this.set(key, value); + }); + else if (isES6Map(other)) + other.forEach(function (value, key) { return _this.set(key, value); }); + else if (other !== null && other !== undefined) + fail("Cannot initialize map from " + other); + }); + return this; + }; + ObservableMap.prototype.clear = function () { + var _this = this; + transaction(function () { + untracked(function () { + _this.keys().forEach(_this.delete, _this); + }); + }); + }; + ObservableMap.prototype.replace = function (values) { + var _this = this; + transaction(function () { + // grab all the keys that are present in the new map but not present in the current map + // and delete them from the map, then merge the new map + // this will cause reactions only on changed values + var newKeys = getMapLikeKeys(values); + var oldKeys = _this.keys(); + var missingKeys = oldKeys.filter(function (k) { return newKeys.indexOf(k) === -1; }); + missingKeys.forEach(function (k) { return _this.delete(k); }); + _this.merge(values); + }); + return this; + }; + Object.defineProperty(ObservableMap.prototype, "size", { + get: function () { + return this._keys.length; + }, + enumerable: true, + configurable: true + }); + /** + * Returns a shallow non observable object clone of this map. + * Note that the values might still be observable. For a deep clone use mobx.toJS. + */ + ObservableMap.prototype.toJS = function () { + var _this = this; + var res = {}; + this.keys().forEach(function (key) { return (res[key] = _this.get(key)); }); + return res; + }; + ObservableMap.prototype.toJSON = function () { + // Used by JSON.stringify + return this.toJS(); + }; + ObservableMap.prototype.isValidKey = function (key) { + if (key === null || key === undefined) + return false; + if (typeof key === "string" || typeof key === "number" || typeof key === "boolean") + return true; + return false; + }; + ObservableMap.prototype.assertValidKey = function (key) { + if (!this.isValidKey(key)) + throw new Error("[mobx.map] Invalid key: '" + key + "', only strings, numbers and booleans are accepted as key in observable maps."); + }; + ObservableMap.prototype.toString = function () { + var _this = this; + return (this.name + + "[{ " + + this.keys().map(function (key) { return key + ": " + ("" + _this.get(key)); }).join(", ") + + " }]"); + }; + /** + * Observes this object. Triggers for the events 'add', 'update' and 'delete'. + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe + * for callback details + */ + ObservableMap.prototype.observe = function (listener, fireImmediately) { + invariant(fireImmediately !== true, getMessage("m033")); + return registerListener(this, listener); + }; + ObservableMap.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableMap; +}()); +declareIterator(ObservableMap.prototype, function () { + return this.entries(); +}); +function map(initialValues) { + deprecated("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"); + return observable.map(initialValues); +} +/* 'var' fixes small-build issue */ +var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); + +var EMPTY_ARRAY = []; +Object.freeze(EMPTY_ARRAY); +function getGlobal() { + return typeof window !== "undefined" ? window : global; +} +function getNextId() { + return ++globalState.mobxGuid; +} +function fail(message, thing) { + invariant(false, message, thing); + throw "X"; // unreachable +} +function invariant(check, message, thing) { + if (!check) + throw new Error("[mobx] Invariant failed: " + message + (thing ? " in '" + thing + "'" : "")); +} +/** + * Prints a deprecation message, but only one time. + * Returns false if the deprecated message was already printed before + */ +var deprecatedMessages = []; +function deprecated(msg) { + if (deprecatedMessages.indexOf(msg) !== -1) + return false; + deprecatedMessages.push(msg); + console.error("[mobx] Deprecated: " + msg); + return true; +} +/** + * Makes sure that the provided function is invoked at most once. + */ +function once(func) { + var invoked = false; + return function () { + if (invoked) + return; + invoked = true; + return func.apply(this, arguments); + }; +} +var noop = function () { }; +function unique(list) { + var res = []; + list.forEach(function (item) { + if (res.indexOf(item) === -1) + res.push(item); + }); + return res; +} +function joinStrings(things, limit, separator) { + if (limit === void 0) { limit = 100; } + if (separator === void 0) { separator = " - "; } + if (!things) + return ""; + var sliced = things.slice(0, limit); + return "" + sliced.join(separator) + (things.length > limit + ? " (... and " + (things.length - limit) + "more)" + : ""); +} +function isObject(value) { + return value !== null && typeof value === "object"; +} +function isPlainObject(value) { + if (value === null || typeof value !== "object") + return false; + var proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; +} +function objectAssign() { + var res = arguments[0]; + for (var i = 1, l = arguments.length; i < l; i++) { + var source = arguments[i]; + for (var key in source) + if (hasOwnProperty(source, key)) { + res[key] = source[key]; + } + } + return res; +} +var prototypeHasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwnProperty(object, propName) { + return prototypeHasOwnProperty.call(object, propName); +} +function makeNonEnumerable(object, propNames) { + for (var i = 0; i < propNames.length; i++) { + addHiddenProp(object, propNames[i], object[propNames[i]]); + } +} +function addHiddenProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: true, + configurable: true, + value: value + }); +} +function addHiddenFinalProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: false, + configurable: true, + value: value + }); +} +function isPropertyConfigurable(object, prop) { + var descriptor = Object.getOwnPropertyDescriptor(object, prop); + return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false); +} +function assertPropertyConfigurable(object, prop) { + invariant(isPropertyConfigurable(object, prop), "Cannot make property '" + prop + "' observable, it is not configurable and writable in the target object"); +} +function createInstanceofPredicate(name, clazz) { + var propName = "isMobX" + name; + clazz.prototype[propName] = true; + return function (x) { + return isObject(x) && x[propName] === true; + }; +} +function areBothNaN(a, b) { + return typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); +} +/** + * Returns whether the argument is an array, disregarding observability. + */ +function isArrayLike(x) { + return Array.isArray(x) || isObservableArray(x); +} +function isES6Map(thing) { + if (getGlobal().Map !== undefined && thing instanceof getGlobal().Map) + return true; + return false; +} +function getMapLikeKeys(map$$1) { + if (isPlainObject(map$$1)) + return Object.keys(map$$1); + if (Array.isArray(map$$1)) + return map$$1.map(function (_a) { + var key = _a[0]; + return key; + }); + if (isES6Map(map$$1)) + return Array.from(map$$1.keys()); + if (isObservableMap(map$$1)) + return map$$1.keys(); + return fail("Cannot get keys from " + map$$1); +} +function iteratorToArray(it) { + var res = []; + while (true) { + var r = it.next(); + if (r.done) + break; + res.push(r.value); + } + return res; +} +function primitiveSymbol() { + return (typeof Symbol === "function" && Symbol.toPrimitive) || "@@toPrimitive"; +} +function toPrimitive(value) { + return value === null ? null : typeof value === "object" ? "" + value : value; +} + +/** + * These values will persist if global state is reset + */ +var persistentKeys = ["mobxGuid", "resetId", "spyListeners", "strictMode", "runId"]; +var MobXGlobals = (function () { + function MobXGlobals() { + /** + * MobXGlobals version. + * MobX compatiblity with other versions loaded in memory as long as this version matches. + * It indicates that the global state still stores similar information + */ + this.version = 5; + /** + * Currently running derivation + */ + this.trackingDerivation = null; + /** + * Are we running a computation currently? (not a reaction) + */ + this.computationDepth = 0; + /** + * Each time a derivation is tracked, it is assigned a unique run-id + */ + this.runId = 0; + /** + * 'guid' for general purpose. Will be persisted amongst resets. + */ + this.mobxGuid = 0; + /** + * Are we in a batch block? (and how many of them) + */ + this.inBatch = 0; + /** + * Observables that don't have observers anymore, and are about to be + * suspended, unless somebody else accesses it in the same batch + * + * @type {IObservable[]} + */ + this.pendingUnobservations = []; + /** + * List of scheduled, not yet executed, reactions. + */ + this.pendingReactions = []; + /** + * Are we currently processing reactions? + */ + this.isRunningReactions = false; + /** + * Is it allowed to change observables at this point? + * In general, MobX doesn't allow that when running computations and React.render. + * To ensure that those functions stay pure. + */ + this.allowStateChanges = true; + /** + * If strict mode is enabled, state changes are by default not allowed + */ + this.strictMode = false; + /** + * Used by createTransformer to detect that the global state has been reset. + */ + this.resetId = 0; + /** + * Spy callbacks + */ + this.spyListeners = []; + /** + * Globally attached error handlers that react specifically to errors in reactions + */ + this.globalReactionErrorHandlers = []; + } + return MobXGlobals; +}()); +var globalState = new MobXGlobals(); +var shareGlobalStateCalled = false; +var runInIsolationCalled = false; +var warnedAboutMultipleInstances = false; +{ + var global_1 = getGlobal(); + if (!global_1.__mobxInstanceCount) { + global_1.__mobxInstanceCount = 1; + } + else { + global_1.__mobxInstanceCount++; + setTimeout(function () { + if (!shareGlobalStateCalled && !runInIsolationCalled && !warnedAboutMultipleInstances) { + warnedAboutMultipleInstances = true; + console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."); + } + }); + } +} +function isolateGlobalState() { + runInIsolationCalled = true; + getGlobal().__mobxInstanceCount--; +} +function shareGlobalState() { + // TODO: remove in 4.0; just use peer dependencies instead. + deprecated("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."); + shareGlobalStateCalled = true; + var global = getGlobal(); + var ownState = globalState; + /** + * Backward compatibility check + */ + if (global.__mobservableTrackingStack || global.__mobservableViewStack) + throw new Error("[mobx] An incompatible version of mobservable is already loaded."); + if (global.__mobxGlobal && global.__mobxGlobal.version !== ownState.version) + throw new Error("[mobx] An incompatible version of mobx is already loaded."); + if (global.__mobxGlobal) + globalState = global.__mobxGlobal; + else + global.__mobxGlobal = ownState; +} +function getGlobalState() { + return globalState; +} + +/** + * For testing purposes only; this will break the internal state of existing observables, + * but can be used to get back at a stable state after throwing errors + */ +function resetGlobalState() { + globalState.resetId++; + var defaultGlobals = new MobXGlobals(); + for (var key in defaultGlobals) + if (persistentKeys.indexOf(key) === -1) + globalState[key] = defaultGlobals[key]; + globalState.allowStateChanges = !globalState.strictMode; +} + +function getAtom(thing, property) { + if (typeof thing === "object" && thing !== null) { + if (isObservableArray(thing)) { + invariant(property === undefined, getMessage("m036")); + return thing.$mobx.atom; + } + if (isObservableMap(thing)) { + var anyThing = thing; + if (property === undefined) + return getAtom(anyThing._keys); + var observable = anyThing._data[property] || anyThing._hasMap[property]; + invariant(!!observable, "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'"); + return observable; + } + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (property && !thing.$mobx) + thing[property]; // See #1072 // TODO: remove in 4.0 + if (isObservableObject(thing)) { + if (!property) + return fail("please specify a property"); + var observable = thing.$mobx.values[property]; + invariant(!!observable, "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'"); + return observable; + } + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { + return thing; + } + } + else if (typeof thing === "function") { + if (isReaction(thing.$mobx)) { + // disposer function + return thing.$mobx; + } + } + return fail("Cannot obtain atom from " + thing); +} +function getAdministration(thing, property) { + invariant(thing, "Expecting some object"); + if (property !== undefined) + return getAdministration(getAtom(thing, property)); + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) + return thing; + if (isObservableMap(thing)) + return thing; + // Initializers run lazily when transpiling to babel, so make sure they are run... + runLazyInitializers(thing); + if (thing.$mobx) + return thing.$mobx; + invariant(false, "Cannot obtain administration from " + thing); +} +function getDebugName(thing, property) { + var named; + if (property !== undefined) + named = getAtom(thing, property); + else if (isObservableObject(thing) || isObservableMap(thing)) + named = getAdministration(thing); + else + named = getAtom(thing); // valid for arrays as well + return named.name; +} + +function getDependencyTree(thing, property) { + return nodeToDependencyTree(getAtom(thing, property)); +} +function nodeToDependencyTree(node) { + var result = { + name: node.name + }; + if (node.observing && node.observing.length > 0) + result.dependencies = unique(node.observing).map(nodeToDependencyTree); + return result; +} +function getObserverTree(thing, property) { + return nodeToObserverTree(getAtom(thing, property)); +} +function nodeToObserverTree(node) { + var result = { + name: node.name + }; + if (hasObservers(node)) + result.observers = getObservers(node).map(nodeToObserverTree); + return result; +} + +function hasObservers(observable) { + return observable.observers && observable.observers.length > 0; +} +function getObservers(observable) { + return observable.observers; +} +function addObserver(observable, node) { + // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1"); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node"); + // invariantObservers(observable); + var l = observable.observers.length; + if (l) { + // because object assignment is relatively expensive, let's not store data about index 0. + observable.observersIndexes[node.__mapid] = l; + } + observable.observers[l] = node; + if (observable.lowestObserverState > node.dependenciesState) + observable.lowestObserverState = node.dependenciesState; + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node"); +} +function removeObserver(observable, node) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node"); + // invariantObservers(observable); + if (observable.observers.length === 1) { + // deleting last observer + observable.observers.length = 0; + queueForUnobservation(observable); + } + else { + // deleting from _observersIndexes is straight forward, to delete from _observers, let's swap `node` with last element + var list = observable.observers; + var map = observable.observersIndexes; + var filler = list.pop(); // get last element, which should fill the place of `node`, so the array doesn't have holes + if (filler !== node) { + // otherwise node was the last element, which already got removed from array + var index = map[node.__mapid] || 0; // getting index of `node`. this is the only place we actually use map. + if (index) { + // map store all indexes but 0, see comment in `addObserver` + map[filler.__mapid] = index; + } + else { + delete map[filler.__mapid]; + } + list[index] = filler; + } + delete map[node.__mapid]; + } + // invariantObservers(observable); + // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2"); +} +function queueForUnobservation(observable) { + if (!observable.isPendingUnobservation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); + // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables"); + observable.isPendingUnobservation = true; + globalState.pendingUnobservations.push(observable); + } +} +/** + * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. + * During a batch `onBecomeUnobserved` will be called at most once per observable. + * Avoids unnecessary recalculations. + */ +function startBatch() { + globalState.inBatch++; +} +function endBatch() { + if (--globalState.inBatch === 0) { + runReactions(); + // the batch is actually about to finish, all unobserving should happen here. + var list = globalState.pendingUnobservations; + for (var i = 0; i < list.length; i++) { + var observable = list[i]; + observable.isPendingUnobservation = false; + if (observable.observers.length === 0) { + observable.onBecomeUnobserved(); + // NOTE: onBecomeUnobserved might push to `pendingUnobservations` + } + } + globalState.pendingUnobservations = []; + } +} +function reportObserved(observable) { + var derivation = globalState.trackingDerivation; + if (derivation !== null) { + /** + * Simple optimization, give each derivation run an unique id (runId) + * Check if last time this observable was accessed the same runId is used + * if this is the case, the relation is already known + */ + if (derivation.runId !== observable.lastAccessedBy) { + observable.lastAccessedBy = derivation.runId; + derivation.newObserving[derivation.unboundDepsCount++] = observable; + } + } + else if (observable.observers.length === 0) { + queueForUnobservation(observable); + } +} +/** + * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly + * It will propagate changes to observers from previous run + * It's hard or maybe impossible (with reasonable perf) to get it right with current approach + * Hopefully self reruning autoruns aren't a feature people should depend on + * Also most basic use cases should be ok + */ +// Called by Atom when its value changes +function propagateChanged(observable) { + // invariantLOS(observable, "changed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + d.dependenciesState = IDerivationState.STALE; + } + // invariantLOS(observable, "changed end"); +} +// Called by ComputedValue when it recalculate and its value changed +function propagateChangeConfirmed(observable) { + // invariantLOS(observable, "confirmed start"); + if (observable.lowestObserverState === IDerivationState.STALE) + return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) + d.dependenciesState = IDerivationState.STALE; + else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date. + ) + observable.lowestObserverState = IDerivationState.UP_TO_DATE; + } + // invariantLOS(observable, "confirmed end"); +} +// Used by computed when its dependency changed, but we don't wan't to immediately recompute. +function propagateMaybeChanged(observable) { + // invariantLOS(observable, "maybe start"); + if (observable.lowestObserverState !== IDerivationState.UP_TO_DATE) + return; + observable.lowestObserverState = IDerivationState.POSSIBLY_STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + d.dependenciesState = IDerivationState.POSSIBLY_STALE; + if (d.isTracing !== TraceMode.NONE) { + logTraceInfo(d, observable); + } + d.onBecomeStale(); + } + } + // invariantLOS(observable, "maybe end"); +} +function logTraceInfo(derivation, observable) { + console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'"); + if (derivation.isTracing === TraceMode.BREAK) { + var lines = []; + printDepTree(getDependencyTree(derivation), lines, 1); + // prettier-ignore + new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString() : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")(); + } +} +function printDepTree(tree, lines, depth) { + if (lines.length >= 1000) { + lines.push("(and many more)"); + return; + } + lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :) + if (tree.dependencies) + tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); }); +} + +var IDerivationState; +(function (IDerivationState) { + // before being run or (outside batch and not being observed) + // at this point derivation is not holding any data about dependency tree + IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; + // no shallow dependency changed since last computation + // won't recalculate derivation + // this is what makes mobx fast + IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; + // some deep dependency changed, but don't know if shallow dependency changed + // will require to check first if UP_TO_DATE or POSSIBLY_STALE + // currently only ComputedValue will propagate POSSIBLY_STALE + // + // having this state is second big optimization: + // don't have to recompute on every dependency change, but only when it's needed + IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; + // A shallow dependency has changed since last computation and the derivation + // will need to recompute when it's needed next. + IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; +})(IDerivationState || (IDerivationState = {})); +var TraceMode; +(function (TraceMode) { + TraceMode[TraceMode["NONE"] = 0] = "NONE"; + TraceMode[TraceMode["LOG"] = 1] = "LOG"; + TraceMode[TraceMode["BREAK"] = 2] = "BREAK"; +})(TraceMode || (TraceMode = {})); +var CaughtException = (function () { + function CaughtException(cause) { + this.cause = cause; + // Empty + } + return CaughtException; +}()); +function isCaughtException(e) { + return e instanceof CaughtException; +} +/** + * Finds out whether any dependency of the derivation has actually changed. + * If dependenciesState is 1 then it will recalculate dependencies, + * if any dependency changed it will propagate it by changing dependenciesState to 2. + * + * By iterating over the dependencies in the same order that they were reported and + * stopping on the first change, all the recalculations are only called for ComputedValues + * that will be tracked by derivation. That is because we assume that if the first x + * dependencies of the derivation doesn't change then the derivation should run the same way + * up until accessing x-th dependency. + */ +function shouldCompute(derivation) { + switch (derivation.dependenciesState) { + case IDerivationState.UP_TO_DATE: + return false; + case IDerivationState.NOT_TRACKING: + case IDerivationState.STALE: + return true; + case IDerivationState.POSSIBLY_STALE: { + var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction. + var obs = derivation.observing, l = obs.length; + for (var i = 0; i < l; i++) { + var obj = obs[i]; + if (isComputedValue(obj)) { + try { + obj.get(); + } + catch (e) { + // we are not interested in the value *or* exception at this moment, but if there is one, notify all + untrackedEnd(prevUntracked); + return true; + } + // if ComputedValue `obj` actually changed it will be computed and propagated to its observers. + // and `derivation` is an observer of `obj` + if (derivation.dependenciesState === IDerivationState.STALE) { + untrackedEnd(prevUntracked); + return true; + } + } + } + changeDependenciesStateTo0(derivation); + untrackedEnd(prevUntracked); + return false; + } + } +} +function isComputingDerivation() { + return globalState.trackingDerivation !== null; // filter out actions inside computations +} +function checkIfStateModificationsAreAllowed(atom) { + var hasObservers$$1 = atom.observers.length > 0; + // Should never be possible to change an observed observable from inside computed, see #798 + if (globalState.computationDepth > 0 && hasObservers$$1) + fail(getMessage("m031") + atom.name); + // Should not be possible to change observed state outside strict mode, except during initialization, see #563 + if (!globalState.allowStateChanges && hasObservers$$1) + fail(getMessage(globalState.strictMode ? "m030a" : "m030b") + atom.name); +} +/** + * Executes the provided function `f` and tracks which observables are being accessed. + * The tracking information is stored on the `derivation` object and the derivation is registered + * as observer of any of the accessed observables. + */ +function trackDerivedFunction(derivation, f, context) { + // pre allocate array allocation + room for variation in deps + // array will be trimmed by bindDependencies + changeDependenciesStateTo0(derivation); + derivation.newObserving = new Array(derivation.observing.length + 100); + derivation.unboundDepsCount = 0; + derivation.runId = ++globalState.runId; + var prevTracking = globalState.trackingDerivation; + globalState.trackingDerivation = derivation; + var result; + try { + result = f.call(context); + } + catch (e) { + result = new CaughtException(e); + } + globalState.trackingDerivation = prevTracking; + bindDependencies(derivation); + return result; +} +/** + * diffs newObserving with observing. + * update observing to be newObserving with unique observables + * notify observers that become observed/unobserved + */ +function bindDependencies(derivation) { + // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1"); + var prevObserving = derivation.observing; + var observing = (derivation.observing = derivation.newObserving); + var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE; + // Go through all new observables and check diffValue: (this list can contain duplicates): + // 0: first occurrence, change to 1 and keep it + // 1: extra occurrence, drop it + var i0 = 0, l = derivation.unboundDepsCount; + for (var i = 0; i < l; i++) { + var dep = observing[i]; + if (dep.diffValue === 0) { + dep.diffValue = 1; + if (i0 !== i) + observing[i0] = dep; + i0++; + } + // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined, + // not hitting the condition + if (dep.dependenciesState > lowestNewObservingDerivationState) { + lowestNewObservingDerivationState = dep.dependenciesState; + } + } + observing.length = i0; + derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614) + // Go through all old observables and check diffValue: (it is unique after last bindDependencies) + // 0: it's not in new observables, unobserve it + // 1: it keeps being observed, don't want to notify it. change to 0 + l = prevObserving.length; + while (l--) { + var dep = prevObserving[l]; + if (dep.diffValue === 0) { + removeObserver(dep, derivation); + } + dep.diffValue = 0; + } + // Go through all new observables and check diffValue: (now it should be unique) + // 0: it was set to 0 in last loop. don't need to do anything. + // 1: it wasn't observed, let's observe it. set back to 0 + while (i0--) { + var dep = observing[i0]; + if (dep.diffValue === 1) { + dep.diffValue = 0; + addObserver(dep, derivation); + } + } + // Some new observed derivations may become stale during this derivation computation + // so they have had no chance to propagate staleness (#916) + if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) { + derivation.dependenciesState = lowestNewObservingDerivationState; + derivation.onBecomeStale(); + } +} +function clearObserving(derivation) { + // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch"); + var obs = derivation.observing; + derivation.observing = []; + var i = obs.length; + while (i--) + removeObserver(obs[i], derivation); + derivation.dependenciesState = IDerivationState.NOT_TRACKING; +} +function untracked(action) { + var prev = untrackedStart(); + var res = action(); + untrackedEnd(prev); + return res; +} +function untrackedStart() { + var prev = globalState.trackingDerivation; + globalState.trackingDerivation = null; + return prev; +} +function untrackedEnd(prev) { + globalState.trackingDerivation = prev; +} +/** + * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 + * + */ +function changeDependenciesStateTo0(derivation) { + if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) + return; + derivation.dependenciesState = IDerivationState.UP_TO_DATE; + var obs = derivation.observing; + var i = obs.length; + while (i--) + obs[i].lowestObserverState = IDerivationState.UP_TO_DATE; +} + +function log(msg) { + console.log(msg); + return msg; +} +function whyRun(thing, prop) { + deprecated("`whyRun` is deprecated in favor of `trace`"); + thing = getAtomFromArgs(arguments); + if (!thing) + return log(getMessage("m024")); + if (isComputedValue(thing) || isReaction(thing)) + return log(thing.whyRun()); + return fail(getMessage("m025")); +} +function trace() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var enterBreakPoint = false; + if (typeof args[args.length - 1] === "boolean") + enterBreakPoint = args.pop(); + var derivation = getAtomFromArgs(args); + if (!derivation) { + return fail("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly"); + } + if (derivation.isTracing === TraceMode.NONE) { + console.log("[mobx.trace] '" + derivation.name + "' tracing enabled"); + } + derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG; +} +function getAtomFromArgs(args) { + switch (args.length) { + case 0: + return globalState.trackingDerivation; + case 1: + return getAtom(args[0]); + case 2: + return getAtom(args[0], args[1]); + } +} + +var Reaction = (function () { + function Reaction(name, onInvalidate) { + if (name === void 0) { name = "Reaction@" + getNextId(); } + this.name = name; + this.onInvalidate = onInvalidate; + this.observing = []; // nodes we are looking at. Our value depends on these nodes + this.newObserving = []; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.diffValue = 0; + this.runId = 0; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.isDisposed = false; + this._isScheduled = false; + this._isTrackPending = false; + this._isRunning = false; + this.isTracing = TraceMode.NONE; + } + Reaction.prototype.onBecomeStale = function () { + this.schedule(); + }; + Reaction.prototype.schedule = function () { + if (!this._isScheduled) { + this._isScheduled = true; + globalState.pendingReactions.push(this); + runReactions(); + } + }; + Reaction.prototype.isScheduled = function () { + return this._isScheduled; + }; + /** + * internal, use schedule() if you intend to kick off a reaction + */ + Reaction.prototype.runReaction = function () { + if (!this.isDisposed) { + startBatch(); + this._isScheduled = false; + if (shouldCompute(this)) { + this._isTrackPending = true; + this.onInvalidate(); + if (this._isTrackPending && isSpyEnabled()) { + // onInvalidate didn't trigger track right away.. + spyReport({ + object: this, + type: "scheduled-reaction" + }); + } + } + endBatch(); + } + }; + Reaction.prototype.track = function (fn) { + startBatch(); + var notify = isSpyEnabled(); + var startTime; + if (notify) { + startTime = Date.now(); + spyReportStart({ + object: this, + type: "reaction", + fn: fn + }); + } + this._isRunning = true; + var result = trackDerivedFunction(this, fn, undefined); + this._isRunning = false; + this._isTrackPending = false; + if (this.isDisposed) { + // disposed during last run. Clean up everything that was bound after the dispose call. + clearObserving(this); + } + if (isCaughtException(result)) + this.reportExceptionInDerivation(result.cause); + if (notify) { + spyReportEnd({ + time: Date.now() - startTime + }); + } + endBatch(); + }; + Reaction.prototype.reportExceptionInDerivation = function (error) { + var _this = this; + if (this.errorHandler) { + this.errorHandler(error, this); + return; + } + var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this; + var messageToUser = getMessage("m037"); + console.error(message || messageToUser /* latter will not be true, make sure uglify doesn't remove */, error); + /** If debugging brought you here, please, read the above message :-). Tnx! */ + if (isSpyEnabled()) { + spyReport({ + type: "error", + message: message, + error: error, + object: this + }); + } + globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); }); + }; + Reaction.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + if (!this._isRunning) { + // if disposed while running, clean up later. Maybe not optimal, but rare case + startBatch(); + clearObserving(this); + endBatch(); + } + } + }; + Reaction.prototype.getDisposer = function () { + var r = this.dispose.bind(this); + r.$mobx = this; + r.onError = registerErrorHandler; + return r; + }; + Reaction.prototype.toString = function () { + return "Reaction[" + this.name + "]"; + }; + Reaction.prototype.whyRun = function () { + var observing = unique(this._isRunning ? this.newObserving : this.observing).map(function (dep) { return dep.name; }); + return "\nWhyRun? reaction '" + this.name + "':\n * Status: [" + (this.isDisposed + ? "stopped" + : this._isRunning ? "running" : this.isScheduled() ? "scheduled" : "idle") + "]\n * This reaction will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this._isRunning + ? " (... or any observable accessed during the remainder of the current run)" + : "") + "\n\t" + getMessage("m038") + "\n"; + }; + Reaction.prototype.trace = function (enterBreakPoint) { + if (enterBreakPoint === void 0) { enterBreakPoint = false; } + trace(this, enterBreakPoint); + }; + return Reaction; +}()); +function registerErrorHandler(handler) { + invariant(this && this.$mobx && isReaction(this.$mobx), "Invalid `this`"); + invariant(!this.$mobx.errorHandler, "Only one onErrorHandler can be registered"); + this.$mobx.errorHandler = handler; +} +function onReactionError(handler) { + globalState.globalReactionErrorHandlers.push(handler); + return function () { + var idx = globalState.globalReactionErrorHandlers.indexOf(handler); + if (idx >= 0) + globalState.globalReactionErrorHandlers.splice(idx, 1); + }; +} +/** + * Magic number alert! + * Defines within how many times a reaction is allowed to re-trigger itself + * until it is assumed that this is gonna be a never ending loop... + */ +var MAX_REACTION_ITERATIONS = 100; +var reactionScheduler = function (f) { return f(); }; +function runReactions() { + // Trampolining, if runReactions are already running, new reactions will be picked up + if (globalState.inBatch > 0 || globalState.isRunningReactions) + return; + reactionScheduler(runReactionsHelper); +} +function runReactionsHelper() { + globalState.isRunningReactions = true; + var allReactions = globalState.pendingReactions; + var iterations = 0; + // While running reactions, new reactions might be triggered. + // Hence we work with two variables and check whether + // we converge to no remaining reactions after a while. + while (allReactions.length > 0) { + if (++iterations === MAX_REACTION_ITERATIONS) { + console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + + (" Probably there is a cycle in the reactive function: " + allReactions[0])); + allReactions.splice(0); // clear reactions + } + var remainingReactions = allReactions.splice(0); + for (var i = 0, l = remainingReactions.length; i < l; i++) + remainingReactions[i].runReaction(); + } + globalState.isRunningReactions = false; +} +var isReaction = createInstanceofPredicate("Reaction", Reaction); +function setReactionScheduler(fn) { + var baseScheduler = reactionScheduler; + reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); }; +} + +function asReference(value) { + deprecated("asReference is deprecated, use observable.ref instead"); + return observable.ref(value); +} +function asStructure(value) { + deprecated("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."); + return observable.struct(value); +} +function asFlat(value) { + deprecated("asFlat is deprecated, use observable.shallow instead"); + return observable.shallow(value); +} +function asMap(data) { + deprecated("asMap is deprecated, use observable.map or observable.shallowMap instead"); + return observable.map(data || {}); +} + +function createComputedDecorator(equals) { + return createClassPropertyDecorator(function (target, name, _, __, originalDescriptor) { + invariant(typeof originalDescriptor !== "undefined", getMessage("m009")); + invariant(typeof originalDescriptor.get === "function", getMessage("m010")); + var adm = asObservableObject(target, ""); + defineComputedProperty(adm, name, originalDescriptor.get, originalDescriptor.set, equals, false); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined // See #505 + ) + return undefined; + return observable.get(); + }, function (name, value) { + this.$mobx.values[name].set(value); + }, false, false); +} +var computedDecorator = createComputedDecorator(comparer.default); +var computedStructDecorator = createComputedDecorator(comparer.structural); +/** + * Decorator for class properties: @computed get value() { return expr; }. + * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; + */ +var computed = function computed(arg1, arg2, arg3) { + if (typeof arg2 === "string") { + return computedDecorator.apply(null, arguments); + } + invariant(typeof arg1 === "function", getMessage("m011")); + invariant(arguments.length < 3, getMessage("m012")); + var opts = typeof arg2 === "object" ? arg2 : {}; + opts.setter = typeof arg2 === "function" ? arg2 : opts.setter; + var equals = opts.equals + ? opts.equals + : opts.compareStructural || opts.struct ? comparer.structural : comparer.default; + return new ComputedValue(arg1, opts.context, equals, opts.name || arg1.name || "", opts.setter); +}; +computed.struct = computedStructDecorator; +computed.equals = createComputedDecorator; + +function isComputed(value, property) { + if (value === null || value === undefined) + return false; + if (property !== undefined) { + if (isObservableObject(value) === false) + return false; + if (!value.$mobx.values[property]) + return false; + var atom = getAtom(value, property); + return isComputedValue(atom); + } + return isComputedValue(value); +} + +function observe(thing, propOrCb, cbOrFire, fireImmediately) { + if (typeof cbOrFire === "function") + return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately); + else + return observeObservable(thing, propOrCb, cbOrFire); +} +function observeObservable(thing, listener, fireImmediately) { + return getAdministration(thing).observe(listener, fireImmediately); +} +function observeObservableProperty(thing, property, listener, fireImmediately) { + return getAdministration(thing, property).observe(listener, fireImmediately); +} + +function intercept(thing, propOrHandler, handler) { + if (typeof handler === "function") + return interceptProperty(thing, propOrHandler, handler); + else + return interceptInterceptable(thing, propOrHandler); +} +function interceptInterceptable(thing, handler) { + return getAdministration(thing).intercept(handler); +} +function interceptProperty(thing, property, handler) { + return getAdministration(thing, property).intercept(handler); +} + +/** + * expr can be used to create temporarily views inside views. + * This can be improved to improve performance if a value changes often, but usually doesn't affect the outcome of an expression. + * + * In the following example the expression prevents that a component is rerender _each time_ the selection changes; + * instead it will only rerenders when the current todo is (de)selected. + * + * reactiveComponent((props) => { + * const todo = props.todo; + * const isSelected = mobx.expr(() => props.viewState.selection === todo); + * return
{todo.title}
+ * }); + * + */ +function expr(expr, scope) { + if (!isComputingDerivation()) + console.warn(getMessage("m013")); + // optimization: would be more efficient if the expr itself wouldn't be evaluated first on the next change, but just a 'changed' signal would be fired + return computed(expr, { context: scope }).get(); +} + +function toJS(source, detectCycles, __alreadySeen) { + if (detectCycles === void 0) { detectCycles = true; } + if (__alreadySeen === void 0) { __alreadySeen = []; } + // optimization: using ES6 map would be more efficient! + // optimization: lift this function outside toJS, this makes recursion expensive + function cache(value) { + if (detectCycles) + __alreadySeen.push([source, value]); + return value; + } + if (isObservable(source)) { + if (detectCycles && __alreadySeen === null) + __alreadySeen = []; + if (detectCycles && source !== null && typeof source === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) + if (__alreadySeen[i][0] === source) + return __alreadySeen[i][1]; + } + if (isObservableArray(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { return toJS(value, detectCycles, __alreadySeen); }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) + res[i] = toAdd[i]; + return res; + } + if (isObservableObject(source)) { + var res = cache({}); + for (var key in source) + res[key] = toJS(source[key], detectCycles, __alreadySeen); + return res; + } + if (isObservableMap(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { return (res_1[key] = toJS(value, detectCycles, __alreadySeen)); }); + return res_1; + } + if (isObservableValue(source)) + return toJS(source.get(), detectCycles, __alreadySeen); + } + return source; +} + +function createTransformer(transformer, onCleanup) { + invariant(typeof transformer === "function" && transformer.length < 2, "createTransformer expects a function that accepts one argument"); + // Memoizes: object id -> reactive view that applies transformer to the object + var objectCache = {}; + // If the resetId changes, we will clear the object cache, see #163 + // This construction is used to avoid leaking refs to the objectCache directly + var resetId = globalState.resetId; + // Local transformer class specifically for this transformer + var Transformer = (function (_super) { + __extends(Transformer, _super); + function Transformer(sourceIdentifier, sourceObject) { + var _this = _super.call(this, function () { return transformer(sourceObject); }, undefined, comparer.default, "Transformer-" + transformer.name + "-" + sourceIdentifier, undefined) || this; + _this.sourceIdentifier = sourceIdentifier; + _this.sourceObject = sourceObject; + return _this; + } + Transformer.prototype.onBecomeUnobserved = function () { + var lastValue = this.value; + _super.prototype.onBecomeUnobserved.call(this); + delete objectCache[this.sourceIdentifier]; + if (onCleanup) + onCleanup(lastValue, this.sourceObject); + }; + return Transformer; + }(ComputedValue)); + return function (object) { + if (resetId !== globalState.resetId) { + objectCache = {}; + resetId = globalState.resetId; + } + var identifier = getMemoizationId(object); + var reactiveTransformer = objectCache[identifier]; + if (reactiveTransformer) + return reactiveTransformer.get(); + // Not in cache; create a reactive view + reactiveTransformer = objectCache[identifier] = new Transformer(identifier, object); + return reactiveTransformer.get(); + }; +} +function getMemoizationId(object) { + if (typeof object === "string" || typeof object === "number") + return object; + if (object === null || typeof object !== "object") + throw new Error("[mobx] transform expected some kind of object or primitive value, got: " + object); + var tid = object.$transformId; + if (tid === undefined) { + tid = getNextId(); + addHiddenProp(object, "$transformId", tid); + } + return tid; +} + +function interceptReads(thing, propOrHandler, handler) { + var target; + if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { + target = getAdministration(thing); + } + else if (isObservableObject(thing)) { + if (typeof propOrHandler !== "string") + return fail("InterceptReads can only be used with a specific property, not with an object in general"); + target = getAdministration(thing, propOrHandler); + } + else { + return fail("Expected observable map, object or array as first array"); + } + if (target.dehancer !== undefined) + return fail("An intercept reader was already established"); + target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler; + return function () { + target.dehancer = undefined; + }; +} + +/** + * (c) Michel Weststrate 2015 - 2016 + * MIT Licensed + * + * Welcome to the mobx sources! To get an global overview of how MobX internally works, + * this is a good place to start: + * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 + * + * Source folders: + * =============== + * + * - api/ Most of the public static methods exposed by the module can be found here. + * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. + * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. + * - utils/ Utility stuff. + * + */ +var extras = { + allowStateChanges: allowStateChanges, + deepEqual: deepEqual, + getAtom: getAtom, + getDebugName: getDebugName, + getDependencyTree: getDependencyTree, + getAdministration: getAdministration, + getGlobalState: getGlobalState, + getObserverTree: getObserverTree, + interceptReads: interceptReads, + isComputingDerivation: isComputingDerivation, + isSpyEnabled: isSpyEnabled, + onReactionError: onReactionError, + reserveArrayBuffer: reserveArrayBuffer, + resetGlobalState: resetGlobalState, + isolateGlobalState: isolateGlobalState, + shareGlobalState: shareGlobalState, + spyReport: spyReport, + spyReportEnd: spyReportEnd, + spyReportStart: spyReportStart, + setReactionScheduler: setReactionScheduler +}; +var everything = { + Reaction: Reaction, + untracked: untracked, + Atom: Atom, + BaseAtom: BaseAtom, + useStrict: useStrict, + isStrictModeEnabled: isStrictModeEnabled, + spy: spy, + comparer: comparer, + asReference: asReference, + asFlat: asFlat, + asStructure: asStructure, + asMap: asMap, + isModifierDescriptor: isModifierDescriptor, + isObservableObject: isObservableObject, + isBoxedObservable: isObservableValue, + isObservableArray: isObservableArray, + ObservableMap: ObservableMap, + isObservableMap: isObservableMap, + map: map, + transaction: transaction, + observable: observable, + computed: computed, + isObservable: isObservable, + isComputed: isComputed, + extendObservable: extendObservable, + extendShallowObservable: extendShallowObservable, + observe: observe, + intercept: intercept, + autorun: autorun, + autorunAsync: autorunAsync, + when: when, + reaction: reaction, + action: action, + isAction: isAction, + runInAction: runInAction, + expr: expr, + toJS: toJS, + createTransformer: createTransformer, + whyRun: whyRun, + isArrayLike: isArrayLike, + extras: extras +}; +var warnedAboutDefaultExport = false; +var _loop_1 = function (p) { + var val = everything[p]; + Object.defineProperty(everything, p, { + get: function () { + if (!warnedAboutDefaultExport) { + warnedAboutDefaultExport = true; + console.warn("Using default export (`import mobx from 'mobx'`) is deprecated " + + "and won’t work in mobx@4.0.0\n" + + "Use `import * as mobx from 'mobx'` instead"); + } + return val; + } + }); +}; +for (var p in everything) { + _loop_1(p); +} +if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") { + __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: spy, extras: extras }); +} + +/* harmony default export */ __webpack_exports__["default"] = (everything); + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ 0: +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__("./node_modules/chameleon-runtime/index.js"); +module.exports = __webpack_require__("./node_modules/chameleon-store/index.js"); + + +/***/ }) + +},[0]); \ No newline at end of file diff --git a/dist/wx/static/js/components/polyScroller/polyScroller.js b/dist/wx/static/js/components/polyScroller/polyScroller.js index 4074ea6..259d2a5 100644 --- a/dist/wx/static/js/components/polyScroller/polyScroller.js +++ b/dist/wx/static/js/components/polyScroller/polyScroller.js @@ -1 +1,320 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([3],{64:function(e,n,t){t(65),t(66)},65:function(e,n){},66:function(e,n,t){function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t(3),u=function(e){return e&&e.__esModule?e:{default:e}}(o),f=function e(){a(this,e)};n.default=new f,n.default=u.default.createComponent(n.default).getOptions()}},[64]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([8],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/src/components/polyScroller/polyScroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "PolyScrollerInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "PolyScroller": ["PolyScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var PolyScroller = function PolyScroller() { + _classCallCheck(this, PolyScroller); +}; + +exports.default = __CML__WRAPPER__(new PolyScroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/components/polyScroller/polyScroller.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/components/polyScroller/polyScroller.wx.cml"); + + +/***/ }) + +},["./src/components/polyScroller/polyScroller.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/manifest.js b/dist/wx/static/js/manifest.js index f5596ae..024d6ee 100644 --- a/dist/wx/static/js/manifest.js +++ b/dist/wx/static/js/manifest.js @@ -1 +1,103 @@ -var __CML__GLOBAL={};!function(r){function t(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return r[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e=__CML__GLOBAL.webpackJsonp;__CML__GLOBAL.webpackJsonp=function(n,u,c){for(var p,f,_,a=0,l=[];a 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Button = function Button() { + _classCallCheck(this, Button); + + this.props = { + text: { + type: String, + default: "" + }, + size: { + type: String, + default: "stretch" + }, + width: { + type: Number, + default: -1 + }, + type: { + type: String, + default: "blue" + }, + disabled: { + type: Boolean, + default: false + }, + btnStyle: { + type: String, + default: "" + }, + textStyle: { + type: String, + default: "" + }, + textStyleDisabled: { + type: String, + default: "" + }, + disabledStyle: { + type: String, + default: "" + }, + btnHoverStyle: { + type: String, + default: '' + }, + textHoverStyle: { + type: String, + default: '' + }, + openType: { + type: String, + default: "" + }, + lang: { + type: String, + default: "en" + }, + sessionFrom: { + type: String, + default: "" + }, + sendMessageTitle: { + type: String, + default: "当前标题" + }, + sendMessagePath: { + type: String, + default: "当前分享路径" + }, + sendMessageImg: { + type: String, + default: "截图" + }, + showMessageCard: { + type: Boolean, + default: false + }, + appParameter: { + type: String, + default: "" + } + }; + this.data = { + hover: false + }; + this.computed = { + hasWidth: function hasWidth() { + return this.width !== -1; + }, + btnClasses: function btnClasses() { + return (0, _util.transCls)('cml-view cml-btn', this); + }, + textClasses: function textClasses() { + return (0, _util.transCls)('btn-text', this); + }, + mrBtnStyle: function mrBtnStyle() { + var disabled = this.disabled, + btnStyle = this.btnStyle, + disabledStyle = this.disabledStyle, + hover = this.hover, + btnHoverStyle = this.btnHoverStyle, + hasWidth = this.hasWidth, + width = this.width; + + var style = disabled ? btnStyle + ";" + disabledStyle : hover ? btnStyle + ";" + btnHoverStyle : btnStyle; + + if (hasWidth) { + style = "width:" + width + "cpx;" + style; + } + + return style; + }, + mrTextStyle: function mrTextStyle() { + var disabled = this.disabled, + textStyle = this.textStyle, + textStyleDisabled = this.textStyleDisabled, + hover = this.hover, + textHoverStyle = this.textHoverStyle; + + return disabled ? textStyle + ";" + textStyleDisabled : hover ? textStyle + ";" + textHoverStyle : textStyle; + } + }; + this.methods = { + onclick: function onclick(e) { + var type = this.type, + disabled = this.disabled; + + if (disabled) return; + this.$cmlEmit('onclick', { + type: type, + disabled: disabled + }); + }, + touchstart: function touchstart(e) { + this.hover = true; + }, + touchend: function touchend(e) { + this.hover = false; + }, + getuserinfo: function getuserinfo(e) { + this.$cmlEmit('getuserinfo', e.detail); + }, + contact: function contact(e) { + this.$cmlEmit('contact'); + }, + getphonenumber: function getphonenumber(e) { + this.$cmlEmit('getphonenumber', { + errMsg: e.detail.errMsg, + encryptedData: e.detail.encryptedData || '', + //包括敏感数据在内的完整用户信息的加密数据 + iv: e.detail.iv || '' //加密算法的初始向量 + + }); + }, + error: function error(e) { + this.$cmlEmit('error', { + errMsg: e.detail.errMsg + }); + }, + opensetting: function opensetting(e) { + this.$cmlEmit('opensetting'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Button()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/button.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/button/button.wx.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/button/util.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.transCls = transCls; +function transCls(base, ctx) { + var type = ctx.type, + disabled = ctx.disabled, + size = ctx.size, + hover = ctx.hover, + hasWidth = ctx.hasWidth; + + + var classList = [base]; + + if (hover) { + classList.push(base + '-active'); + } + + if (!!~'red|orange|white|green'.indexOf(type)) { + classList.push(base + '-' + type); + + if (hover) { + classList.push(base + '-' + type + '-active'); + } + + if (disabled) { + classList.push(base + '-' + type + '-disable'); + } + } + + if (!!~'full|big|medium|small|stretch|auto'.indexOf(size) && !hasWidth) { + classList.push(base + '-' + size); + } + + if (disabled) { + classList.push(base + '-disable'); + } + + return classList.join(' '); +} + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/button/button.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js new file mode 100644 index 0000000..f14afea --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel-item/carousel-item.js @@ -0,0 +1,312 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([23],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CCarouselItemInterface": {} + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarouselItem": ["CCarouselItemInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarouselItem = function CCarouselItem() { + _classCallCheck(this, CCarouselItem); +}; + +exports.default = __CML__WRAPPER__(new CCarouselItem()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel-item/carousel-item.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js new file mode 100644 index 0000000..ba7b5d0 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/carousel/carousel.js @@ -0,0 +1,367 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([22],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/carousel/carousel.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": { + "current": "Number" + } + }, + "interfaces": { + "CCarouselInterface": { + "autoplay": "Boolean", + "interval": "Number", + "circular": "Boolean", + "current": "Number", + "indicatorDots": "Boolean", + "indicatorColor": "String", + "indicatorActiveColor": "String", + "change": { + "input": ["EventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CCarousel": ["CCarouselInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CCarousel = function CCarousel() { + _classCallCheck(this, CCarousel); + + this.props = { + autoplay: { + type: Boolean, + default: false + }, + interval: { + type: Number, + default: 5000 + }, + current: { + type: Number, + default: 0 + }, + indicatorDots: { + type: Boolean, + default: false + }, + indicatorColor: { + type: String, + default: '#cccccc' + }, + indicatorActiveColor: { + type: String, + default: '#000000' + }, + circular: { + type: Boolean, + default: false + } + }; +}; + +exports.default = __CML__WRAPPER__(new CCarousel()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/carousel/carousel.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js new file mode 100644 index 0000000..bc0d05f --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/checkbox/checkbox.js @@ -0,0 +1,144 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([2],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Checkbox = function () { + function Checkbox() { + _classCallCheck(this, Checkbox); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + } + }; + this.data = { + checkedImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png"), + uncheckImg: __webpack_require__("./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png"), + innerChecked: false + }; + this.computed = { + checkStyle: function checkStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + checkImg: function checkImg() { + return this.innerChecked ? this.checkedImg : this.uncheckImg; + }, + checkClass: function checkClass() { + if (this.disabled) { + return 'cml-checkbox-disabled'; + } + return this.innerChecked ? 'cml-checkbox-checked' : 'cml-checkbox-uncheck'; + } + }; + this.watch = { + checked: function checked(newChecked) { + this.innerChecked = newChecked; + } + }; + this.methods = { + changeCheck: function changeCheck() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('changeevent', value); + this.$cmlEmit('change', value); + } + }; + } + + _createClass(Checkbox, [{ + key: 'created', + value: function created() { + var checked = this.checked; + + this.innerChecked = checked; + } + }]); + + return Checkbox; +}(); + +exports.default = new Checkbox(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"); + + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/selected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/selected_520dcc8.png"; + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/checkbox/images/unselected.png": +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "static/img/unselected_4e38c39.png"; + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/checkbox/checkbox.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/input/input.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/input/input.js new file mode 100644 index 0000000..79bfe51 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/input/input.js @@ -0,0 +1,592 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([6],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _utils = __webpack_require__("./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js"); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/input/input.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + }, + "blurEventDetail": {}, + "focusEventDetail": {}, + "confirEventDetail": {} + }, + "interfaces": { + "InputInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "type": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "maxValue": "Number", + "minValue": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Input": ["InputInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Input = function () { + function Input() { + _classCallCheck(this, Input); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + value: { + type: String, + default: '' + }, + //input的类型 + type: { + type: String, + default: 'text' //枚举值 text number password + + }, + //input的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用input输入 + disabled: { + type: Boolean, + default: false + }, + //控制input是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#bebebe' + }, + maxValue: { + //type=number 最大值 + type: Number, + default: Infinity + }, + minValue: { + //type=number 最小值 + type: Number, + default: -Infinity + } + }; + this.data = { + inputValue: "" + }; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor + ";"; + }, + isInputNumber: function isInputNumber() { + return this.type === 'number'; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {}, + value: function value(newVal, oldVal) { + this.inputValue = newVal; + } + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.handleDetail(e); + this.$cmlEmit('input', { + value: this.inputValue + }); + this.$cmlEmit('inputevent', { + value: this.inputValue + }); + }, + blurEvent: function blurEvent(e) { + this.handleDetail(e); + this.$cmlEmit('blurevent', { + value: this.inputValue + }); + this.$cmlEmit('blur', { + value: this.inputValue + }); + }, + focusEvent: function focusEvent(e) { + this.handleDetail(e); + this.$cmlEmit('focusevent', { + value: this.inputValue + }); + this.$cmlEmit('focus', { + value: this.inputValue + }); + }, + confirmEvent: function confirmEvent(e) { + this.handleDetail(e); + this.$cmlEmit('confirmevent', { + value: this.inputValue + }); + this.$cmlEmit('confirm', { + value: this.inputValue + }); + }, + handleDetail: function handleDetail(e) { + if (!e) { + return ''; + } + + var value = e.detail.value; + + if (this.isInputNumber) { + value = (0, _utils.getValBetweenMaxAndMin)(value, this.maxValue, this.minValue); + } + + return this.inputValue = value || ''; + } + }; + } + + _createClass(Input, [{ + key: "mounted", + value: function mounted() { + this.inputValue = this.value; + } + }]); + + return Input; +}(); + +exports.default = __CML__WRAPPER__(new Input()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/assets/js/utils/utils.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index2 = _interopRequireDefault(_index); + +exports.str2obj = str2obj; +exports.pxTransform = pxTransform; +exports.cmlStyleTransfer = cmlStyleTransfer; +exports.getValBetweenMaxAndMin = getValBetweenMaxAndMin; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function str2obj(str) { + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + var classValue = String(classObj[1]).replace(/(^\s*)|(\s*)$/g, ""); + obj[className] = classValue; + }); + return obj; +} + +function pxTransform(s) { + if (!s) return ''; + if (!!~s.indexOf('cpx')) { + return s.replace(/(-?\d*\.?\d*)cpx/ig, function (matchs, $1) { + return (0, _index2.default)(Number($1)) + 'px'; + }); + } + return s; +} + +function cmlStyleTransfer(str) { + if (!str) return {}; + var styleAry = str.split(';'); + var obj = {}; + styleAry.forEach(function (element) { + var classObj = element.split(':'); + var className = String(classObj[0]).replace(/(^\s*)|(\s*)$/g, ""); + if (className) { + var classValue = pxTransform(String(classObj[1]).replace(/(^\s*)|(\s*)$/g, "")); + obj[className] = classValue; + } + }); + return obj; +} + +function getValBetweenMaxAndMin(value, maxValue, minValue) { + if (isNaN(Number(value))) { + return ''; + } + if (isNaN(maxValue) || isNaN(minValue)) { + return value; + } + if (maxValue != Infinity && maxValue <= Number(value)) { + value = String(maxValue); + } + if (minValue != -Infinity && minValue >= Number(value)) { + value = String(minValue); + } + return value; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/input/input.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/input/input.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/input/input.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js new file mode 100644 index 0000000..b9e183e --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/aside/aside.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([21],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CAside = function CAside() { + _classCallCheck(this, CAside); + + this.props = { + asideStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'width:200cpx;' + }; + this.computed = { + mergeAsideStyle: function mergeAsideStyle() { + return this.defaultStyle + this.asideStyle; + } + }; +}; + +exports.default = new CAside(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/aside/aside.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js new file mode 100644 index 0000000..45b1045 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/col/col.js @@ -0,0 +1,84 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([20],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CCol = function CCol() { + _classCallCheck(this, CCol); + + this.props = { + width: { + type: Number, + default: 0 + }, + height: { + type: Number, + default: 0 + }, + backgroundColor: { + type: String, + default: '' + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + colStyle: function colStyle() { + var style = ''; + if (this.height) { + style = 'height:' + this.height + 'cpx;'; + } + if (this.width) { + style += 'width:' + this.width + 'cpx;'; + } + if (this.backgroundColor) { + style += 'background-color:' + this.backgroundColor + ';'; + } + if (this.margin) { + var mr = this.margin / 2; + style += 'margin-right:' + mr + 'cpx;margin-left:' + mr + 'cpx;'; + } + return style; + } + }; +}; + +exports.default = new CCol(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/col/col.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/col/col.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js new file mode 100644 index 0000000..95662fe --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/container/container.js @@ -0,0 +1,70 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([19],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CContainer = function CContainer() { + _classCallCheck(this, CContainer); + + this.props = { + direction: { + type: String, + default: 'row' + } + }; + this.computed = { + isVertical: function isVertical() { + if (this.direction === 'column') { + return true; + } else if (this.direction === 'row') { + return false; + } + }, + containerStyle: function containerStyle() { + var finalStyle = ''; + + if (this.isVertical) { + finalStyle = "flex-direction:column"; + } + return finalStyle; + } + }; +}; + +exports.default = new CContainer(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/container/container.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/container/container.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js new file mode 100644 index 0000000..a5ed5c3 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/foot/foot.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([18],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CFoot = function CFoot() { + _classCallCheck(this, CFoot); + + this.props = { + footStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeFootStyle: function mergeFootStyle() { + return this.defaultStyle + this.footStyle; + } + }; +}; + +exports.default = new CFoot(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/foot/foot.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js new file mode 100644 index 0000000..9014650 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/head/head.js @@ -0,0 +1,61 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([17],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CHead = function CHead() { + _classCallCheck(this, CHead); + + this.props = { + headStyle: { + type: String, + default: '' + } + }; + this.data = { + defaultStyle: 'height:80cpx;' + }; + this.computed = { + mergeHeadStyle: function mergeHeadStyle() { + return this.defaultStyle + this.headStyle; + } + }; +}; + +exports.default = new CHead(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/head/head.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/head/head.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js new file mode 100644 index 0000000..4f6409b --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/main/main.js @@ -0,0 +1,59 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([16],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CMain = function CMain() { + _classCallCheck(this, CMain); + + this.props = { + mainStyle: { + type: String, + default: '' + } + }; + this.data = {}; + this.computed = { + mergeMainStyle: function mergeMainStyle() { + return this.mainStyle; + } + }; +}; + +exports.default = new CMain(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/main/main.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/main/main.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js new file mode 100644 index 0000000..8ef9c06 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/layout/row/row.js @@ -0,0 +1,89 @@ +var __CML__GLOBAL = require("../../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([15],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var CRow = function CRow() { + _classCallCheck(this, CRow); + + this.props = { + // start/end/center/space-around/space-between + justify: { + type: String, + default: 'center' + }, + // top/middle/bottom + align: { + type: String, + default: 'middle' + }, + height: { + type: Number, + default: 0 + }, + wrap: { + type: Boolean, + default: false + }, + margin: { + type: Number, + default: 0 + } + }; + this.computed = { + rowClass: function rowClass() { + return 'flex-row-' + this.justify + '-' + this.align; + }, + rowStyle: function rowStyle() { + var style = ''; + if (this.height) { + style += 'height:' + this.height + 'cpx;'; + } + if (this.wrap) { + style += 'flex-wrap:wrap;'; + } + if (this.margin) { + style += 'margin:' + this.margin / 2 + 'cpx 0;'; + } + return style; + } + }; +}; + +exports.default = new CRow(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/layout/row/row.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/layout/row/row.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/list/list.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/list/list.js new file mode 100644 index 0000000..ab49763 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/list/list.js @@ -0,0 +1,474 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([14],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _index5 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index6 = _interopRequireDefault(_index5); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/list/list.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollDetail": { + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number", + "deltaX": "Number", + "deltaY": "Number" + }, + "bottomDetail": { + "direction": "String" + } + }, + "interfaces": { + "ListInterface": { + "bottomOffset": "Number", + "toElement": "String", + "bounce": "Boolean", + "height": "Number", + "cstyle": "String", + "onscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["bottomDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "List": ["ListInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var List = function () { + function List() { + _classCallCheck(this, List); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + toElement: { + type: String, + default: '' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + } + }; + this.data = { + cmtstyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "cpx;"; + } + + return this.cmtstyle + this.cstyle; + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index6.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + this.$cmlEmit('scrolltobottom', e.detail); + } + }; + } + + _createClass(List, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var rectData, windowRect, height; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (_this2.height) { + _context.next = 3; + break; + } + + console.error('list组件必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.height === -1)) { + _context.next = 12; + break; + } + + _context.next = 6; + return (0, _index4.default)('c-list', _this2); + + case 6: + rectData = _context.sent; + _context.next = 9; + return (0, _index2.default)(); + + case 9: + windowRect = _context.sent; + height = windowRect.viewportHeight - rectData.top; + + _this2.cmtstyle = "height:" + height + "cpx;"; + + case 12: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return List; +}(); + +exports.default = __CML__WRAPPER__(new List()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/list/list.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/list/list.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/list/list.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/page/page.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/page/page.js new file mode 100644 index 0000000..4bf87b2 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/page/page.js @@ -0,0 +1,740 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([3],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/page/page.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": {}, + "interfaces": { + "CPageInterface": { + "title": "String", + "back": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "CPage": ["CPageInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var CPage = function () { + function CPage() { + _classCallCheck(this, CPage); + + this.props = { + title: { + required: true, + type: String, + default: '' + } + }; + this.watch = { + title: function title(v) { + this.setTitle(v); + } + }; + this.methods = { + setTitle: function setTitle(v) { + (0, _index2.default)(v); + } + }; + } + + _createClass(CPage, [{ + key: "created", + value: function created() { + this.setTitle(this.title); + } + }]); + + return CPage; +}(); + +exports.default = __CML__WRAPPER__(new CPage()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.interface": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _util = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/cml-compile/runtime/common/util.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-api/src/interfaces/setTitle/index.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = ""; +var __CHECK__DEFINES__ = { + "types": {}, + "interfaces": { + "setTitleInterface": { + "setTitle": { + "input": ["String"], + "output": "Undefined" + } + } + }, + "classes": { + "Method": ["setTitleInterface"] + } +}; +var __OBJECT__WRAPPER__ = function __OBJECT__WRAPPER__(obj) { + var className = obj.constructor.name; + /* eslint-disable no-undef */ + var defines = __CHECK__DEFINES__; + var enableTypes = __enableTypes__.split(',') || []; // ['Object','Array','Nullable'] + /* eslint-disable no-undef */ + var types = defines.types; + var interfaceNames = defines.classes[className]; + var methods = {}; + + interfaceNames && interfaceNames.forEach(function (interfaceName) { + var keys = Object.keys(defines.interfaces); + keys.forEach(function (key) { + methods = _extends({}, methods, defines.interfaces[key]); + }); + }); + /** + * 获取类型 + * + * @param {*} value 值 + * @return {string} 类型 + */ + var getType = function getType(value) { + if (value instanceof Promise) { + return "Promise"; + } + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + + /* eslint complexity:[2,39] */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); + var canUseNullable = !!~enableTypes.indexOf("Nullable"); + var canUseObject = !!~enableTypes.indexOf("Object"); + var canUseArray = !!~enableTypes.indexOf("Array"); + if (currentType == 'Null') { + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var _keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + _keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > _keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseArray ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + // if (type == 'Function') { + // errList = []; + // } else { + // errList.push(`定义了${type}类型的参数,传入的却是${currentType},请检查所传参数是否和接口定义的一致`) + // } + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + return errList; + } + if (currentType == 'Promise') { + if (type === 'Promise') { + errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49Promise\u7C7B\u578B\uFF0C\u5F02\u6B65\u8BF7\u91C7\u7528\u56DE\u8C03\u51FD\u6570\u7684\u5F62\u5F0F\uFF01"); + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + /** + * 校验参数类型 + * + * @param {string} methodName 方法名称 + * @param {Array} argNames 参数名称列表 + * @param {Array} argValues 参数值列表 + * @return {bool} 校验结果 + */ + var checkArgsType = function checkArgsType(methodName, argValues) { + var argList = void 0; + + if (getType(methodName) == 'Array') { + // 回调函数的校验 methodName[0] 方法的名字 methodName[1]该回调函数在方法的参数索引 + argList = types[methods[methodName[0]].input[methodName[1]]].input; + // 拿到这个回调函数的参数定义 + } else { + argList = methods[methodName].input; + } + // todo 函数可能多传参数 + argList.forEach(function (argType, index) { + var errList = checkType(argValues[index], argType, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + " \u6216\u8BE5" + methodName + "\u7684\u56DE\u8C03\u51FD\u6570\u4E2D\u7B2C" + (index + 1) + "\u4E2A\u53C2\u6570\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }); + if (argValues.length > argList.length) { + __CML_ERROR__("[" + methodName + "]\u65B9\u6CD5\u53C2\u6570\u4F20\u9012\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + }; + + /** + * 校验返回值类型 + * + * @param {string} methodName 方法名称 + * @param {*} returnData 返回值 + * @return {bool} 校验结果 + */ + var checkReturnType = function checkReturnType(methodName, returnData) { + var output = void 0; + if (getType(methodName) == 'Array') { + output = types[methods[methodName[0]].input[methodName[1]]].output; + } else { + output = methods[methodName].output; + } + // todo output 为什么可以是数组 + // if (output instanceof Array) { + // output.forEach(type => { + + // //todo 而且是要有一个校验不符合就check失败? 应该是有一个校验通过就可以吧 + // checkType(returnData, type,[]) + // }); + // } + var errList = checkType(returnData, output, []); + if (errList && errList.length > 0) { + __CML_ERROR__("\n \u6821\u9A8C\u4F4D\u7F6E: \u65B9\u6CD5" + methodName + "\u8FD4\u56DE\u503C\n \u9519\u8BEF\u4FE1\u606F: " + errList.join('\n')); + } + }; + + /** + * 创建warpper + * + * @param {string} funcName 方法名称 + * @param {Function} originFunc 原有方法 + * @return {Function} 包裹后的方法 + */ + var createWarpper = function createWarpper(funcName, originFunc) { + return function () { + // 白名单方法 + if (this && this.$cmlPolyHooks && this.$cmlPolyHooks.indexOf(originFunc)) { + return originFunc.apply(this, arguments); + } + var argValues = Array.prototype.slice.call(arguments).map(function (arg, index) { + // 对传入的方法要做特殊的处理,这个是传入的callback,对callback函数再做包装 + if (getType(arg) == 'Function') { + return createWarpper([funcName, index], arg); + } + return arg; + }); + + checkArgsType(funcName, argValues); + + var result = originFunc.apply(this, argValues); + + checkReturnType(funcName, result); + return result; + }; + }; + + // 获取所有方法 + var keys = Object.keys(methods); + // 微信 预览模式会执行 白屏暂时注释 + // Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).forEach(key => { + // if (!/constructor|prototype|length/ig.test(key)) { + // if (!~keys.indexOf(key)) { + // __CML_ERROR__('method [' + key + '] not declare in the interface!'); + // } + // } + // }) + // 处理包装方法 + keys.forEach(function (key) { + var originFunc = obj[key]; + if (!originFunc) { + __CML_ERROR__('method [' + key + '] not found!'); + return; + } + + if (obj.hasOwnProperty(key)) { + obj[key] = createWarpper(key, originFunc); + } else { + Object.getPrototypeOf(obj)[key] = createWarpper(key, originFunc); + } + }); + + return obj; +}; + +var Method = function () { + function Method() { + _classCallCheck(this, Method); + } + + _createClass(Method, [{ + key: "setTitle", + value: function setTitle(title) { + wx.setNavigationBarTitle({ + title: title + }); + } + }]); + + return Method; +}(); + +exports.default = __OBJECT__WRAPPER__(new Method()); + +(0, _util.copyProtoProperty)(exports.default); + +/***/ }), + +/***/ "./node_modules/chameleon-api/src/interfaces/setTitle/index.js": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = setTitle; + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/setTitle/index.interface"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function setTitle() { + var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _index2.default.setTitle(title); +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/page/page.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/page/page.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/page/page.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/radio/radio.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/radio/radio.js new file mode 100644 index 0000000..ae01fe4 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/radio/radio.js @@ -0,0 +1,137 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([13],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Radio = function () { + function Radio() { + _classCallCheck(this, Radio); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String + }, + disabled: { + type: Boolean, + default: false + }, + position: { + type: String, + default: 'left' + }, + groupIndex: { + type: Number, + default: -1 + }, + color: { + type: String, + default: '#fc9153' + } + }; + this.data = { + innerChecked: false + }; + this.computed = { + radioStyle: function radioStyle() { + var style = ''; + if (this.disabled) { + style += 'opacity:0.5;'; + } + if (this.position == 'right') { + style += 'position:absolute;right:0;margin-right:45cpx;'; + } else { + style += 'margin-right:13cpx;'; + } + return style; + }, + radioInnerStyle: function radioInnerStyle() { + var style = ''; + if (this.innerChecked) { + style += 'border:10cpx solid ' + this.color + ';'; + } else { + style += 'border:1px solid #ccc;'; + } + + return style; + }, + radioClass: function radioClass() { + if (this.disabled) { + return this.innerChecked ? 'cml-radio-selected-disabled' : 'cml-radio-unselect-disabled'; + } + return this.innerChecked ? 'cml-radio-selected' : 'cml-radio-unselect'; + } + }; + this.watch = { + checked: function checked(val) { + this.innerChecked = val; + } + }; + this.methods = { + changeSelect: function changeSelect() { + if (this.disabled) return; + this.innerChecked = !this.innerChecked; + var value = { + value: this.innerChecked + }; + if (this.groupIndex !== -1) { + value.index = this.groupIndex; + } + this.$cmlEmit('change', value); + this.$cmlEmit('changeevent', value); + } + }; + } + + _createClass(Radio, [{ + key: 'mounted', + value: function mounted() { + this.innerChecked = this.checked; + } + }]); + + return Radio; +}(); + +exports.default = new Radio(); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/radio/radio.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/radio/radio.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/radio/radio.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js new file mode 100644 index 0000000..06fdb07 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/richtext/richtext.js @@ -0,0 +1,434 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([4],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _richHandle = __webpack_require__("./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js"); + +var _richHandle2 = _interopRequireDefault(_richHandle); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/richtext/richtext.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "richConfig": { + "color": "String", + "font_size": "Number", + "start": "Number", + "end": "Number" + }, + "richMessageArray": ["richConfig"], + "richData": { + "message": "String", + "rich_message": "richMessageArray" + } + }, + "interfaces": { + "RichtextInterface": { + "richData": "richData" + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Richtext": ["RichtextInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Richtext = function Richtext() { + _classCallCheck(this, Richtext); + + this.props = { + richData: { + type: Object, + default: { + message: '', + rich_message: [{ + color: '', + font_size: 0, + start: 0, + end: 0 + }] + } + } + }; + this.computed = { + richList: function richList() { + var richList = (0, _richHandle2.default)(this.richData); + richList = richList.map(function (item) { + if (item.color && item.font_size) { + item.style = "color:" + item.color + ";font-size:" + item.font_size + "cpx;"; + } else { + item.style = ''; + } + + return item; + }); + return richList; + } + }; +}; + +exports.default = __CML__WRAPPER__(new Richtext()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richHandle.js": +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = richHandle; +function richHandle(richData) { + var richConf = richData.rich_message, + richTexts = richData.message.split(''); + //切割文本 + richTexts = richTexts.map(function (item) { + return { + text: item, + index: -1 + }; + }); + // 过滤错误配置 + richConf = richConf.filter(function (item) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + return !isNaN(start) && !isNaN(end) && start <= end; + }); + // 遍历获取文本对应样式index + richConf.forEach(function (item, index) { + var start = item.start, + end = item.end; + + start = parseInt(start, 10); + end = parseInt(end, 10); + start = start < 0 ? 0 : start; + end = end > richTexts.length - 1 ? richTexts.length - 1 : end; + for (var i = start; i <= end; i++) { + richTexts[i].index = index; + } + }); + var start = 0, + end = richTexts.length; + var richList = []; + while (start < end) { + var i = start; + var rIndex = richTexts[i].index; + var conf = rIndex === -1 ? null : richConf[rIndex]; + var ri = { + font_size: conf && conf.font_size, + color: conf && conf.color, + text: '' + }; + for (; i < end; i++) { + if (richTexts[i].index !== rIndex) { + break; + } + ri.text += richTexts[i].text; + } + richList.push(ri); + start = i; + } + + return richList; +} + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/richtext/richtext.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js new file mode 100644 index 0000000..164eda4 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/scroller/scroller.js @@ -0,0 +1,525 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([12],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _regenerator = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-runtime/regenerator/index.js"); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _index = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getSystemInfo/index.js"); + +var _index2 = _interopRequireDefault(_index); + +var _index3 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/getRect/index.js"); + +var _index4 = _interopRequireDefault(_index3); + +var _index5 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/px2cpx/index.js"); + +var _index6 = _interopRequireDefault(_index5); + +var _index7 = __webpack_require__("./node_modules/chameleon-api/src/interfaces/cpx2px/index.js"); + +var _index8 = _interopRequireDefault(_index7); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/scroller/scroller.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "scrollEventDetail": { + "deltaX": "Number", + "deltaY": "Number", + "scrollHeight": "Number", + "scrollLeft": "Number", + "scrollTop": "Number", + "scrollWidth": "Number" + }, + "scrolltobottomEventDetail": { + "direction": "String" + } + }, + "interfaces": { + "ScrollerInterface": { + "cstyle": "String", + "bottomOffset": "Number", + "scrollDirection": "String", + "bounce": "Boolean", + "height": "Number", + "width": "Number", + "scrollTop": "Number", + "scrollLeft": "Number", + "onscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "customscroll": { + "input": ["scrollEventDetail"], + "output": "Undefined" + }, + "scrolltobottom": { + "input": ["scrolltobottomEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Scroller": ["ScrollerInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Scroller = function () { + function Scroller() { + _classCallCheck(this, Scroller); + + this.props = { + cstyle: { + type: String, + default: '' + }, + bottomOffset: { + // 距底部/右边多远时(单位px),触发 scrolltolower 事件 + type: Number, + default: 0 + }, + scrollDirection: { + // 可选为 horizontal 或者 vertical,默认值为 vertical 。定义滚动的方向。 + type: String, + default: 'vertical' + }, + bounce: { + type: Boolean, + default: true + }, + height: { + type: Number, + default: 0 + }, + width: { + type: Number, + default: 0 + }, + scrollTop: { + type: Number, + default: 0 + }, + scrollLeft: { + type: Number, + default: 0 + } + }; + this.data = { + cmtStyle: '' + }; + this.computed = { + wrapperStyle: function wrapperStyle() { + if (this.scrollDirection === 'vertical') { + if (this.height >= 0) { + return this.cstyle + ";height:" + this.height + "rpx;"; + } + } else { + if (this.width >= 0) { + return this.cstyle + ";width:" + this.width + "rpx;white-space:nowrap;"; + } + } // 没有传递的情况 + + + return this.cmtStyle + this.cstyle; + }, + scrollTopPx: function scrollTopPx() { + // scroll-top仅支持px + return (0, _index8.default)(this.scrollTop); + }, + scrollLeftPx: function scrollLeftPx() { + return (0, _index8.default)(this.scrollLeft); + } + }; + this.methods = { + onScroll: function onScroll(e) { + var detail = e.detail; + detail.deltaX = detail.deltaX || 0; + detail.deltaY = detail.deltaY || 0; + Object.keys(detail).forEach(function (key) { + detail[key] = (0, _index6.default)(detail[key]); + }); + this.$cmlEmit('onscroll', detail); + this.$cmlEmit('customscroll', detail); + }, + onBottom: function onBottom(e) { + this.$cmlEmit('scrolltobottom', e.detail); + } + }; + } + + _createClass(Scroller, [{ + key: "mounted", + value: function mounted() { + var _this2 = this; + + setTimeout(_asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() { + var rectData, windowRect, height, width; + return _regenerator2.default.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(_this2.scrollDirection === 'vertical' && !_this2.height)) { + _context.next = 3; + break; + } + + console.error('纵向滚动必须传递高度属性'); + return _context.abrupt("return"); + + case 3: + if (!(_this2.scrollDirection !== 'vertical' && !_this2.width)) { + _context.next = 6; + break; + } + + console.error('横向滚动必须传递宽度属性'); + return _context.abrupt("return"); + + case 6: + if (!(_this2.height === -1 || _this2.width === -1)) { + _context.next = 14; + break; + } + + _context.next = 9; + return (0, _index4.default)('c-scroller', _this2); + + case 9: + rectData = _context.sent; + _context.next = 12; + return (0, _index2.default)(); + + case 12: + windowRect = _context.sent; + + + if (_this2.scrollDirection === 'vertical') { + height = windowRect.viewportHeight - rectData.top; + + _this2.cmtStyle = "height:" + height + "cpx;"; + } else { + width = windowRect.viewportWidth - rectData.left; + + _this2.cmtStyle = "width:" + width + "cpx;white-space:nowrap;"; + } + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, _this2); + })), 200); + } + }]); + + return Scroller; +}(); + +exports.default = __CML__WRAPPER__(new Scroller()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/scroller/scroller.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/switch/switch.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/switch/switch.js new file mode 100644 index 0000000..f22fe49 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/switch/switch.js @@ -0,0 +1,366 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([11],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/switch/switch.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "valueDetail": { + "value": "Boolean" + } + }, + "interfaces": { + "SwitchInterface": { + "checked": "Boolean", + "disabled": "Boolean", + "label": "String", + "opencolor": "String", + "changeevent": { + "input": ["valueDetail"], + "output": "Undefined" + }, + "change": { + "input": ["valueDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Switch": ["SwitchInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Switch = function Switch() { + _classCallCheck(this, Switch); + + this.props = { + checked: { + type: Boolean, + default: false + }, + label: { + type: String, + default: '' + }, + disabled: { + type: Boolean, + default: false + }, + opencolor: { + type: String, + default: '#fc9153' + } + }; + this.methods = { + switchChange: function switchChange(e) { + this.$cmlEmit('change', { + value: e.detail.value + }); + this.$cmlEmit('changeevent', { + value: e.detail.value + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Switch()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/switch/switch.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js new file mode 100644 index 0000000..491d103 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/textarea/textarea.js @@ -0,0 +1,465 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([10],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/textarea/textarea.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "inputEventDetail": { + "value": "String" + } + }, + "interfaces": { + "TextareaInterface": { + "cStyle": "String", + "cstyle": "String", + "value": "String", + "placeholder": "String", + "disabled": "Boolean", + "focus": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "maxlength": "Number", + "returnKeyType": "String", + "placerHolderColor": "String", + "rows": "Number", + "inputevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blurevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "focusevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirmevent": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "input": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "blur": { + "input": ["inputEventDetail"], + "output": "Undefined" + }, + "confirm": { + "input": ["inputEventDetail"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Textarea": ["TextareaInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; +/* +event: cinput cblur cfocus cconfirm +*/ +var Textarea = function Textarea() { + _classCallCheck(this, Textarea); + + this.props = { + cStyle: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + }, + //textarea的内容 + value: { + type: String, + default: '' + }, + //textarea的placerholder + placeholder: { + type: String, + default: '' + }, + //是否禁用textarea输入 + disabled: { + type: Boolean, + default: false + }, + //控制textarea是否聚焦 + focus: { + type: Boolean, + default: false + }, + //最大长度 + maxlength: { + type: Number, + default: 140 + }, + //右下角返回键类型 + returnKeyType: { + //枚举值 done search next go + type: String, + default: 'done' + }, + placerHolderColor: { + type: String, + default: '#666' + }, + rows: { + type: Number, + default: 2 + } + }; + this.data = {}; + this.computed = { + wxPlaceHolderStyle: function wxPlaceHolderStyle() { + return "color: " + this.placerHolderColor; + }, + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cStyle || this.cstyle; + } + }; + this.watch = { + focus: function focus(newVal, oldVal) {} + }; + this.methods = { + inputEvent: function inputEvent(e) { + this.$cmlEmit('input', { + value: e.detail.value || '' + }); + this.$cmlEmit('inputevent', { + value: e.detail.value || '' + }); + }, + blurEvent: function blurEvent(e) { + this.$cmlEmit('blur', { + value: e.detail.value || '' + }); + this.$cmlEmit('blurevent', { + value: e.detail.value || '' + }); + }, + focusEvent: function focusEvent(e) { + this.$cmlEmit('focus', { + value: e.detail.value || '' + }); + this.$cmlEmit('focusevent', { + value: e.detail.value || '' + }); + }, + confirmEvent: function confirmEvent(e) { + this.$cmlEmit('confirm', { + value: e.detail.value || '' + }); + this.$cmlEmit('confirmevent', { + value: e.detail.value || '' + }); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Textarea()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/textarea/textarea.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/npm/chameleon-ui-builtin/components/video/video.js b/dist/wx/static/js/npm/chameleon-ui-builtin/components/video/video.js new file mode 100644 index 0000000..c7391c3 --- /dev/null +++ b/dist/wx/static/js/npm/chameleon-ui-builtin/components/video/video.js @@ -0,0 +1,407 @@ +var __CML__GLOBAL = require("../../../../manifest.js"); +__CML__GLOBAL.webpackJsonp([9],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var __INTERFACE__FILEPATH = "/Users/xuguodong/didi/develop/fe/ididi4/cml-gitlab-open/cml-flexbox/node_modules/chameleon-ui-builtin/components/video/video.interface"; +var __CML_ERROR__ = function throwError(content) { + throw new Error("\u6587\u4EF6\u4F4D\u7F6E: " + __INTERFACE__FILEPATH + "\n " + content); +}; + +var __enableTypes__ = []; +var __INTERFAE__DEFINES__ = { + "types": { + "EventDetail": {} + }, + "interfaces": { + "VideoInterface": { + "controls": "Boolean", + "autoplay": "Boolean", + "loop": "Boolean", + "src": "String", + "cstyle": "String", + "customstart": { + "input": ["Undefined"], + "output": "Undefined" + }, + "custompause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfinish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "customfail": { + "input": ["Undefined"], + "output": "Undefined" + }, + "start": { + "input": ["Undefined"], + "output": "Undefined" + }, + "pause": { + "input": ["Undefined"], + "output": "Undefined" + }, + "finish": { + "input": ["Undefined"], + "output": "Undefined" + }, + "fail": { + "input": ["Undefined"], + "output": "Undefined" + } + } + }, + "classes": {} +}; +var __CML__DEFINES__ = { + "types": {}, + "interfaces": {}, + "classes": { + "Video": ["VideoInterface"] + } +}; +var __CML__WRAPPER__ = function wrapper(obj) { + var className = obj.constructor.name; + var interfaceDefines = __INTERFAE__DEFINES__; + var enableTypes = __enableTypes__; // ['Object','Array','Nullable'] + var types = interfaceDefines.types; + var interfaceKey = Object.keys(interfaceDefines.interfaces)[0]; // interface Name + var interfaceObj = interfaceDefines.interfaces[interfaceKey]; + var cmlDefines = __CML__DEFINES__; + var isImplementInterface = false; + // 找到class + if (cmlDefines.classes[className]) { + // class 的interface数组中有interface中的定义 + if (~cmlDefines.classes[className].indexOf(interfaceKey)) { + isImplementInterface = true; + } else { + console.error("class " + className + " not implements interface " + interfaceKey); + } + } + + var props = []; + var events = {}; + + Object.keys(interfaceObj).forEach(function (key) { + var item = interfaceObj[key]; + if (is(item, 'Object')) { + // 是事件 有output和input + events[key] = item; + } else { + // 是属性 + props.push({ + key: key, + value: item + }); + } + }); + + // created 时做props校验 同时建立watch属性检测props类型 + // 包装this.$cmlEmit 校验自定义事件参数类型 + function isFunc(target) { + return target && is(target, 'Function'); + } + + function is(source, type) { + return Object.prototype.toString.call(source) === '[object ' + type + ']'; + } + + var getType = function getType(value) { + var type = Object.prototype.toString.call(value); + return type.replace(/\[object\s(.*)\]/g, '$1').replace(/( |^)[a-z]/g, function (L) { + return L.toUpperCase(); + }); + }; + + // beforeCreate时 vue中还获取不到mixins的this.$cmlEmit方法 + var oldCreated = obj.created || function () {}; + obj.created = function () { + checkProps.call(this); + oldCreated.call(this); + }; + + obj.methods = obj.methods || {}; + + obj.methods.$__checkCmlEmit__ = function (eventName, eventDetail) { + if (events[eventName]) { + var input = events[eventName].input; + + var detailType = input[0]; + var _errList = checkType(eventDetail, detailType, []); + if (_errList && _errList.length) { + __CML_ERROR__("errorinfo: event " + eventName + " detail verification fails\n " + _errList.join('\n') + "\n "); + } + } else { + __CML_ERROR__("errorinfo: event " + eventName + " is not defined in interface\n " + errList.join('\n') + "\n "); + } + }; + + function checkProps() { + var _this = this; + + props.forEach(function (item) { + var errList = checkType(_this[item.key], item.value, []); + if (errList && errList.length) { + __CML_ERROR__("error: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + }); + } + + obj.watch = obj.watch || {}; + + props.forEach(function (item) { + var oldWatch = obj.watch[item.key]; + obj.watch[item.key] = function (newVal, oldVal) { + var errList = checkType(newVal, item.value, []); + if (errList && errList.length) { + __CML_ERROR__("errorinfo: prop [" + item.key + "] verification fails\n " + errList.join('\n') + "\n "); + } + if (isFunc(oldWatch)) { + oldWatch.call(this, newVal, oldVal); + } + }; + }); + + /** + * 校验类型 两个loader共用代码 + * + * @param {*} value 实际传入的值 + * @param {string} type 静态分析时候得到的值得类型 + * @param {array[string]} errList 校验错误信息 类型 + * @return {bool} 校验结果 + */ + var checkType = function checkType(value, originType) { + var errList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var isNullableReg = /_cml_nullable_lmc_/g; + var type = originType.replace('_cml_nullable_lmc_', ''); + type === "Void" && (type = "Undefined"); + var currentType = getType(value); // Undefined Null Object Array Number String Function只可能是这几种类型; + // 但是对于type的值则可能是 Undefined Null Number String NullUndefinedStiring + // Object Array Function EventDetail(...这种自定义的复杂数据类型) 这几种; + // 判断nullable类型的参数 + // 如果 currentType === type 那么就会直接返回 []; + var canUseNullable = enableTypes.includes("Nullable"); + var canUseObject = enableTypes.includes("Object"); + var canUseArray = enableTypes.includes("Array"); + if (currentType == 'Null') { + // 如果传入的值是 null类型,那么可能的情况是该值在接口处的被定义为Null或者是 ?string 这种可选参数的形式; + if (type == "Null") { + // 如果定义的参数的值就是 Null,那么校验通过 + errList = []; + } else { + // 实际定义的参数的值不是 Null ?string这种形式的定义,type = new String('String') ?Callback type = new String('Callback') + // 那么判断是否是可选参数的情况 + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E"); + } + return errList; + } + if (currentType == 'Undefined') { + // 如果运行时传入的真实值是undefined,那么可能改值在接口处就是被定义为 Undefined类型或者是 ?string 这种可选参数 nullable的情况; + if (type == "Undefined") { + errList = []; + } else { + canUseNullable && isNullableReg.test(originType) ? errList = [] : errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542Fnullable\u914D\u7F6E\u6216\u8005\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'String') { + if (type == 'String') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Boolean') { + if (type == 'Boolean') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Number') { + if (type == 'Number') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Object') { + if (type == 'Object') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Object \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else if (type == 'CMLObject') { + errList = []; + } else { + // 这种情况的对象就是自定义的对象; + if (types[type]) { + var keys = Object.keys(types[type]); + // todo 这里是同样的问题,可能多传递 + keys.forEach(function (key) { + var subError = checkType(value[key], types[type][key], []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + }); + if (Object.keys(value).length > keys.length) { + errList.push("type [" + type + "] \u53C2\u6570\u4E2A\u6570\u4E0E\u5B9A\u4E49\u4E0D\u7B26"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + return errList; + } + if (currentType == 'Array') { + if (type == 'Array') { + !canUseObject ? errList.push("\u4E0D\u80FD\u76F4\u63A5\u5B9A\u4E49\u7C7B\u578B" + type + "\uFF0C\u9700\u8981\u4F7F\u7528\u7B26\u5408\u7C7B\u578B\u5B9A\u4E49\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5F00\u542F\u4E86\u53EF\u4EE5\u76F4\u63A5\u5B9A\u4E49 Array \u7C7B\u578B\u53C2\u6570\uFF1B") : errList = []; + } else { + if (types[type]) { + // 数组元素的类型 + var itemType = types[type][0]; + for (var i = 0; i < value.length; i++) { + var subError = checkType(value[i], itemType, []); + if (subError && subError.length) { + errList = errList.concat(subError); + } + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + + return errList; + } + if (currentType == 'Function') { + if (types[type]) { + if (!types[type].input && !types[type].output) { + errList.push("\u627E\u4E0D\u5230" + types[type] + " \u51FD\u6570\u5B9A\u4E49\u7684\u8F93\u5165\u8F93\u51FA"); + } + } else { + errList.push('找不到定义的type [' + type + ']!'); + } + } + if (currentType == 'Promise') { + if (type == 'Promise') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'Date') { + if (type == 'Date') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + if (currentType == 'RegExp') { + if (type == 'RegExp') { + errList = []; + } else { + errList.push("\u5B9A\u4E49\u4E86" + type + "\u7C7B\u578B\u7684\u53C2\u6570\uFF0C\u4F20\u5165\u7684\u5374\u662F" + currentType + ",\u8BF7\u68C0\u67E5\u6240\u4F20\u53C2\u6570\u662F\u5426\u548C\u63A5\u53E3\u5B9A\u4E49\u7684\u4E00\u81F4"); + } + return errList; + } + + return errList; + }; + + return obj; +}; + +var Video = function Video() { + _classCallCheck(this, Video); + + this.props = { + controls: { + type: Boolean, + default: false + }, + autoplay: { + type: Boolean, + default: false + }, + loop: { + type: Boolean, + default: false + }, + src: { + type: String, + default: '' + }, + cstyle: { + type: String, + default: '' + } + }; + this.computed = { + computedStyle: function computedStyle() { + // props 必须经过计算属性,否则没有经过 cpx 转换 + return this.cstyle; + } + }; + this.methods = { + onstart: function onstart(e) { + this.$cmlEmit('start'); + this.$cmlEmit('customstart'); + }, + onpause: function onpause(e) { + this.$cmlEmit('pause'); + this.$cmlEmit('custompause'); + }, + onfinish: function onfinish(e) { + this.$cmlEmit('finish'); + this.$cmlEmit('customfinish'); + }, + onfail: function onfail(e) { + this.$cmlEmit('fail'); + this.$cmlEmit('customfail'); + } + }; +}; + +exports.default = __CML__WRAPPER__(new Video()); + + +exports.default = _chameleonRuntime2.default.createComponent(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.wx.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./node_modules/chameleon-ui-builtin/components/video/video.wx.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.wx.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=component&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./node_modules/chameleon-ui-builtin/components/video/video.wx.cml"); + + +/***/ }) + +},["./node_modules/chameleon-ui-builtin/components/video/video.wx.cml"]); \ No newline at end of file diff --git a/dist/wx/static/js/pages/index/index.js b/dist/wx/static/js/pages/index/index.js index e7e7739..f2a9240 100644 --- a/dist/wx/static/js/pages/index/index.js +++ b/dist/wx/static/js/pages/index/index.js @@ -1 +1,50 @@ -var __CML__GLOBAL=require("../../manifest.js");__CML__GLOBAL.webpackJsonp([2],{61:function(e,t,n){n(62),n(63)},62:function(e,t){},63:function(e,t,n){function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=n(3),f=function(e){return e&&e.__esModule?e:{default:e}}(u),i=function e(){a(this,e),this.data={list:["0","1","2","3","4","5","6","7","8","9"]}};t.default=new i,t.default=f.default.createPage(t.default).getOptions()}},[61]); \ No newline at end of file +var __CML__GLOBAL = require("../../manifest.js"); +__CML__GLOBAL.webpackJsonp([7],{ + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _chameleonRuntime = __webpack_require__("./node_modules/chameleon-runtime/index.js"); + +var _chameleonRuntime2 = _interopRequireDefault(_chameleonRuntime); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Row = function Row() { + _classCallCheck(this, Row); + + this.data = { + list: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + }; +}; + +exports.default = new Row(); + + +exports.default = _chameleonRuntime2.default.createPage(exports.default).getOptions(); + +/***/ }), + +/***/ "../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml": +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ "./src/pages/index/index.cml": +/***/ (function(module, exports, __webpack_require__) { + +var __cml__style0 = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/cml-extract-css-webpack-plugin/dist/loader.js?{\"omit\":1,\"remove\":true}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/vue-style-loader/index.js!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/css-loader/index.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"platform\":\"miniapp\",\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/postcss-loader/lib/index.js?{\"sourceMap\":false,\"config\":{\"path\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/configs/postcss/wx/.postcssrc.js\"}}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/less-loader/dist/cjs.js?{\"sourceMap\":false}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-css-loader/index.js?{\"media\":true,\"cmlType\":\"wx\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=styles&index=0&fileType=page&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); +var __cml__script = __webpack_require__("../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/babel-loader/lib/index.js?{\"filename\":\"/Users/xuguodong/.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/chameleon.js\"}!../../../../../../.nvm/versions/node/v8.11.2/lib/node_modules/chameleon-tool/node_modules/chameleon-loader/src/selector.js?type=script&index=0&fileType=page&media=dev&cmlType=wx&isInjectBaseStyle=true&check={\"enable\":true,\"enableTypes\":[]}!./src/pages/index/index.cml"); + + +/***/ }) + +},["./src/pages/index/index.cml"]); \ No newline at end of file diff --git a/preview/preview.html b/preview/preview.html new file mode 100644 index 0000000..4f4d984 --- /dev/null +++ b/preview/preview.html @@ -0,0 +1,485 @@ + + + + + + Chameleon Preview + + + + + + + + + +
+
+
+
+ + H5页面 效果预览 +
+
+
+
+
+ +
+
+
+
+
+
+ + +