@mpxjs/webpack-plugin 2.10.5-beta.1 → 2.10.6-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 CHANGED
@@ -1815,11 +1815,9 @@ try {
1815
1815
  normalModuleFactory.hooks.afterResolve.tap('MpxWebpackPlugin', ({ createData }) => {
1816
1816
  const { queryObj } = parseRequest(createData.request)
1817
1817
  const loaders = createData.loaders
1818
- if (queryObj.mpx && queryObj.mpx !== MPX_PROCESSED_FLAG) {
1819
- const type = queryObj.type
1820
- const extract = queryObj.extract
1821
-
1822
- if (type === 'styles') {
1818
+ const type = queryObj.type
1819
+ if ((queryObj.mpx && queryObj.mpx !== MPX_PROCESSED_FLAG) || queryObj.vue) {
1820
+ if (type === 'styles' || type === 'style') {
1823
1821
  let insertBeforeIndex = -1
1824
1822
  // 单次遍历收集所有索引
1825
1823
  loaders.forEach((loader, index) => {
@@ -1834,7 +1832,10 @@ try {
1834
1832
  }
1835
1833
  loaders.push({ loader: styleStripConditionalPath })
1836
1834
  }
1835
+ }
1837
1836
 
1837
+ if (queryObj.mpx && queryObj.mpx !== MPX_PROCESSED_FLAG) {
1838
+ const extract = queryObj.extract
1838
1839
  switch (type) {
1839
1840
  case 'styles':
1840
1841
  case 'template': {
@@ -21,7 +21,7 @@ const _MovableArea = forwardRef((props, ref) => {
21
21
  }), [normalStyle.width, normalStyle.height]);
22
22
  const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: movableViewRef });
23
23
  const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
24
- style: extendObject({ height: contextValue.height, width: contextValue.width, overflow: 'hidden' }, normalStyle, layoutStyle),
24
+ style: extendObject({ height: contextValue.height, width: contextValue.width }, normalStyle, layoutStyle),
25
25
  ref: movableViewRef
26
26
  }), [], { layoutRef });
27
27
  let movableComponent = createElement(MovableAreaContext.Provider, { value: contextValue }, createElement(View, innerProps, wrapChildren(props, {
@@ -41,7 +41,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
41
41
  const hasLayoutRef = useRef(false);
42
42
  const propsRef = useRef({});
43
43
  propsRef.current = (props || {});
44
- const { x = 0, y = 0, inertia = false, disabled = false, animation = true, 'out-of-bounds': outOfBounds = false, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, direction = 'none', 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, bindtouchstart, catchtouchstart, bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove, bindtouchend, catchtouchend } = props;
44
+ const { x = 0, y = 0, inertia = false, disabled = false, animation = true, 'out-of-bounds': outOfBounds = false, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, direction = 'none', 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, bindtouchstart, catchtouchstart, bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove, bindtouchend, catchtouchend, bindchange } = props;
45
45
  const { hasSelfPercent, normalStyle, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(Object.assign({}, style, styles.container), { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
46
46
  const navigation = useNavigation();
47
47
  const prevSimultaneousHandlersRef = useRef(originSimultaneousHandlers || []);
@@ -119,7 +119,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
119
119
  })
120
120
  : newY;
121
121
  }
122
- if (propsRef.current.bindchange) {
122
+ if (bindchange) {
123
123
  runOnJS(handleTriggerChange)({
124
124
  x: newX,
125
125
  y: newY,
@@ -252,11 +252,13 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
252
252
  });
253
253
  }, []);
254
254
  const triggerStartOnJS = ({ e }) => {
255
+ const { bindtouchstart, catchtouchstart } = propsRef.current;
255
256
  extendEvent(e, 'start');
256
257
  bindtouchstart && bindtouchstart(e);
257
258
  catchtouchstart && catchtouchstart(e);
258
259
  };
259
260
  const triggerMoveOnJS = ({ e, hasTouchmove, hasCatchTouchmove, touchEvent }) => {
261
+ const { bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove } = propsRef.current;
260
262
  extendEvent(e, 'move');
261
263
  if (hasTouchmove) {
262
264
  if (touchEvent === 'htouchmove') {
@@ -278,6 +280,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
278
280
  }
279
281
  };
280
282
  const triggerEndOnJS = ({ e }) => {
283
+ const { bindtouchend, catchtouchend } = propsRef.current;
281
284
  extendEvent(e, 'end');
282
285
  bindtouchend && bindtouchend(e);
283
286
  catchtouchend && catchtouchend(e);
@@ -350,7 +353,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
350
353
  offsetY.value = newY;
351
354
  }
352
355
  }
353
- if (propsRef.current.bindchange) {
356
+ if (bindchange) {
354
357
  runOnJS(handleTriggerChange)({
355
358
  x: offsetX.value,
356
359
  y: offsetY.value
@@ -390,47 +393,48 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
390
393
  })
391
394
  : y;
392
395
  }
393
- if (propsRef.current.bindchange) {
396
+ if (bindchange) {
394
397
  runOnJS(handleTriggerChange)({
395
398
  x,
396
399
  y
397
400
  });
398
401
  }
399
402
  }
400
- return;
401
403
  }
402
- // 惯性处理
403
- if (direction === 'horizontal' || direction === 'all') {
404
- xInertialMotion.value = true;
405
- offsetX.value = withDecay({
406
- velocity: e.velocityX / 10,
407
- rubberBandEffect: outOfBounds,
408
- clamp: draggableXRange.value
409
- }, () => {
410
- xInertialMotion.value = false;
411
- if (propsRef.current.bindchange) {
412
- runOnJS(handleTriggerChange)({
413
- x: offsetX.value,
414
- y: offsetY.value
415
- });
416
- }
417
- });
418
- }
419
- if (direction === 'vertical' || direction === 'all') {
420
- yInertialMotion.value = true;
421
- offsetY.value = withDecay({
422
- velocity: e.velocityY / 10,
423
- rubberBandEffect: outOfBounds,
424
- clamp: draggableYRange.value
425
- }, () => {
426
- yInertialMotion.value = false;
427
- if (propsRef.current.bindchange) {
428
- runOnJS(handleTriggerChange)({
429
- x: offsetX.value,
430
- y: offsetY.value
431
- });
432
- }
433
- });
404
+ else if (inertia) {
405
+ // 惯性处理
406
+ if (direction === 'horizontal' || direction === 'all') {
407
+ xInertialMotion.value = true;
408
+ offsetX.value = withDecay({
409
+ velocity: e.velocityX / 10,
410
+ rubberBandEffect: outOfBounds,
411
+ clamp: draggableXRange.value
412
+ }, () => {
413
+ xInertialMotion.value = false;
414
+ if (bindchange) {
415
+ runOnJS(handleTriggerChange)({
416
+ x: offsetX.value,
417
+ y: offsetY.value
418
+ });
419
+ }
420
+ });
421
+ }
422
+ if (direction === 'vertical' || direction === 'all') {
423
+ yInertialMotion.value = true;
424
+ offsetY.value = withDecay({
425
+ velocity: e.velocityY / 10,
426
+ rubberBandEffect: outOfBounds,
427
+ clamp: draggableYRange.value
428
+ }, () => {
429
+ yInertialMotion.value = false;
430
+ if (bindchange) {
431
+ runOnJS(handleTriggerChange)({
432
+ x: offsetX.value,
433
+ y: offsetY.value
434
+ });
435
+ }
436
+ });
437
+ }
434
438
  }
435
439
  })
436
440
  .withRef(movableGestureRef);
@@ -54,7 +54,7 @@ const _MovableArea = forwardRef<HandlerRef<View, MovableAreaProps>, MovableAreaP
54
54
  props,
55
55
  layoutProps,
56
56
  {
57
- style: extendObject({ height: contextValue.height, width: contextValue.width, overflow: 'hidden' }, normalStyle, layoutStyle),
57
+ style: extendObject({ height: contextValue.height, width: contextValue.width }, normalStyle, layoutStyle),
58
58
  ref: movableViewRef
59
59
  }
60
60
  ),
@@ -114,7 +114,8 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
114
114
  catchvtouchmove,
115
115
  catchtouchmove,
116
116
  bindtouchend,
117
- catchtouchend
117
+ catchtouchend,
118
+ bindchange
118
119
  } = props
119
120
 
120
121
  const {
@@ -140,6 +141,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
140
141
  x: 0,
141
142
  y: 0
142
143
  })
144
+
143
145
  const draggableXRange = useSharedValue<[min: number, max: number]>([0, 0])
144
146
  const draggableYRange = useSharedValue<[min: number, max: number]>([0, 0])
145
147
  const isMoving = useSharedValue(false)
@@ -215,7 +217,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
215
217
  })
216
218
  : newY
217
219
  }
218
- if (propsRef.current.bindchange) {
220
+ if (bindchange) {
219
221
  runOnJS(handleTriggerChange)({
220
222
  x: newX,
221
223
  y: newY,
@@ -356,12 +358,14 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
356
358
  }, [])
357
359
 
358
360
  const triggerStartOnJS = ({ e }: { e: GestureTouchEvent }) => {
361
+ const { bindtouchstart, catchtouchstart } = propsRef.current
359
362
  extendEvent(e, 'start')
360
363
  bindtouchstart && bindtouchstart(e)
361
364
  catchtouchstart && catchtouchstart(e)
362
365
  }
363
366
 
364
367
  const triggerMoveOnJS = ({ e, hasTouchmove, hasCatchTouchmove, touchEvent }: { e: GestureTouchEvent; hasTouchmove: boolean; hasCatchTouchmove: boolean; touchEvent: string }) => {
368
+ const { bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove } = propsRef.current
365
369
  extendEvent(e, 'move')
366
370
  if (hasTouchmove) {
367
371
  if (touchEvent === 'htouchmove') {
@@ -383,6 +387,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
383
387
  }
384
388
 
385
389
  const triggerEndOnJS = ({ e }: { e: GestureTouchEvent }) => {
390
+ const { bindtouchend, catchtouchend } = propsRef.current
386
391
  extendEvent(e, 'end')
387
392
  bindtouchend && bindtouchend(e)
388
393
  catchtouchend && catchtouchend(e)
@@ -454,7 +459,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
454
459
  offsetY.value = newY
455
460
  }
456
461
  }
457
- if (propsRef.current.bindchange) {
462
+ if (bindchange) {
458
463
  runOnJS(handleTriggerChange)({
459
464
  x: offsetX.value,
460
465
  y: offsetY.value
@@ -493,47 +498,47 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
493
498
  })
494
499
  : y
495
500
  }
496
- if (propsRef.current.bindchange) {
501
+ if (bindchange) {
497
502
  runOnJS(handleTriggerChange)({
498
503
  x,
499
504
  y
500
505
  })
501
506
  }
502
507
  }
503
- return
504
- }
505
- // 惯性处理
506
- if (direction === 'horizontal' || direction === 'all') {
507
- xInertialMotion.value = true
508
- offsetX.value = withDecay({
509
- velocity: e.velocityX / 10,
510
- rubberBandEffect: outOfBounds,
511
- clamp: draggableXRange.value
512
- }, () => {
513
- xInertialMotion.value = false
514
- if (propsRef.current.bindchange) {
515
- runOnJS(handleTriggerChange)({
516
- x: offsetX.value,
517
- y: offsetY.value
518
- })
519
- }
520
- })
521
- }
522
- if (direction === 'vertical' || direction === 'all') {
523
- yInertialMotion.value = true
524
- offsetY.value = withDecay({
525
- velocity: e.velocityY / 10,
526
- rubberBandEffect: outOfBounds,
527
- clamp: draggableYRange.value
528
- }, () => {
529
- yInertialMotion.value = false
530
- if (propsRef.current.bindchange) {
531
- runOnJS(handleTriggerChange)({
532
- x: offsetX.value,
533
- y: offsetY.value
534
- })
535
- }
536
- })
508
+ } else if (inertia) {
509
+ // 惯性处理
510
+ if (direction === 'horizontal' || direction === 'all') {
511
+ xInertialMotion.value = true
512
+ offsetX.value = withDecay({
513
+ velocity: e.velocityX / 10,
514
+ rubberBandEffect: outOfBounds,
515
+ clamp: draggableXRange.value
516
+ }, () => {
517
+ xInertialMotion.value = false
518
+ if (bindchange) {
519
+ runOnJS(handleTriggerChange)({
520
+ x: offsetX.value,
521
+ y: offsetY.value
522
+ })
523
+ }
524
+ })
525
+ }
526
+ if (direction === 'vertical' || direction === 'all') {
527
+ yInertialMotion.value = true
528
+ offsetY.value = withDecay({
529
+ velocity: e.velocityY / 10,
530
+ rubberBandEffect: outOfBounds,
531
+ clamp: draggableYRange.value
532
+ }, () => {
533
+ yInertialMotion.value = false
534
+ if (bindchange) {
535
+ runOnJS(handleTriggerChange)({
536
+ x: offsetX.value,
537
+ y: offsetY.value
538
+ })
539
+ }
540
+ })
541
+ }
537
542
  }
538
543
  })
539
544
  .withRef(movableGestureRef)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.5-beta.1",
3
+ "version": "2.10.6-beta.1",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -28,7 +28,7 @@
28
28
  "@better-scroll/wheel": "^2.5.1",
29
29
  "@better-scroll/zoom": "^2.5.1",
30
30
  "@mpxjs/template-engine": "^2.8.7",
31
- "@mpxjs/utils": "^2.10.4",
31
+ "@mpxjs/utils": "^2.10.6 | ^2.10.6-beta.1",
32
32
  "acorn": "^8.11.3",
33
33
  "acorn-walk": "^7.2.0",
34
34
  "async": "^2.6.0",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "devDependencies": {
85
85
  "@d11/react-native-fast-image": "^8.6.12",
86
- "@mpxjs/api-proxy": "^2.10.5 | ^2.10.5-beta.1",
86
+ "@mpxjs/api-proxy": "^2.10.6 | ^2.10.6-beta.1",
87
87
  "@types/babel-traverse": "^6.25.4",
88
88
  "@types/babel-types": "^7.0.4",
89
89
  "@types/react": "^18.2.79",