@mpxjs/webpack-plugin 2.10.16-beta.7 → 2.10.17
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/LICENSE +433 -0
- package/lib/config.js +0 -60
- package/lib/file-loader.js +3 -13
- package/lib/json-compiler/index.js +2 -2
- package/lib/platform/json/wx/index.js +0 -6
- package/lib/platform/template/wx/component-config/ad.js +0 -5
- package/lib/platform/template/wx/component-config/button.js +2 -9
- package/lib/platform/template/wx/component-config/camera.js +3 -25
- package/lib/platform/template/wx/component-config/canvas.js +1 -8
- package/lib/platform/template/wx/component-config/cover-image.js +2 -7
- package/lib/platform/template/wx/component-config/cover-view.js +1 -3
- package/lib/platform/template/wx/component-config/form.js +2 -27
- package/lib/platform/template/wx/component-config/image.js +0 -5
- package/lib/platform/template/wx/component-config/input.js +0 -10
- package/lib/platform/template/wx/component-config/label.js +2 -10
- package/lib/platform/template/wx/component-config/map.js +0 -11
- package/lib/platform/template/wx/component-config/movable-area.js +1 -4
- package/lib/platform/template/wx/component-config/movable-view.js +2 -17
- package/lib/platform/template/wx/component-config/navigator.js +0 -26
- package/lib/platform/template/wx/component-config/picker-view.js +0 -12
- package/lib/platform/template/wx/component-config/picker.js +1 -3
- package/lib/platform/template/wx/component-config/progress.js +1 -11
- package/lib/platform/template/wx/component-config/rich-text.js +0 -5
- package/lib/platform/template/wx/component-config/scroll-view.js +1 -12
- package/lib/platform/template/wx/component-config/slider.js +0 -8
- package/lib/platform/template/wx/component-config/swiper-item.js +2 -5
- package/lib/platform/template/wx/component-config/swiper.js +0 -10
- package/lib/platform/template/wx/component-config/text.js +0 -5
- package/lib/platform/template/wx/component-config/textarea.js +2 -19
- package/lib/platform/template/wx/component-config/unsupported.js +1 -10
- package/lib/platform/template/wx/component-config/video.js +0 -10
- package/lib/platform/template/wx/index.js +1 -21
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-image.jsx +26 -20
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-input.jsx +1 -3
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +11 -3
- package/lib/runtime/components/react/mpx-canvas/index.tsx +1 -1
- package/lib/runtime/components/react/mpx-image.tsx +41 -35
- package/lib/runtime/components/react/mpx-input.tsx +1 -3
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +1 -1
- package/lib/runtime/components/react/mpx-web-view.tsx +14 -5
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/style-compiler/strip-conditional-loader.js +4 -5
- package/lib/template-compiler/bind-this.js +2 -2
- package/lib/template-compiler/compiler.js +3 -3
- package/lib/template-compiler/index.js +6 -6
- package/lib/utils/dom-tag-config.js +1 -1
- package/lib/utils/merge-visitors.js +55 -0
- package/lib/wxs/pre-loader.js +8 -5
- package/package.json +7 -8
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -28
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.jsx +0 -102
- package/lib/runtime/components/react/mpx-camera.tsx +0 -167
- package/lib/utils/chain-assign.js +0 -47
|
@@ -23,8 +23,6 @@ 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' })
|
|
28
26
|
|
|
29
27
|
return {
|
|
30
28
|
test: TAG_NAME,
|
|
@@ -97,17 +95,12 @@ module.exports = function ({ print }) {
|
|
|
97
95
|
ios: iosPropLog,
|
|
98
96
|
android: androidPropLog,
|
|
99
97
|
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
|
|
104
98
|
}
|
|
105
99
|
],
|
|
106
100
|
event: [
|
|
107
101
|
{
|
|
108
102
|
test: /^(confirm|linechange)$/,
|
|
109
|
-
web: webEventLog
|
|
110
|
-
ks: ksEventLog
|
|
103
|
+
web: webEventLog
|
|
111
104
|
},
|
|
112
105
|
{
|
|
113
106
|
test: /^keyboardheightchange$/,
|
|
@@ -131,17 +124,7 @@ module.exports = function ({ print }) {
|
|
|
131
124
|
test: /^keyboard.+$/,
|
|
132
125
|
ios: iosEventLog,
|
|
133
126
|
android: androidEventLog,
|
|
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
|
|
127
|
+
harmony: harmonyEventLog
|
|
145
128
|
}
|
|
146
129
|
]
|
|
147
130
|
}
|
|
@@ -6,14 +6,12 @@ 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']
|
|
11
9
|
// 京东小程序不支持的标签集合
|
|
12
10
|
const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'live-player', 'rich-text', 'audio', 'video', 'camera']
|
|
13
11
|
// 快应用不支持的标签集合
|
|
14
12
|
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']
|
|
15
13
|
// RN不支持的标签集合
|
|
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']
|
|
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']
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* @param {function(object): function} print
|
|
@@ -24,7 +22,6 @@ module.exports = function ({ print }) {
|
|
|
24
22
|
const baiduUnsupportedTagError = print({ platform: 'baidu', isError: true, type: 'tag' })
|
|
25
23
|
const qqUnsupportedTagError = print({ platform: 'qq', isError: true, type: 'tag' })
|
|
26
24
|
const ttUnsupportedTagError = print({ platform: 'bytedance', isError: true, type: 'tag' })
|
|
27
|
-
const ksUnsupportedTagError = print({ platform: 'ks', isError: true, type: 'tag' })
|
|
28
25
|
const jdUnsupportedTagError = print({ platform: 'jd', isError: true, type: 'tag' })
|
|
29
26
|
const qaUnsupportedTagError = print({ platform: 'qa', isError: true, type: 'tag' })
|
|
30
27
|
const iosUnsupportedTagError = print({ platform: 'ios', isError: true, type: 'tag' })
|
|
@@ -35,7 +32,6 @@ module.exports = function ({ print }) {
|
|
|
35
32
|
const baiduUnsupportedExp = new RegExp('^(' + BAIDU_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
36
33
|
const qqUnsupportedExp = new RegExp('^(' + QQ_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
37
34
|
const ttUnsupportedExp = new RegExp('^(' + TT_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
38
|
-
const ksUnsupportedExp = new RegExp('^(' + KS_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
39
35
|
const jdUnsupportedExp = new RegExp('^(' + JD_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
40
36
|
const qaUnsupportedExp = new RegExp('^(' + QA_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
41
37
|
const iosUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
@@ -63,11 +59,6 @@ module.exports = function ({ print }) {
|
|
|
63
59
|
test: ttUnsupportedExp,
|
|
64
60
|
tt: ttUnsupportedTagError
|
|
65
61
|
},
|
|
66
|
-
{
|
|
67
|
-
supportedModes: ['ks'],
|
|
68
|
-
test: ksUnsupportedExp,
|
|
69
|
-
ks: ksUnsupportedTagError
|
|
70
|
-
},
|
|
71
62
|
{
|
|
72
63
|
supportedModes: ['jd'],
|
|
73
64
|
test: jdUnsupportedExp,
|
|
@@ -17,8 +17,6 @@ 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' })
|
|
22
20
|
return {
|
|
23
21
|
test: TAG_NAME,
|
|
24
22
|
web (tag, { el }) {
|
|
@@ -76,10 +74,6 @@ module.exports = function ({ print }) {
|
|
|
76
74
|
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)$/,
|
|
77
75
|
android: androidPropLog,
|
|
78
76
|
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
|
|
83
77
|
}
|
|
84
78
|
],
|
|
85
79
|
event: [
|
|
@@ -123,10 +117,6 @@ module.exports = function ({ print }) {
|
|
|
123
117
|
test: /^(progress|enterpictureinpicture|leavepictureinpicture|castinguserselect|castingstatechange|castinginterrupt)$/,
|
|
124
118
|
android: androidEventLogError,
|
|
125
119
|
harmony: harmonyEventLogError
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
test: /^(waiting|controlstoggle|enterpictureinpicture|leavepictureinpicture|seekcomplete|castinguserselect)$/,
|
|
129
|
-
ks: ksEventLogError
|
|
130
120
|
}
|
|
131
121
|
]
|
|
132
122
|
}
|
|
@@ -62,7 +62,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const spec = {
|
|
65
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', '
|
|
65
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'harmony'],
|
|
66
66
|
// props预处理
|
|
67
67
|
preProps: [],
|
|
68
68
|
// props后处理
|
|
@@ -325,13 +325,6 @@ 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
|
-
},
|
|
335
328
|
dd ({ name, value }) {
|
|
336
329
|
const dir = this.test.exec(name)[1]
|
|
337
330
|
return {
|
|
@@ -420,19 +413,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
420
413
|
value
|
|
421
414
|
}
|
|
422
415
|
},
|
|
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
|
-
},
|
|
436
416
|
dd ({ name, value }, { eventRules }) {
|
|
437
417
|
const match = this.test.exec(name)
|
|
438
418
|
const prefix = match[1]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mpx-image.d.ts","sourceRoot":"","sources":["../mpx-image.tsx"],"names":[],"mappings":";AAaA,OAAO,EACL,KAAK,IAAI,OAAO,EAEhB,UAAU,EAEV,oBAAoB,EACpB,mBAAmB,EAGnB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAIrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,MAAM,MAAM,IAAI,GACZ,aAAa,GACb,WAAW,GACX,YAAY,GACZ,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAA;AAElB,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IAC5E,SAAS,CAAC,EAAE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O,KAAK,IAAI,CAAA;CAC/E;AAmED,QAAA,MAAM,KAAK,wHAoYT,CAAA;AAIF,eAAe,KAAK,CAAA"}
|
|
@@ -315,29 +315,35 @@ const Image = forwardRef((props, ref) => {
|
|
|
315
315
|
], {
|
|
316
316
|
layoutRef
|
|
317
317
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
318
|
+
function renderSvgImage() {
|
|
319
|
+
return createElement(View, innerProps, createElement(SvgCssUri, {
|
|
320
|
+
uri: src,
|
|
321
|
+
onLayout: onSvgLoad,
|
|
322
|
+
onError: binderror && onSvgError,
|
|
323
|
+
style: extendObject({ transformOrigin: 'left top' }, modeStyle)
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
function renderBaseImage() {
|
|
327
|
+
return renderImage(extendObject({
|
|
328
|
+
source: { uri: src },
|
|
329
|
+
resizeMode: resizeMode,
|
|
330
|
+
onLoad: bindload && onImageLoad,
|
|
331
|
+
onError: binderror && onImageError,
|
|
332
|
+
style: extendObject({
|
|
333
|
+
transformOrigin: 'left top',
|
|
334
|
+
width: isCropMode ? imageWidth : '100%',
|
|
335
|
+
height: isCropMode ? imageHeight : '100%'
|
|
336
|
+
}, isCropMode ? modeStyle : {})
|
|
337
|
+
}, isLayoutMode ? {} : innerProps), enableFastImage);
|
|
338
|
+
}
|
|
339
|
+
function renderLayoutImage() {
|
|
340
|
+
return createElement(View, innerProps, loaded && renderBaseImage());
|
|
341
|
+
}
|
|
342
|
+
const finalComponent = isSvg ? renderSvgImage() : isLayoutMode ? renderLayoutImage() : renderBaseImage();
|
|
337
343
|
if (hasPositionFixed) {
|
|
338
344
|
return createElement(Portal, null, finalComponent);
|
|
339
345
|
}
|
|
340
346
|
return finalComponent;
|
|
341
347
|
});
|
|
342
|
-
Image.displayName = '
|
|
348
|
+
Image.displayName = 'MpxImage';
|
|
343
349
|
export default Image;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mpx-input.d.ts","sourceRoot":"","sources":["../mpx-input.tsx"],"names":[],"mappings":";AAwCA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,mCAAmC,EACnC,SAAS,EACT,iCAAiC,EACjC,uBAAuB,EAEvB,+BAA+B,EAEhC,MAAM,cAAc,CAAA;AAIrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,KAAK,UAAU,GAAG,IAAI,CACpB,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAClD,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GACtB,yBAAyB,GACzB,wBAAwB,CAC3B,CAAA;AAED,KAAK,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElD,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;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,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;IACzH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,iCAAiC,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CACvG;AAED,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,mCAAmC,CAAC,GAAG,OAAO,KAAK,IAAI,CAAA;CACpG;AAED,KAAK,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAA;AASrD,QAAA,MAAM,KAAK,mJAqYT,CAAA;AAIF,eAAe,KAAK,CAAA"}
|
|
@@ -156,9 +156,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
156
156
|
evt.nativeEvent.origin = 'input';
|
|
157
157
|
};
|
|
158
158
|
const onFocus = (evt) => {
|
|
159
|
-
|
|
160
|
-
setKeyboardAvoidContext();
|
|
161
|
-
}
|
|
159
|
+
setKeyboardAvoidContext();
|
|
162
160
|
if (bindfocus) {
|
|
163
161
|
const focusAction = () => {
|
|
164
162
|
bindfocus(getCustomEvent('focus', evt, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mpx-web-view.d.ts","sourceRoot":"","sources":["../mpx-web-view.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAMvD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,EAAE,CAAA;KACZ,CAAA;CACF,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;CACF,CAAA;AAED,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAA;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC/C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAChD,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB;AAgDD,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"mpx-web-view.d.ts","sourceRoot":"","sources":["../mpx-web-view.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAMvD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,EAAE,CAAA;KACZ,CAAA;CACF,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;CACF,CAAA;AAED,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAA;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC/C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAChD,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB;AAgDD,QAAA,MAAM,QAAQ,6IAmSZ,CAAA;AAIF,eAAe,QAAQ,CAAA"}
|
|
@@ -80,8 +80,16 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
80
80
|
useNodesRef(props, ref, webViewRef, {
|
|
81
81
|
style: defaultWebViewStyle
|
|
82
82
|
});
|
|
83
|
+
const getHostFromUrl = function (url) {
|
|
84
|
+
if (!url)
|
|
85
|
+
return '';
|
|
86
|
+
// 匹配协议://主机名(:端口) 的模式
|
|
87
|
+
const regex = /^(?:https?|ftp):\/\/([^/?:#]+)(?::(\d+))?/i;
|
|
88
|
+
const match = url.match(regex);
|
|
89
|
+
return match ? match[1] : '';
|
|
90
|
+
};
|
|
83
91
|
const hostValidate = (url) => {
|
|
84
|
-
const host = url &&
|
|
92
|
+
const host = url && getHostFromUrl(url);
|
|
85
93
|
const hostWhitelists = mpx.config.rnConfig?.webviewConfig?.hostWhitelists || [];
|
|
86
94
|
if (hostWhitelists.length) {
|
|
87
95
|
return hostWhitelists.some((item) => {
|
|
@@ -176,7 +184,7 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
176
184
|
}
|
|
177
185
|
break;
|
|
178
186
|
case 'postMessage':
|
|
179
|
-
bindmessage && bindmessage(getCustomEvent('
|
|
187
|
+
bindmessage && bindmessage(getCustomEvent('messsage', {}, {
|
|
180
188
|
detail: {
|
|
181
189
|
data: params[0]?.data
|
|
182
190
|
}
|
|
@@ -291,7 +299,7 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
291
299
|
<View style={styles.loadErrorText}><Text style={{ fontSize: 14, color: '#999999' }}>{currentErrorText.text}</Text></View>
|
|
292
300
|
<View style={styles.loadErrorButton} onTouchEnd={_reload}><Text style={{ fontSize: 12, color: '#666666' }}>{currentErrorText.button}</Text></View>
|
|
293
301
|
</View>)
|
|
294
|
-
: (<WebView
|
|
302
|
+
: (<WebView containerStyle={defaultWebViewStyle} source={{ uri: src }} ref={webViewRef} javaScriptEnabled={true} onNavigationStateChange={_changeUrl} onMessage={_message} injectedJavaScript={injectedJavaScript} onLoadProgress={_onLoadProgress} onLoadEnd={onLoadEnd} onHttpError={onHttpError} onError={onError} allowsBackForwardNavigationGestures={true}></WebView>)}
|
|
295
303
|
</Portal>);
|
|
296
304
|
});
|
|
297
305
|
_WebView.displayName = 'MpxWebview';
|
|
@@ -464,44 +464,50 @@ const Image = forwardRef<HandlerRef<RNImage, ImageProps>, ImageProps>((props, re
|
|
|
464
464
|
}
|
|
465
465
|
)
|
|
466
466
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
{ transformOrigin: 'left top' },
|
|
476
|
-
modeStyle
|
|
477
|
-
)
|
|
478
|
-
})
|
|
479
|
-
)
|
|
480
|
-
|
|
481
|
-
const BaseImage = renderImage(
|
|
482
|
-
extendObject(
|
|
483
|
-
{
|
|
484
|
-
source: { uri: src },
|
|
485
|
-
resizeMode: resizeMode,
|
|
486
|
-
onLoad: bindload && onImageLoad,
|
|
487
|
-
onError: binderror && onImageError,
|
|
467
|
+
function renderSvgImage () {
|
|
468
|
+
return createElement(
|
|
469
|
+
View,
|
|
470
|
+
innerProps,
|
|
471
|
+
createElement(SvgCssUri, {
|
|
472
|
+
uri: src,
|
|
473
|
+
onLayout: onSvgLoad,
|
|
474
|
+
onError: binderror && onSvgError,
|
|
488
475
|
style: extendObject(
|
|
489
|
-
{
|
|
490
|
-
|
|
491
|
-
width: isCropMode ? imageWidth : '100%',
|
|
492
|
-
height: isCropMode ? imageHeight : '100%'
|
|
493
|
-
},
|
|
494
|
-
isCropMode ? modeStyle : {}
|
|
476
|
+
{ transformOrigin: 'left top' },
|
|
477
|
+
modeStyle
|
|
495
478
|
)
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
enableFastImage
|
|
500
|
-
)
|
|
479
|
+
})
|
|
480
|
+
)
|
|
481
|
+
}
|
|
501
482
|
|
|
502
|
-
|
|
483
|
+
function renderBaseImage () {
|
|
484
|
+
return renderImage(
|
|
485
|
+
extendObject(
|
|
486
|
+
{
|
|
487
|
+
source: { uri: src },
|
|
488
|
+
resizeMode: resizeMode,
|
|
489
|
+
onLoad: bindload && onImageLoad,
|
|
490
|
+
onError: binderror && onImageError,
|
|
491
|
+
style: extendObject(
|
|
492
|
+
{
|
|
493
|
+
transformOrigin: 'left top',
|
|
494
|
+
width: isCropMode ? imageWidth : '100%',
|
|
495
|
+
height: isCropMode ? imageHeight : '100%'
|
|
496
|
+
},
|
|
497
|
+
isCropMode ? modeStyle : {}
|
|
498
|
+
)
|
|
499
|
+
},
|
|
500
|
+
isLayoutMode ? {} : innerProps
|
|
501
|
+
),
|
|
502
|
+
enableFastImage
|
|
503
|
+
)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function renderLayoutImage () {
|
|
507
|
+
return createElement(View, innerProps, loaded && renderBaseImage())
|
|
508
|
+
}
|
|
503
509
|
|
|
504
|
-
const finalComponent = isSvg ?
|
|
510
|
+
const finalComponent = isSvg ? renderSvgImage() : isLayoutMode ? renderLayoutImage() : renderBaseImage()
|
|
505
511
|
|
|
506
512
|
if (hasPositionFixed) {
|
|
507
513
|
return createElement(Portal, null, finalComponent)
|
|
@@ -510,6 +516,6 @@ const Image = forwardRef<HandlerRef<RNImage, ImageProps>, ImageProps>((props, re
|
|
|
510
516
|
return finalComponent
|
|
511
517
|
})
|
|
512
518
|
|
|
513
|
-
Image.displayName = '
|
|
519
|
+
Image.displayName = 'MpxImage'
|
|
514
520
|
|
|
515
521
|
export default Image
|
|
@@ -295,9 +295,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
const onFocus = (evt: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
298
|
-
|
|
299
|
-
setKeyboardAvoidContext()
|
|
300
|
-
}
|
|
298
|
+
setKeyboardAvoidContext()
|
|
301
299
|
|
|
302
300
|
if (bindfocus) {
|
|
303
301
|
const focusAction = () => {
|
|
@@ -127,8 +127,16 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
127
127
|
style: defaultWebViewStyle
|
|
128
128
|
})
|
|
129
129
|
|
|
130
|
+
const getHostFromUrl = function (url: string): string {
|
|
131
|
+
if (!url) return ''
|
|
132
|
+
// 匹配协议://主机名(:端口) 的模式
|
|
133
|
+
const regex = /^(?:https?|ftp):\/\/([^/?:#]+)(?::(\d+))?/i
|
|
134
|
+
const match = url.match(regex)
|
|
135
|
+
return match ? match[1] : ''
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
const hostValidate = (url: string) => {
|
|
131
|
-
const host = url &&
|
|
139
|
+
const host = url && getHostFromUrl(url)
|
|
132
140
|
const hostWhitelists = mpx.config.rnConfig?.webviewConfig?.hostWhitelists || []
|
|
133
141
|
if (hostWhitelists.length) {
|
|
134
142
|
return hostWhitelists.some((item: string) => {
|
|
@@ -226,7 +234,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
226
234
|
}
|
|
227
235
|
break
|
|
228
236
|
case 'postMessage':
|
|
229
|
-
bindmessage && bindmessage(getCustomEvent('
|
|
237
|
+
bindmessage && bindmessage(getCustomEvent('messsage', {}, { // RN组件销毁顺序与小程序不一致,所以改成和支付宝消息一致
|
|
230
238
|
detail: {
|
|
231
239
|
data: params[0]?.data
|
|
232
240
|
}
|
|
@@ -343,8 +351,9 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
343
351
|
<View style={styles.loadErrorButton} onTouchEnd={_reload}><Text style={{ fontSize: 12, color: '#666666' }}>{currentErrorText.button}</Text></View>
|
|
344
352
|
</View>
|
|
345
353
|
)
|
|
346
|
-
: (
|
|
347
|
-
|
|
354
|
+
: (
|
|
355
|
+
<WebView
|
|
356
|
+
containerStyle={ defaultWebViewStyle }
|
|
348
357
|
source={{ uri: src }}
|
|
349
358
|
ref={webViewRef}
|
|
350
359
|
javaScriptEnabled={true}
|
|
@@ -356,7 +365,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
356
365
|
onHttpError={onHttpError}
|
|
357
366
|
onError={onError}
|
|
358
367
|
allowsBackForwardNavigationGestures={true}
|
|
359
|
-
|
|
368
|
+
></WebView>)}
|
|
360
369
|
</Portal>
|
|
361
370
|
)
|
|
362
371
|
})
|
|
@@ -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__) {
|
|
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
|
+
}
|
|
@@ -243,14 +243,13 @@ async function stripByPostcss(options) {
|
|
|
243
243
|
// less/scss syntax 在 postcss 重新生成 css 后,`//` 注释后面不会保留换行,会和后续的 css 语句和注释连在一起,导致后续语法错误
|
|
244
244
|
postcssPlugin: 'mpx-strip-conditional-loader-append-command',
|
|
245
245
|
CommentExit(comment) {
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
comment.raws.right ??= ''
|
|
247
|
+
|
|
248
|
+
if (comment.raws.right.endsWith('\n')) {
|
|
248
249
|
return
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
comment.raws.right = '\n' + comment.raws.right
|
|
253
|
-
}
|
|
252
|
+
comment.raws.right += '\n'
|
|
254
253
|
}
|
|
255
254
|
}
|
|
256
255
|
]
|
|
@@ -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) ? `_sc(${JSON.stringify(key)});` : `_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('_sc') : t.identifier('_c')
|
|
440
440
|
const replaceNode = renderReduce
|
|
441
441
|
? t.callExpression(callee, [key])
|
|
442
442
|
: t.callExpression(callee, [key, path.node])
|
|
@@ -1014,7 +1014,7 @@ function processComponentIs (el, options) {
|
|
|
1014
1014
|
ranges = range.split(',').map(i => i.trim()).filter(i => i)
|
|
1015
1015
|
} else {
|
|
1016
1016
|
// 根据原始用户写的usingComponents字段生成ranges
|
|
1017
|
-
ranges = options.originalUsingComponents
|
|
1017
|
+
ranges = options.originalUsingComponents || []
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
1020
|
const rangeMap = new Map()
|
|
@@ -2720,7 +2720,7 @@ function postProcessTemplate (el) {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
}
|
|
2722
2722
|
|
|
2723
|
-
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,ios,android,harmony,
|
|
2723
|
+
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,ios,android,harmony,noMode')
|
|
2724
2724
|
|
|
2725
2725
|
function isValidModeP (i) {
|
|
2726
2726
|
return isValidMode(i[0] === '_' ? i.slice(1) : i)
|
|
@@ -3262,7 +3262,7 @@ function genFor (node) {
|
|
|
3262
3262
|
node.forProcessed = true
|
|
3263
3263
|
const index = node.for.index || 'index'
|
|
3264
3264
|
const item = node.for.item || 'item'
|
|
3265
|
-
return `
|
|
3265
|
+
return `_i(${node.for.exp}, function(${item},${index}){\n${genNode(node)}});\n`
|
|
3266
3266
|
}
|
|
3267
3267
|
|
|
3268
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
|
+
_i: true,
|
|
116
|
+
_c: true,
|
|
117
|
+
_sc: true,
|
|
118
|
+
_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 (_i, _c, _r, _sc) {
|
|
130
130
|
${bindResult.code}
|
|
131
|
-
|
|
131
|
+
_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`
|
|
@@ -91,7 +91,7 @@ const isBuildInReactTag = makeMap(
|
|
|
91
91
|
'mpx-movable-area,mpx-label,mpx-input,' +
|
|
92
92
|
'mpx-image,mpx-form,mpx-checkbox,mpx-checkbox-group,mpx-button,' +
|
|
93
93
|
'mpx-rich-text,mpx-picker-view-column,mpx-picker-view,mpx-picker,' +
|
|
94
|
-
'mpx-icon,mpx-canvas
|
|
94
|
+
'mpx-icon,mpx-canvas'
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
const isSpace = makeMap('ensp,emsp,nbsp')
|