@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.70

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 (99) hide show
  1. package/LICENSE +433 -0
  2. package/README.md +1 -1
  3. package/lib/config.js +0 -14
  4. package/lib/dependencies/ResolveDependency.js +0 -5
  5. package/lib/index.js +7 -38
  6. package/lib/json-compiler/helper.js +3 -3
  7. package/lib/loader.js +0 -53
  8. package/lib/parser.js +1 -1
  9. package/lib/platform/json/wx/index.js +21 -8
  10. package/lib/platform/style/wx/index.js +51 -54
  11. package/lib/platform/template/wx/component-config/button.js +2 -14
  12. package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
  13. package/lib/platform/template/wx/component-config/image.js +0 -4
  14. package/lib/platform/template/wx/component-config/index.js +1 -1
  15. package/lib/platform/template/wx/component-config/input.js +0 -4
  16. package/lib/platform/template/wx/component-config/rich-text.js +6 -2
  17. package/lib/platform/template/wx/component-config/scroll-view.js +0 -4
  18. package/lib/platform/template/wx/component-config/switch.js +0 -4
  19. package/lib/platform/template/wx/component-config/text.js +0 -4
  20. package/lib/platform/template/wx/component-config/textarea.js +0 -5
  21. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  22. package/lib/platform/template/wx/component-config/view.js +0 -4
  23. package/lib/platform/template/wx/index.js +1 -127
  24. package/lib/resolve-loader.js +1 -4
  25. package/lib/runtime/components/react/dist/getInnerListeners.js +5 -6
  26. package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
  27. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
  28. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +96 -107
  29. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +26 -27
  30. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +480 -0
  31. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +68 -0
  32. package/lib/runtime/components/react/dist/mpx-swiper/type.js +1 -0
  33. package/lib/runtime/components/react/dist/mpx-view.jsx +6 -3
  34. package/lib/runtime/components/react/dist/pickerFaces.js +6 -12
  35. package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerOverlay.jsx} +3 -5
  36. package/lib/runtime/components/react/dist/useAnimationHooks.js +7 -8
  37. package/lib/runtime/components/react/dist/utils.jsx +89 -60
  38. package/lib/runtime/components/react/event.config.ts +25 -26
  39. package/lib/runtime/components/react/getInnerListeners.ts +212 -169
  40. package/lib/runtime/components/react/mpx-button.tsx +9 -14
  41. package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
  42. package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
  43. package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
  44. package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
  45. package/lib/runtime/components/react/mpx-form.tsx +15 -20
  46. package/lib/runtime/components/react/mpx-icon.tsx +2 -2
  47. package/lib/runtime/components/react/mpx-image.tsx +87 -47
  48. package/lib/runtime/components/react/mpx-input.tsx +24 -32
  49. package/lib/runtime/components/react/mpx-label.tsx +12 -14
  50. package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
  51. package/lib/runtime/components/react/mpx-movable-view.tsx +20 -24
  52. package/lib/runtime/components/react/mpx-navigator.tsx +2 -8
  53. package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
  54. package/lib/runtime/components/react/mpx-radio.tsx +19 -25
  55. package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
  56. package/lib/runtime/components/react/mpx-rich-text/index.tsx +121 -0
  57. package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
  58. package/lib/runtime/components/react/mpx-scroll-view.tsx +40 -41
  59. package/lib/runtime/components/react/mpx-switch.tsx +19 -15
  60. package/lib/runtime/components/react/mpx-text.tsx +8 -16
  61. package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
  62. package/lib/runtime/components/react/mpx-view.tsx +18 -20
  63. package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
  64. package/lib/runtime/components/react/types/global.d.ts +2 -1
  65. package/lib/runtime/components/react/useAnimationHooks.ts +36 -12
  66. package/lib/runtime/components/react/utils.tsx +91 -60
  67. package/lib/runtime/components/web/mpx-web-view.vue +34 -20
  68. package/lib/runtime/optionProcessor.js +0 -22
  69. package/lib/style-compiler/index.js +1 -1
  70. package/lib/style-compiler/plugins/scope-id.js +30 -2
  71. package/lib/template-compiler/compiler.js +30 -26
  72. package/lib/utils/env.js +1 -6
  73. package/lib/utils/pre-process-json.js +9 -5
  74. package/package.json +4 -7
  75. package/lib/dependencies/AddEntryDependency.js +0 -24
  76. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +0 -39
  77. package/lib/runtime/components/react/dist/mpx-swiper.jsx +0 -606
  78. package/lib/runtime/components/react/dist/pickerVIewContext.js +0 -9
  79. package/lib/runtime/components/react/dist/pickerViewMask.jsx +0 -18
  80. package/lib/runtime/components/tenon/getInnerListeners.js +0 -334
  81. package/lib/runtime/components/tenon/tenon-button.vue +0 -309
  82. package/lib/runtime/components/tenon/tenon-image.vue +0 -66
  83. package/lib/runtime/components/tenon/tenon-input.vue +0 -171
  84. package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -26
  85. package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -127
  86. package/lib/runtime/components/tenon/tenon-switch.vue +0 -96
  87. package/lib/runtime/components/tenon/tenon-text.vue +0 -70
  88. package/lib/runtime/components/tenon/tenon-textarea.vue +0 -86
  89. package/lib/runtime/components/tenon/tenon-view.vue +0 -93
  90. package/lib/runtime/components/web/event.js +0 -105
  91. package/lib/runtime/optionProcessor.tenon.js +0 -84
  92. package/lib/style-compiler/plugins/hm.js +0 -20
  93. package/lib/tenon/index.js +0 -117
  94. package/lib/tenon/processJSON.js +0 -352
  95. package/lib/tenon/processScript.js +0 -203
  96. package/lib/tenon/processStyles.js +0 -21
  97. package/lib/tenon/processTemplate.js +0 -126
  98. package/lib/tenon/script-helper.js +0 -223
  99. package/lib/utils/get-relative-path.js +0 -25
@@ -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: ['ali', 'swan', 'qq', 'tt', 'jd', 'qa', 'dd', 'web'],
260
- normalizeTest,
261
- page: [
262
- ...windowRules,
263
- ...componentRules
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
- if (Array.isArray(value)) return { prop, value }
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.split(',').map(val => +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
- // 2 个以上的值处理
411
- key = key.replace('3d', '')
412
- const vals = val.split(',', key === 'rotate' ? 4 : 3)
413
- // scale(.5) === scaleX(.5) scaleY(.5)
414
- if (vals.length === 1 && key === 'scale') {
415
- vals.push(vals[0])
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
- error(`Value of [flex] in ${selector} supports up to three values, received [${value}], please check again!`)
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
- const lastOne = values[values.length - 1]
464
- const isAuto = lastOne === 'auto'
465
- // 枚举值 none initial
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
- // 最后一个值是flexBasis 的有效值(auto或者有单位百分比、px等)
479
- // flex 0 1 auto flex auto flex 1 auto flex 1 30px flex 1 10% flex 1 1 auto
480
- if (!isNumber(lastOne) || !cssVariableExp.test(value)) {
481
- // 添加 grow shrink
482
- // 在设置 flex basis 有效值的场景下,如果没有设置 grow shrink,则默认为1
483
- // 单值 flex: 1 1 <flex-basis>
484
- // 双值 flex: <flex-grow> 1 <flex-basis>
485
- // 三值 flex: <flex-grow> <flex-shrink> <flex-basis>
486
- for (let i = 0; i < 2; i++) {
487
- const item = getIntegersFlex({ prop: AbbreviationMap[prop][i], value: isNumber(values[i]) || cssVariableExp.test(value) ? values[i] : 1 })
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.split(',').filter(i => i)
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
@@ -28,8 +28,6 @@ module.exports = function ({ print }) {
28
28
  const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
29
29
  const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
30
30
  const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
31
- const tenonPropLog = print({ platform: 'tenon', tag: TAG_NAME, isError: false })
32
- const tenonEventLog = print({ platform: 'tenon', tag: TAG_NAME, isError: false, type: 'event' })
33
31
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
34
32
  const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' })
35
33
  const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
@@ -45,10 +43,6 @@ module.exports = function ({ print }) {
45
43
  el.isBuiltIn = true
46
44
  return 'mpx-button'
47
45
  },
48
- tenon (tag, { el }) {
49
- el.isBuiltIn = true
50
- return 'tenon-button'
51
- },
52
46
  ios (tag, { el }) {
53
47
  el.isBuiltIn = true
54
48
  return 'mpx-button'
@@ -163,18 +157,13 @@ module.exports = function ({ print }) {
163
157
  },
164
158
  {
165
159
  test: /^(open-type|lang|session-from|send-message-title|send-message-path|send-message-img|show-message-card|app-parameter)$/,
166
- web: webPropLog,
167
- tenon: tenonPropLog
160
+ web: webPropLog
168
161
  },
169
162
  {
170
163
  test: /^(size|type|plain|loading|form-type|hover-class|hover-stop-propagation|hover-start-time|hover-stay-time|use-built-in)$/,
171
164
  web (prop, { el }) {
172
165
  // todo 这部分能力基于内部封装实现
173
166
  el.isBuiltIn = true
174
- },
175
- tenon (prop, { el }) {
176
- // todo 这部分能力基于内部封装实现
177
- el.isBuiltIn = true
178
167
  }
179
168
  },
180
169
  {
@@ -216,8 +205,7 @@ module.exports = function ({ print }) {
216
205
  },
217
206
  {
218
207
  test: /^(getuserinfo|contact|error|launchapp|opensetting|getphonenumber)$/,
219
- web: webEventLog,
220
- tenon: tenonEventLog
208
+ web: webEventLog
221
209
  },
222
210
  {
223
211
  test: /^(getuserinfo|contact|getphonenumber|bindgetrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
@@ -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
- // 输出web时对组件名进行转义避免与原生tag和内建tag冲突
10
- web (el, data) {
11
- const newTag = `mpx-com-${el.tag}`
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
  }
@@ -15,10 +15,6 @@ module.exports = function ({ print }) {
15
15
  el.isBuiltIn = true
16
16
  return 'mpx-image'
17
17
  },
18
- tenon (tag, { el }) {
19
- el.isBuiltIn = true
20
- return 'tenon-image'
21
- },
22
18
  ios (tag, { el }) {
23
19
  el.isBuiltIn = true
24
20
  return 'mpx-image'
@@ -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 }),
@@ -26,10 +26,6 @@ module.exports = function ({ print }) {
26
26
  el.isBuiltIn = true
27
27
  return 'mpx-input'
28
28
  },
29
- tenon (tag, { el }) {
30
- el.isBuiltIn = true
31
- return 'tenon-input'
32
- },
33
29
  ios (tag, { el }) {
34
30
  el.isBuiltIn = true
35
31
  return 'mpx-input'
@@ -12,9 +12,13 @@ module.exports = function ({ print }) {
12
12
  el.isBuiltIn = true
13
13
  return 'mpx-rich-text'
14
14
  },
15
- tenon (tag, { el }) {
15
+ ios (tag, { el }) {
16
16
  el.isBuiltIn = true
17
- return 'tenon-rich-text'
17
+ return 'mpx-rich-text'
18
+ },
19
+ android (tag, { el }) {
20
+ el.isBuiltIn = true
21
+ return 'mpx-rich-text'
18
22
  },
19
23
  props: [
20
24
  {
@@ -23,10 +23,6 @@ module.exports = function ({ print }) {
23
23
  el.isBuiltIn = true
24
24
  return 'mpx-scroll-view'
25
25
  },
26
- tenon (tag, { el }) {
27
- el.isBuiltIn = true
28
- return 'tenon-scroll-view'
29
- },
30
26
  android (tag, { el }) {
31
27
  el.isBuiltIn = true
32
28
  return 'mpx-scroll-view'
@@ -10,10 +10,6 @@ module.exports = function ({ print }) {
10
10
  el.isBuiltIn = true
11
11
  return 'mpx-switch'
12
12
  },
13
- tenon (tag, { el }) {
14
- el.isBuiltIn = true
15
- return 'tenon-switch'
16
- },
17
13
  ios (tag, { el }) {
18
14
  el.isBuiltIn = true
19
15
  return 'mpx-switch'
@@ -22,10 +22,6 @@ module.exports = function ({ print }) {
22
22
  return 'span'
23
23
  }
24
24
  },
25
- tenon (tag, { el }) {
26
- el.isBuiltIn = true
27
- return 'tenon-text'
28
- },
29
25
  ios (tag, { el }) {
30
26
  el.isBuiltIn = true
31
27
  return 'mpx-text'
@@ -28,11 +28,6 @@ module.exports = function ({ print }) {
28
28
  el.isBuiltIn = true
29
29
  return 'mpx-textarea'
30
30
  },
31
- tenon (tag, { el }) {
32
- // form全量使用内建组件
33
- el.isBuiltIn = true
34
- return 'tenon-textarea'
35
- },
36
31
  ios (tag, { el }) {
37
32
  el.isBuiltIn = true
38
33
  return 'mpx-textarea'
@@ -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', 'rich-text', 'slider', 'audio', 'camera', 'video', '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', 'progress', 'slider', 'audio', 'camera', 'video', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
15
15
 
16
16
  /**
17
17
  * @param {function(object): function} print
@@ -23,10 +23,6 @@ module.exports = function ({ print }) {
23
23
  return 'div'
24
24
  }
25
25
  },
26
- tenon (tag, { el }) {
27
- el.isBuiltIn = true
28
- return 'tenon-view'
29
- },
30
26
  ios (tag, { el }) {
31
27
  el.isBuiltIn = true
32
28
  return 'mpx-view'
@@ -9,7 +9,7 @@ const { dash2hump } = require('../../../utils/hump-dash')
9
9
 
10
10
  module.exports = function getSpec ({ warn, error }) {
11
11
  const spec = {
12
- supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'tenon'],
12
+ supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android'],
13
13
  // props预处理
14
14
  preProps: [],
15
15
  // props后处理
@@ -28,15 +28,6 @@ module.exports = function getSpec ({ warn, error }) {
28
28
  value: parsed.result
29
29
  }
30
30
  }
31
- },
32
- tenon ({ name, value }) {
33
- const parsed = parseMustacheWithContext(value)
34
- if (parsed.hasBinding) {
35
- return {
36
- name: name === 'animation' ? 'v-' + name : ':' + name,
37
- value: parsed.result
38
- }
39
- }
40
31
  }
41
32
  }
42
33
  ],
@@ -99,16 +90,6 @@ module.exports = function getSpec ({ warn, error }) {
99
90
  name: 'v-for',
100
91
  value: `(${itemName}, ${indexName}) in ${parsed.result}`
101
92
  }
102
- },
103
- tenon ({ value }, { el }) {
104
- const parsed = parseMustacheWithContext(value)
105
- const attrsMap = el.attrsMap
106
- const itemName = attrsMap['wx:for-item'] || 'item'
107
- const indexName = attrsMap['wx:for-index'] || 'index'
108
- return {
109
- name: 'v-for',
110
- value: `(${itemName}, ${indexName}) in ${parsed.result}`
111
- }
112
93
  }
113
94
  },
114
95
  {
@@ -134,25 +115,6 @@ module.exports = function getSpec ({ warn, error }) {
134
115
  name: ':key',
135
116
  value
136
117
  }
137
- },
138
- tenon ({ value }, { el }) {
139
- // vue的template中不能包含key,对应于小程序中的block
140
- if (el.tag === 'block') return false
141
- const itemName = el.attrsMap['wx:for-item'] || 'item'
142
- const keyName = value
143
- if (value === '*this') {
144
- value = itemName
145
- } else {
146
- if (isValidIdentifierStr(keyName)) {
147
- value = `${itemName}.${keyName}`
148
- } else {
149
- value = `${itemName}['${keyName}']`
150
- }
151
- }
152
- return {
153
- name: ':key',
154
- value
155
- }
156
118
  }
157
119
  },
158
120
  {
@@ -163,9 +125,6 @@ module.exports = function getSpec ({ warn, error }) {
163
125
  },
164
126
  web () {
165
127
  return false
166
- },
167
- tenon () {
168
- return false
169
128
  }
170
129
  },
171
130
  {
@@ -208,49 +167,6 @@ module.exports = function getSpec ({ warn, error }) {
208
167
  }
209
168
  ]
210
169
  }
211
- },
212
- tenon ({ value }, { el }) {
213
- el.hasEvent = true
214
- const attrsMap = el.attrsMap
215
- const tagRE = /\{\{((?:.|\n|\r)+?)\}\}(?!})/
216
- const stringify = JSON.stringify
217
- const match = tagRE.exec(value)
218
- if (match) {
219
- const modelProp = attrsMap['wx:model-prop'] || 'value'
220
- const modelEvent = attrsMap['wx:model-event'] || 'input'
221
- const modelValuePathRaw = attrsMap['wx:model-value-path']
222
- const modelValuePath = modelValuePathRaw === undefined ? 'value' : modelValuePathRaw
223
- const modelFilter = attrsMap['wx:model-filter']
224
- let modelValuePathArr
225
- try {
226
- modelValuePathArr = JSON5.parse(modelValuePath)
227
- } catch (e) {
228
- if (modelValuePath === '') {
229
- modelValuePathArr = []
230
- } else {
231
- modelValuePathArr = modelValuePath.split('.')
232
- }
233
- }
234
- const modelValue = match[1].trim()
235
- return [
236
- {
237
- name: ':' + modelProp,
238
- value: modelValue
239
- },
240
- {
241
- name: 'mpxModelEvent',
242
- value: modelEvent
243
- },
244
- {
245
- name: 'mpxModelEventId',
246
- value: Math.random().toString(36).slice(3, 11)
247
- },
248
- {
249
- name: '@mpxModel',
250
- value: `__model(${stringifyWithResolveComputed(modelValue)}, $event, ${stringify(modelValuePathArr)}, ${stringify(modelFilter)})`
251
- }
252
- ]
253
- }
254
170
  }
255
171
  },
256
172
  {
@@ -267,12 +183,6 @@ module.exports = function getSpec ({ warn, error }) {
267
183
  name: 'ref',
268
184
  value: `__mpx_ref_${value}__`
269
185
  }
270
- },
271
- tenon ({ value }) {
272
- return {
273
- name: 'ref',
274
- value: `${value}`
275
- }
276
186
  }
277
187
  },
278
188
  {
@@ -322,14 +232,6 @@ module.exports = function getSpec ({ warn, error }) {
322
232
  value: classBinding[0]
323
233
  }
324
234
  }
325
- },
326
- tenon ({ name, value }) {
327
- const dir = this.test.exec(name)[1]
328
- const parsed = parseMustacheWithContext(value)
329
- return {
330
- name: ':' + dir,
331
- value: parsed.result
332
- }
333
235
  }
334
236
  },
335
237
  // 通用指令
@@ -387,17 +289,6 @@ module.exports = function getSpec ({ warn, error }) {
387
289
  name: 'v-' + dir,
388
290
  value: parsed.result
389
291
  }
390
- },
391
- tenon ({ name, value }) {
392
- let dir = this.test.exec(name)[1]
393
- const parsed = parseMustacheWithContext(value)
394
- if (dir === 'elif') {
395
- dir = 'else-if'
396
- }
397
- return {
398
- name: 'v-' + dir,
399
- value: parsed.result
400
- }
401
292
  }
402
293
  },
403
294
  // 事件
@@ -541,23 +432,6 @@ module.exports = function getSpec ({ warn, error }) {
541
432
  name: rPrefix + rEventName + meta.modifierStr,
542
433
  value
543
434
  }
544
- },
545
- tenon ({ name, value }, { eventRules, el }) {
546
- const match = this.test.exec(name)
547
- const prefix = match[1]
548
- const eventName = match[2]
549
- const modifierStr = match[3] || ''
550
- const meta = {
551
- modifierStr
552
- }
553
- // 记录event监听信息用于后续判断是否需要使用内置基础组件
554
- el.hasEvent = true
555
- const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'web', meta })
556
- const rEventName = runRules(eventRules, eventName, { mode: 'web' })
557
- return {
558
- name: rPrefix + rEventName + meta.modifierStr,
559
- value
560
- }
561
435
  }
562
436
  },
563
437
  // 无障碍
@@ -1,6 +1,3 @@
1
1
  module.exports = function () {
2
- return `
3
- var currentURL = global.currentPagePath
4
- var getRelativePath = require('@mpxjs/webpack-plugin/lib/utils/get-relative-path').getRelativePath
5
- module.exports = __mpx_resolve_path__(${JSON.stringify(this.resource)})`
2
+ return `module.exports = __mpx_resolve_path__(${JSON.stringify(this.resource)})`
6
3
  }
@@ -82,8 +82,8 @@ function checkIsNeedPress(e, type, ref) {
82
82
  const nativeEvent = e.nativeEvent;
83
83
  const currentPageX = nativeEvent.changedTouches[0].pageX;
84
84
  const currentPageY = nativeEvent.changedTouches[0].pageY;
85
- if (Math.abs(currentPageX - tapDetailInfo.x) > 1 ||
86
- Math.abs(currentPageY - tapDetailInfo.y) > 1) {
85
+ if (Math.abs(currentPageX - tapDetailInfo.x) > 3 ||
86
+ Math.abs(currentPageY - tapDetailInfo.y) > 3) {
87
87
  ref.current.needPress[type] = false;
88
88
  ref.current.startTimer[type] &&
89
89
  clearTimeout(ref.current.startTimer[type]);
@@ -213,7 +213,6 @@ const useInnerProps = (props = {}, additionalProps = {}, userRemoveProps = [], r
213
213
  const eventConfig = {};
214
214
  const config = rawConfig || {
215
215
  layoutRef: { current: {} },
216
- disableTouch: false,
217
216
  disableTap: false
218
217
  };
219
218
  const removeProps = [
@@ -237,10 +236,10 @@ const useInnerProps = (props = {}, additionalProps = {}, userRemoveProps = [], r
237
236
  rawEventKeys.push(key);
238
237
  }
239
238
  }
240
- if (!rawEventKeys.length || config.disableTouch) {
241
- return omit(propsRef.current, removeProps);
242
- }
243
239
  const events = useMemo(() => {
240
+ if (!rawEventKeys.length) {
241
+ return {};
242
+ }
244
243
  const transformedEventKeys = rawEventKeys.reduce((acc, key) => {
245
244
  if (propsRef.current[key]) {
246
245
  return acc.concat(eventConfig[key]);