@mpxjs/webpack-plugin 2.10.21 → 2.10.24-beta.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 +4 -1
- package/lib/loader.js +2 -0
- package/lib/react/index.js +3 -1
- package/lib/react/processTemplate.js +3 -1
- package/lib/resolver/AddEnvPlugin.js +1 -1
- package/lib/resolver/AddModePlugin.js +1 -1
- package/lib/resolver/ExtendComponentsPlugin.js +91 -0
- package/lib/runtime/components/extends/section-list.mpx +14 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +3 -1
- package/lib/runtime/components/react/dist/mpx-section-list.d.ts +56 -0
- package/lib/runtime/components/react/dist/mpx-section-list.jsx +484 -0
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +12 -12
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +12 -12
- package/lib/runtime/components/react/dist/mpx-text.jsx +15 -15
- package/lib/runtime/components/react/dist/mpx-view.jsx +15 -15
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +2 -1
- package/lib/runtime/components/react/dist/utils.d.ts +1 -0
- package/lib/runtime/components/react/dist/utils.jsx +4 -1
- package/lib/runtime/components/react/mpx-canvas/index.tsx +4 -2
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +3 -1
- package/lib/runtime/components/react/mpx-section-list.tsx +734 -0
- package/lib/runtime/components/react/mpx-simple-text.tsx +12 -12
- package/lib/runtime/components/react/mpx-simple-view.tsx +12 -12
- package/lib/runtime/components/react/mpx-text.tsx +15 -15
- package/lib/runtime/components/react/mpx-view.tsx +15 -15
- package/lib/runtime/components/react/mpx-web-view.tsx +4 -3
- package/lib/runtime/components/react/utils.tsx +5 -1
- package/lib/template-compiler/compiler.js +5 -1
- package/lib/utils/source-location.js +9 -13
- package/lib/web/index.js +3 -1
- package/lib/web/processTemplate.js +3 -1
- package/package.json +6 -4
- package/LICENSE +0 -433
|
@@ -566,13 +566,13 @@ function wrapWithChildren(props, { hasVarDec, enableBackground, backgroundStyle,
|
|
|
566
566
|
}
|
|
567
567
|
const _View = forwardRef((viewProps, ref) => {
|
|
568
568
|
// 性能探针 - total
|
|
569
|
-
let
|
|
569
|
+
let idTotal = -1;
|
|
570
570
|
if (__mpx_perf_framework__)
|
|
571
|
-
|
|
571
|
+
idTotal = perf.scopeStart('view:render:total');
|
|
572
572
|
// ───── props 阶段 ─────
|
|
573
|
-
let
|
|
573
|
+
let idProps = -1;
|
|
574
574
|
if (__mpx_perf_framework__)
|
|
575
|
-
|
|
575
|
+
idProps = perf.scopeStart('view:render:props');
|
|
576
576
|
const { textProps, innerProps: props = {} } = splitProps(viewProps);
|
|
577
577
|
let { style = {}, 'hover-style': hoverStyle, 'hover-start-time': hoverStartTime = 50, 'hover-stay-time': hoverStayTime = 400, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'enable-background': enableBackground, 'enable-fast-image': enableFastImage, 'enable-animation': enableAnimation, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, animation, catchtransitionend, bindtransitionend } = props;
|
|
578
578
|
// 默认样式
|
|
@@ -588,11 +588,11 @@ const _View = forwardRef((viewProps, ref) => {
|
|
|
588
588
|
const { isHover, gesture } = useHover({ enableHover, hoverStartTime, hoverStayTime });
|
|
589
589
|
const styleObj = extendObject({}, defaultStyle, style, isHover ? hoverStyle : {});
|
|
590
590
|
if (__mpx_perf_framework__)
|
|
591
|
-
|
|
591
|
+
perf.scopeEnd(idProps);
|
|
592
592
|
// ───── style 阶段 ─────
|
|
593
|
-
let
|
|
593
|
+
let idStyle = -1;
|
|
594
594
|
if (__mpx_perf_framework__)
|
|
595
|
-
|
|
595
|
+
idStyle = perf.scopeStart('view:render:style');
|
|
596
596
|
const { normalStyle, hasSelfPercent, hasPositionFixed, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(styleObj, {
|
|
597
597
|
enableVar,
|
|
598
598
|
externalVarContext,
|
|
@@ -626,11 +626,11 @@ const _View = forwardRef((viewProps, ref) => {
|
|
|
626
626
|
transitionend
|
|
627
627
|
});
|
|
628
628
|
if (__mpx_perf_framework__)
|
|
629
|
-
|
|
629
|
+
perf.scopeEnd(idStyle);
|
|
630
630
|
// ───── innerProps 阶段 ─────
|
|
631
|
-
let
|
|
631
|
+
let idInnerProps = -1;
|
|
632
632
|
if (__mpx_perf_framework__)
|
|
633
|
-
|
|
633
|
+
idInnerProps = perf.scopeStart('view:render:innerProps');
|
|
634
634
|
const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
|
|
635
635
|
ref: nodeRef,
|
|
636
636
|
style: enableStyleAnimation ? [viewStyle, animationStyle] : viewStyle
|
|
@@ -648,11 +648,11 @@ const _View = forwardRef((viewProps, ref) => {
|
|
|
648
648
|
layoutRef
|
|
649
649
|
});
|
|
650
650
|
if (__mpx_perf_framework__)
|
|
651
|
-
|
|
651
|
+
perf.scopeEnd(idInnerProps);
|
|
652
652
|
// ───── createElement 阶段 ─────
|
|
653
|
-
let
|
|
653
|
+
let idCreate = -1;
|
|
654
654
|
if (__mpx_perf_framework__)
|
|
655
|
-
|
|
655
|
+
idCreate = perf.scopeStart('view:render:createElement');
|
|
656
656
|
const childNode = wrapWithChildren(props, {
|
|
657
657
|
hasVarDec,
|
|
658
658
|
enableBackground: enableBackgroundRef.current,
|
|
@@ -672,9 +672,9 @@ const _View = forwardRef((viewProps, ref) => {
|
|
|
672
672
|
finalComponent = createElement(Portal, null, finalComponent);
|
|
673
673
|
}
|
|
674
674
|
if (__mpx_perf_framework__)
|
|
675
|
-
|
|
675
|
+
perf.scopeEnd(idCreate);
|
|
676
676
|
if (__mpx_perf_framework__)
|
|
677
|
-
|
|
677
|
+
perf.scopeEnd(idTotal);
|
|
678
678
|
return finalComponent;
|
|
679
679
|
});
|
|
680
680
|
_View.displayName = 'MpxView';
|
|
@@ -18,5 +18,6 @@ interface WebViewProps {
|
|
|
18
18
|
binderror?: (event: CommonCallbackEvent) => void;
|
|
19
19
|
[x: string]: any;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
type WebViewInstance = WebView<{}>;
|
|
22
|
+
declare const _WebView: import("react").ForwardRefExoticComponent<Omit<WebViewProps, "ref"> & import("react").RefAttributes<HandlerRef<WebViewInstance, WebViewProps>>>;
|
|
22
23
|
export default _WebView;
|
|
@@ -113,6 +113,7 @@ export interface GestureHandler {
|
|
|
113
113
|
};
|
|
114
114
|
}>;
|
|
115
115
|
current?: unknown;
|
|
116
|
+
handlerTag?: number;
|
|
116
117
|
}
|
|
117
118
|
export declare function flatGesture(gestures?: Array<GestureHandler>): any[];
|
|
118
119
|
export declare function getCurrentPage(pageId: number | null | undefined): any;
|
|
@@ -698,7 +698,10 @@ export function flatGesture(gestures = []) {
|
|
|
698
698
|
return gesture.nodeRefs
|
|
699
699
|
.map((item) => item.getNodeInstance()?.instance?.gestureRef || {});
|
|
700
700
|
}
|
|
701
|
-
|
|
701
|
+
if (gesture && (gesture.current || gesture.handlerTag !== undefined)) {
|
|
702
|
+
return [gesture];
|
|
703
|
+
}
|
|
704
|
+
return [];
|
|
702
705
|
})) || [];
|
|
703
706
|
}
|
|
704
707
|
export function getCurrentPage(pageId) {
|
|
@@ -33,6 +33,8 @@ import { createImageData as canvasCreateImageData } from './ImageData'
|
|
|
33
33
|
import { useConstructorsRegistry } from './constructorsRegistry'
|
|
34
34
|
import Portal from '../mpx-portal'
|
|
35
35
|
|
|
36
|
+
type WebViewInstance = WebView<{}>
|
|
37
|
+
|
|
36
38
|
const stylesheet = StyleSheet.create({
|
|
37
39
|
container: { overflow: 'hidden', flex: 0 },
|
|
38
40
|
webview: {
|
|
@@ -268,7 +270,7 @@ const _Canvas = forwardRef<HandlerRef<CanvasProps & View, CanvasProps>, CanvasPr
|
|
|
268
270
|
canvasComponent = createElement(View, innerProps, createElement(
|
|
269
271
|
WebView,
|
|
270
272
|
{
|
|
271
|
-
ref: (element) => {
|
|
273
|
+
ref: (element: WebViewInstance | null) => {
|
|
272
274
|
if (canvasRef.current) {
|
|
273
275
|
canvasRef.current.webview = element
|
|
274
276
|
}
|
|
@@ -293,7 +295,7 @@ const _Canvas = forwardRef<HandlerRef<CanvasProps & View, CanvasProps>, CanvasPr
|
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
canvasComponent = createElement(View, innerProps, createElement(WebView, {
|
|
296
|
-
ref: (element) => {
|
|
298
|
+
ref: (element: WebViewInstance | null) => {
|
|
297
299
|
if (canvasRef.current) {
|
|
298
300
|
canvasRef.current.webview = element
|
|
299
301
|
}
|
|
@@ -2,6 +2,8 @@ import { useEffect, useRef } from 'react'
|
|
|
2
2
|
import { WebView } from 'react-native-webview'
|
|
3
3
|
import Bus from './Bus'
|
|
4
4
|
|
|
5
|
+
type WebViewInstance = WebView<{}>
|
|
6
|
+
|
|
5
7
|
export const WEBVIEW_TARGET = '@@WEBVIEW_TARGET'
|
|
6
8
|
|
|
7
9
|
export const constructors: Record<string, any> = {}
|
|
@@ -42,7 +44,7 @@ export interface WebviewMessage {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export interface CanvasInstance {
|
|
45
|
-
webview:
|
|
47
|
+
webview: WebViewInstance | null;
|
|
46
48
|
bus: Bus | null;
|
|
47
49
|
context2D: CanvasRenderingContext2D;
|
|
48
50
|
getContext: (contextType: string) => CanvasRenderingContext2D | null;
|