@mpxjs/webpack-plugin 2.10.17-beta.2 → 2.10.17-beta.4

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.
Files changed (98) hide show
  1. package/lib/config.js +60 -0
  2. package/lib/file-loader.js +4 -1
  3. package/lib/global.d.ts +16 -0
  4. package/lib/index.js +22 -2
  5. package/lib/json-compiler/index.js +13 -4
  6. package/lib/platform/json/wx/index.js +6 -0
  7. package/lib/platform/style/wx/index.js +57 -33
  8. package/lib/platform/template/wx/component-config/ad.js +5 -0
  9. package/lib/platform/template/wx/component-config/button.js +9 -2
  10. package/lib/platform/template/wx/component-config/camera.js +25 -3
  11. package/lib/platform/template/wx/component-config/canvas.js +8 -1
  12. package/lib/platform/template/wx/component-config/cover-image.js +7 -2
  13. package/lib/platform/template/wx/component-config/cover-view.js +3 -1
  14. package/lib/platform/template/wx/component-config/form.js +27 -2
  15. package/lib/platform/template/wx/component-config/image.js +5 -0
  16. package/lib/platform/template/wx/component-config/input.js +10 -0
  17. package/lib/platform/template/wx/component-config/label.js +10 -2
  18. package/lib/platform/template/wx/component-config/map.js +11 -0
  19. package/lib/platform/template/wx/component-config/movable-area.js +4 -1
  20. package/lib/platform/template/wx/component-config/movable-view.js +17 -2
  21. package/lib/platform/template/wx/component-config/navigator.js +26 -0
  22. package/lib/platform/template/wx/component-config/picker-view.js +12 -0
  23. package/lib/platform/template/wx/component-config/picker.js +3 -1
  24. package/lib/platform/template/wx/component-config/progress.js +11 -1
  25. package/lib/platform/template/wx/component-config/rich-text.js +5 -0
  26. package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
  27. package/lib/platform/template/wx/component-config/slider.js +8 -0
  28. package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
  29. package/lib/platform/template/wx/component-config/swiper.js +10 -0
  30. package/lib/platform/template/wx/component-config/text.js +5 -0
  31. package/lib/platform/template/wx/component-config/textarea.js +19 -2
  32. package/lib/platform/template/wx/component-config/unsupported.js +10 -1
  33. package/lib/platform/template/wx/component-config/video.js +10 -0
  34. package/lib/platform/template/wx/index.js +21 -1
  35. package/lib/react/LoadAsyncChunkModule.js +1 -1
  36. package/lib/react/processStyles.js +21 -9
  37. package/lib/react/style-helper.js +76 -13
  38. package/lib/resolver/AddModePlugin.js +23 -8
  39. package/lib/runtime/components/react/animationHooks/index.ts +75 -0
  40. package/lib/runtime/components/react/animationHooks/useAnimationAPIHooks.ts +198 -0
  41. package/lib/runtime/components/react/animationHooks/useTransitionHooks.ts +297 -0
  42. package/lib/runtime/components/react/animationHooks/utils.ts +196 -0
  43. package/lib/runtime/components/react/context.ts +7 -1
  44. package/lib/runtime/components/react/dist/animationHooks/index.d.ts +16 -0
  45. package/lib/runtime/components/react/dist/animationHooks/index.d.ts.map +1 -0
  46. package/lib/runtime/components/react/dist/animationHooks/index.js +67 -0
  47. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +4 -0
  48. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts.map +1 -0
  49. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.js +182 -0
  50. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +4 -0
  51. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts.map +1 -0
  52. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.js +274 -0
  53. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +110 -0
  54. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts.map +1 -0
  55. package/lib/runtime/components/react/dist/animationHooks/utils.js +150 -0
  56. package/lib/runtime/components/react/dist/context.d.ts +6 -1
  57. package/lib/runtime/components/react/dist/context.d.ts.map +1 -1
  58. package/lib/runtime/components/react/dist/mpx-camera.d.ts +32 -0
  59. package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +1 -0
  60. package/lib/runtime/components/react/dist/mpx-camera.jsx +236 -0
  61. package/lib/runtime/components/react/dist/mpx-input.d.ts +2 -0
  62. package/lib/runtime/components/react/dist/mpx-input.d.ts.map +1 -1
  63. package/lib/runtime/components/react/dist/mpx-input.jsx +21 -10
  64. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +1 -1
  65. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +3 -0
  66. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +2 -2
  67. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +10 -0
  68. package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +1 -1
  69. package/lib/runtime/components/react/dist/mpx-swiper.jsx +28 -16
  70. package/lib/runtime/components/react/dist/mpx-view.d.ts +3 -2
  71. package/lib/runtime/components/react/dist/mpx-view.d.ts.map +1 -1
  72. package/lib/runtime/components/react/dist/mpx-view.jsx +2 -2
  73. package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
  74. package/lib/runtime/components/react/dist/utils.d.ts +1 -0
  75. package/lib/runtime/components/react/dist/utils.d.ts.map +1 -1
  76. package/lib/runtime/components/react/dist/utils.jsx +34 -13
  77. package/lib/runtime/components/react/mpx-camera.tsx +327 -0
  78. package/lib/runtime/components/react/mpx-input.tsx +26 -10
  79. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +3 -0
  80. package/lib/runtime/components/react/mpx-portal/portal-manager.tsx +2 -2
  81. package/lib/runtime/components/react/mpx-swiper.tsx +43 -15
  82. package/lib/runtime/components/react/mpx-view.tsx +4 -5
  83. package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
  84. package/lib/runtime/components/react/types/global.d.ts +1 -0
  85. package/lib/runtime/components/react/utils.tsx +34 -16
  86. package/lib/runtime/optionProcessor.js +5 -0
  87. package/lib/runtime/optionProcessorReact.js +7 -0
  88. package/lib/runtime/stringify.wxs +2 -2
  89. package/lib/style-compiler/strip-conditional-loader/rebaseUrl.js +225 -0
  90. package/lib/style-compiler/strip-conditional-loader.js +55 -180
  91. package/lib/template-compiler/compiler.js +1 -3
  92. package/lib/utils/dom-tag-config.js +1 -1
  93. package/lib/utils/string.js +25 -1
  94. package/package.json +2 -1
  95. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -33
  96. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
  97. package/lib/runtime/components/react/dist/useAnimationHooks.js +0 -289
  98. package/lib/runtime/components/react/useAnimationHooks.ts +0 -320
@@ -1,6 +1,8 @@
1
1
  const TAG_NAME = 'label'
2
2
 
3
- module.exports = function () {
3
+ module.exports = function ({ print }) {
4
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
5
+
4
6
  return {
5
7
  test: TAG_NAME,
6
8
  ios (tag, { el }) {
@@ -14,6 +16,12 @@ module.exports = function () {
14
16
  harmony (tag, { el }) {
15
17
  el.isBuiltIn = true
16
18
  return 'mpx-label'
17
- }
19
+ },
20
+ props: [
21
+ {
22
+ test: /^(for)$/,
23
+ ks: ksPropLog
24
+ }
25
+ ]
18
26
  }
19
27
  }
@@ -12,6 +12,9 @@ module.exports = function ({ print }) {
12
12
  const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
13
13
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
14
14
  const qaEventLogError = print({ platform: 'qa', tag: TAG_NAME, isError: true, type: 'event' })
15
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
16
+ const ksEventLogError = print({ platform: 'ks', tag: TAG_NAME, isError: true, type: 'event' })
17
+
15
18
  return {
16
19
  // 匹配标签名,可传递正则
17
20
  test: TAG_NAME,
@@ -55,6 +58,10 @@ module.exports = function ({ print }) {
55
58
  {
56
59
  test: /^(min-scale|max-scale|covers|polyline|include-points|show-location|subkey|layer-style|skew|enable-3D|show-compass|show-scale|enable-overlooking|enable-zoom|enable-scroll|enable-rotate|enable-satellite|enable-traffic|enable-poi|enable-building|setting)$/,
57
60
  qa: qaPropLog
61
+ },
62
+ {
63
+ test: /^(min-scale|max-scale|covers|polyline|controls|include-points|show-location|polygons|subkey|layer-style|skew|enable-3D|show-compass|show-scale|enable-overlooking|enable-auto-max-overlooking|enable-zoom|enable-scroll|enable-rotate|enable-satellite|enable-traffic|enable-poi|enable-building|setting)$/,
64
+ ks: ksPropLog
58
65
  }
59
66
  ],
60
67
  // 组件事件中的差异部分
@@ -93,6 +100,10 @@ module.exports = function ({ print }) {
93
100
  {
94
101
  test: /^(labeltap|anchorpointtap)$/,
95
102
  qa: qaEventLogError
103
+ },
104
+ {
105
+ test: /^(updated|regionchange|poitap|polylinetap|abilitysuccess|abilityfail|authsuccess|interpolatepoint|error)$/,
106
+ ks: ksEventLogError
96
107
  }
97
108
  ]
98
109
  }
@@ -4,6 +4,8 @@ module.exports = function ({ print }) {
4
4
  const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
5
5
  const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
6
6
  const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
7
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
8
+
7
9
  return {
8
10
  test: TAG_NAME,
9
11
  web (tag, { el }) {
@@ -27,7 +29,8 @@ module.exports = function ({ print }) {
27
29
  test: /^(scale-area)$/,
28
30
  ios: iosPropLog,
29
31
  android: androidPropLog,
30
- harmony: harmonyPropLog
32
+ harmony: harmonyPropLog,
33
+ ks: ksPropLog
31
34
  }
32
35
  ]
33
36
  }
@@ -9,6 +9,9 @@ module.exports = function ({ print }) {
9
9
  const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
10
10
  const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
11
11
  const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
12
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
13
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
14
+
12
15
  return {
13
16
  test: TAG_NAME,
14
17
  web (tag, { el }) {
@@ -36,7 +39,18 @@ module.exports = function ({ print }) {
36
39
  harmony: harmonyPropLog
37
40
  },
38
41
  {
39
- test: /^(damping|friction|scale|scale-min|scale-max|scale-value)$/,
42
+ test: /^(inertia)$/,
43
+ ks: ksPropLog
44
+ },
45
+ {
46
+ test: /^(damping|friction)$/,
47
+ ios: iosPropLog,
48
+ android: androidPropLog,
49
+ harmony: harmonyPropLog,
50
+ ks: ksPropLog
51
+ },
52
+ {
53
+ test: /^(scale|scale-min|scale-max|scale-value)$/,
40
54
  ios: iosPropLog,
41
55
  android: androidPropLog,
42
56
  harmony: harmonyPropLog
@@ -45,7 +59,8 @@ module.exports = function ({ print }) {
45
59
  event: [
46
60
  {
47
61
  test: /^(htouchmove|vtouchmove)$/,
48
- ali: aliEventLog
62
+ ali: aliEventLog,
63
+ ks: ksEventLog
49
64
  },
50
65
  {
51
66
  test: /^(bindscale)$/,
@@ -22,6 +22,16 @@ module.exports = function ({ print }) {
22
22
  const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
23
23
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
24
24
  const qaValueLogError = print({ platform: 'qa', tag: TAG_NAME, isError: true, type: 'value' })
25
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
26
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
27
+ const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
28
+ const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
29
+ const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
30
+ const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
31
+ const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
32
+ const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
33
+ const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
34
+
25
35
  return {
26
36
  test: TAG_NAME,
27
37
  web (tag, { el }) {
@@ -103,6 +113,18 @@ module.exports = function ({ print }) {
103
113
  {
104
114
  test: /^(target|app-id|path|extra-data|version)$/,
105
115
  web: webPropLog
116
+ },
117
+ {
118
+ test: /^(short-link)$/,
119
+ ks: ksPropLog,
120
+ web: webPropLog,
121
+ ios: iosPropLog,
122
+ android: androidPropLog,
123
+ harmony: harmonyPropLog,
124
+ jd: jdPropLog,
125
+ ali: aliPropLog,
126
+ tt: ttPropLog,
127
+ qa: qaPropLog
106
128
  }
107
129
  ],
108
130
  event: [
@@ -112,6 +134,10 @@ module.exports = function ({ print }) {
112
134
  tt: ttEventLog,
113
135
  web: webEventLog,
114
136
  qa: qaEventLog,
137
+ ks: ksEventLog,
138
+ ios: iosEventLog,
139
+ android: androidEventLog,
140
+ harmony: harmonyEventLog,
115
141
  jd (eventName) {
116
142
  const eventMap = {
117
143
  success: 'success',
@@ -9,6 +9,8 @@ module.exports = function ({ print }) {
9
9
  const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
10
10
  const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
11
11
  const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
12
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
13
+ const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
12
14
 
13
15
  return {
14
16
  test: TAG_NAME,
@@ -44,6 +46,16 @@ module.exports = function ({ print }) {
44
46
  ios: iosEventLog,
45
47
  android: androidEventLog,
46
48
  harmony: harmonyEventLog
49
+ },
50
+ {
51
+ test: /^(immediate-change)$/,
52
+ swan: baiduEventLog,
53
+ ks: ksEventLog,
54
+ ios: iosEventLog,
55
+ android: androidEventLog,
56
+ harmony: harmonyEventLog,
57
+ web: webEventLog,
58
+ jd: jdEventLog
47
59
  }
48
60
  ]
49
61
  }
@@ -11,6 +11,7 @@ module.exports = function ({ print }) {
11
11
  const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
12
12
  const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
13
13
  const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
14
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
14
15
 
15
16
  return {
16
17
  test: TAG_NAME,
@@ -49,7 +50,8 @@ module.exports = function ({ print }) {
49
50
  qa: qaPropLog,
50
51
  ios: iosPropLog,
51
52
  android: androidPropLog,
52
- harmony: harmonyPropLog
53
+ harmony: harmonyPropLog,
54
+ ks: ksPropLog
53
55
  }
54
56
  ],
55
57
  event: [
@@ -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,12 +6,14 @@ 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
  // 快应用不支持的标签集合
12
14
  const QA_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image']
13
15
  // RN不支持的标签集合
14
- const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'audio', 'camera', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
16
+ const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'audio', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
15
17
 
16
18
  /**
17
19
  * @param {function(object): function} print
@@ -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]
@@ -54,7 +54,7 @@ class LoadAsyncChunkRuntimeModule extends HelperRuntimeModule {
54
54
  ]),
55
55
  '}',
56
56
  `var timeout = setTimeout(callback.bind(null, 'timeout'), ${this.timeout})`,
57
- 'var loadChunkAsyncFn = global.__mpx.config.rnConfig && global.__mpx.config.rnConfig.loadChunkAsync',
57
+ `var loadChunkAsyncFn = ${RuntimeGlobals.global}.__mpx.config.rnConfig && ${RuntimeGlobals.global}.__mpx.config.rnConfig.loadChunkAsync`,
58
58
  'try {',
59
59
  Template.indent([
60
60
  'loadChunkAsyncFn(config).then(callback).catch(callback)'
@@ -2,6 +2,7 @@ const createHelpers = require('../helpers')
2
2
  const async = require('async')
3
3
  const getClassMap = require('./style-helper').getClassMap
4
4
  const shallowStringify = require('../utils/shallow-stringify')
5
+ const isValidIdentifierStr = require('../utils/is-valid-identifier-str')
5
6
 
6
7
  module.exports = function (styles, {
7
8
  loaderContext,
@@ -47,6 +48,11 @@ module.exports = function (styles, {
47
48
  }, (err) => {
48
49
  if (err) return callback(err)
49
50
  try {
51
+ output += `
52
+ global.__classCaches = global.__classCaches || []
53
+ var __classCache = new Map()
54
+ global.__classCaches.push(__classCache)`
55
+ const formatValueName = '_f'
50
56
  const classMap = getClassMap({
51
57
  content,
52
58
  filename: loaderContext.resourcePath,
@@ -54,26 +60,32 @@ module.exports = function (styles, {
54
60
  srcMode,
55
61
  ctorType,
56
62
  warn,
57
- error
63
+ error,
64
+ formatValueName
58
65
  })
66
+ const classMapCode = Object.entries(classMap).reduce((result, [key, value]) => {
67
+ result !== '' && (result += ',')
68
+ result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: function(${formatValueName}){return ${shallowStringify(value)};}`
69
+ return result
70
+ }, '')
59
71
  if (ctorType === 'app') {
60
72
  output += `
61
- let __appClassMap
62
- global.__getAppClassMap = function() {
73
+ var __appClassMap
74
+ global.__getAppClassStyle = function(className) {
63
75
  if(!__appClassMap) {
64
- __appClassMap = ${shallowStringify(classMap)};
76
+ __appClassMap = {${classMapCode}};
65
77
  }
66
- return __appClassMap;
78
+ return global.__GCC(className, __appClassMap, __classCache);
67
79
  };\n`
68
80
  } else {
69
81
  output += `
70
- let __classMap
82
+ var __classMap
71
83
  global.currentInject.injectMethods = {
72
- __getClassMap: function() {
84
+ __getClassStyle: function(className) {
73
85
  if(!__classMap) {
74
- __classMap = ${shallowStringify(classMap)};
86
+ __classMap = {${classMapCode}};
75
87
  }
76
- return __classMap;
88
+ return global.__GCC(className, __classMap, __classCache);
77
89
  }
78
90
  };\n`
79
91
  }