@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.70-alpha.2
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 +3 -1
- package/lib/file-loader.js +5 -0
- package/lib/index.js +1 -1
- package/lib/loader.js +0 -1
- package/lib/parser.js +1 -1
- package/lib/platform/json/wx/index.js +21 -8
- package/lib/platform/style/wx/index.js +51 -54
- package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
- package/lib/platform/template/wx/component-config/index.js +1 -1
- package/lib/platform/template/wx/component-config/movable-view.js +8 -1
- package/lib/platform/template/wx/component-config/picker-view.js +1 -5
- package/lib/platform/template/wx/component-config/rich-text.js +8 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +1 -1
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/platform/template/wx/index.js +3 -5
- package/lib/react/processScript.js +6 -3
- package/lib/react/script-helper.js +5 -1
- package/lib/runtime/components/react/context.ts +8 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +39 -37
- package/lib/runtime/components/react/dist/mpx-button.jsx +16 -44
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
- package/lib/runtime/components/react/dist/mpx-icon/icons/cancel.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/clear.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/download.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/info.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/search.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/success.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/success_no_circle.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/waiting.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/icons/warn.png +0 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.jsx +50 -0
- package/lib/runtime/components/react/dist/mpx-image.jsx +19 -18
- package/lib/runtime/components/react/dist/mpx-input.jsx +11 -9
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +93 -58
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +10 -14
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +94 -81
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +19 -16
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +10 -11
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +20 -9
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +31 -8
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +435 -371
- package/lib/runtime/components/react/dist/mpx-view.jsx +18 -53
- package/lib/runtime/components/react/dist/pickerFaces.js +3 -8
- package/lib/runtime/components/react/dist/pickerVIewContext.js +5 -0
- package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerViewIndicator.jsx} +6 -6
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +2 -2
- package/lib/runtime/components/react/dist/useAnimationHooks.js +27 -10
- package/lib/runtime/components/react/dist/utils.jsx +162 -70
- package/lib/runtime/components/react/event.config.ts +25 -26
- package/lib/runtime/components/react/getInnerListeners.ts +236 -182
- package/lib/runtime/components/react/mpx-button.tsx +27 -69
- package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
- package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
- package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
- package/lib/runtime/components/react/mpx-form.tsx +15 -20
- package/lib/runtime/components/react/mpx-icon/icons/cancel.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/clear.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/download.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/info.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/search.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/success.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/success_no_circle.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/waiting.png +0 -0
- package/lib/runtime/components/react/mpx-icon/icons/warn.png +0 -0
- package/lib/runtime/components/react/mpx-icon/index.tsx +111 -0
- package/lib/runtime/components/react/mpx-image.tsx +99 -47
- package/lib/runtime/components/react/mpx-input.tsx +33 -39
- package/lib/runtime/components/react/mpx-label.tsx +12 -14
- package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
- package/lib/runtime/components/react/mpx-movable-view.tsx +133 -92
- package/lib/runtime/components/react/mpx-navigator.tsx +3 -9
- package/lib/runtime/components/react/mpx-picker-view-column-item.tsx +76 -0
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +206 -183
- package/lib/runtime/components/react/mpx-picker-view.tsx +49 -48
- package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
- package/lib/runtime/components/react/mpx-radio.tsx +19 -25
- package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +115 -0
- package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
- package/lib/runtime/components/react/mpx-scroll-view.tsx +62 -49
- package/lib/runtime/components/react/mpx-swiper-item.tsx +45 -11
- package/lib/runtime/components/react/mpx-swiper.tsx +742 -0
- package/lib/runtime/components/react/mpx-switch.tsx +19 -15
- package/lib/runtime/components/react/mpx-text.tsx +8 -16
- package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
- package/lib/runtime/components/react/mpx-view.tsx +28 -77
- package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
- package/lib/runtime/components/react/pickerFaces.ts +10 -7
- package/lib/runtime/components/react/pickerVIewContext.ts +27 -0
- package/lib/runtime/components/react/pickerViewIndicator.tsx +34 -0
- package/lib/runtime/components/react/pickerViewMask.tsx +30 -0
- package/lib/runtime/components/react/types/{getInnerListeners.ts → getInnerListeners.d.ts} +4 -5
- package/lib/runtime/components/react/types/global.d.ts +14 -1
- package/lib/runtime/components/react/useAnimationHooks.ts +60 -15
- package/lib/runtime/components/react/utils.tsx +175 -71
- package/lib/runtime/components/web/mpx-checkbox.vue +1 -1
- package/lib/runtime/components/web/mpx-picker-view-column.vue +9 -4
- package/lib/runtime/components/web/mpx-web-view.vue +34 -20
- package/lib/runtime/optionProcessor.js +0 -22
- package/lib/runtime/optionProcessor.tenon.js +3 -3
- package/lib/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/compiler.js +96 -29
- package/lib/tenon/index.js +2 -7
- package/lib/tenon/processScript.js +0 -5
- package/lib/tenon/processTemplate.js +1 -2
- package/lib/utils/pre-process-json.js +9 -5
- package/lib/wxss/loader.js +15 -2
- package/package.json +4 -3
- package/lib/runtime/components/react/dist/mpx-icon.jsx +0 -41
- package/lib/runtime/components/react/dist/types/common.js +0 -1
- package/lib/runtime/components/react/dist/types/getInnerListeners.js +0 -1
- package/lib/runtime/components/react/mpx-icon.tsx +0 -102
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +0 -527
- package/lib/runtime/components/react/mpx-swiper/index.tsx +0 -80
- package/lib/runtime/components/react/mpx-swiper/type.ts +0 -87
- package/lib/runtime/components/react/pickerOverlay.tsx +0 -32
- package/lib/runtime/components/web/event.js +0 -105
- /package/lib/runtime/components/react/types/{common.ts → common.d.ts} +0 -0
package/lib/config.js
CHANGED
|
@@ -138,7 +138,9 @@ module.exports = {
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
getEvent (eventName, prefix = 'on') {
|
|
141
|
-
return
|
|
141
|
+
return prefix + dash2hump(eventName.replace(/^./, (matched) => {
|
|
142
|
+
return matched.toUpperCase()
|
|
143
|
+
}))
|
|
142
144
|
},
|
|
143
145
|
defaultModelProp: 'value',
|
|
144
146
|
defaultModelEvent: 'input',
|
package/lib/file-loader.js
CHANGED
|
@@ -7,6 +7,8 @@ const RecordResourceMapDependency = require('./dependencies/RecordResourceMapDep
|
|
|
7
7
|
module.exports = function loader (content, prevOptions) {
|
|
8
8
|
const options = prevOptions || loaderUtils.getOptions(this) || {}
|
|
9
9
|
const context = options.context || this.rootContext
|
|
10
|
+
const mpx = this.getMpx()
|
|
11
|
+
const isRN = ['ios', 'android', 'harmony'].includes(mpx.mode)
|
|
10
12
|
|
|
11
13
|
let url = loaderUtils.interpolateName(this, options.name, {
|
|
12
14
|
context,
|
|
@@ -33,6 +35,9 @@ module.exports = function loader (content, prevOptions) {
|
|
|
33
35
|
|
|
34
36
|
let publicPath = `__webpack_public_path__ + ${JSON.stringify(url)}`
|
|
35
37
|
|
|
38
|
+
// todo 未来添加分包处理后相对地址不一定是./开头的,需要考虑通过dependency的方式在sourceModule时通过最终的chunkName得到准确的相对路径
|
|
39
|
+
if (isRN) publicPath = `__non_webpack_require__(${JSON.stringify(`./${url}`)})`
|
|
40
|
+
|
|
36
41
|
if (options.publicPath) {
|
|
37
42
|
if (typeof options.publicPath === 'function') {
|
|
38
43
|
publicPath = options.publicPath(url, this.resourcePath, context)
|
package/lib/index.js
CHANGED
|
@@ -1880,7 +1880,7 @@ try {
|
|
|
1880
1880
|
if (tenonStyleLoaderIndex > -1 && !isPitcherRequest) {
|
|
1881
1881
|
loaders.splice(tenonStyleLoaderIndex + 1, 0, {
|
|
1882
1882
|
loader: normalize.lib('style-compiler/index.js'),
|
|
1883
|
-
options: (mpxStyleOptions && JSON.parse(mpxStyleOptions)) || {}
|
|
1883
|
+
options: (queryObj.mpxStyleOptions && JSON.parse(queryObj.mpxStyleOptions)) || {}
|
|
1884
1884
|
})
|
|
1885
1885
|
}
|
|
1886
1886
|
} else if (mpxStyleLoaderIndex === -1) {
|
package/lib/loader.js
CHANGED
package/lib/parser.js
CHANGED
|
@@ -156,7 +156,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
test: 'usingComponents',
|
|
159
|
-
web: fixComponentName('usingComponents')
|
|
159
|
+
web: fixComponentName('usingComponents'),
|
|
160
|
+
ios: fixComponentName('usingComponents'),
|
|
161
|
+
android: fixComponentName('usingComponents')
|
|
160
162
|
},
|
|
161
163
|
{
|
|
162
164
|
test: 'usingComponents',
|
|
@@ -256,12 +258,21 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
const spec = {
|
|
259
|
-
supportedModes: [
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
supportedModes: [
|
|
262
|
+
'ali',
|
|
263
|
+
'swan',
|
|
264
|
+
'qq',
|
|
265
|
+
'tt',
|
|
266
|
+
'jd',
|
|
267
|
+
'qa',
|
|
268
|
+
'dd',
|
|
269
|
+
'web',
|
|
270
|
+
'ios',
|
|
271
|
+
'android'
|
|
264
272
|
],
|
|
273
|
+
|
|
274
|
+
normalizeTest,
|
|
275
|
+
page: [...windowRules, ...componentRules],
|
|
265
276
|
component: componentRules,
|
|
266
277
|
window: windowRules,
|
|
267
278
|
tabBar: {
|
|
@@ -297,7 +308,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
297
308
|
ali (input) {
|
|
298
309
|
const value = input.list
|
|
299
310
|
delete input.list
|
|
300
|
-
input.items = value.map(item => {
|
|
311
|
+
input.items = value.map((item) => {
|
|
301
312
|
return runRules(spec.tabBar.list, item, {
|
|
302
313
|
mode: 'ali',
|
|
303
314
|
normalizeTest,
|
|
@@ -361,7 +372,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
361
372
|
},
|
|
362
373
|
{
|
|
363
374
|
test: 'usingComponents',
|
|
364
|
-
web: fixComponentName('usingComponents')
|
|
375
|
+
web: fixComponentName('usingComponents'),
|
|
376
|
+
ios: fixComponentName('usingComponents'),
|
|
377
|
+
android: fixComponentName('usingComponents')
|
|
365
378
|
},
|
|
366
379
|
{
|
|
367
380
|
test: 'usingComponents',
|
|
@@ -373,11 +373,12 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
373
373
|
|
|
374
374
|
// transform 转换
|
|
375
375
|
const formatTransform = ({ prop, value, selector }, { mode }) => {
|
|
376
|
-
|
|
376
|
+
// css var & 数组直接返回
|
|
377
|
+
if (Array.isArray(value) || cssVariableExp.test(value)) return { prop, value }
|
|
377
378
|
const values = parseValues(value)
|
|
378
379
|
const transform = []
|
|
379
380
|
values.forEach(item => {
|
|
380
|
-
const match = item.match(/([/\w]+)\((
|
|
381
|
+
const match = item.match(/([/\w]+)\((.+)\)/)
|
|
381
382
|
if (match && match.length >= 3) {
|
|
382
383
|
let key = match[1]
|
|
383
384
|
const val = match[2]
|
|
@@ -398,7 +399,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
398
399
|
break
|
|
399
400
|
case 'matrix':
|
|
400
401
|
case 'matrix3d':
|
|
401
|
-
transform.push({ [key]: val
|
|
402
|
+
transform.push({ [key]: parseValues(val, ',').map(val => +val) })
|
|
402
403
|
break
|
|
403
404
|
case 'translate':
|
|
404
405
|
case 'scale':
|
|
@@ -406,23 +407,23 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
406
407
|
case 'rotate3d': // x y z angle
|
|
407
408
|
case 'translate3d': // x y 支持 z不支持
|
|
408
409
|
case 'scale3d': // x y 支持 z不支持
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
const xyz = ['X', 'Y', 'Z']
|
|
418
|
-
transform.push(...vals.map((v, index) => {
|
|
419
|
-
if (key !== 'rotate' && index > 1) {
|
|
420
|
-
unsupportedPropError({ prop: `${key}Z`, value, selector }, { mode })
|
|
421
|
-
}
|
|
422
|
-
return { [`${key}${xyz[index] || ''}`]: v.trim() }
|
|
423
|
-
}))
|
|
424
|
-
break
|
|
410
|
+
{
|
|
411
|
+
// 2 个以上的值处理
|
|
412
|
+
key = key.replace('3d', '')
|
|
413
|
+
const vals = parseValues(val, ',').splice(0, key === 'rotate' ? 4 : 3)
|
|
414
|
+
// scale(.5) === scaleX(.5) scaleY(.5)
|
|
415
|
+
if (vals.length === 1 && key === 'scale') {
|
|
416
|
+
vals.push(vals[0])
|
|
425
417
|
}
|
|
418
|
+
const xyz = ['X', 'Y', 'Z']
|
|
419
|
+
transform.push(...vals.map((v, index) => {
|
|
420
|
+
if (key !== 'rotate' && index > 1) {
|
|
421
|
+
unsupportedPropError({ prop: `${key}Z`, value, selector }, { mode })
|
|
422
|
+
}
|
|
423
|
+
return { [`${key}${xyz[index] || ''}`]: v.trim() }
|
|
424
|
+
}))
|
|
425
|
+
break
|
|
426
|
+
}
|
|
426
427
|
case 'translateZ':
|
|
427
428
|
case 'scaleZ':
|
|
428
429
|
default:
|
|
@@ -455,14 +456,17 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
455
456
|
|
|
456
457
|
const formatFlex = ({ prop, value, selector }) => {
|
|
457
458
|
let values = parseValues(value)
|
|
459
|
+
// 值大于3 去前三
|
|
458
460
|
if (values.length > 3) {
|
|
459
|
-
|
|
461
|
+
warn(`Value of [flex] in ${selector} supports up to three values, received [${value}], please check again!`)
|
|
460
462
|
values = values.splice(0, 3)
|
|
461
463
|
}
|
|
462
464
|
const cssMap = []
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
465
|
+
// 单个css var 直接设置 flex 属性
|
|
466
|
+
if (values.length === 1 && cssVariableExp.test(value)) {
|
|
467
|
+
return { prop, value }
|
|
468
|
+
}
|
|
469
|
+
// 包含枚举值 none initial
|
|
466
470
|
if (values.includes('initial') || values.includes('none')) {
|
|
467
471
|
// css flex: initial ===> flex: 0 1 ===> rn flex 0 1
|
|
468
472
|
// css flex: none ===> css flex: 0 0 ===> rn flex 0 0
|
|
@@ -475,38 +479,31 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
475
479
|
}
|
|
476
480
|
return cssMap
|
|
477
481
|
}
|
|
478
|
-
//
|
|
479
|
-
//
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
482
|
+
// 只有1-2个值且最后的值是flexBasis 的有效值(auto或者有单位百分比、px等)
|
|
483
|
+
// 在设置 flex basis 有效值的场景下,如果没有设置 grow 和 shrink,则默认为1
|
|
484
|
+
// 单值 flex: 1 1 <flex-basis>
|
|
485
|
+
// 双值 flex: <flex-grow> 1 <flex-basis>
|
|
486
|
+
// 三值 flex: <flex-grow> <flex-shrink> <flex-basis>
|
|
487
|
+
for (let i = 0; i < 3; i++) {
|
|
488
|
+
if (i < 2) {
|
|
489
|
+
// 添加 grow 和 shrink
|
|
490
|
+
const isValid = isNumber(values[0]) || cssVariableExp.test(values[0])
|
|
491
|
+
// 兜底 1
|
|
492
|
+
const val = isValid ? values[0] : 1
|
|
493
|
+
const item = getIntegersFlex({ prop: AbbreviationMap[prop][i], value: val, selector })
|
|
488
494
|
item && cssMap.push(item)
|
|
495
|
+
isValid && values.shift()
|
|
496
|
+
} else {
|
|
497
|
+
// 添加 flexBasis
|
|
498
|
+
// 有单位(百分比、px等) 的 value 赋值 flexBasis,auto 不处理,兜底 0
|
|
499
|
+
const val = values[0] || 0
|
|
500
|
+
if (val !== 'auto') {
|
|
501
|
+
cssMap.push({
|
|
502
|
+
prop: 'flexBasis',
|
|
503
|
+
value: val
|
|
504
|
+
})
|
|
505
|
+
}
|
|
489
506
|
}
|
|
490
|
-
if (!isAuto) {
|
|
491
|
-
// 有单位(百分比、px等) 的 value 赋值 flexBasis,auto 不处理
|
|
492
|
-
cssMap.push({
|
|
493
|
-
prop: 'flexBasis',
|
|
494
|
-
value: lastOne
|
|
495
|
-
})
|
|
496
|
-
}
|
|
497
|
-
return cssMap
|
|
498
|
-
}
|
|
499
|
-
// 纯数值:value 按flex-grow flex-shrink flex-basis 顺序赋值
|
|
500
|
-
// 兜底 shrink & basis
|
|
501
|
-
if (values.length === 1) {
|
|
502
|
-
values.push(...[1, 0])
|
|
503
|
-
} else if (values.length === 2) {
|
|
504
|
-
values.push(0)
|
|
505
|
-
}
|
|
506
|
-
// 循环赋值
|
|
507
|
-
for (let i = 0; i < values.length; i++) {
|
|
508
|
-
const item = getIntegersFlex({ prop: AbbreviationMap[prop][i], value: values[i] })
|
|
509
|
-
item && cssMap.push(item)
|
|
510
507
|
}
|
|
511
508
|
return cssMap
|
|
512
509
|
}
|
|
@@ -514,7 +511,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
514
511
|
const formatFontFamily = ({ prop, value, selector }) => {
|
|
515
512
|
// 去掉引号 取逗号分隔后的第一个
|
|
516
513
|
const newVal = value.replace(/"|'/g, '').trim()
|
|
517
|
-
const values = newVal
|
|
514
|
+
const values = parseValues(newVal, ',')
|
|
518
515
|
if (!newVal || !values.length) {
|
|
519
516
|
error(`Value of [${prop}] is invalid in ${selector}, received [${value}], please check again!`)
|
|
520
517
|
return false
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
const { isOriginTag, isBuildInTag } = require('../../../../utils/dom-tag-config')
|
|
2
2
|
|
|
3
3
|
module.exports = function () {
|
|
4
|
+
const handleComponentTag = (el, data) => {
|
|
5
|
+
const newTag = `mpx-com-${el.tag}`
|
|
6
|
+
const usingComponents = data.usingComponents || []
|
|
7
|
+
// 当前组件名与原生tag或内建tag同名,对组件名进行转义
|
|
8
|
+
// json转义见:platform/json/wx/index.js fixComponentName
|
|
9
|
+
if (usingComponents.includes(newTag)) {
|
|
10
|
+
el.tag = newTag
|
|
11
|
+
}
|
|
12
|
+
return el
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
return {
|
|
5
16
|
waterfall: true,
|
|
6
17
|
skipNormalize: true,
|
|
7
|
-
supportedModes: ['web'],
|
|
18
|
+
supportedModes: ['web', 'ios', 'android'],
|
|
8
19
|
test: (input) => isOriginTag(input) || isBuildInTag(input),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const usingComponents = data.usingComponents || []
|
|
13
|
-
// 当前组件名与原生tag或内建tag同名,对组件名进行转义
|
|
14
|
-
// json转义见:platform/json/wx/index.js fixComponentName
|
|
15
|
-
if (usingComponents.includes(newTag)) {
|
|
16
|
-
el.tag = newTag
|
|
17
|
-
}
|
|
18
|
-
return el
|
|
19
|
-
}
|
|
20
|
+
web: handleComponentTag,
|
|
21
|
+
ios: handleComponentTag,
|
|
22
|
+
android: handleComponentTag
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -82,8 +82,8 @@ module.exports = function getComponentConfigs ({ warn, error }) {
|
|
|
82
82
|
|
|
83
83
|
// 转换规则只需以微信为基准配置微信和支付宝的差异部分,比如微信和支付宝都支持但是写法不一致,或者微信支持而支付宝不支持的部分(抛出错误或警告)
|
|
84
84
|
return [
|
|
85
|
-
...unsupported({ print }),
|
|
86
85
|
fixComponentName({ print }),
|
|
86
|
+
...unsupported({ print }),
|
|
87
87
|
ad({ print }),
|
|
88
88
|
view({ print }),
|
|
89
89
|
scrollView({ print }),
|
|
@@ -2,6 +2,8 @@ const TAG_NAME = 'movable-view'
|
|
|
2
2
|
|
|
3
3
|
module.exports = function ({ print }) {
|
|
4
4
|
const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
|
|
5
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
6
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
5
7
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
6
8
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
7
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
@@ -27,7 +29,7 @@ module.exports = function ({ print }) {
|
|
|
27
29
|
android: androidPropLog
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
|
-
test: /^(
|
|
32
|
+
test: /^(damping|friction|scale|scale-min|scale-max|scale-value)$/,
|
|
31
33
|
ios: iosPropLog,
|
|
32
34
|
android: androidPropLog
|
|
33
35
|
}
|
|
@@ -36,6 +38,11 @@ module.exports = function ({ print }) {
|
|
|
36
38
|
{
|
|
37
39
|
test: /^(htouchmove|vtouchmove)$/,
|
|
38
40
|
ali: aliEventLog
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
test: /^(bindscale)$/,
|
|
44
|
+
ios: iosEventLog,
|
|
45
|
+
android: androidEventLog
|
|
39
46
|
}
|
|
40
47
|
]
|
|
41
48
|
}
|
|
@@ -6,9 +6,7 @@ module.exports = function ({ print }) {
|
|
|
6
6
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
7
7
|
const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
|
|
8
8
|
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
9
|
-
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
9
|
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
11
|
-
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
12
10
|
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
11
|
|
|
14
12
|
return {
|
|
@@ -28,9 +26,7 @@ module.exports = function ({ print }) {
|
|
|
28
26
|
props: [
|
|
29
27
|
{
|
|
30
28
|
test: /^(indicator-class|mask-class)$/,
|
|
31
|
-
tt: ttPropLog
|
|
32
|
-
ios: iosPropLog,
|
|
33
|
-
android: androidPropLog
|
|
29
|
+
tt: ttPropLog
|
|
34
30
|
}
|
|
35
31
|
],
|
|
36
32
|
event: [
|
|
@@ -16,6 +16,14 @@ module.exports = function ({ print }) {
|
|
|
16
16
|
el.isBuiltIn = true
|
|
17
17
|
return 'tenon-rich-text'
|
|
18
18
|
},
|
|
19
|
+
ios (tag, { el }) {
|
|
20
|
+
el.isBuiltIn = true
|
|
21
|
+
return 'mpx-rich-text'
|
|
22
|
+
},
|
|
23
|
+
android (tag, { el }) {
|
|
24
|
+
el.isBuiltIn = true
|
|
25
|
+
return 'mpx-rich-text'
|
|
26
|
+
},
|
|
19
27
|
props: [
|
|
20
28
|
{
|
|
21
29
|
test: /^(space)$/,
|
|
@@ -57,7 +57,7 @@ module.exports = function ({ print }) {
|
|
|
57
57
|
qa: qaPropLog
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
test: /^(
|
|
60
|
+
test: /^(refresher-threshold|enable-passive|scroll-anchoring|using-sticky|fast-deceleration|enable-flex)$/,
|
|
61
61
|
android: androidPropLog,
|
|
62
62
|
ios: iosPropLog
|
|
63
63
|
},
|
|
@@ -11,7 +11,7 @@ const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher',
|
|
|
11
11
|
// 快应用不支持的标签集合
|
|
12
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']
|
|
13
13
|
// RN不支持的标签集合
|
|
14
|
-
const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'progress', '
|
|
14
|
+
const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'progress', 'slider', 'audio', 'camera', 'video', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {function(object): function} print
|
|
@@ -411,7 +411,9 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
411
411
|
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ali' })
|
|
412
412
|
const rEventName = runRules(eventRules, eventName, { mode: 'ali' })
|
|
413
413
|
return {
|
|
414
|
-
name:
|
|
414
|
+
name: rPrefix + dash2hump(rEventName.replace(/^./, (matched) => {
|
|
415
|
+
return matched.toUpperCase()
|
|
416
|
+
})) + modifierStr,
|
|
415
417
|
value
|
|
416
418
|
}
|
|
417
419
|
},
|
|
@@ -493,10 +495,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
493
495
|
}
|
|
494
496
|
},
|
|
495
497
|
web ({ name, value }, { eventRules, el, usingComponents }) {
|
|
496
|
-
const parsed = parseMustacheWithContext(value)
|
|
497
|
-
if (parsed.hasBinding) {
|
|
498
|
-
value = '__invokeHandler(' + parsed.result + ', $event)'
|
|
499
|
-
}
|
|
500
498
|
const match = this.test.exec(name)
|
|
501
499
|
const prefix = match[1]
|
|
502
500
|
const eventName = match[2]
|
|
@@ -9,6 +9,7 @@ module.exports = function (script, {
|
|
|
9
9
|
moduleId,
|
|
10
10
|
isProduction,
|
|
11
11
|
jsonConfig,
|
|
12
|
+
outputPath,
|
|
12
13
|
builtInComponentsMap,
|
|
13
14
|
localComponentsMap,
|
|
14
15
|
localPagesMap
|
|
@@ -25,14 +26,16 @@ module.exports = function (script, {
|
|
|
25
26
|
output += `
|
|
26
27
|
import { getComponent } from ${stringifyRequest(loaderContext, optionProcessorPath)}
|
|
27
28
|
import { NavigationContainer, StackActions } from '@react-navigation/native'
|
|
28
|
-
import {
|
|
29
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
|
29
30
|
import { Provider } from '@ant-design/react-native'
|
|
31
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
30
32
|
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
31
33
|
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
|
32
34
|
|
|
33
35
|
global.__navigationHelper = {
|
|
34
36
|
NavigationContainer: NavigationContainer,
|
|
35
|
-
createStackNavigator:
|
|
37
|
+
createStackNavigator: createNativeStackNavigator,
|
|
38
|
+
useHeaderHeight: useHeaderHeight,
|
|
36
39
|
StackActions: StackActions,
|
|
37
40
|
GestureHandlerRootView: GestureHandlerRootView,
|
|
38
41
|
Provider: Provider,
|
|
@@ -64,7 +67,7 @@ global.__navigationHelper = {
|
|
|
64
67
|
jsonConfig
|
|
65
68
|
})
|
|
66
69
|
|
|
67
|
-
output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, ctorType, jsonConfig, componentsMap })
|
|
70
|
+
output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, ctorType, jsonConfig, componentsMap, outputPath })
|
|
68
71
|
output += getRequireScript({ ctorType, script, loaderContext })
|
|
69
72
|
output += `export default global.__mpxOptionsMap[${JSON.stringify(moduleId)}]\n`
|
|
70
73
|
}
|
|
@@ -88,7 +88,8 @@ function buildGlobalParams ({
|
|
|
88
88
|
jsonConfig,
|
|
89
89
|
componentsMap,
|
|
90
90
|
pagesMap,
|
|
91
|
-
firstPage
|
|
91
|
+
firstPage,
|
|
92
|
+
outputPath
|
|
92
93
|
}) {
|
|
93
94
|
let content = ''
|
|
94
95
|
if (ctorType === 'app') {
|
|
@@ -117,6 +118,9 @@ global.currentInject.firstPage = ${JSON.stringify(firstPage)}\n`
|
|
|
117
118
|
content += `global.currentInject.getComponents = function () {
|
|
118
119
|
return ${shallowStringify(componentsMap)}
|
|
119
120
|
}\n`
|
|
121
|
+
if (ctorType === 'component') {
|
|
122
|
+
content += `global.currentInject.componentPath = '/' + ${JSON.stringify(outputPath)}\n`
|
|
123
|
+
}
|
|
120
124
|
}
|
|
121
125
|
content += `global.currentModuleId = ${JSON.stringify(moduleId)}\n`
|
|
122
126
|
content += `global.currentSrcMode = ${JSON.stringify(scriptSrcMode)}\n`
|
|
@@ -33,6 +33,10 @@ export interface IntersectionObserver {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface ScrollViewContextValue {
|
|
37
|
+
gestureRef: React.RefObject<any> | null
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
export const MovableAreaContext = createContext({ width: 0, height: 0 })
|
|
37
41
|
|
|
38
42
|
export const FormContext = createContext<FormContextValue | null>(null)
|
|
@@ -51,4 +55,8 @@ export const IntersectionObserverContext = createContext<IntersectionObserver |
|
|
|
51
55
|
|
|
52
56
|
export const RouteContext = createContext<number | null>(null)
|
|
53
57
|
|
|
58
|
+
export const SwiperContext = createContext({})
|
|
59
|
+
|
|
54
60
|
export const KeyboardAvoidContext = createContext<KeyboardAvoidContextValue | null>(null)
|
|
61
|
+
|
|
62
|
+
export const ScrollViewContext = createContext<ScrollViewContextValue>({ gestureRef: null })
|
|
@@ -8,4 +8,6 @@ export const PickerContext = createContext(null);
|
|
|
8
8
|
export const VarContext = createContext({});
|
|
9
9
|
export const IntersectionObserverContext = createContext(null);
|
|
10
10
|
export const RouteContext = createContext(null);
|
|
11
|
+
export const SwiperContext = createContext({});
|
|
11
12
|
export const KeyboardAvoidContext = createContext(null);
|
|
13
|
+
export const ScrollViewContext = createContext({ gestureRef: null });
|