@mpxjs/webpack-plugin 2.9.67 → 2.9.69-beta.0

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 (140) hide show
  1. package/lib/index.js +13 -8
  2. package/lib/platform/json/wx/index.js +21 -8
  3. package/lib/platform/style/wx/index.js +35 -38
  4. package/lib/platform/template/wx/component-config/canvas.js +8 -0
  5. package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
  6. package/lib/platform/template/wx/component-config/index.js +1 -1
  7. package/lib/platform/template/wx/component-config/input.js +1 -1
  8. package/lib/platform/template/wx/component-config/rich-text.js +8 -0
  9. package/lib/platform/template/wx/component-config/swiper.js +1 -1
  10. package/lib/platform/template/wx/component-config/textarea.js +1 -1
  11. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  12. package/lib/react/processStyles.js +14 -4
  13. package/lib/react/processTemplate.js +3 -0
  14. package/lib/resolver/AddModePlugin.js +8 -8
  15. package/lib/runtime/components/react/context.ts +6 -0
  16. package/lib/runtime/components/react/dist/context.js +2 -0
  17. package/lib/runtime/components/react/dist/event.config.js +24 -24
  18. package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
  19. package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
  20. package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
  21. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
  22. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
  23. package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
  24. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
  25. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
  26. package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
  27. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
  28. package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
  29. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
  30. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
  31. package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
  32. package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
  33. package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
  34. package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
  35. package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
  36. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
  37. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
  38. package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
  39. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
  40. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
  41. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
  42. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
  43. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
  44. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
  45. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
  46. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
  47. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
  48. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
  49. package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
  50. package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
  51. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
  52. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
  53. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
  54. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
  55. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
  56. package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
  57. package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
  58. package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
  59. package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
  60. package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
  61. package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
  62. package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
  63. package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
  64. package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
  65. package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
  66. package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
  67. package/lib/runtime/components/react/dist/utils.jsx +70 -23
  68. package/lib/runtime/components/react/event.config.ts +25 -26
  69. package/lib/runtime/components/react/getInnerListeners.ts +237 -199
  70. package/lib/runtime/components/react/mpx-button.tsx +104 -57
  71. package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
  72. package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
  73. package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
  74. package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
  75. package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
  76. package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
  77. package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
  78. package/lib/runtime/components/react/mpx-canvas/index.tsx +296 -0
  79. package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
  80. package/lib/runtime/components/react/mpx-checkbox-group.tsx +28 -25
  81. package/lib/runtime/components/react/mpx-checkbox.tsx +48 -49
  82. package/lib/runtime/components/react/mpx-form.tsx +25 -28
  83. package/lib/runtime/components/react/mpx-icon.tsx +12 -17
  84. package/lib/runtime/components/react/mpx-image.tsx +436 -0
  85. package/lib/runtime/components/react/mpx-input.tsx +77 -57
  86. package/lib/runtime/components/react/mpx-label.tsx +26 -27
  87. package/lib/runtime/components/react/mpx-movable-area.tsx +18 -23
  88. package/lib/runtime/components/react/mpx-movable-view.tsx +21 -25
  89. package/lib/runtime/components/react/mpx-navigator.tsx +2 -8
  90. package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
  91. package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
  92. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
  93. package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
  94. package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
  95. package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
  96. package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
  97. package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
  98. package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
  99. package/lib/runtime/components/react/mpx-radio-group.tsx +24 -27
  100. package/lib/runtime/components/react/mpx-radio.tsx +45 -54
  101. package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
  102. package/lib/runtime/components/react/mpx-rich-text/index.tsx +121 -0
  103. package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
  104. package/lib/runtime/components/react/mpx-scroll-view.tsx +72 -71
  105. package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
  106. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
  107. package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
  108. package/lib/runtime/components/react/mpx-switch.tsx +29 -23
  109. package/lib/runtime/components/react/mpx-text.tsx +14 -18
  110. package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
  111. package/lib/runtime/components/react/mpx-view.tsx +92 -76
  112. package/lib/runtime/components/react/mpx-web-view.tsx +116 -54
  113. package/lib/runtime/components/react/pickerFaces.ts +104 -0
  114. package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
  115. package/lib/runtime/components/react/types/common.ts +2 -0
  116. package/lib/runtime/components/react/types/global.d.ts +5 -17
  117. package/lib/runtime/components/react/useAnimationHooks.ts +36 -11
  118. package/lib/runtime/components/react/utils.tsx +99 -28
  119. package/lib/runtime/components/web/getInnerListeners.js +6 -6
  120. package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
  121. package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
  122. package/lib/runtime/components/web/mpx-picker.vue +382 -385
  123. package/lib/runtime/components/web/mpx-web-view.vue +175 -161
  124. package/lib/runtime/optionProcessor.js +7 -38
  125. package/lib/runtime/utils.js +2 -0
  126. package/lib/style-compiler/plugins/scope-id.js +30 -2
  127. package/lib/template-compiler/bind-this.js +7 -2
  128. package/lib/template-compiler/compiler.js +79 -47
  129. package/lib/template-compiler/gen-node-react.js +3 -3
  130. package/lib/utils/pre-process-json.js +9 -5
  131. package/package.json +6 -4
  132. package/LICENSE +0 -433
  133. package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
  134. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
  135. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
  136. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
  137. package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
  138. package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
  139. package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
  140. package/lib/runtime/components/web/event.js +0 -105
@@ -47,9 +47,32 @@ const InitialValue = Object.assign({
47
47
  const TransformOrigin = 'transformOrigin';
48
48
  // transform
49
49
  const isTransform = (key) => Object.keys(TransformInitial).includes(key);
50
+ // 多value解析
51
+ const parseValues = (str, char = ' ') => {
52
+ let stack = 0;
53
+ let temp = '';
54
+ const result = [];
55
+ for (let i = 0; i < str.length; i++) {
56
+ if (str[i] === '(') {
57
+ stack++;
58
+ }
59
+ else if (str[i] === ')') {
60
+ stack--;
61
+ }
62
+ // 非括号内 或者 非分隔字符且非空
63
+ if (stack !== 0 || (str[i] !== char && str[i] !== ' ')) {
64
+ temp += str[i];
65
+ }
66
+ if ((stack === 0 && str[i] === char) || i === str.length - 1) {
67
+ result.push(temp);
68
+ temp = '';
69
+ }
70
+ }
71
+ return result;
72
+ };
50
73
  // parse string transform, eg: transform: 'rotateX(45deg) rotateZ(0.785398rad)'
51
74
  const parseTransform = (transformStr) => {
52
- const values = transformStr.trim().split(/\s+/);
75
+ const values = parseValues(transformStr);
53
76
  const transform = [];
54
77
  values.forEach(item => {
55
78
  const match = item.match(/([/\w]+)\(([^)]+)\)/);
@@ -73,7 +96,7 @@ const parseTransform = (transformStr) => {
73
96
  break;
74
97
  case 'matrix':
75
98
  case 'matrix3d':
76
- transform.push({ [key]: val.split(',').map(val => +val) });
99
+ transform.push({ [key]: parseValues(val, ',').map(val => +val) });
77
100
  break;
78
101
  case 'translate':
79
102
  case 'scale':
@@ -84,8 +107,8 @@ const parseTransform = (transformStr) => {
84
107
  {
85
108
  // 2 个以上的值处理
86
109
  key = key.replace('3d', '');
87
- const vals = val.split(',', key === 'rotate' ? 4 : 3);
88
- // scale(.5) === scaleX(.5) scaleY(.5) 这里处理一下
110
+ const vals = parseValues(val, ',').splice(0, key === 'rotate' ? 4 : 3);
111
+ // scale(.5) === scaleX(.5) scaleY(.5)
89
112
  if (vals.length === 1 && key === 'scale') {
90
113
  vals.push(vals[0]);
91
114
  }
@@ -183,11 +206,14 @@ export default function useAnimationHooks(props) {
183
206
  }
184
207
  // 添加每个key的多次step动画
185
208
  animatedKeys.forEach(key => {
186
- let toVal = (rules.get(key) || transform.get(key));
187
209
  // key不存在,第一轮取shareValMap[key]value,非第一轮取上一轮的
188
- if (toVal === undefined) {
189
- toVal = index > 0 ? lastValueMap[key] : shareValMap[key].value;
190
- }
210
+ const toVal = rules.get(key) !== undefined
211
+ ? rules.get(key)
212
+ : transform.get(key) !== undefined
213
+ ? transform.get(key)
214
+ : index > 0
215
+ ? lastValueMap[key]
216
+ : shareValMap[key].value;
191
217
  const animation = getAnimation({ key, value: toVal }, { delay, duration, easing }, needSetCallback ? setTransformOrigin : undefined);
192
218
  needSetCallback = false;
193
219
  if (!sequence[key]) {
@@ -298,6 +324,6 @@ export default function useAnimationHooks(props) {
298
324
  styles[key] = shareValMap[key].value;
299
325
  }
300
326
  return styles;
301
- }, Object.assign({}, originalStyle));
327
+ }, {});
302
328
  });
303
329
  }
@@ -1,13 +1,16 @@
1
- import { useEffect, useRef, isValidElement, useContext, useState, Children, cloneElement } from 'react';
2
- import { isObject, hasOwn, diffAndCloneA, error, warn, getFocusedNavigation } from '@mpxjs/utils';
1
+ import { useEffect, useCallback, useMemo, useRef, isValidElement, useContext, useState, Children, cloneElement } from 'react';
2
+ import { Image } from 'react-native';
3
+ import { isObject, isFunction, isNumber, hasOwn, diffAndCloneA, error, warn, getFocusedNavigation } from '@mpxjs/utils';
3
4
  import { VarContext } from './context';
4
5
  import { ExpressionParser, parseFunc, ReplaceSource } from './parser';
5
6
  import { initialWindowMetrics } from 'react-native-safe-area-context';
7
+ import FastImage from '@d11/react-native-fast-image';
6
8
  export const TEXT_STYLE_REGEX = /color|font.*|text.*|letterSpacing|lineHeight|includeFontPadding|writingDirection/;
7
9
  export const PERCENT_REGEX = /^\s*-?\d+(\.\d+)?%\s*$/;
8
10
  export const URL_REGEX = /^\s*url\(["']?(.*?)["']?\)\s*$/;
11
+ export const SVG_REGEXP = /https?:\/\/.*\.(?:svg)/i;
9
12
  export const BACKGROUND_REGEX = /^background(Image|Size|Repeat|Position)$/;
10
- export const TEXT_PROPS_REGEX = /ellipsizeMode|numberOfLines/;
13
+ export const TEXT_PROPS_REGEX = /ellipsizeMode|numberOfLines|allowFontScaling/;
11
14
  export const DEFAULT_FONT_SIZE = 16;
12
15
  export const HIDDEN_STYLE = {
13
16
  opacity: 0
@@ -24,10 +27,7 @@ const safeAreaInsetMap = {
24
27
  };
25
28
  function getSafeAreaInset(name) {
26
29
  const navigation = getFocusedNavigation();
27
- const insets = {
28
- ...initialWindowMetrics?.insets,
29
- ...navigation?.insets
30
- };
30
+ const insets = extendObject({}, initialWindowMetrics?.insets, navigation?.insets);
31
31
  return insets[safeAreaInsetMap[name]];
32
32
  }
33
33
  export function omit(obj, fields) {
@@ -69,7 +69,7 @@ export const parseInlineStyle = (inlineStyle = '') => {
69
69
  if (rest.length || !v || !k)
70
70
  return styleObj;
71
71
  const key = k.trim().replace(/-./g, c => c.substring(1).toUpperCase());
72
- return Object.assign(styleObj, { [key]: v.trim() });
72
+ return Object.assign(styleObj, { [key]: global.__formatValue(v.trim()) });
73
73
  }, {});
74
74
  };
75
75
  export const parseUrl = (cssUrl = '') => {
@@ -79,23 +79,13 @@ export const parseUrl = (cssUrl = '') => {
79
79
  return match?.[1];
80
80
  };
81
81
  export const getRestProps = (transferProps = {}, originProps = {}, deletePropsKey = []) => {
82
- return {
83
- ...transferProps,
84
- ...omit(originProps, deletePropsKey)
85
- };
82
+ return extendObject({}, transferProps, omit(originProps, deletePropsKey));
86
83
  };
87
84
  export function isText(ele) {
88
85
  if (isValidElement(ele)) {
89
86
  const displayName = ele.type?.displayName;
90
87
  const isCustomText = ele.type?.isCustomText;
91
- return displayName === 'MpxText' || displayName === 'Text' || !!isCustomText;
92
- }
93
- return false;
94
- }
95
- export function isEmbedded(ele) {
96
- if (isValidElement(ele)) {
97
- const displayName = ele.type?.displayName || '';
98
- return ['mpx-checkbox', 'mpx-radio', 'mpx-switch'].includes(displayName);
88
+ return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'Text' || !!isCustomText;
99
89
  }
100
90
  return false;
101
91
  }
@@ -238,6 +228,14 @@ function transformCalc(styleObj, calcKeyPaths, formatter) {
238
228
  });
239
229
  });
240
230
  }
231
+ const stringifyProps = ['fontWeight'];
232
+ function transformStringify(styleObj) {
233
+ stringifyProps.forEach((prop) => {
234
+ if (isNumber(styleObj[prop])) {
235
+ styleObj[prop] = '' + styleObj[prop];
236
+ }
237
+ });
238
+ }
241
239
  export function useTransformStyle(styleObj = {}, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight }) {
242
240
  const varStyle = {};
243
241
  const normalStyle = {};
@@ -336,6 +334,8 @@ export function useTransformStyle(styleObj = {}, { enableVar, externalVarContext
336
334
  }
337
335
  }
338
336
  });
337
+ // transform number enum stringify
338
+ transformStringify(normalStyle);
339
339
  return {
340
340
  normalStyle,
341
341
  hasSelfPercent,
@@ -402,7 +402,7 @@ export function splitProps(props) {
402
402
  export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }) => {
403
403
  const layoutRef = useRef({});
404
404
  const hasLayoutRef = useRef(false);
405
- const layoutStyle = !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {};
405
+ const layoutStyle = useMemo(() => { return !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {}; }, [hasLayoutRef.current]);
406
406
  const layoutProps = {};
407
407
  const enableOffset = props['enable-offset'];
408
408
  if (hasSelfPercent || onLayout || enableOffset) {
@@ -433,8 +433,8 @@ export function wrapChildren(props = {}, { hasVarDec, varContext, textStyle, tex
433
433
  if (textStyle || textProps) {
434
434
  children = Children.map(children, (child) => {
435
435
  if (isText(child)) {
436
- const style = { ...textStyle, ...child.props.style };
437
- return cloneElement(child, { ...textProps, style });
436
+ const style = extendObject({}, textStyle, child.props.style);
437
+ return cloneElement(child, extendObject({}, textProps, { style }));
438
438
  }
439
439
  return child;
440
440
  });
@@ -444,6 +444,34 @@ export function wrapChildren(props = {}, { hasVarDec, varContext, textStyle, tex
444
444
  }
445
445
  return children;
446
446
  }
447
+ export const debounce = (func, delay) => {
448
+ let timer;
449
+ const wrapper = (...args) => {
450
+ clearTimeout(timer);
451
+ timer = setTimeout(() => {
452
+ func(...args);
453
+ }, delay);
454
+ };
455
+ wrapper.clear = () => {
456
+ clearTimeout(timer);
457
+ };
458
+ return wrapper;
459
+ };
460
+ export const useDebounceCallback = (func, delay) => {
461
+ const debounced = useMemo(() => debounce(func, delay), [func]);
462
+ return debounced;
463
+ };
464
+ export const useStableCallback = (callback) => {
465
+ const ref = useRef(callback);
466
+ ref.current = callback;
467
+ return useCallback((...args) => ref.current?.(...args), []);
468
+ };
469
+ export const usePrevious = (value) => {
470
+ const ref = useRef(undefined);
471
+ const prev = ref.current;
472
+ ref.current = value;
473
+ return prev;
474
+ };
447
475
  export function flatGesture(gestures = []) {
448
476
  return (gestures && gestures.flatMap((gesture) => {
449
477
  if (gesture && gesture.nodeRefs) {
@@ -453,3 +481,22 @@ export function flatGesture(gestures = []) {
453
481
  return gesture?.current ? [gesture] : [];
454
482
  })) || [];
455
483
  }
484
+ export const extendObject = Object.assign;
485
+ export function getCurrentPage(pageId) {
486
+ if (!global.getCurrentPages)
487
+ return;
488
+ const pages = global.getCurrentPages();
489
+ return pages.find((page) => isFunction(page.getPageId) && page.getPageId() === pageId);
490
+ }
491
+ export function renderImage(imageProps, enableFastImage = false) {
492
+ const Component = enableFastImage ? FastImage : Image;
493
+ return <Component {...imageProps}/>;
494
+ }
495
+ export function pickStyle(styleObj = {}, pickedKeys, callback) {
496
+ return pickedKeys.reduce((acc, key) => {
497
+ if (key in styleObj) {
498
+ acc[key] = callback ? callback(key, styleObj[key]) : styleObj[key];
499
+ }
500
+ return acc;
501
+ }, {});
502
+ }
@@ -2,31 +2,30 @@ interface EventConfig {
2
2
  [key: string]: string[];
3
3
  }
4
4
 
5
- const eventConfigMap: EventConfig = {
6
- bindtap: ['onTouchStart', 'onTouchMove', 'onTouchEnd'],
7
- bindlongpress: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'],
8
- bindtouchstart: ['onTouchStart'],
9
- bindtouchmove: ['onTouchMove'],
10
- bindtouchend: ['onTouchEnd'],
11
- bindtouchcancel: ['onTouchCancel'],
12
- catchtap: ['onTouchStart', 'onTouchMove', 'onTouchEnd'],
13
- catchlongpress: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'],
14
- catchtouchstart: ['onTouchStart'],
15
- catchtouchmove: ['onTouchMove'],
16
- catchtouchend: ['onTouchEnd'],
17
- catchtouchcancel: ['onTouchCancel'],
18
- 'capture-bindtap': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'],
19
- 'capture-bindlongpress': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'],
20
- 'capture-bindtouchstart': ['onTouchStartCapture'],
21
- 'capture-bindtouchmove': ['onTouchMoveCapture'],
22
- 'capture-bindtouchend': ['onTouchEndCapture'],
23
- 'capture-bindtouchcancel': ['onTouchCancelCapture'],
24
- 'capture-catchtap': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'],
25
- 'capture-catchlongpress': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'],
26
- 'capture-catchtouchstart': ['onTouchStartCapture'],
27
- 'capture-catchtouchmove': ['onTouchMoveCapture'],
28
- 'capture-catchtouchend': ['onTouchEndCapture'],
29
- 'capture-catchtouchcancel': ['onTouchCancelCapture']
5
+ const eventConfigMap: { [key: string]: { bitFlag: string; events: string[] } } = {
6
+ bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
7
+ bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
8
+ bindtouchstart: { bitFlag: '2', events: ['onTouchStart'] },
9
+ bindtouchmove: { bitFlag: '3', events: ['onTouchMove'] },
10
+ bindtouchend: { bitFlag: '4', events: ['onTouchEnd'] },
11
+ bindtouchcancel: { bitFlag: '5', events: ['onTouchCancel'] },
12
+ catchtap: { bitFlag: '6', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
13
+ catchlongpress: { bitFlag: '7', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
14
+ catchtouchstart: { bitFlag: '8', events: ['onTouchStart'] },
15
+ catchtouchmove: { bitFlag: '9', events: ['onTouchMove'] },
16
+ catchtouchend: { bitFlag: 'a', events: ['onTouchEnd'] },
17
+ catchtouchcancel: { bitFlag: 'b', events: ['onTouchCancel'] },
18
+ 'capture-bindtap': { bitFlag: 'c', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'] },
19
+ 'capture-bindlongpress': { bitFlag: 'd', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'] },
20
+ 'capture-bindtouchstart': { bitFlag: 'e', events: ['onTouchStartCapture'] },
21
+ 'capture-bindtouchmove': { bitFlag: 'f', events: ['onTouchMoveCapture'] },
22
+ 'capture-bindtouchend': { bitFlag: 'g', events: ['onTouchEndCapture'] },
23
+ 'capture-bindtouchcancel': { bitFlag: 'h', events: ['onTouchCancelCapture'] },
24
+ 'capture-catchtap': { bitFlag: 'i', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'] },
25
+ 'capture-catchlongpress': { bitFlag: 'j', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'] },
26
+ 'capture-catchtouchstart': { bitFlag: 'k', events: ['onTouchStartCapture'] },
27
+ 'capture-catchtouchmove': { bitFlag: 'l', events: ['onTouchMoveCapture'] },
28
+ 'capture-catchtouchend': { bitFlag: 'm', events: ['onTouchEndCapture'] },
29
+ 'capture-catchtouchcancel': { bitFlag: 'n', events: ['onTouchCancelCapture'] }
30
30
  }
31
-
32
31
  export default eventConfigMap