@mpxjs/webpack-plugin 2.9.70-alpha.1 → 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/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 +0 -2
- package/lib/runtime/components/react/dist/getInnerListeners.js +34 -31
- package/lib/runtime/components/react/dist/mpx-button.jsx +11 -11
- 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 +12 -15
- package/lib/runtime/components/react/dist/mpx-input.jsx +10 -8
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +92 -57
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +1 -2
- 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 +79 -67
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +19 -16
- package/lib/runtime/components/react/dist/mpx-root-portal.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +2 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +13 -7
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +382 -325
- package/lib/runtime/components/react/dist/mpx-view.jsx +15 -13
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +22 -118
- package/lib/runtime/components/react/dist/pickerFaces.js +1 -6
- 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 +15 -10
- package/lib/runtime/components/react/dist/utils.jsx +117 -84
- 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/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/compiler.js +96 -29
- 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/locale-provider.jsx +0 -15
- package/lib/runtime/components/react/dist/mpx-icon.jsx +0 -41
- package/lib/runtime/components/react/dist/mpx-portal/portal-consumer.jsx +0 -23
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.jsx +0 -124
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +0 -40
- package/lib/runtime/components/react/dist/mpx-portal.jsx +0 -12
- package/lib/runtime/components/react/dist/mpx-provider.jsx +0 -31
- 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
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
-
|
|
4
|
-
type OverlayProps = {
|
|
5
|
-
itemHeight: number
|
|
6
|
-
overlayItemStyle?: StyleProp<ViewStyle>
|
|
7
|
-
overlayContainerStyle?: StyleProp<ViewStyle>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const Overlay = ({ itemHeight, overlayItemStyle, overlayContainerStyle }: OverlayProps) => {
|
|
11
|
-
return (
|
|
12
|
-
<View style={[styles.overlayContainer, overlayContainerStyle]} pointerEvents={'none'}>
|
|
13
|
-
<View style={[styles.selection, { height: itemHeight }, overlayItemStyle]} />
|
|
14
|
-
</View>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const styles = StyleSheet.create({
|
|
19
|
-
overlayContainer: {
|
|
20
|
-
...StyleSheet.absoluteFillObject,
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
alignItems: 'center'
|
|
23
|
-
},
|
|
24
|
-
selection: {
|
|
25
|
-
borderTopWidth: 1,
|
|
26
|
-
borderBottomWidth: 1,
|
|
27
|
-
borderColor: 'rgba(0, 0, 0, 0.05)',
|
|
28
|
-
alignSelf: 'stretch'
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
export default React.memo(Overlay)
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { extendEvent } from './getInnerListeners'
|
|
2
|
-
import { isBrowser } from '../../env'
|
|
3
|
-
|
|
4
|
-
function MpxEvent (layer) {
|
|
5
|
-
this.targetElement = null
|
|
6
|
-
|
|
7
|
-
this.touches = []
|
|
8
|
-
|
|
9
|
-
this.touchStartX = 0
|
|
10
|
-
|
|
11
|
-
this.touchStartY = 0
|
|
12
|
-
|
|
13
|
-
this.startTimer = null
|
|
14
|
-
|
|
15
|
-
this.needTap = true
|
|
16
|
-
|
|
17
|
-
this.isTouchDevice = document && ('ontouchstart' in document.documentElement)
|
|
18
|
-
|
|
19
|
-
this.onTouchStart = (event) => {
|
|
20
|
-
if (event.targetTouches?.length > 1) {
|
|
21
|
-
return true
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this.touches = event.targetTouches
|
|
25
|
-
this.targetElement = event.target
|
|
26
|
-
this.needTap = true
|
|
27
|
-
this.startTimer = null
|
|
28
|
-
this.touchStartX = this.touches[0].pageX
|
|
29
|
-
this.touchStartY = this.touches[0].pageY
|
|
30
|
-
this.startTimer = setTimeout(() => {
|
|
31
|
-
this.needTap = false
|
|
32
|
-
this.sendEvent(this.targetElement, 'longpress', event)
|
|
33
|
-
this.sendEvent(this.targetElement, 'longtap', event)
|
|
34
|
-
}, 350)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.onTouchMove = (event) => {
|
|
38
|
-
const touch = event.changedTouches[0]
|
|
39
|
-
if (Math.abs(touch.pageX - this.touchStartX) > 1 || Math.abs(touch.pageY - this.touchStartY) > 1) {
|
|
40
|
-
this.needTap = false
|
|
41
|
-
this.startTimer && clearTimeout(this.startTimer)
|
|
42
|
-
this.startTimer = null
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this.onTouchEnd = (event) => {
|
|
47
|
-
if (event.targetTouches?.length > 1) {
|
|
48
|
-
return true
|
|
49
|
-
}
|
|
50
|
-
this.startTimer && clearTimeout(this.startTimer)
|
|
51
|
-
this.startTimer = null
|
|
52
|
-
if (this.needTap) {
|
|
53
|
-
this.sendEvent(this.targetElement, 'tap', event)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.onClick = (event) => {
|
|
58
|
-
this.targetElement = event.target
|
|
59
|
-
this.sendEvent(this.targetElement, 'tap', event)
|
|
60
|
-
}
|
|
61
|
-
this.sendEvent = (targetElement, type, event) => {
|
|
62
|
-
const touchEvent = new CustomEvent(type, {
|
|
63
|
-
bubbles: true,
|
|
64
|
-
cancelable: true
|
|
65
|
-
})
|
|
66
|
-
const changedTouches = event.changedTouches || []
|
|
67
|
-
extendEvent(touchEvent, {
|
|
68
|
-
timeStamp: event.timeStamp,
|
|
69
|
-
changedTouches,
|
|
70
|
-
touches: changedTouches,
|
|
71
|
-
detail: {
|
|
72
|
-
// pc端点击事件可能没有changedTouches,所以直接从 event中取
|
|
73
|
-
x: changedTouches[0]?.pageX || event.pageX || 0,
|
|
74
|
-
y: changedTouches[0]?.pageY || event.pageY || 0
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
targetElement && targetElement.dispatchEvent(touchEvent)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
this.addListener = () => {
|
|
81
|
-
if (this.isTouchDevice) {
|
|
82
|
-
layer.addEventListener('touchstart', this.onTouchStart, true)
|
|
83
|
-
layer.addEventListener('touchmove', this.onTouchMove, true)
|
|
84
|
-
layer.addEventListener('touchend', this.onTouchEnd, true)
|
|
85
|
-
} else {
|
|
86
|
-
layer.addEventListener('click', this.onClick, true)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
this.addListener()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function createEvent () {
|
|
93
|
-
if (isBrowser && !global.__mpxCreatedEvent) {
|
|
94
|
-
global.__mpxCreatedEvent = true
|
|
95
|
-
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
96
|
-
// eslint-disable-next-line no-new
|
|
97
|
-
new MpxEvent(document.body)
|
|
98
|
-
} else {
|
|
99
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
100
|
-
// eslint-disable-next-line no-new
|
|
101
|
-
new MpxEvent(document.body)
|
|
102
|
-
}, false)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
File without changes
|