@mpxjs/webpack-plugin 2.10.24-beta.1 → 2.10.24-test.1
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/index.js +1 -4
- package/lib/platform/style/wx/index.js +395 -104
- package/lib/react/style-helper.js +6 -6
- package/lib/resolver/AddEnvPlugin.js +1 -1
- package/lib/resolver/AddModePlugin.js +1 -1
- package/lib/runtime/components/react/animationHooks/index.ts +7 -3
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts +0 -2
- package/lib/runtime/components/react/dist/animationHooks/index.js +6 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +2 -6
- package/lib/runtime/components/react/dist/event.config.js +28 -24
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +1 -1
- package/lib/runtime/components/react/dist/getInnerListeners.js +74 -56
- package/lib/runtime/components/react/dist/mpx-button.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-button.jsx +16 -9
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.jsx +1 -2
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +1 -2
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +1 -3
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +3 -4
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +8 -9
- package/lib/runtime/components/react/dist/mpx-form.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-form.jsx +5 -5
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-image.jsx +59 -43
- package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-input.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-label.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-label.jsx +5 -6
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +3 -3
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +6 -6
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +5 -7
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.jsx +1 -2
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +3 -4
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-radio.jsx +8 -9
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +1 -2
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +6 -6
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +24 -19
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +4 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +11 -4
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.jsx +6 -6
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +5 -5
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +6 -6
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +5 -5
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +4 -7
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-switch.jsx +1 -2
- package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-text.jsx +29 -25
- package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-video.jsx +4 -4
- package/lib/runtime/components/react/dist/mpx-view.d.ts +2 -1
- package/lib/runtime/components/react/dist/mpx-view.jsx +214 -113
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +1 -2
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +5 -1
- package/lib/runtime/components/react/dist/namedColorSet.d.ts +2 -0
- package/lib/runtime/components/react/dist/namedColorSet.js +149 -0
- package/lib/runtime/components/react/dist/utils.d.ts +73 -70
- package/lib/runtime/components/react/dist/utils.jsx +1295 -445
- package/lib/runtime/components/react/event.config.ts +32 -25
- package/lib/runtime/components/react/getInnerListeners.ts +84 -60
- package/lib/runtime/components/react/mpx-button.tsx +18 -16
- package/lib/runtime/components/react/mpx-camera.tsx +0 -3
- package/lib/runtime/components/react/mpx-canvas/index.tsx +3 -7
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +3 -3
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +2 -6
- package/lib/runtime/components/react/mpx-checkbox.tsx +9 -11
- package/lib/runtime/components/react/mpx-form.tsx +6 -6
- package/lib/runtime/components/react/mpx-icon/index.tsx +1 -3
- package/lib/runtime/components/react/mpx-image.tsx +65 -54
- package/lib/runtime/components/react/mpx-input.tsx +1 -3
- package/lib/runtime/components/react/mpx-label.tsx +6 -8
- package/lib/runtime/components/react/mpx-movable-area.tsx +3 -4
- package/lib/runtime/components/react/mpx-movable-view.tsx +7 -7
- package/lib/runtime/components/react/mpx-picker-view/index.tsx +6 -8
- package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +2 -4
- package/lib/runtime/components/react/mpx-progress.tsx +0 -3
- package/lib/runtime/components/react/mpx-radio-group.tsx +2 -6
- package/lib/runtime/components/react/mpx-radio.tsx +9 -11
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +0 -3
- package/lib/runtime/components/react/mpx-scroll-view.tsx +7 -7
- package/lib/runtime/components/react/mpx-simple-text.tsx +24 -26
- package/lib/runtime/components/react/mpx-simple-view.tsx +17 -5
- package/lib/runtime/components/react/mpx-slider.tsx +15 -10
- package/lib/runtime/components/react/mpx-sticky-header.tsx +6 -6
- package/lib/runtime/components/react/mpx-sticky-section.tsx +7 -7
- package/lib/runtime/components/react/mpx-swiper-item.tsx +6 -6
- package/lib/runtime/components/react/mpx-swiper.tsx +5 -8
- package/lib/runtime/components/react/mpx-switch.tsx +0 -3
- package/lib/runtime/components/react/mpx-text.tsx +31 -34
- package/lib/runtime/components/react/mpx-video.tsx +3 -5
- package/lib/runtime/components/react/mpx-view.tsx +235 -126
- package/lib/runtime/components/react/mpx-web-view.tsx +11 -7
- package/lib/runtime/components/react/namedColorSet.ts +150 -0
- package/lib/runtime/components/react/types/getInnerListeners.d.ts +21 -1
- package/lib/runtime/components/react/types/global.d.ts +1 -0
- package/lib/runtime/components/react/utils.tsx +1348 -544
- package/lib/runtime/i18n.wxs +15 -9
- package/lib/style-compiler/strip-conditional.js +19 -4
- package/package.json +2 -2
- package/lib/resolver/ExtendComponentsPlugin.js +0 -91
- package/lib/runtime/components/extends/section-list.mpx +0 -14
- package/lib/runtime/components/react/dist/mpx-section-list.d.ts +0 -56
- package/lib/runtime/components/react/dist/mpx-section-list.jsx +0 -484
- package/lib/runtime/components/react/mpx-section-list.tsx +0 -734
|
@@ -4,13 +4,18 @@ import Portal from './mpx-portal/index'
|
|
|
4
4
|
import { usePreventRemove, PreventRemoveEvent } from '@react-navigation/native'
|
|
5
5
|
import { getCustomEvent } from './getInnerListeners'
|
|
6
6
|
import { promisify, redirectTo, navigateTo, navigateBack, reLaunch, switchTab } from '@mpxjs/api-proxy'
|
|
7
|
-
import { WebView } from 'react-native-webview'
|
|
7
|
+
import { WebView, WebViewProps as RNWebViewProps } from 'react-native-webview'
|
|
8
8
|
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
9
9
|
import { getCurrentPage, useNavigation } from './utils'
|
|
10
10
|
import { WebViewHttpErrorEvent, WebViewEvent, WebViewMessageEvent, WebViewNavigation, WebViewProgressEvent } from 'react-native-webview/lib/WebViewTypes'
|
|
11
11
|
import { RouteContext } from './context'
|
|
12
12
|
import { StyleSheet, View, Text } from 'react-native'
|
|
13
13
|
|
|
14
|
+
// react-native-webview@13.17+ 将 WebView 泛型默认值由 {} 改为 undefined,
|
|
15
|
+
// 导致 WebViewProps & undefined 塌成 never、JSX 直接使用时 props 全部不可赋值。
|
|
16
|
+
// 显式实参化为 WebView<object>(其 props 即 WebViewProps),保留类实例签名使 ref 仍解析为 WebView,兼容各版本声明。
|
|
17
|
+
const RNWebView = WebView as unknown as new (props: RNWebViewProps) => WebView<object>
|
|
18
|
+
|
|
14
19
|
type OnMessageCallbackEvent = {
|
|
15
20
|
detail: {
|
|
16
21
|
data: any[]
|
|
@@ -30,7 +35,6 @@ interface WebViewProps {
|
|
|
30
35
|
binderror?: (event: CommonCallbackEvent) => void
|
|
31
36
|
[x: string]: any
|
|
32
37
|
}
|
|
33
|
-
type WebViewInstance = WebView<{}>
|
|
34
38
|
type Listener = (type: string, callback: (e: Event) => void) => () => void
|
|
35
39
|
|
|
36
40
|
interface PayloadData {
|
|
@@ -78,7 +82,7 @@ const styles = StyleSheet.create({
|
|
|
78
82
|
}
|
|
79
83
|
})
|
|
80
84
|
|
|
81
|
-
const _WebView = forwardRef<HandlerRef<
|
|
85
|
+
const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((props, ref): JSX.Element | null => {
|
|
82
86
|
const { src, bindmessage, bindload, binderror } = props
|
|
83
87
|
const mpx = global.__mpx
|
|
84
88
|
const errorText: ErrorTextMap = {
|
|
@@ -99,7 +103,7 @@ const _WebView = forwardRef<HandlerRef<WebViewInstance, WebViewProps>, WebViewPr
|
|
|
99
103
|
const { pageId } = useContext(RouteContext) || {}
|
|
100
104
|
const [pageLoadErr, setPageLoadErr] = useState<boolean>(false)
|
|
101
105
|
const currentPage = useMemo(() => getCurrentPage(pageId), [pageId])
|
|
102
|
-
const webViewRef = useRef<
|
|
106
|
+
const webViewRef = useRef<WebView>(null)
|
|
103
107
|
const fristLoaded = useRef<boolean>(false)
|
|
104
108
|
const isLoadError = useRef<boolean>(false)
|
|
105
109
|
const isNavigateBack = useRef<boolean>(false)
|
|
@@ -124,7 +128,7 @@ const _WebView = forwardRef<HandlerRef<WebViewInstance, WebViewProps>, WebViewPr
|
|
|
124
128
|
isNavigateBack.current = false
|
|
125
129
|
})
|
|
126
130
|
|
|
127
|
-
useNodesRef<
|
|
131
|
+
useNodesRef<WebView, WebViewProps>(props, ref, webViewRef, {
|
|
128
132
|
style: defaultWebViewStyle
|
|
129
133
|
})
|
|
130
134
|
|
|
@@ -353,7 +357,7 @@ const _WebView = forwardRef<HandlerRef<WebViewInstance, WebViewProps>, WebViewPr
|
|
|
353
357
|
</View>
|
|
354
358
|
)
|
|
355
359
|
: (
|
|
356
|
-
<
|
|
360
|
+
<RNWebView
|
|
357
361
|
containerStyle={ defaultWebViewStyle }
|
|
358
362
|
source={{ uri: src }}
|
|
359
363
|
ref={webViewRef}
|
|
@@ -366,7 +370,7 @@ const _WebView = forwardRef<HandlerRef<WebViewInstance, WebViewProps>, WebViewPr
|
|
|
366
370
|
onHttpError={onHttpError}
|
|
367
371
|
onError={onError}
|
|
368
372
|
allowsBackForwardNavigationGestures={true}
|
|
369
|
-
></
|
|
373
|
+
></RNWebView>)}
|
|
370
374
|
</Portal>
|
|
371
375
|
)
|
|
372
376
|
})
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const namedColorSet: Record<string, boolean> = {
|
|
2
|
+
transparent: true,
|
|
3
|
+
aliceblue: true,
|
|
4
|
+
antiquewhite: true,
|
|
5
|
+
aqua: true,
|
|
6
|
+
aquamarine: true,
|
|
7
|
+
azure: true,
|
|
8
|
+
beige: true,
|
|
9
|
+
bisque: true,
|
|
10
|
+
black: true,
|
|
11
|
+
blanchedalmond: true,
|
|
12
|
+
blue: true,
|
|
13
|
+
blueviolet: true,
|
|
14
|
+
brown: true,
|
|
15
|
+
burlywood: true,
|
|
16
|
+
cadetblue: true,
|
|
17
|
+
chartreuse: true,
|
|
18
|
+
chocolate: true,
|
|
19
|
+
coral: true,
|
|
20
|
+
cornflowerblue: true,
|
|
21
|
+
cornsilk: true,
|
|
22
|
+
crimson: true,
|
|
23
|
+
cyan: true,
|
|
24
|
+
darkblue: true,
|
|
25
|
+
darkcyan: true,
|
|
26
|
+
darkgoldenrod: true,
|
|
27
|
+
darkgray: true,
|
|
28
|
+
darkgreen: true,
|
|
29
|
+
darkgrey: true,
|
|
30
|
+
darkkhaki: true,
|
|
31
|
+
darkmagenta: true,
|
|
32
|
+
darkolivegreen: true,
|
|
33
|
+
darkorange: true,
|
|
34
|
+
darkorchid: true,
|
|
35
|
+
darkred: true,
|
|
36
|
+
darksalmon: true,
|
|
37
|
+
darkseagreen: true,
|
|
38
|
+
darkslateblue: true,
|
|
39
|
+
darkslategrey: true,
|
|
40
|
+
darkturquoise: true,
|
|
41
|
+
darkviolet: true,
|
|
42
|
+
deeppink: true,
|
|
43
|
+
deepskyblue: true,
|
|
44
|
+
dimgray: true,
|
|
45
|
+
dimgrey: true,
|
|
46
|
+
dodgerblue: true,
|
|
47
|
+
firebrick: true,
|
|
48
|
+
floralwhite: true,
|
|
49
|
+
forestgreen: true,
|
|
50
|
+
fuchsia: true,
|
|
51
|
+
gainsboro: true,
|
|
52
|
+
ghostwhite: true,
|
|
53
|
+
gold: true,
|
|
54
|
+
goldenrod: true,
|
|
55
|
+
gray: true,
|
|
56
|
+
green: true,
|
|
57
|
+
greenyellow: true,
|
|
58
|
+
grey: true,
|
|
59
|
+
honeydew: true,
|
|
60
|
+
hotpink: true,
|
|
61
|
+
indianred: true,
|
|
62
|
+
indigo: true,
|
|
63
|
+
ivory: true,
|
|
64
|
+
khaki: true,
|
|
65
|
+
lavender: true,
|
|
66
|
+
lavenderblush: true,
|
|
67
|
+
lawngreen: true,
|
|
68
|
+
lemonchiffon: true,
|
|
69
|
+
lightblue: true,
|
|
70
|
+
lightcoral: true,
|
|
71
|
+
lightcyan: true,
|
|
72
|
+
lightgoldenrodyellow: true,
|
|
73
|
+
lightgray: true,
|
|
74
|
+
lightgreen: true,
|
|
75
|
+
lightgrey: true,
|
|
76
|
+
lightpink: true,
|
|
77
|
+
lightsalmon: true,
|
|
78
|
+
lightseagreen: true,
|
|
79
|
+
lightskyblue: true,
|
|
80
|
+
lightslategrey: true,
|
|
81
|
+
lightsteelblue: true,
|
|
82
|
+
lightyellow: true,
|
|
83
|
+
lime: true,
|
|
84
|
+
limegreen: true,
|
|
85
|
+
linen: true,
|
|
86
|
+
magenta: true,
|
|
87
|
+
maroon: true,
|
|
88
|
+
mediumaquamarine: true,
|
|
89
|
+
mediumblue: true,
|
|
90
|
+
mediumorchid: true,
|
|
91
|
+
mediumpurple: true,
|
|
92
|
+
mediumseagreen: true,
|
|
93
|
+
mediumslateblue: true,
|
|
94
|
+
mediumspringgreen: true,
|
|
95
|
+
mediumturquoise: true,
|
|
96
|
+
mediumvioletred: true,
|
|
97
|
+
midnightblue: true,
|
|
98
|
+
mintcream: true,
|
|
99
|
+
mistyrose: true,
|
|
100
|
+
moccasin: true,
|
|
101
|
+
navajowhite: true,
|
|
102
|
+
navy: true,
|
|
103
|
+
oldlace: true,
|
|
104
|
+
olive: true,
|
|
105
|
+
olivedrab: true,
|
|
106
|
+
orange: true,
|
|
107
|
+
orangered: true,
|
|
108
|
+
orchid: true,
|
|
109
|
+
palegoldenrod: true,
|
|
110
|
+
palegreen: true,
|
|
111
|
+
paleturquoise: true,
|
|
112
|
+
palevioletred: true,
|
|
113
|
+
papayawhip: true,
|
|
114
|
+
peachpuff: true,
|
|
115
|
+
peru: true,
|
|
116
|
+
pink: true,
|
|
117
|
+
plum: true,
|
|
118
|
+
powderblue: true,
|
|
119
|
+
purple: true,
|
|
120
|
+
rebeccapurple: true,
|
|
121
|
+
red: true,
|
|
122
|
+
rosybrown: true,
|
|
123
|
+
royalblue: true,
|
|
124
|
+
saddlebrown: true,
|
|
125
|
+
salmon: true,
|
|
126
|
+
sandybrown: true,
|
|
127
|
+
seagreen: true,
|
|
128
|
+
seashell: true,
|
|
129
|
+
sienna: true,
|
|
130
|
+
silver: true,
|
|
131
|
+
skyblue: true,
|
|
132
|
+
slateblue: true,
|
|
133
|
+
slategray: true,
|
|
134
|
+
snow: true,
|
|
135
|
+
springgreen: true,
|
|
136
|
+
steelblue: true,
|
|
137
|
+
tan: true,
|
|
138
|
+
teal: true,
|
|
139
|
+
thistle: true,
|
|
140
|
+
tomato: true,
|
|
141
|
+
turquoise: true,
|
|
142
|
+
violet: true,
|
|
143
|
+
wheat: true,
|
|
144
|
+
white: true,
|
|
145
|
+
whitesmoke: true,
|
|
146
|
+
yellow: true,
|
|
147
|
+
yellowgreen: true
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default namedColorSet
|
|
@@ -43,6 +43,14 @@ interface EventConfigDetail {
|
|
|
43
43
|
hasCatch: boolean
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
interface EventMeta {
|
|
47
|
+
bitFlag: string
|
|
48
|
+
events: string[]
|
|
49
|
+
eventName: string
|
|
50
|
+
eventType: EventType
|
|
51
|
+
hasCatch: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
type EventConfig = {
|
|
47
55
|
innerRef: InnerRef
|
|
48
56
|
propsRef: PropsRef
|
|
@@ -52,6 +60,15 @@ type EventConfig = {
|
|
|
52
60
|
[index: string]: EventConfigDetail
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
type EventConfigRef = MutableRefObject<EventConfig>
|
|
64
|
+
|
|
65
|
+
type TouchHandler = (e: ExtendedNativeTouchEvent, type: EventType, eventConfig: EventConfig) => void
|
|
66
|
+
|
|
67
|
+
interface TouchHandlerConfig {
|
|
68
|
+
type: EventType
|
|
69
|
+
handler: TouchHandler
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
interface RawConfig {
|
|
56
73
|
layoutRef?: LayoutRef
|
|
57
74
|
disableTap?: boolean
|
|
@@ -101,7 +118,10 @@ export {
|
|
|
101
118
|
Navigation,
|
|
102
119
|
ExtendedNativeTouchEvent,
|
|
103
120
|
EventConfig,
|
|
121
|
+
EventConfigRef,
|
|
122
|
+
EventMeta,
|
|
104
123
|
RawConfig,
|
|
105
124
|
EventType,
|
|
106
|
-
GlobalEventState
|
|
125
|
+
GlobalEventState,
|
|
126
|
+
TouchHandlerConfig
|
|
107
127
|
}
|
|
@@ -14,6 +14,7 @@ declare module '@mpxjs/utils' {
|
|
|
14
14
|
diff: boolean
|
|
15
15
|
diffData: Object | null
|
|
16
16
|
}
|
|
17
|
+
export function shallowEqual (a: unknown, b: unknown): boolean
|
|
17
18
|
export function isObject (value): value is Object
|
|
18
19
|
export function error (msg: string, location?: string, e?: any): void
|
|
19
20
|
export function warn (msg: string, location?: string, e?: any): void
|