@mpxjs/webpack-plugin 2.10.16-beta.9 → 2.10.16-xp.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/config.js +0 -60
- package/lib/dependencies/AppEntryDependency.js +2 -2
- package/lib/dependencies/ResolveDependency.js +1 -1
- package/lib/file-loader.js +3 -13
- package/lib/helpers.js +0 -2
- package/lib/index.js +15 -40
- package/lib/json-compiler/helper.js +2 -72
- package/lib/json-compiler/index.js +56 -16
- package/lib/json-compiler/plugin.js +2 -2
- package/lib/loader.js +4 -10
- package/lib/native-loader.js +3 -6
- package/lib/platform/json/wx/index.js +29 -30
- package/lib/platform/style/wx/index.js +1 -8
- package/lib/platform/template/wx/component-config/ad.js +0 -5
- package/lib/platform/template/wx/component-config/button.js +5 -21
- package/lib/platform/template/wx/component-config/camera.js +3 -25
- package/lib/platform/template/wx/component-config/canvas.js +1 -8
- package/lib/platform/template/wx/component-config/component.js +33 -31
- package/lib/platform/template/wx/component-config/cover-image.js +2 -7
- package/lib/platform/template/wx/component-config/cover-view.js +1 -3
- package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
- package/lib/platform/template/wx/component-config/form.js +2 -27
- package/lib/platform/template/wx/component-config/image.js +0 -5
- package/lib/platform/template/wx/component-config/input.js +0 -10
- package/lib/platform/template/wx/component-config/label.js +2 -10
- package/lib/platform/template/wx/component-config/map.js +0 -11
- package/lib/platform/template/wx/component-config/movable-area.js +1 -4
- package/lib/platform/template/wx/component-config/movable-view.js +2 -17
- package/lib/platform/template/wx/component-config/navigator.js +0 -26
- package/lib/platform/template/wx/component-config/picker-view.js +0 -12
- package/lib/platform/template/wx/component-config/picker.js +1 -3
- package/lib/platform/template/wx/component-config/progress.js +1 -11
- package/lib/platform/template/wx/component-config/rich-text.js +0 -5
- package/lib/platform/template/wx/component-config/scroll-view.js +1 -12
- package/lib/platform/template/wx/component-config/slider.js +0 -8
- package/lib/platform/template/wx/component-config/swiper-item.js +2 -5
- package/lib/platform/template/wx/component-config/swiper.js +0 -10
- package/lib/platform/template/wx/component-config/text.js +0 -5
- package/lib/platform/template/wx/component-config/textarea.js +2 -19
- package/lib/platform/template/wx/component-config/unsupported.js +1 -10
- package/lib/platform/template/wx/component-config/video.js +0 -10
- package/lib/platform/template/wx/index.js +1 -21
- package/lib/react/index.js +0 -2
- package/lib/react/processJSON.js +71 -39
- package/lib/react/processStyles.js +2 -3
- package/lib/react/processTemplate.js +6 -8
- package/lib/react/script-helper.js +16 -6
- package/lib/react/style-helper.js +2 -10
- package/lib/runtime/components/react/context.ts +6 -13
- package/lib/runtime/components/react/dist/context.js +0 -1
- package/lib/runtime/components/react/dist/mpx-image.jsx +62 -100
- package/lib/runtime/components/react/dist/mpx-input.jsx +11 -37
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +50 -61
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +3 -4
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +18 -12
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +11 -8
- package/lib/runtime/components/react/dist/mpx-portal/index.jsx +1 -5
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +14 -6
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -5
- package/lib/runtime/components/react/dist/mpx-text.jsx +5 -33
- package/lib/runtime/components/react/dist/mpx-view.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
- package/lib/runtime/components/react/dist/utils.jsx +6 -16
- package/lib/runtime/components/react/mpx-image.tsx +82 -123
- package/lib/runtime/components/react/mpx-input.tsx +17 -44
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +49 -69
- package/lib/runtime/components/react/mpx-picker-view/index.tsx +2 -5
- package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +21 -26
- package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItem.tsx +12 -8
- package/lib/runtime/components/react/mpx-portal/index.tsx +2 -8
- package/lib/runtime/components/react/mpx-scroll-view.tsx +17 -6
- package/lib/runtime/components/react/mpx-swiper.tsx +9 -5
- package/lib/runtime/components/react/mpx-text.tsx +5 -38
- package/lib/runtime/components/react/mpx-view.tsx +1 -1
- package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
- package/lib/runtime/components/react/types/common.d.ts +0 -19
- package/lib/runtime/components/react/utils.tsx +6 -15
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/script-setup-compiler/index.js +2 -2
- package/lib/style-compiler/index.js +2 -3
- package/lib/style-compiler/load-postcss-config.js +1 -1
- package/lib/style-compiler/plugins/trans-special.js +2 -10
- package/lib/style-compiler/strip-conditional-loader.js +15 -178
- package/lib/template-compiler/bind-this.js +2 -2
- package/lib/template-compiler/compiler.js +71 -267
- package/lib/template-compiler/gen-node-react.js +6 -18
- package/lib/template-compiler/index.js +10 -12
- package/lib/template-compiler/parse-exps.js +1 -1
- package/lib/utils/const.js +1 -2
- package/lib/utils/dom-tag-config.js +6 -6
- package/lib/utils/env.js +1 -6
- package/lib/utils/pre-process-json.js +0 -5
- package/lib/web/index.js +0 -2
- package/lib/web/processJSON.js +16 -44
- package/lib/web/processScript.js +1 -1
- package/lib/web/processTemplate.js +4 -6
- package/lib/web/script-helper.js +9 -19
- package/lib/wxs/pre-loader.js +1 -1
- package/lib/wxss/loader.js +9 -1
- package/package.json +4 -15
- package/lib/dependencies/RecordModuleIdMapDependency.js +0 -49
- package/lib/runtime/components/react/dist/context.d.ts +0 -76
- package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +0 -8
- package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -8
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -13
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -69
- package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -27
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.jsx +0 -197
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -24
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -21
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -9
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -11
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -3
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -33
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -53
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -21
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -33
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -28
- package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -19
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -22
- package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -51
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -13
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -21
- package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -21
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -66
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-nav.d.ts +0 -9
- package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-nav.jsx +0 -132
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -10
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -3
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -7
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -107
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -33
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -9
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -24
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -14
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +0 -20
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -17
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -13
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -12
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -23
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -17
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -16
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -30
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -10
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -24
- package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -21
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -27
- package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -2
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -25
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -15
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -55
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -31
- package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -18
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -16
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -19
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +0 -53
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -27
- package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -23
- package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -8
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -102
- package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-view.d.ts +0 -35
- package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -23
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/parser.d.ts +0 -40
- package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -33
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -12
- package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/utils.d.ts +0 -123
- package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
- package/lib/runtime/components/react/mpx-camera.tsx +0 -275
- package/lib/runtime/components/react/mpx-nav.tsx +0 -155
- package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItemLite.tsx +0 -55
- package/lib/utils/get-build-tag-component.js +0 -35
|
@@ -5,8 +5,7 @@ import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAn
|
|
|
5
5
|
import useNodesRef, { HandlerRef } from '../useNodesRef'
|
|
6
6
|
import PickerIndicator from './pickerViewIndicator'
|
|
7
7
|
import PickerMask from './pickerViewMask'
|
|
8
|
-
import
|
|
9
|
-
import MpxPickerViewColumnItemLite from './pickerViewColumnItemLite'
|
|
8
|
+
import MpxPickerVIewColumnItem from './pickerViewColumnItem'
|
|
10
9
|
import { PickerViewColumnAnimationContext } from '../mpx-picker-view/pickerVIewContext'
|
|
11
10
|
import { calcHeightOffsets } from './pickerViewFaces'
|
|
12
11
|
|
|
@@ -26,7 +25,6 @@ interface ColumnProps {
|
|
|
26
25
|
}
|
|
27
26
|
pickerMaskStyle: Record<string, any>
|
|
28
27
|
pickerIndicatorStyle: Record<string, any>
|
|
29
|
-
enableWheelAnimation?: boolean
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
const visibleCount = 5
|
|
@@ -41,7 +39,6 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
41
39
|
wrapperStyle,
|
|
42
40
|
pickerMaskStyle,
|
|
43
41
|
pickerIndicatorStyle,
|
|
44
|
-
enableWheelAnimation = true,
|
|
45
42
|
'enable-var': enableVar,
|
|
46
43
|
'external-var-context': externalVarContext
|
|
47
44
|
} = props
|
|
@@ -98,11 +95,6 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
98
95
|
return [{ paddingVertical: paddingHeight }]
|
|
99
96
|
}, [paddingHeight])
|
|
100
97
|
|
|
101
|
-
const initialContentOffsetY = useMemo(
|
|
102
|
-
() => initialIndex * itemRawH,
|
|
103
|
-
[initialIndex, itemRawH]
|
|
104
|
-
)
|
|
105
|
-
|
|
106
98
|
const getIndex = useCallback((y: number) => {
|
|
107
99
|
const calc = Math.round(y / itemRawH)
|
|
108
100
|
return Math.max(0, Math.min(calc, maxIndex))
|
|
@@ -160,6 +152,17 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
160
152
|
}, isIOS ? 0 : 200)
|
|
161
153
|
}, [itemRawH, maxIndex, initialIndex])
|
|
162
154
|
|
|
155
|
+
const onContentSizeChange = useCallback((_w: number, h: number) => {
|
|
156
|
+
const y = initialIndex * itemRawH
|
|
157
|
+
if (y <= h) {
|
|
158
|
+
clearTimerScrollTo()
|
|
159
|
+
timerScrollTo.current = setTimeout(() => {
|
|
160
|
+
scrollViewRef.current?.scrollTo({ x: 0, y, animated: false })
|
|
161
|
+
activeIndex.current = initialIndex
|
|
162
|
+
}, 0)
|
|
163
|
+
}
|
|
164
|
+
}, [itemRawH, initialIndex])
|
|
165
|
+
|
|
163
166
|
const onItemLayout = useCallback((e: LayoutChangeEvent) => {
|
|
164
167
|
const { height: rawH } = e.nativeEvent.layout
|
|
165
168
|
const roundedH = Math.round(rawH)
|
|
@@ -284,8 +287,8 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
284
287
|
|
|
285
288
|
const renderInnerchild = () =>
|
|
286
289
|
columnData.map((item: React.ReactElement, index: number) => {
|
|
287
|
-
return
|
|
288
|
-
|
|
290
|
+
return (
|
|
291
|
+
<MpxPickerVIewColumnItem
|
|
289
292
|
key={index}
|
|
290
293
|
item={item}
|
|
291
294
|
index={index}
|
|
@@ -294,16 +297,8 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
294
297
|
textProps={textProps}
|
|
295
298
|
visibleCount={visibleCount}
|
|
296
299
|
onItemLayout={onItemLayout}
|
|
297
|
-
/>
|
|
298
|
-
|
|
299
|
-
key={index}
|
|
300
|
-
item={item}
|
|
301
|
-
index={index}
|
|
302
|
-
itemHeight={itemHeight}
|
|
303
|
-
textStyle={textStyle}
|
|
304
|
-
textProps={textProps}
|
|
305
|
-
onItemLayout={onItemLayout}
|
|
306
|
-
/>)
|
|
300
|
+
/>
|
|
301
|
+
)
|
|
307
302
|
})
|
|
308
303
|
|
|
309
304
|
const renderScollView = () => {
|
|
@@ -325,8 +320,8 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
325
320
|
onScrollEndDrag,
|
|
326
321
|
onMomentumScrollBegin,
|
|
327
322
|
onMomentumScrollEnd,
|
|
328
|
-
|
|
329
|
-
|
|
323
|
+
onContentSizeChange,
|
|
324
|
+
contentContainerStyle
|
|
330
325
|
}) as React.ComponentProps<typeof Reanimated.ScrollView>
|
|
331
326
|
|
|
332
327
|
return createElement(
|
|
@@ -356,9 +351,9 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
356
351
|
|
|
357
352
|
return (
|
|
358
353
|
<View style={[styles.wrapper, normalStyle]}>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
354
|
+
{renderScollView()}
|
|
355
|
+
{renderMask()}
|
|
356
|
+
{renderIndicator()}
|
|
362
357
|
</View>
|
|
363
358
|
)
|
|
364
359
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import { LayoutChangeEvent } from 'react-native'
|
|
3
|
-
import Reanimated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
import Reanimated, { Extrapolation, interpolate, useAnimatedStyle, useSharedValue } from 'react-native-reanimated'
|
|
4
4
|
import { extendObject } from '../utils'
|
|
5
5
|
import { createFaces } from './pickerViewFaces'
|
|
6
6
|
import { usePickerViewColumnAnimationContext, usePickerViewStyleContext } from '../mpx-picker-view/pickerVIewContext'
|
|
@@ -28,16 +28,20 @@ const PickerViewColumnItem: React.FC<PickerColumnItemProps> = ({
|
|
|
28
28
|
}) => {
|
|
29
29
|
const textStyleFromAncestor = usePickerViewStyleContext()
|
|
30
30
|
const offsetYShared = usePickerViewColumnAnimationContext()
|
|
31
|
-
const facesShared =
|
|
31
|
+
const facesShared = useSharedValue(createFaces(itemHeight, visibleCount))
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
facesShared.value = createFaces(itemHeight, visibleCount)
|
|
35
|
+
}, [itemHeight])
|
|
32
36
|
|
|
33
37
|
const animatedStyles = useAnimatedStyle(() => {
|
|
34
|
-
const inputRange = facesShared.map((f) => itemHeight * (index + f.index))
|
|
38
|
+
const inputRange = facesShared.value.map((f) => itemHeight * (index + f.index))
|
|
35
39
|
return {
|
|
36
|
-
opacity: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.opacity), Extrapolation.CLAMP),
|
|
40
|
+
opacity: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.opacity), Extrapolation.CLAMP),
|
|
37
41
|
transform: [
|
|
38
|
-
{ translateY: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.offsetY), Extrapolation.EXTEND) },
|
|
39
|
-
{ rotateX: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.deg), Extrapolation.CLAMP) + 'deg' },
|
|
40
|
-
{ scale: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.scale), Extrapolation.EXTEND) }
|
|
42
|
+
{ translateY: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.offsetY), Extrapolation.EXTEND) },
|
|
43
|
+
{ rotateX: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.deg), Extrapolation.CLAMP) + 'deg' },
|
|
44
|
+
{ scale: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.scale), Extrapolation.EXTEND) }
|
|
41
45
|
]
|
|
42
46
|
}
|
|
43
47
|
})
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import { ReactNode, useContext, useEffect, useRef } from 'react'
|
|
2
|
-
import { PortalContext,
|
|
2
|
+
import { PortalContext, RouteContext, VarContext } from '../context'
|
|
3
3
|
import PortalHost, { portal } from './portal-host'
|
|
4
4
|
|
|
5
5
|
export type PortalProps = {
|
|
6
6
|
children?: ReactNode
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const Portal = ({ children }:
|
|
9
|
+
const Portal = ({ children }:PortalProps): null => {
|
|
10
10
|
const manager = useContext(PortalContext)
|
|
11
11
|
const keyRef = useRef<any>(null)
|
|
12
12
|
const { pageId } = useContext(RouteContext) || {}
|
|
13
13
|
const varContext = useContext(VarContext)
|
|
14
|
-
const parentProvides = useContext(ProviderContext)
|
|
15
|
-
|
|
16
14
|
if (varContext) {
|
|
17
15
|
children = (<VarContext.Provider value={varContext} key='varContextWrap'>{children}</VarContext.Provider>)
|
|
18
16
|
}
|
|
19
|
-
if (parentProvides) {
|
|
20
|
-
children = (<ProviderContext.Provider value={parentProvides} key='providerContextWrap'>{children}</ProviderContext.Provider>)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
17
|
useEffect(() => {
|
|
24
18
|
manager.update(keyRef.current, children)
|
|
25
19
|
}, [children])
|
|
@@ -159,6 +159,9 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
159
159
|
const simultaneousHandlers = flatGesture(originSimultaneousHandlers)
|
|
160
160
|
const waitForHandlers = flatGesture(waitFor)
|
|
161
161
|
|
|
162
|
+
const snapScrollTop = useRef(0)
|
|
163
|
+
const snapScrollLeft = useRef(0)
|
|
164
|
+
|
|
162
165
|
const [refreshing, setRefreshing] = useState(false)
|
|
163
166
|
|
|
164
167
|
const [enableScroll, setEnableScroll] = useState(true)
|
|
@@ -265,12 +268,16 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
265
268
|
warn('scroll-x and scroll-y cannot be set to true at the same time, Mpx will use the value of scroll-y as the criterion')
|
|
266
269
|
}
|
|
267
270
|
useEffect(() => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
if (
|
|
272
|
+
snapScrollTop.current !== scrollTop || snapScrollLeft.current !== scrollLeft
|
|
273
|
+
) {
|
|
274
|
+
initialTimeout.current = setTimeout(() => {
|
|
275
|
+
scrollToOffset(scrollLeft, scrollTop)
|
|
276
|
+
}, 0)
|
|
277
|
+
|
|
278
|
+
return () => {
|
|
279
|
+
initialTimeout.current && clearTimeout(initialTimeout.current)
|
|
280
|
+
}
|
|
274
281
|
}
|
|
275
282
|
}, [scrollTop, scrollLeft])
|
|
276
283
|
|
|
@@ -474,6 +481,10 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
474
481
|
function scrollToOffset (x = 0, y = 0, animated = scrollWithAnimation) {
|
|
475
482
|
if (scrollViewRef.current) {
|
|
476
483
|
scrollViewRef.current.scrollTo({ x, y, animated })
|
|
484
|
+
scrollOptions.current.scrollLeft = x
|
|
485
|
+
scrollOptions.current.scrollTop = y
|
|
486
|
+
snapScrollLeft.current = x
|
|
487
|
+
snapScrollTop.current = y
|
|
477
488
|
}
|
|
478
489
|
}
|
|
479
490
|
|
|
@@ -148,7 +148,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
148
148
|
autoplay = false,
|
|
149
149
|
circular = false,
|
|
150
150
|
disableGesture = false,
|
|
151
|
-
current: propCurrent
|
|
151
|
+
current: propCurrent,
|
|
152
152
|
bindchange
|
|
153
153
|
} = props
|
|
154
154
|
const easeingFunc = props['easing-function'] || 'default'
|
|
@@ -199,10 +199,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
199
199
|
// 每个元素的宽度 or 高度,有固定值直接初始化无则0
|
|
200
200
|
const step = useSharedValue(initStep)
|
|
201
201
|
// 记录选中元素的索引值
|
|
202
|
-
const currentIndex = useSharedValue(propCurrent)
|
|
202
|
+
const currentIndex = useSharedValue(propCurrent || 0)
|
|
203
203
|
// const initOffset = getOffset(props.current || 0, initStep)
|
|
204
204
|
// 记录元素的偏移量
|
|
205
|
-
const offset = useSharedValue(getOffset(propCurrent, initStep))
|
|
205
|
+
const offset = useSharedValue(getOffset(propCurrent || 0, initStep))
|
|
206
206
|
const strAbso = 'absolute' + dir.toUpperCase() as StrAbsoType
|
|
207
207
|
const strVelocity = 'velocity' + dir.toUpperCase() as StrVelocityType
|
|
208
208
|
// 标识手指触摸和抬起, 起点在onBegin
|
|
@@ -271,7 +271,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
271
271
|
const iStep = dir === 'x' ? realWidth : realHeight
|
|
272
272
|
if (iStep !== step.value) {
|
|
273
273
|
step.value = iStep
|
|
274
|
-
updateCurrent(propCurrent, iStep)
|
|
274
|
+
updateCurrent(propCurrent || 0, iStep)
|
|
275
275
|
updateAutoplay()
|
|
276
276
|
}
|
|
277
277
|
}
|
|
@@ -520,7 +520,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
520
520
|
// 1. 如果用户在touch的过程中, 外部更新了current以外部为准(小程序表现)
|
|
521
521
|
// 2. 手指滑动过程中更新索引,外部会把current再传入进来,导致offset直接更新,增加判断不同才更新
|
|
522
522
|
if (propCurrent !== currentIndex.value) {
|
|
523
|
-
updateCurrent(propCurrent, step.value)
|
|
523
|
+
updateCurrent(propCurrent || 0, step.value)
|
|
524
524
|
}
|
|
525
525
|
}, [propCurrent])
|
|
526
526
|
|
|
@@ -790,6 +790,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
790
790
|
}
|
|
791
791
|
preAbsolutePos.value = e[strAbso]
|
|
792
792
|
})
|
|
793
|
+
.onEnd((e) => {
|
|
794
|
+
// 修复部分安卓机型下onFinalize拿到的absolute值 和 onUpdate不一致的情况,通过onEnd进行修正为最终的位置
|
|
795
|
+
preAbsolutePos.value = e[strAbso]
|
|
796
|
+
})
|
|
793
797
|
.onFinalize((e: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {
|
|
794
798
|
'worklet'
|
|
795
799
|
if (touchfinish.value) return
|
|
@@ -2,41 +2,15 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* ✔ selectable
|
|
4
4
|
* ✘ space
|
|
5
|
-
*
|
|
5
|
+
* ✘ decode
|
|
6
6
|
*/
|
|
7
7
|
import { Text, TextStyle, TextProps } from 'react-native'
|
|
8
|
-
import { useRef, forwardRef, ReactNode, JSX, createElement
|
|
8
|
+
import { useRef, forwardRef, ReactNode, JSX, createElement } from 'react'
|
|
9
9
|
import Portal from './mpx-portal'
|
|
10
10
|
import useInnerProps from './getInnerListeners'
|
|
11
11
|
import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
|
|
12
12
|
import { useTransformStyle, wrapChildren, extendObject } from './utils'
|
|
13
13
|
|
|
14
|
-
const decodeMap = {
|
|
15
|
-
'<': '<',
|
|
16
|
-
'>': '>',
|
|
17
|
-
'"': '"',
|
|
18
|
-
'&': '&',
|
|
19
|
-
''': '\'',
|
|
20
|
-
' ': ' '
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const encodedRe = /&(?:lt|gt|quot|amp|#39|nbsp);/g
|
|
24
|
-
function decode (value: string) {
|
|
25
|
-
if (value != null) {
|
|
26
|
-
return value.replace(encodedRe, function (match) {
|
|
27
|
-
return decodeMap[match as keyof typeof decodeMap]
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function getDecodedChildren (children: ReactNode) {
|
|
33
|
-
return Children.map(children, (child) => {
|
|
34
|
-
if (typeof child === 'string') {
|
|
35
|
-
return decode(child)
|
|
36
|
-
}
|
|
37
|
-
return child
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
14
|
interface _TextProps extends TextProps {
|
|
41
15
|
style?: TextStyle
|
|
42
16
|
children?: ReactNode
|
|
@@ -47,7 +21,6 @@ interface _TextProps extends TextProps {
|
|
|
47
21
|
'parent-font-size'?: number
|
|
48
22
|
'parent-width'?: number
|
|
49
23
|
'parent-height'?: number
|
|
50
|
-
decode?: boolean
|
|
51
24
|
}
|
|
52
25
|
|
|
53
26
|
const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref): JSX.Element => {
|
|
@@ -60,8 +33,7 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
60
33
|
'user-select': userSelect,
|
|
61
34
|
'parent-font-size': parentFontSize,
|
|
62
35
|
'parent-width': parentWidth,
|
|
63
|
-
'parent-height': parentHeight
|
|
64
|
-
decode
|
|
36
|
+
'parent-height': parentHeight
|
|
65
37
|
} = props
|
|
66
38
|
|
|
67
39
|
const {
|
|
@@ -94,17 +66,12 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
94
66
|
}
|
|
95
67
|
),
|
|
96
68
|
[
|
|
97
|
-
'user-select'
|
|
98
|
-
'decode'
|
|
69
|
+
'user-select'
|
|
99
70
|
]
|
|
100
71
|
)
|
|
101
72
|
|
|
102
|
-
const children = decode ? getDecodedChildren(props.children) : props.children
|
|
103
|
-
|
|
104
73
|
let finalComponent:JSX.Element = createElement(Text, innerProps, wrapChildren(
|
|
105
|
-
|
|
106
|
-
children
|
|
107
|
-
}),
|
|
74
|
+
props,
|
|
108
75
|
{
|
|
109
76
|
hasVarDec,
|
|
110
77
|
varContext: varContextRef.current
|
|
@@ -226,7 +226,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
226
226
|
}
|
|
227
227
|
break
|
|
228
228
|
case 'postMessage':
|
|
229
|
-
bindmessage && bindmessage(getCustomEvent('
|
|
229
|
+
bindmessage && bindmessage(getCustomEvent('messsage', {}, { // RN组件销毁顺序与小程序不一致,所以改成和支付宝消息一致
|
|
230
230
|
detail: {
|
|
231
231
|
data: params[0]?.data
|
|
232
232
|
}
|
|
@@ -18,22 +18,3 @@ export type ExtendedFunctionComponent = FunctionComponent & {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type AnyFunc = (...args: ReadonlyArray<any>) => any
|
|
21
|
-
|
|
22
|
-
declare global {
|
|
23
|
-
interface PageConfig {
|
|
24
|
-
/**
|
|
25
|
-
* 是否自定义导航栏
|
|
26
|
-
*/
|
|
27
|
-
navigationStyle?: 'custom'
|
|
28
|
-
/**
|
|
29
|
-
* 标题栏样式
|
|
30
|
-
*/
|
|
31
|
-
navigationBarTextStyle?: 'white' | 'black' | '#ffffff' | '#000000'
|
|
32
|
-
/**
|
|
33
|
-
* 页面标题
|
|
34
|
-
*/
|
|
35
|
-
navigationBarTitleText?: string
|
|
36
|
-
|
|
37
|
-
[key: string]: any
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -215,33 +215,24 @@ function resolveVar (input: string, varContext: Record<string, any>) {
|
|
|
215
215
|
const parsed = parseFunc(input, 'var')
|
|
216
216
|
const replaced = new ReplaceSource(input)
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
parsed.forEach(({ start, end, args }) => {
|
|
219
219
|
const varName = args[0]
|
|
220
|
-
const fallback = args[1]
|
|
220
|
+
const fallback = args[1] || ''
|
|
221
221
|
let varValue = hasOwn(varContext, varName) ? varContext[varName] : fallback
|
|
222
|
-
if (varValue === undefined) return
|
|
223
222
|
if (varUseRegExp.test(varValue)) {
|
|
224
|
-
varValue = resolveVar(varValue, varContext)
|
|
225
|
-
if (varValue === undefined) return
|
|
223
|
+
varValue = '' + resolveVar(varValue, varContext)
|
|
226
224
|
} else {
|
|
227
|
-
varValue = global.__formatValue(varValue)
|
|
225
|
+
varValue = '' + global.__formatValue(varValue)
|
|
228
226
|
}
|
|
229
227
|
replaced.replace(start, end - 1, varValue)
|
|
230
|
-
}
|
|
231
|
-
|
|
228
|
+
})
|
|
232
229
|
return global.__formatValue(replaced.source())
|
|
233
230
|
}
|
|
234
231
|
|
|
235
232
|
function transformVar (styleObj: Record<string, any>, varKeyPaths: Array<Array<string>>, varContext: Record<string, any>, visitOther: (arg: VisitorArg) => void) {
|
|
236
233
|
varKeyPaths.forEach((varKeyPath) => {
|
|
237
234
|
setStyle(styleObj, varKeyPath, ({ target, key, value }) => {
|
|
238
|
-
|
|
239
|
-
if (resolved === undefined) {
|
|
240
|
-
delete target[key]
|
|
241
|
-
error(`Can not resolve css var at ${varKeyPath.join('.')}:${value}.`)
|
|
242
|
-
return
|
|
243
|
-
}
|
|
244
|
-
target[key] = resolved
|
|
235
|
+
target[key] = resolveVar(value, varContext)
|
|
245
236
|
visitOther({ target, key, value: target[key], keyPath: varKeyPath })
|
|
246
237
|
})
|
|
247
238
|
})
|
|
@@ -45,7 +45,7 @@ function objectKeys (obj) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function genRegExp (str, flags) {
|
|
48
|
-
if (!__mpx_wxs__
|
|
48
|
+
if (!__mpx_wxs__) {
|
|
49
49
|
return new RegExp(str, flags)
|
|
50
50
|
} else {
|
|
51
51
|
return getRegExp(str, flags)
|
|
@@ -234,4 +234,4 @@ module.exports = {
|
|
|
234
234
|
var parsedStaticStyle = typeof staticStyle === 'string' ? parseStyleText(staticStyle) : {}
|
|
235
235
|
return genStyleText(extend(parsedStaticStyle, normalizedDynamicStyle))
|
|
236
236
|
}
|
|
237
|
-
}
|
|
237
|
+
}
|
|
@@ -98,7 +98,7 @@ function compileScriptSetup (
|
|
|
98
98
|
) {
|
|
99
99
|
if (node) {
|
|
100
100
|
throw new Error(
|
|
101
|
-
`[
|
|
101
|
+
`[@mpxjs/webpack-plugin script-setup-compiler] ${msg}\n\n${filePath}\n${formatCodeFrame(
|
|
102
102
|
content,
|
|
103
103
|
node.start + startOffset,
|
|
104
104
|
end
|
|
@@ -106,7 +106,7 @@ function compileScriptSetup (
|
|
|
106
106
|
)
|
|
107
107
|
} else {
|
|
108
108
|
throw new Error(
|
|
109
|
-
`[
|
|
109
|
+
`[@mpxjs/webpack-plugin script-setup-compiler] ${msg}\n\n${filePath}\n`
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -18,8 +18,7 @@ module.exports = function (css, map) {
|
|
|
18
18
|
const { resourcePath, queryObj } = parseRequest(this.resource)
|
|
19
19
|
const mpx = this.getMpx()
|
|
20
20
|
const mpxStyleOptions = (queryObj.mpxStyleOptions && JSON.parse(queryObj.mpxStyleOptions)) || {}
|
|
21
|
-
const id = queryObj.moduleId || mpxStyleOptions.mid || mpx.getModuleId(resourcePath
|
|
22
|
-
|
|
21
|
+
const id = queryObj.moduleId || mpxStyleOptions.mid || mpx.getModuleId(resourcePath)
|
|
23
22
|
const appInfo = mpx.appInfo
|
|
24
23
|
const defs = mpx.defs
|
|
25
24
|
const mode = mpx.mode
|
|
@@ -56,7 +55,7 @@ module.exports = function (css, map) {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
if (isReact(mode)) {
|
|
59
|
-
plugins.push(transSpecial({ id
|
|
58
|
+
plugins.push(transSpecial({ id }))
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
// plugins.push(pluginCondStrip({
|
|
@@ -29,7 +29,7 @@ module.exports = function loadPostcssConfig (loaderContext, inlineConfig = {}) {
|
|
|
29
29
|
if (err.message.indexOf('No PostCSS Config found') >= 0) {
|
|
30
30
|
return
|
|
31
31
|
}
|
|
32
|
-
loaderContext.emitWarning(`
|
|
32
|
+
loaderContext.emitWarning(`Error loading PostCSS config: ${err.message}`)
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const selectorParser = require('postcss-selector-parser')
|
|
2
|
-
const { MPX_TAG_PAGE_SELECTOR } = require('../../utils/const')
|
|
3
2
|
// trans-special
|
|
4
3
|
|
|
5
|
-
module.exports = ({ id
|
|
4
|
+
module.exports = ({ id }) => {
|
|
6
5
|
return {
|
|
7
6
|
postcssPlugin: 'trans-special',
|
|
8
7
|
Once: (root) => {
|
|
@@ -14,14 +13,7 @@ module.exports = ({ id, transPage = false }) => {
|
|
|
14
13
|
if (/^:host$/.test(n.value)) {
|
|
15
14
|
const compoundSelectors = n.nodes
|
|
16
15
|
n.replaceWith(selectorParser.className({
|
|
17
|
-
value:
|
|
18
|
-
}))
|
|
19
|
-
selector.insertAfter(n, compoundSelectors)
|
|
20
|
-
}
|
|
21
|
-
if (transPage && /^page$/.test(n.value)) {
|
|
22
|
-
const compoundSelectors = n.nodes || []
|
|
23
|
-
n.replaceWith(selectorParser.className({
|
|
24
|
-
value: MPX_TAG_PAGE_SELECTOR
|
|
16
|
+
value: 'host-' + id
|
|
25
17
|
}))
|
|
26
18
|
selector.insertAfter(n, compoundSelectors)
|
|
27
19
|
}
|