@mpxjs/webpack-plugin 2.9.67 → 2.9.70-alpha.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 (161) hide show
  1. package/README.md +1 -1
  2. package/lib/config.js +14 -0
  3. package/lib/dependencies/AddEntryDependency.js +24 -0
  4. package/lib/dependencies/ResolveDependency.js +5 -0
  5. package/lib/index.js +51 -15
  6. package/lib/json-compiler/helper.js +3 -3
  7. package/lib/loader.js +53 -0
  8. package/lib/platform/template/wx/component-config/button.js +14 -2
  9. package/lib/platform/template/wx/component-config/canvas.js +8 -0
  10. package/lib/platform/template/wx/component-config/image.js +4 -0
  11. package/lib/platform/template/wx/component-config/input.js +5 -1
  12. package/lib/platform/template/wx/component-config/rich-text.js +4 -0
  13. package/lib/platform/template/wx/component-config/scroll-view.js +4 -0
  14. package/lib/platform/template/wx/component-config/swiper.js +1 -1
  15. package/lib/platform/template/wx/component-config/switch.js +4 -0
  16. package/lib/platform/template/wx/component-config/text.js +4 -0
  17. package/lib/platform/template/wx/component-config/textarea.js +6 -1
  18. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  19. package/lib/platform/template/wx/component-config/view.js +4 -0
  20. package/lib/platform/template/wx/index.js +127 -1
  21. package/lib/react/processStyles.js +14 -4
  22. package/lib/react/processTemplate.js +3 -0
  23. package/lib/resolve-loader.js +4 -1
  24. package/lib/resolver/AddModePlugin.js +8 -8
  25. package/lib/runtime/components/react/context.ts +6 -0
  26. package/lib/runtime/components/react/dist/context.js +2 -0
  27. package/lib/runtime/components/react/dist/event.config.js +24 -24
  28. package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
  29. package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
  30. package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
  31. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
  32. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
  33. package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
  34. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
  35. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
  36. package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
  37. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
  38. package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
  39. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
  40. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
  41. package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
  42. package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
  43. package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
  44. package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
  45. package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
  46. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
  47. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
  48. package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
  49. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
  50. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
  51. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
  52. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
  53. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
  54. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
  55. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
  56. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
  57. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
  58. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
  59. package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
  60. package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
  61. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
  62. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
  63. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
  64. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
  65. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
  66. package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
  67. package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
  68. package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
  69. package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
  70. package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
  71. package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
  72. package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
  73. package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
  74. package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
  75. package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
  76. package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
  77. package/lib/runtime/components/react/dist/utils.jsx +70 -23
  78. package/lib/runtime/components/react/getInnerListeners.ts +36 -43
  79. package/lib/runtime/components/react/mpx-button.tsx +95 -43
  80. package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
  81. package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
  82. package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
  83. package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
  84. package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
  85. package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
  86. package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
  87. package/lib/runtime/components/react/mpx-canvas/index.tsx +302 -0
  88. package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
  89. package/lib/runtime/components/react/mpx-checkbox-group.tsx +13 -12
  90. package/lib/runtime/components/react/mpx-checkbox.tsx +28 -28
  91. package/lib/runtime/components/react/mpx-form.tsx +10 -8
  92. package/lib/runtime/components/react/mpx-icon.tsx +10 -15
  93. package/lib/runtime/components/react/mpx-image.tsx +396 -0
  94. package/lib/runtime/components/react/mpx-input.tsx +61 -33
  95. package/lib/runtime/components/react/mpx-label.tsx +14 -13
  96. package/lib/runtime/components/react/mpx-movable-area.tsx +8 -7
  97. package/lib/runtime/components/react/mpx-movable-view.tsx +1 -1
  98. package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
  99. package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
  100. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
  101. package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
  102. package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
  103. package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
  104. package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
  105. package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
  106. package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
  107. package/lib/runtime/components/react/mpx-radio-group.tsx +11 -12
  108. package/lib/runtime/components/react/mpx-radio.tsx +26 -29
  109. package/lib/runtime/components/react/mpx-scroll-view.tsx +32 -30
  110. package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
  111. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
  112. package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
  113. package/lib/runtime/components/react/mpx-switch.tsx +10 -8
  114. package/lib/runtime/components/react/mpx-text.tsx +6 -2
  115. package/lib/runtime/components/react/mpx-view.tsx +81 -59
  116. package/lib/runtime/components/react/mpx-web-view.tsx +46 -19
  117. package/lib/runtime/components/react/pickerFaces.ts +104 -0
  118. package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
  119. package/lib/runtime/components/react/types/common.ts +2 -0
  120. package/lib/runtime/components/react/types/global.d.ts +3 -16
  121. package/lib/runtime/components/react/utils.tsx +98 -27
  122. package/lib/runtime/components/tenon/getInnerListeners.js +334 -0
  123. package/lib/runtime/components/tenon/tenon-button.vue +309 -0
  124. package/lib/runtime/components/tenon/tenon-image.vue +66 -0
  125. package/lib/runtime/components/tenon/tenon-input.vue +171 -0
  126. package/lib/runtime/components/tenon/tenon-rich-text.vue +26 -0
  127. package/lib/runtime/components/tenon/tenon-scroll-view.vue +127 -0
  128. package/lib/runtime/components/tenon/tenon-switch.vue +96 -0
  129. package/lib/runtime/components/tenon/tenon-text.vue +70 -0
  130. package/lib/runtime/components/tenon/tenon-textarea.vue +86 -0
  131. package/lib/runtime/components/tenon/tenon-view.vue +93 -0
  132. package/lib/runtime/components/web/getInnerListeners.js +6 -6
  133. package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
  134. package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
  135. package/lib/runtime/components/web/mpx-picker.vue +382 -385
  136. package/lib/runtime/components/web/mpx-web-view.vue +162 -162
  137. package/lib/runtime/optionProcessor.js +7 -16
  138. package/lib/runtime/optionProcessor.tenon.js +84 -0
  139. package/lib/runtime/utils.js +2 -0
  140. package/lib/style-compiler/index.js +1 -1
  141. package/lib/style-compiler/plugins/hm.js +20 -0
  142. package/lib/template-compiler/bind-this.js +7 -2
  143. package/lib/template-compiler/compiler.js +70 -42
  144. package/lib/template-compiler/gen-node-react.js +3 -3
  145. package/lib/tenon/index.js +117 -0
  146. package/lib/tenon/processJSON.js +352 -0
  147. package/lib/tenon/processScript.js +203 -0
  148. package/lib/tenon/processStyles.js +21 -0
  149. package/lib/tenon/processTemplate.js +126 -0
  150. package/lib/tenon/script-helper.js +223 -0
  151. package/lib/utils/env.js +6 -1
  152. package/lib/utils/get-relative-path.js +25 -0
  153. package/package.json +9 -4
  154. package/LICENSE +0 -433
  155. package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
  156. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
  157. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
  158. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
  159. package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
  160. package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
  161. package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
@@ -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'],
12
+ supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android', 'tenon'],
13
13
  // props预处理
14
14
  preProps: [],
15
15
  // props后处理
@@ -28,6 +28,15 @@ 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
+ }
31
40
  }
32
41
  }
33
42
  ],
@@ -90,6 +99,16 @@ module.exports = function getSpec ({ warn, error }) {
90
99
  name: 'v-for',
91
100
  value: `(${itemName}, ${indexName}) in ${parsed.result}`
92
101
  }
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
+ }
93
112
  }
94
113
  },
95
114
  {
@@ -115,6 +134,25 @@ module.exports = function getSpec ({ warn, error }) {
115
134
  name: ':key',
116
135
  value
117
136
  }
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
+ }
118
156
  }
119
157
  },
120
158
  {
@@ -125,6 +163,9 @@ module.exports = function getSpec ({ warn, error }) {
125
163
  },
126
164
  web () {
127
165
  return false
166
+ },
167
+ tenon () {
168
+ return false
128
169
  }
129
170
  },
130
171
  {
@@ -167,6 +208,49 @@ module.exports = function getSpec ({ warn, error }) {
167
208
  }
168
209
  ]
169
210
  }
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
+ }
170
254
  }
171
255
  },
172
256
  {
@@ -183,6 +267,12 @@ module.exports = function getSpec ({ warn, error }) {
183
267
  name: 'ref',
184
268
  value: `__mpx_ref_${value}__`
185
269
  }
270
+ },
271
+ tenon ({ value }) {
272
+ return {
273
+ name: 'ref',
274
+ value: `${value}`
275
+ }
186
276
  }
187
277
  },
188
278
  {
@@ -232,6 +322,14 @@ module.exports = function getSpec ({ warn, error }) {
232
322
  value: classBinding[0]
233
323
  }
234
324
  }
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
+ }
235
333
  }
236
334
  },
237
335
  // 通用指令
@@ -289,6 +387,17 @@ module.exports = function getSpec ({ warn, error }) {
289
387
  name: 'v-' + dir,
290
388
  value: parsed.result
291
389
  }
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
+ }
292
401
  }
293
402
  },
294
403
  // 事件
@@ -432,6 +541,23 @@ module.exports = function getSpec ({ warn, error }) {
432
541
  name: rPrefix + rEventName + meta.modifierStr,
433
542
  value
434
543
  }
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
+ }
435
561
  }
436
562
  },
437
563
  // 无障碍
@@ -56,13 +56,23 @@ module.exports = function (styles, {
56
56
  error
57
57
  })
58
58
  if (ctorType === 'app') {
59
- output += `global.__getAppClassMap = function() {
60
- return ${shallowStringify(classMap)};
59
+ output += `
60
+ let __appClassMap
61
+ global.__getAppClassMap = function() {
62
+ if(!__appClassMap) {
63
+ __appClassMap = ${shallowStringify(classMap)};
64
+ }
65
+ return __appClassMap;
61
66
  };\n`
62
67
  } else {
63
- output += `global.currentInject.injectMethods = {
68
+ output += `
69
+ let __classMap
70
+ global.currentInject.injectMethods = {
64
71
  __getClassMap: function() {
65
- return ${shallowStringify(classMap)};
72
+ if(!__classMap) {
73
+ __classMap = ${shallowStringify(classMap)};
74
+ }
75
+ return __classMap;
66
76
  }
67
77
  };\n`
68
78
  }
@@ -119,6 +119,9 @@ module.exports = function (template, {
119
119
  }, meta.wxsModuleMap)
120
120
  const bindResult = bindThis.transform(rawCode, {
121
121
  ignoreMap
122
+ // customBindThis (path, t) {
123
+ // path.replaceWith(t.callExpression(t.identifier('getValue'), [t.stringLiteral(path.node.name)]))
124
+ // }
122
125
  })
123
126
  output += `global.currentInject.render = function (createElement, getComponent) {
124
127
  return ${bindResult.code}
@@ -1,3 +1,6 @@
1
1
  module.exports = function () {
2
- return `module.exports = __mpx_resolve_path__(${JSON.stringify(this.resource)})`
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)})`
3
6
  }
@@ -6,17 +6,17 @@ const addInfix = require('../utils/add-infix')
6
6
  const { JSON_JS_EXT } = require('../utils/const')
7
7
 
8
8
  module.exports = class AddModePlugin {
9
- constructor (source, mode, fileConditionRules, target, defaultMode) {
9
+ constructor (source, mode, options, target) {
10
10
  this.source = source
11
11
  this.target = target
12
12
  this.mode = mode
13
- this.fileConditionRules = fileConditionRules
14
- this.defaultMode = defaultMode
13
+ this.options = options
15
14
  }
16
15
 
17
16
  apply (resolver) {
18
17
  const target = resolver.ensureHook(this.target)
19
- const { defaultMode, mode } = this
18
+ const { options = {}, mode } = this
19
+ const { defaultMode, fileConditionRules, implicitMode } = options
20
20
  resolver.getHook(this.source).tapAsync('AddModePlugin', (request, resolveContext, callback) => {
21
21
  if (request.mode || request.env) {
22
22
  return callback()
@@ -32,20 +32,20 @@ module.exports = class AddModePlugin {
32
32
  extname = path.extname(resourcePath)
33
33
  }
34
34
  // 当前资源没有后缀名或者路径不符合fileConditionRules规则时,直接返回
35
- if (!extname || !matchCondition(resourcePath, this.fileConditionRules)) return callback()
35
+ if (!extname || !matchCondition(resourcePath, fileConditionRules)) return callback()
36
36
  const queryObj = parseQuery(request.query || '?')
37
37
  const queryInfix = queryObj.infix
38
- queryObj.mode = mode
38
+ if (!implicitMode) queryObj.mode = mode
39
39
  queryObj.infix = `${queryInfix || ''}.${mode}`
40
40
  obj.query = stringifyQuery(queryObj)
41
41
  obj.path = addInfix(resourcePath, mode, extname)
42
42
  obj.relativePath = request.relativePath && addInfix(request.relativePath, mode, extname)
43
43
  resolver.doResolve(target, Object.assign({}, request, obj), 'add mode: ' + mode, resolveContext, (err, result) => {
44
- if (this.defaultMode && !result) {
44
+ if (defaultMode && !result) {
45
45
  queryObj.infix = `${queryInfix || ''}.${defaultMode}`
46
46
  obj.query = stringifyQuery(queryObj)
47
47
  obj.path = addInfix(resourcePath, defaultMode, extname)
48
- resolver.doResolve(target, Object.assign({}, request, obj), 'add mode: ' + this.defaultMode, resolveContext, (err, result) => {
48
+ resolver.doResolve(target, Object.assign({}, request, obj), 'add mode: ' + defaultMode, resolveContext, (err, result) => {
49
49
  callback(err, result)
50
50
  })
51
51
  return
@@ -5,6 +5,8 @@ export type LabelContextValue = MutableRefObject<{
5
5
  triggerChange: (evt: NativeSyntheticEvent<TouchEvent>) => void
6
6
  }>
7
7
 
8
+ export type KeyboardAvoidContextValue = (enabled: boolean) => void
9
+
8
10
  export interface GroupValue {
9
11
  [key: string]: { checked: boolean; setValue: Dispatch<SetStateAction<boolean>> }
10
12
  }
@@ -46,3 +48,7 @@ export const PickerContext = createContext(null)
46
48
  export const VarContext = createContext({})
47
49
 
48
50
  export const IntersectionObserverContext = createContext<IntersectionObserver | null>(null)
51
+
52
+ export const RouteContext = createContext<number | null>(null)
53
+
54
+ export const KeyboardAvoidContext = createContext<KeyboardAvoidContextValue | null>(null)
@@ -7,3 +7,5 @@ export const LabelContext = createContext(null);
7
7
  export const PickerContext = createContext(null);
8
8
  export const VarContext = createContext({});
9
9
  export const IntersectionObserverContext = createContext(null);
10
+ export const RouteContext = createContext(null);
11
+ export const KeyboardAvoidContext = createContext(null);
@@ -1,27 +1,27 @@
1
1
  const eventConfigMap = {
2
- bindtap: ['onTouchStart', 'onTouchMove', 'onTouchEnd'],
3
- bindlongpress: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'],
4
- bindtouchstart: ['onTouchStart'],
5
- bindtouchmove: ['onTouchMove'],
6
- bindtouchend: ['onTouchEnd'],
7
- bindtouchcancel: ['onTouchCancel'],
8
- catchtap: ['onTouchStart', 'onTouchMove', 'onTouchEnd'],
9
- catchlongpress: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'],
10
- catchtouchstart: ['onTouchStart'],
11
- catchtouchmove: ['onTouchMove'],
12
- catchtouchend: ['onTouchEnd'],
13
- catchtouchcancel: ['onTouchCancel'],
14
- 'capture-bindtap': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'],
15
- 'capture-bindlongpress': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'],
16
- 'capture-bindtouchstart': ['onTouchStartCapture'],
17
- 'capture-bindtouchmove': ['onTouchMoveCapture'],
18
- 'capture-bindtouchend': ['onTouchEndCapture'],
19
- 'capture-bindtouchcancel': ['onTouchCancelCapture'],
20
- 'capture-catchtap': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'],
21
- 'capture-catchlongpress': ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'],
22
- 'capture-catchtouchstart': ['onTouchStartCapture'],
23
- 'capture-catchtouchmove': ['onTouchMoveCapture'],
24
- 'capture-catchtouchend': ['onTouchEndCapture'],
25
- 'capture-catchtouchcancel': ['onTouchCancelCapture']
2
+ bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
3
+ bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
4
+ bindtouchstart: { bitFlag: '2', events: ['onTouchStart'] },
5
+ bindtouchmove: { bitFlag: '3', events: ['onTouchMove'] },
6
+ bindtouchend: { bitFlag: '4', events: ['onTouchEnd'] },
7
+ bindtouchcancel: { bitFlag: '5', events: ['onTouchCancel'] },
8
+ catchtap: { bitFlag: '6', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
9
+ catchlongpress: { bitFlag: '7', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
10
+ catchtouchstart: { bitFlag: '8', events: ['onTouchStart'] },
11
+ catchtouchmove: { bitFlag: '9', events: ['onTouchMove'] },
12
+ catchtouchend: { bitFlag: 'a', events: ['onTouchEnd'] },
13
+ catchtouchcancel: { bitFlag: 'b', events: ['onTouchCancel'] },
14
+ 'capture-bindtap': { bitFlag: 'c', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'] },
15
+ 'capture-bindlongpress': { bitFlag: 'd', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'] },
16
+ 'capture-bindtouchstart': { bitFlag: 'e', events: ['onTouchStartCapture'] },
17
+ 'capture-bindtouchmove': { bitFlag: 'f', events: ['onTouchMoveCapture'] },
18
+ 'capture-bindtouchend': { bitFlag: 'g', events: ['onTouchEndCapture'] },
19
+ 'capture-bindtouchcancel': { bitFlag: 'h', events: ['onTouchCancelCapture'] },
20
+ 'capture-catchtap': { bitFlag: 'i', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture'] },
21
+ 'capture-catchlongpress': { bitFlag: 'j', events: ['onTouchStartCapture', 'onTouchMoveCapture', 'onTouchEndCapture', 'onTouchCancelCapture'] },
22
+ 'capture-catchtouchstart': { bitFlag: 'k', events: ['onTouchStartCapture'] },
23
+ 'capture-catchtouchmove': { bitFlag: 'l', events: ['onTouchMoveCapture'] },
24
+ 'capture-catchtouchend': { bitFlag: 'm', events: ['onTouchEndCapture'] },
25
+ 'capture-catchtouchcancel': { bitFlag: 'n', events: ['onTouchCancelCapture'] }
26
26
  };
27
27
  export default eventConfigMap;