@mpxjs/webpack-plugin 2.10.16-beta.4 → 2.10.16-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.js +60 -0
- package/lib/file-loader.js +13 -3
- package/lib/json-compiler/index.js +2 -2
- package/lib/platform/json/wx/index.js +6 -0
- package/lib/platform/template/wx/component-config/ad.js +5 -0
- package/lib/platform/template/wx/component-config/button.js +9 -2
- package/lib/platform/template/wx/component-config/camera.js +13 -3
- package/lib/platform/template/wx/component-config/canvas.js +8 -1
- package/lib/platform/template/wx/component-config/cover-image.js +7 -2
- package/lib/platform/template/wx/component-config/cover-view.js +3 -1
- package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
- package/lib/platform/template/wx/component-config/form.js +27 -2
- package/lib/platform/template/wx/component-config/image.js +5 -0
- package/lib/platform/template/wx/component-config/input.js +10 -0
- package/lib/platform/template/wx/component-config/label.js +10 -2
- package/lib/platform/template/wx/component-config/map.js +11 -0
- package/lib/platform/template/wx/component-config/movable-area.js +4 -1
- package/lib/platform/template/wx/component-config/movable-view.js +17 -2
- package/lib/platform/template/wx/component-config/navigator.js +26 -0
- package/lib/platform/template/wx/component-config/picker-view.js +12 -0
- package/lib/platform/template/wx/component-config/picker.js +3 -1
- package/lib/platform/template/wx/component-config/progress.js +11 -1
- package/lib/platform/template/wx/component-config/rich-text.js +5 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
- package/lib/platform/template/wx/component-config/slider.js +8 -0
- package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
- package/lib/platform/template/wx/component-config/swiper.js +10 -0
- package/lib/platform/template/wx/component-config/text.js +5 -0
- package/lib/platform/template/wx/component-config/textarea.js +19 -2
- package/lib/platform/template/wx/component-config/unsupported.js +9 -0
- package/lib/platform/template/wx/component-config/video.js +10 -0
- package/lib/platform/template/wx/index.js +21 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +3 -12
- package/lib/runtime/components/react/mpx-picker-view/index.tsx +1 -1
- package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +7 -13
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/template-compiler/bind-this.js +2 -2
- package/lib/template-compiler/compiler.js +18 -17
- package/lib/template-compiler/index.js +6 -6
- package/lib/utils/dom-tag-config.js +5 -5
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ module.exports = function ({ print }) {
|
|
|
10
10
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
11
11
|
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
12
12
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
13
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
14
|
|
|
14
15
|
return {
|
|
15
16
|
test: TAG_NAME,
|
|
@@ -55,6 +56,14 @@ module.exports = function ({ print }) {
|
|
|
55
56
|
}
|
|
56
57
|
obj.name = propsMap[obj.name]
|
|
57
58
|
return obj
|
|
59
|
+
},
|
|
60
|
+
ks (obj) {
|
|
61
|
+
const propsMap = {
|
|
62
|
+
activeColor: 'active-color',
|
|
63
|
+
backgroundColor: 'background-color'
|
|
64
|
+
}
|
|
65
|
+
obj.name = propsMap[obj.name]
|
|
66
|
+
return obj
|
|
58
67
|
}
|
|
59
68
|
},
|
|
60
69
|
{
|
|
@@ -76,7 +85,8 @@ module.exports = function ({ print }) {
|
|
|
76
85
|
ali: aliEventLog,
|
|
77
86
|
swan: baiduEventLog,
|
|
78
87
|
tt: ttEventLog,
|
|
79
|
-
jd: jdEventLog
|
|
88
|
+
jd: jdEventLog,
|
|
89
|
+
ks: ksEventLog
|
|
80
90
|
}
|
|
81
91
|
]
|
|
82
92
|
}
|
|
@@ -5,6 +5,7 @@ module.exports = function ({ print }) {
|
|
|
5
5
|
const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
|
|
6
6
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
7
7
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
8
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
8
9
|
|
|
9
10
|
return {
|
|
10
11
|
test: TAG_NAME,
|
|
@@ -35,6 +36,10 @@ module.exports = function ({ print }) {
|
|
|
35
36
|
{
|
|
36
37
|
test: /^(nodes)$/,
|
|
37
38
|
jd: jdPropLog
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
test: /^(user-select)$/,
|
|
42
|
+
ks: ksPropLog
|
|
38
43
|
}
|
|
39
44
|
]
|
|
40
45
|
}
|
|
@@ -18,6 +18,8 @@ module.exports = function ({ print }) {
|
|
|
18
18
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
19
19
|
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
20
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
21
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
22
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
21
23
|
|
|
22
24
|
return {
|
|
23
25
|
test: TAG_NAME,
|
|
@@ -67,6 +69,10 @@ module.exports = function ({ print }) {
|
|
|
67
69
|
{
|
|
68
70
|
test: /^(refresher-default-style|refresher-background)$/,
|
|
69
71
|
ios: iosPropLog
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
test: /^(scroll-into-view-offset|enable-back-to-top|enable-passive|refresher-enabled|refresher-threshold|refresher-default-style|refresher-background|refresher-triggered|bounces|fast-deceleration|enable-flex|enhanced|paging-enabled|using-sticky|type|associative-container|reverse|clip|enable-back-to-top|cache-extent|min-drag-distance|scroll-into-view-within-extent|scroll-into-view-alignment|padding|refresher-two-level-enabled|refresher-two-level-triggered|refresher-two-level-threshold|refresher-two-level-close-threshold|refresher-two-level-close-threshold|refresher-two-level-scroll-enabled|refresher-ballistic-refresh-enabled|refresher-two-level-pinned|scroll-anchoring)$/,
|
|
75
|
+
ks: ksPropLog
|
|
70
76
|
}
|
|
71
77
|
],
|
|
72
78
|
event: [
|
|
@@ -90,13 +96,18 @@ module.exports = function ({ print }) {
|
|
|
90
96
|
ali: aliEventLog,
|
|
91
97
|
tt: ttEventLog,
|
|
92
98
|
qq: qqEventLog,
|
|
93
|
-
swan: baiduEventLog
|
|
99
|
+
swan: baiduEventLog,
|
|
100
|
+
ks: ksEventLog
|
|
94
101
|
},
|
|
95
102
|
{
|
|
96
103
|
test: /^(refresherpulling|refresherrestore|refresherabort)$/,
|
|
97
104
|
android: androidEventLog,
|
|
98
105
|
ios: iosEventLog,
|
|
99
106
|
harmony: harmonyEventLog
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
test: /^(scrollstart|scrollend|refresherwillrefresh|refresherstatuschange)$/,
|
|
110
|
+
ks: ksEventLog
|
|
100
111
|
}
|
|
101
112
|
]
|
|
102
113
|
}
|
|
@@ -60,6 +60,14 @@ module.exports = function ({ print }) {
|
|
|
60
60
|
}
|
|
61
61
|
obj.name = propsMap[obj.name]
|
|
62
62
|
return obj
|
|
63
|
+
},
|
|
64
|
+
ks (obj) {
|
|
65
|
+
const propsMap = {
|
|
66
|
+
activeColor: 'active-color',
|
|
67
|
+
backgroundColor: 'background-color'
|
|
68
|
+
}
|
|
69
|
+
obj.name = propsMap[obj.name]
|
|
70
|
+
return obj
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
]
|
|
@@ -9,6 +9,7 @@ module.exports = function ({ print }) {
|
|
|
9
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
10
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
11
11
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
12
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
12
13
|
|
|
13
14
|
return {
|
|
14
15
|
test: TAG_NAME,
|
|
@@ -34,7 +35,8 @@ module.exports = function ({ print }) {
|
|
|
34
35
|
ali: aliPropLog,
|
|
35
36
|
ios: iosPropLog,
|
|
36
37
|
android: androidPropLog,
|
|
37
|
-
harmony: harmonyPropLog
|
|
38
|
+
harmony: harmonyPropLog,
|
|
39
|
+
ks: ksPropLog
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
42
|
test: /^(skip-hidden-item-layout)$/,
|
|
@@ -42,7 +44,8 @@ module.exports = function ({ print }) {
|
|
|
42
44
|
ali: aliPropLog,
|
|
43
45
|
tt: ttPropLog,
|
|
44
46
|
swan: baiduPropLog,
|
|
45
|
-
qq: qqPropLog
|
|
47
|
+
qq: qqPropLog,
|
|
48
|
+
ks: ksPropLog
|
|
46
49
|
}
|
|
47
50
|
]
|
|
48
51
|
}
|
|
@@ -7,6 +7,7 @@ module.exports = function ({ print }) {
|
|
|
7
7
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
8
8
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
9
9
|
const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
|
|
10
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
10
11
|
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
11
12
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
12
13
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
@@ -16,6 +17,7 @@ module.exports = function ({ print }) {
|
|
|
16
17
|
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
17
18
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
18
19
|
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
19
21
|
|
|
20
22
|
return {
|
|
21
23
|
test: TAG_NAME,
|
|
@@ -69,6 +71,10 @@ module.exports = function ({ print }) {
|
|
|
69
71
|
ios: iosPropLog,
|
|
70
72
|
android: androidPropLog,
|
|
71
73
|
harmony: harmonyPropLog
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
test: /^(snap-to-edge|previous-margin|next-margin|display-multiple-items|direction|layout-type|transformer-type|indicator-type|indicator-margin|indicator-spacing|indicator-radius|indicator-width|indicator-height|indicator-alignment|indicator-offset|scroll-with-animation|cache-extent)$/,
|
|
77
|
+
ks: ksPropLog
|
|
72
78
|
}
|
|
73
79
|
],
|
|
74
80
|
event: [
|
|
@@ -95,6 +101,10 @@ module.exports = function ({ print }) {
|
|
|
95
101
|
ios: iosEventLog,
|
|
96
102
|
android: androidEventLog,
|
|
97
103
|
harmony: harmonyEventLog
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
test: /^(onscrollstart|onscrollupdate|onscrollend)$/,
|
|
107
|
+
ks: ksEventLog
|
|
98
108
|
}
|
|
99
109
|
]
|
|
100
110
|
}
|
|
@@ -9,6 +9,7 @@ module.exports = function ({ print }) {
|
|
|
9
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
10
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
11
11
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
12
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
12
13
|
|
|
13
14
|
return {
|
|
14
15
|
test: TAG_NAME,
|
|
@@ -74,6 +75,10 @@ module.exports = function ({ print }) {
|
|
|
74
75
|
el.isSimple = true
|
|
75
76
|
return false
|
|
76
77
|
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
test: /^(user-select|overflow|max-lines|decode)$/,
|
|
81
|
+
ks: ksPropLog
|
|
77
82
|
}
|
|
78
83
|
]
|
|
79
84
|
}
|
|
@@ -23,6 +23,8 @@ module.exports = function ({ print }) {
|
|
|
23
23
|
const harmonyValueLogError = print({ platform: 'harmony', tag: TAG_NAME, isError: true, type: 'value' })
|
|
24
24
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
25
25
|
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
26
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
27
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
26
28
|
|
|
27
29
|
return {
|
|
28
30
|
test: TAG_NAME,
|
|
@@ -95,12 +97,17 @@ module.exports = function ({ print }) {
|
|
|
95
97
|
ios: iosPropLog,
|
|
96
98
|
android: androidPropLog,
|
|
97
99
|
harmony: harmonyPropLog
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
test: /^(cursor-spacing|cursor|selection-start|selection-end|adjust-position|hold-keyboard|disable-default-padding|confirm-hold|adjust-keyboard-to|placeholder-class|show-confirm-bar)$/,
|
|
103
|
+
ks: ksPropLog
|
|
98
104
|
}
|
|
99
105
|
],
|
|
100
106
|
event: [
|
|
101
107
|
{
|
|
102
108
|
test: /^(confirm|linechange)$/,
|
|
103
|
-
web: webEventLog
|
|
109
|
+
web: webEventLog,
|
|
110
|
+
ks: ksEventLog
|
|
104
111
|
},
|
|
105
112
|
{
|
|
106
113
|
test: /^keyboardheightchange$/,
|
|
@@ -124,7 +131,17 @@ module.exports = function ({ print }) {
|
|
|
124
131
|
test: /^keyboard.+$/,
|
|
125
132
|
ios: iosEventLog,
|
|
126
133
|
android: androidEventLog,
|
|
127
|
-
harmony: harmonyEventLog
|
|
134
|
+
harmony: harmonyEventLog,
|
|
135
|
+
ks: ksEventLog
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
test: /^(selectionchange)$/,
|
|
139
|
+
ks: ksEventLog,
|
|
140
|
+
ali: aliEventLog,
|
|
141
|
+
jd: jdEventLog,
|
|
142
|
+
qq: qqEventLog,
|
|
143
|
+
tt: ttEventLog,
|
|
144
|
+
web: webEventLog
|
|
128
145
|
}
|
|
129
146
|
]
|
|
130
147
|
}
|
|
@@ -6,6 +6,8 @@ const BAIDU_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pushe
|
|
|
6
6
|
const QQ_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'official-account', 'editor']
|
|
7
7
|
// 头条小程序不支持的标签集合
|
|
8
8
|
const TT_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'cover-image', 'cover-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'audio', 'live-pusher']
|
|
9
|
+
// 快手小程序不支持的标签集合
|
|
10
|
+
const KS_UNSUPPORTED_TAG_NAME_ARR = ['match-media', 'page-container', 'root-portal', 'selection', 'functional-page-navigator', 'editor', 'editor-portal', 'keyboard-accessory', 'live-player', 'live-pusher', 'voip-room', 'channel-live', 'channel-video', 'ad-custom', 'official-account', 'official-account-publisher', 'open-data', 'store-coupon', 'store-gift', 'store-home', 'store-product']
|
|
9
11
|
// 京东小程序不支持的标签集合
|
|
10
12
|
const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'live-player', 'rich-text', 'audio', 'video', 'camera']
|
|
11
13
|
// 快应用不支持的标签集合
|
|
@@ -22,6 +24,7 @@ module.exports = function ({ print }) {
|
|
|
22
24
|
const baiduUnsupportedTagError = print({ platform: 'baidu', isError: true, type: 'tag' })
|
|
23
25
|
const qqUnsupportedTagError = print({ platform: 'qq', isError: true, type: 'tag' })
|
|
24
26
|
const ttUnsupportedTagError = print({ platform: 'bytedance', isError: true, type: 'tag' })
|
|
27
|
+
const ksUnsupportedTagError = print({ platform: 'ks', isError: true, type: 'tag' })
|
|
25
28
|
const jdUnsupportedTagError = print({ platform: 'jd', isError: true, type: 'tag' })
|
|
26
29
|
const qaUnsupportedTagError = print({ platform: 'qa', isError: true, type: 'tag' })
|
|
27
30
|
const iosUnsupportedTagError = print({ platform: 'ios', isError: true, type: 'tag' })
|
|
@@ -32,6 +35,7 @@ module.exports = function ({ print }) {
|
|
|
32
35
|
const baiduUnsupportedExp = new RegExp('^(' + BAIDU_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
33
36
|
const qqUnsupportedExp = new RegExp('^(' + QQ_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
34
37
|
const ttUnsupportedExp = new RegExp('^(' + TT_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
38
|
+
const ksUnsupportedExp = new RegExp('^(' + KS_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
35
39
|
const jdUnsupportedExp = new RegExp('^(' + JD_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
36
40
|
const qaUnsupportedExp = new RegExp('^(' + QA_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
37
41
|
const iosUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
@@ -59,6 +63,11 @@ module.exports = function ({ print }) {
|
|
|
59
63
|
test: ttUnsupportedExp,
|
|
60
64
|
tt: ttUnsupportedTagError
|
|
61
65
|
},
|
|
66
|
+
{
|
|
67
|
+
supportedModes: ['ks'],
|
|
68
|
+
test: ksUnsupportedExp,
|
|
69
|
+
ks: ksUnsupportedTagError
|
|
70
|
+
},
|
|
62
71
|
{
|
|
63
72
|
supportedModes: ['jd'],
|
|
64
73
|
test: jdUnsupportedExp,
|
|
@@ -17,6 +17,8 @@ module.exports = function ({ print }) {
|
|
|
17
17
|
const androidEventLogError = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
18
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
19
19
|
const harmonyEventLogError = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
21
|
+
const ksEventLogError = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
22
|
return {
|
|
21
23
|
test: TAG_NAME,
|
|
22
24
|
web (tag, { el }) {
|
|
@@ -74,6 +76,10 @@ module.exports = function ({ print }) {
|
|
|
74
76
|
test: /^(duration|enable-danmu|danmu-btn|page-gesture|direction|show-progress|show-fullscreen-btn|show-center-play-btn|enable-progress-gesture|show-mute-btn|title|play-btn-position|enable-play-gesture|auto-pause-if-navigate|auto-pause-if-open-native|vslide-gesture|vslide-gesture-in-fullscreen|show-bottom-progress|ad-unit-id|poster-for-crawler|show-casting-button|picture-in-picture-mode|picture-in-picture-show-progress| picture-in-picture-init-position|enable-auto-rotation|show-snapshot-button|show-screen-lock-button|show-background-playback-button|background-poster|referrer-policy|is-live)$/,
|
|
75
77
|
android: androidPropLog,
|
|
76
78
|
harmony: harmonyPropLog
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
test: /^(duration|danmu-list|enable-danmu|danmu-btn|auto-pause-if-navigate|auto-pause-if-open-native|ad-unit-id|poster-for-crawler|picture-in-picture-mode|picture-in-picture-show-progress|picture-in-picture-init-position|enable-auto-rotation|show-snapshot-button|show-background-playback-button|background-poster|is-drm|is-live|provision-url|certificate-url|license-url|preferred-peak-bit-rate)$/,
|
|
82
|
+
ks: ksPropLog
|
|
77
83
|
}
|
|
78
84
|
],
|
|
79
85
|
event: [
|
|
@@ -117,6 +123,10 @@ module.exports = function ({ print }) {
|
|
|
117
123
|
test: /^(progress|enterpictureinpicture|leavepictureinpicture|castinguserselect|castingstatechange|castinginterrupt)$/,
|
|
118
124
|
android: androidEventLogError,
|
|
119
125
|
harmony: harmonyEventLogError
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
test: /^(waiting|controlstoggle|enterpictureinpicture|leavepictureinpicture|seekcomplete|castinguserselect)$/,
|
|
129
|
+
ks: ksEventLogError
|
|
120
130
|
}
|
|
121
131
|
]
|
|
122
132
|
}
|
|
@@ -62,7 +62,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const spec = {
|
|
65
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'harmony'],
|
|
65
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'ks', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'harmony'],
|
|
66
66
|
// props预处理
|
|
67
67
|
preProps: [],
|
|
68
68
|
// props后处理
|
|
@@ -325,6 +325,13 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
325
325
|
value
|
|
326
326
|
}
|
|
327
327
|
},
|
|
328
|
+
ks ({ name, value }) {
|
|
329
|
+
const dir = this.test.exec(name)[1]
|
|
330
|
+
return {
|
|
331
|
+
name: 'ks:' + dir,
|
|
332
|
+
value
|
|
333
|
+
}
|
|
334
|
+
},
|
|
328
335
|
dd ({ name, value }) {
|
|
329
336
|
const dir = this.test.exec(name)[1]
|
|
330
337
|
return {
|
|
@@ -413,6 +420,19 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
413
420
|
value
|
|
414
421
|
}
|
|
415
422
|
},
|
|
423
|
+
ks ({ name, value }, { eventRules }) {
|
|
424
|
+
const match = this.test.exec(name)
|
|
425
|
+
const prefix = match[1]
|
|
426
|
+
const eventName = match[2]
|
|
427
|
+
const modifierStr = match[3] || ''
|
|
428
|
+
let rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ks' })
|
|
429
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'ks' })
|
|
430
|
+
if (rEventName.includes('-')) rPrefix += ':'
|
|
431
|
+
return {
|
|
432
|
+
name: rPrefix + rEventName + modifierStr,
|
|
433
|
+
value
|
|
434
|
+
}
|
|
435
|
+
},
|
|
416
436
|
dd ({ name, value }, { eventRules }) {
|
|
417
437
|
const match = this.test.exec(name)
|
|
418
438
|
const prefix = match[1]
|
|
@@ -67,7 +67,7 @@ const _PickerView = forwardRef((props, ref) => {
|
|
|
67
67
|
columnData,
|
|
68
68
|
ref: cloneRef,
|
|
69
69
|
columnIndex: index,
|
|
70
|
-
key: `pick-view-${index}`,
|
|
70
|
+
key: `pick-view-${index}-${columnData.length}`,
|
|
71
71
|
wrapperStyle: {
|
|
72
72
|
height: normalStyle?.height || DefaultPickerItemH,
|
|
73
73
|
itemHeight: indicatorH || DefaultPickerItemH
|
|
@@ -44,6 +44,7 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
44
44
|
const contentContainerStyle = useMemo(() => {
|
|
45
45
|
return [{ paddingVertical: paddingHeight }];
|
|
46
46
|
}, [paddingHeight]);
|
|
47
|
+
const initialContentOffsetY = useMemo(() => initialIndex * itemRawH, [initialIndex, itemRawH]);
|
|
47
48
|
const getIndex = useCallback((y) => {
|
|
48
49
|
const calc = Math.round(y / itemRawH);
|
|
49
50
|
return Math.max(0, Math.min(calc, maxIndex));
|
|
@@ -93,16 +94,6 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
93
94
|
activeIndex.current = initialIndex;
|
|
94
95
|
}, isIOS ? 0 : 200);
|
|
95
96
|
}, [itemRawH, maxIndex, initialIndex]);
|
|
96
|
-
const onContentSizeChange = useCallback((_w, h) => {
|
|
97
|
-
const y = initialIndex * itemRawH;
|
|
98
|
-
if (y <= h) {
|
|
99
|
-
clearTimerScrollTo();
|
|
100
|
-
timerScrollTo.current = setTimeout(() => {
|
|
101
|
-
scrollViewRef.current?.scrollTo({ x: 0, y, animated: false });
|
|
102
|
-
activeIndex.current = initialIndex;
|
|
103
|
-
}, 0);
|
|
104
|
-
}
|
|
105
|
-
}, [itemRawH, initialIndex]);
|
|
106
97
|
const onItemLayout = useCallback((e) => {
|
|
107
98
|
const { height: rawH } = e.nativeEvent.layout;
|
|
108
99
|
const roundedH = Math.round(rawH);
|
|
@@ -241,8 +232,8 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
241
232
|
onScrollEndDrag,
|
|
242
233
|
onMomentumScrollBegin,
|
|
243
234
|
onMomentumScrollEnd,
|
|
244
|
-
|
|
245
|
-
|
|
235
|
+
contentContainerStyle,
|
|
236
|
+
contentOffset: { x: 0, y: initialContentOffsetY }
|
|
246
237
|
});
|
|
247
238
|
return createElement(PickerViewColumnAnimationContext.Provider, { value: offsetYShared }, createElement(Reanimated.ScrollView, innerProps, renderInnerchild()));
|
|
248
239
|
};
|
|
@@ -170,7 +170,7 @@ const _PickerView = forwardRef<HandlerRef<View, PickerViewProps>, PickerViewProp
|
|
|
170
170
|
columnData,
|
|
171
171
|
ref: cloneRef,
|
|
172
172
|
columnIndex: index,
|
|
173
|
-
key: `pick-view-${index}`,
|
|
173
|
+
key: `pick-view-${index}-${columnData.length}`,
|
|
174
174
|
wrapperStyle: {
|
|
175
175
|
height: normalStyle?.height || DefaultPickerItemH,
|
|
176
176
|
itemHeight: indicatorH || DefaultPickerItemH
|
|
@@ -98,6 +98,11 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
98
98
|
return [{ paddingVertical: paddingHeight }]
|
|
99
99
|
}, [paddingHeight])
|
|
100
100
|
|
|
101
|
+
const initialContentOffsetY = useMemo(
|
|
102
|
+
() => initialIndex * itemRawH,
|
|
103
|
+
[initialIndex, itemRawH]
|
|
104
|
+
)
|
|
105
|
+
|
|
101
106
|
const getIndex = useCallback((y: number) => {
|
|
102
107
|
const calc = Math.round(y / itemRawH)
|
|
103
108
|
return Math.max(0, Math.min(calc, maxIndex))
|
|
@@ -155,17 +160,6 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
155
160
|
}, isIOS ? 0 : 200)
|
|
156
161
|
}, [itemRawH, maxIndex, initialIndex])
|
|
157
162
|
|
|
158
|
-
const onContentSizeChange = useCallback((_w: number, h: number) => {
|
|
159
|
-
const y = initialIndex * itemRawH
|
|
160
|
-
if (y <= h) {
|
|
161
|
-
clearTimerScrollTo()
|
|
162
|
-
timerScrollTo.current = setTimeout(() => {
|
|
163
|
-
scrollViewRef.current?.scrollTo({ x: 0, y, animated: false })
|
|
164
|
-
activeIndex.current = initialIndex
|
|
165
|
-
}, 0)
|
|
166
|
-
}
|
|
167
|
-
}, [itemRawH, initialIndex])
|
|
168
|
-
|
|
169
163
|
const onItemLayout = useCallback((e: LayoutChangeEvent) => {
|
|
170
164
|
const { height: rawH } = e.nativeEvent.layout
|
|
171
165
|
const roundedH = Math.round(rawH)
|
|
@@ -331,8 +325,8 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
331
325
|
onScrollEndDrag,
|
|
332
326
|
onMomentumScrollBegin,
|
|
333
327
|
onMomentumScrollEnd,
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
contentContainerStyle,
|
|
329
|
+
contentOffset: { x: 0, y: initialContentOffsetY }
|
|
336
330
|
}) as React.ComponentProps<typeof Reanimated.ScrollView>
|
|
337
331
|
|
|
338
332
|
return createElement(
|
|
@@ -45,7 +45,7 @@ function objectKeys (obj) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function genRegExp (str, flags) {
|
|
48
|
-
if (!__mpx_wxs__) {
|
|
48
|
+
if (!__mpx_wxs__ || __mpx_mode__ === 'ks') {
|
|
49
49
|
return new RegExp(str, flags)
|
|
50
50
|
} else {
|
|
51
51
|
return getRegExp(str, flags)
|
|
@@ -234,4 +234,4 @@ module.exports = {
|
|
|
234
234
|
var parsedStaticStyle = typeof staticStyle === 'string' ? parseStyleText(staticStyle) : {}
|
|
235
235
|
return genStyleText(extend(parsedStaticStyle, normalizedDynamicStyle))
|
|
236
236
|
}
|
|
237
|
-
}
|
|
237
|
+
}
|
|
@@ -258,7 +258,7 @@ module.exports = {
|
|
|
258
258
|
})
|
|
259
259
|
return {
|
|
260
260
|
code: pCollectKeys.map((key) => {
|
|
261
|
-
return isSimpleKey(key) ? `
|
|
261
|
+
return isSimpleKey(key) ? `mpx_sc(${JSON.stringify(key)});` : `mpx_c(${JSON.stringify(key)});`
|
|
262
262
|
}).join('\n'),
|
|
263
263
|
propKeys: [...propKeySet]
|
|
264
264
|
}
|
|
@@ -436,7 +436,7 @@ module.exports = {
|
|
|
436
436
|
exit (path) {
|
|
437
437
|
if (path.collectInfo) {
|
|
438
438
|
const { isSimple, key } = path.collectInfo
|
|
439
|
-
const callee = isSimple ? t.identifier('
|
|
439
|
+
const callee = isSimple ? t.identifier('mpx_sc') : t.identifier('mpx_c')
|
|
440
440
|
const replaceNode = renderReduce
|
|
441
441
|
? t.callExpression(callee, [key])
|
|
442
442
|
: t.callExpression(callee, [key, path.node])
|
|
@@ -1884,24 +1884,25 @@ function processRefReact (el, meta) {
|
|
|
1884
1884
|
/**
|
|
1885
1885
|
* selectorsConf: [type, [[prefix, selector], [prefix, selector]]]
|
|
1886
1886
|
*/
|
|
1887
|
-
if (
|
|
1888
|
-
const rawId = el.attrsMap.id
|
|
1889
|
-
const rawClass = el.attrsMap.class
|
|
1890
|
-
const rawDynamicClass = el.attrsMap[config[mode].directive.dynamicClass]
|
|
1891
|
-
|
|
1892
|
-
if (rawId) {
|
|
1893
|
-
const staticId = parseMustacheWithContext(rawId).result
|
|
1894
|
-
selectors.push({ prefix: '#', selector: `${staticId}` })
|
|
1895
|
-
}
|
|
1896
|
-
if (rawClass || rawDynamicClass) {
|
|
1897
|
-
const staticClass = parseMustacheWithContext(rawClass).result
|
|
1898
|
-
const dynamicClass = parseMustacheWithContext(rawDynamicClass).result
|
|
1899
|
-
selectors.push({ prefix: '.', selector: `this.__getClass(${staticClass}, ${dynamicClass})` })
|
|
1900
|
-
}
|
|
1901
|
-
} else {
|
|
1887
|
+
if (val) {
|
|
1902
1888
|
meta.refs.push(refConf)
|
|
1903
1889
|
selectors.push({ prefix: '', selector: `"${refConf.key}"` })
|
|
1904
1890
|
}
|
|
1891
|
+
|
|
1892
|
+
const rawId = el.attrsMap.id
|
|
1893
|
+
const rawClass = el.attrsMap.class
|
|
1894
|
+
const rawDynamicClass = el.attrsMap[config[mode].directive.dynamicClass]
|
|
1895
|
+
|
|
1896
|
+
if (rawId) {
|
|
1897
|
+
const staticId = parseMustacheWithContext(rawId).result
|
|
1898
|
+
selectors.push({ prefix: '#', selector: `${staticId}` })
|
|
1899
|
+
}
|
|
1900
|
+
if (rawClass || rawDynamicClass) {
|
|
1901
|
+
const staticClass = parseMustacheWithContext(rawClass).result
|
|
1902
|
+
const dynamicClass = parseMustacheWithContext(rawDynamicClass).result
|
|
1903
|
+
selectors.push({ prefix: '.', selector: `this.__getClass(${staticClass}, ${dynamicClass})` })
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1905
1906
|
const selectorsConf = selectors.map(item => `["${item.prefix}", ${item.selector}]`)
|
|
1906
1907
|
const refFnId = forScopes.reduce((preV, curV) => {
|
|
1907
1908
|
return `${preV} + "_" + ${curV.index}`
|
|
@@ -2719,7 +2720,7 @@ function postProcessTemplate (el) {
|
|
|
2719
2720
|
}
|
|
2720
2721
|
}
|
|
2721
2722
|
|
|
2722
|
-
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,ios,android,harmony,noMode')
|
|
2723
|
+
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,ios,android,harmony,ks,noMode')
|
|
2723
2724
|
|
|
2724
2725
|
function isValidModeP (i) {
|
|
2725
2726
|
return isValidMode(i[0] === '_' ? i.slice(1) : i)
|
|
@@ -3261,7 +3262,7 @@ function genFor (node) {
|
|
|
3261
3262
|
node.forProcessed = true
|
|
3262
3263
|
const index = node.for.index || 'index'
|
|
3263
3264
|
const item = node.for.item || 'item'
|
|
3264
|
-
return `
|
|
3265
|
+
return `mpx_i(${node.for.exp}, function(${item},${index}){\n${genNode(node)}});\n`
|
|
3265
3266
|
}
|
|
3266
3267
|
|
|
3267
3268
|
function genNode (node) {
|
|
@@ -112,10 +112,10 @@ module.exports = function (raw) {
|
|
|
112
112
|
if (rawCode) {
|
|
113
113
|
try {
|
|
114
114
|
const ignoreMap = Object.assign({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
mpx_i: true,
|
|
116
|
+
mpx_c: true,
|
|
117
|
+
mpx_sc: true,
|
|
118
|
+
mpx_r: true
|
|
119
119
|
}, meta.wxsModuleMap)
|
|
120
120
|
const bindResult = optimizeRenderLevel === 2
|
|
121
121
|
? bindThis.transformSimple(rawCode, {
|
|
@@ -126,9 +126,9 @@ module.exports = function (raw) {
|
|
|
126
126
|
renderReduce: optimizeRenderLevel === 1,
|
|
127
127
|
ignoreMap
|
|
128
128
|
})
|
|
129
|
-
resultSource += `global.currentInject.render = function (
|
|
129
|
+
resultSource += `global.currentInject.render = function (mpx_i, mpx_c, mpx_r, mpx_sc) {
|
|
130
130
|
${bindResult.code}
|
|
131
|
-
|
|
131
|
+
mpx_r(${optimizeRenderLevel === 2 ? 'true' : ''});
|
|
132
132
|
};\n`
|
|
133
133
|
if ((mode === 'tt' || mode === 'swan') && bindResult.propKeys) {
|
|
134
134
|
resultSource += `global.currentInject.propKeys = ${JSON.stringify(bindResult.propKeys)};\n`
|
|
@@ -74,10 +74,10 @@ const isNativeMiniTag = makeMap(
|
|
|
74
74
|
*/
|
|
75
75
|
const isBuildInWebTag = makeMap(
|
|
76
76
|
'mpx-image,mpx-picker-view,mpx-slider,mpx-textarea,mpx-input,mpx-picker,' +
|
|
77
|
-
'mpx-swiper-item,mpx-video,mpx-button,mpx-
|
|
77
|
+
'mpx-swiper-item,mpx-video,mpx-button,mpx-progress,' +
|
|
78
78
|
'mpx-swiper,mpx-view,mpx-checkbox-group,mpx-movable-area,mpx-radio-group,' +
|
|
79
79
|
'mpx-switch,mpx-web-view,mpx-checkbox,mpx-movable-view,mpx-radio,' +
|
|
80
|
-
'mpx-
|
|
80
|
+
'mpx-form,mpx-navigator,mpx-rich-text,' +
|
|
81
81
|
'mpx-icon,mpx-picker-view-column,mpx-scroll-view,mpx-text'
|
|
82
82
|
)
|
|
83
83
|
|
|
@@ -86,11 +86,11 @@ const isBuildInWebTag = makeMap(
|
|
|
86
86
|
*/
|
|
87
87
|
const isBuildInReactTag = makeMap(
|
|
88
88
|
'mpx-web-view,mpx-view,mpx-video,mpx-textarea,mpx-text,mpx-switch,' +
|
|
89
|
-
'mpx-swiper,mpx-swiper-item,mpx-
|
|
89
|
+
'mpx-swiper,mpx-swiper-item,mpx-scroll-view,' +
|
|
90
90
|
'mpx-root-portal,mpx-radio,mpx-radio-group,mpx-navigator,mpx-movable-view,' +
|
|
91
|
-
'mpx-movable-area,mpx-label,mpx-
|
|
91
|
+
'mpx-movable-area,mpx-label,mpx-input,' +
|
|
92
92
|
'mpx-image,mpx-form,mpx-checkbox,mpx-checkbox-group,mpx-button,' +
|
|
93
|
-
'mpx-rich-text,mpx-
|
|
93
|
+
'mpx-rich-text,mpx-picker-view-column,mpx-picker-view,mpx-picker,' +
|
|
94
94
|
'mpx-icon,mpx-canvas,mpx-camera'
|
|
95
95
|
)
|
|
96
96
|
|