@dcloudio/vue-cli-plugin-uni 2.0.2-5000720260410001 → 2.0.2-5010520260709001

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Vue.js v2.6.11
3
- * (c) 2014-2022 Evan You
3
+ * (c) 2014-2026 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  /* */
@@ -524,7 +524,7 @@ var hasProto = '__proto__' in {};
524
524
  var inBrowser = typeof window !== 'undefined';
525
525
  var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
526
526
  var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
527
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
527
+ var UA = inBrowser && window.navigator && window.navigator.userAgent && window.navigator.userAgent.toLowerCase();
528
528
  var isIE = UA && /msie|trident/.test(UA);
529
529
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
530
530
  var isEdge = UA && UA.indexOf('edge/') > 0;
@@ -1002,7 +1002,8 @@ function observe (value, asRootData) {
1002
1002
  !isServerRendering() &&
1003
1003
  (Array.isArray(value) || isPlainObject(value)) &&
1004
1004
  Object.isExtensible(value) &&
1005
- !value._isVue
1005
+ !value._isVue &&
1006
+ !value.__v_isMPComponent
1006
1007
  ) {
1007
1008
  ob = new Observer(value);
1008
1009
  }
@@ -2724,7 +2725,8 @@ function renderSlot (
2724
2725
  name,
2725
2726
  fallback,
2726
2727
  props,
2727
- bindObject
2728
+ bindObject,
2729
+ slotVm
2728
2730
  ) {
2729
2731
  var scopedSlotFn = this.$scopedSlots[name];
2730
2732
  var nodes;
@@ -2740,7 +2742,7 @@ function renderSlot (
2740
2742
  props = extend(extend({}, bindObject), props);
2741
2743
  }
2742
2744
  // fixed by xxxxxx app-plus scopedSlot
2743
- nodes = scopedSlotFn(props, this, props._i) || fallback;
2745
+ nodes = scopedSlotFn(props, slotVm || this, props._i) || fallback;
2744
2746
  } else {
2745
2747
  nodes = this.$slots[name] || fallback;
2746
2748
  }
@@ -7959,11 +7961,67 @@ function getStyle (vnode, checkChild) {
7959
7961
  var cssVarRE = /^--/;
7960
7962
  var importantRE = /\s*!important$/;
7961
7963
 
7964
+ // rpx2rem
7965
+ var defaultRpx2Unit = {
7966
+ unit: 'rem',
7967
+ unitRatio: 10 / 320,
7968
+ unitPrecision: 5
7969
+ };
7970
+
7971
+ var Rpx2Unit = Object.assign({}, defaultRpx2Unit);
7972
+
7973
+ function getRpx2Unit () {
7974
+ return Rpx2Unit
7975
+ }
7976
+
7977
+ function toFixed (number, precision) {
7978
+ var multiplier = Math.pow(10, precision + 1);
7979
+ var wholeNumber = Math.floor(number * multiplier);
7980
+ return (Math.round(wholeNumber / 10) * 10) / multiplier
7981
+ }
7982
+
7983
+ function _rpx2Unit (rpx, unit, unitRatio, unitPrecision) {
7984
+ if (unitRatio === 1) {
7985
+ return ("" + rpx + unit)
7986
+ }
7987
+ var value = toFixed(rpx * unitRatio, unitPrecision);
7988
+ return value === 0 ? '0' : ("" + value + unit)
7989
+ }
7990
+
7991
+ function createRpx2Unit (unit, unitRatio, unitPrecision) {
7992
+ // ignore: rpxCalcIncludeWidth
7993
+ /**
7994
+ * @param {string | number} val
7995
+ * @returns {string}
7996
+ */
7997
+ return function (val) {
7998
+ if (typeof val === 'string') {
7999
+ return val.replace(unitRE, function (m, $1) {
8000
+ if (!$1) {
8001
+ return m
8002
+ }
8003
+
8004
+ return _rpx2Unit(parseFloat($1), unit, unitRatio, unitPrecision)
8005
+ })
8006
+ } else if (typeof val === 'number') {
8007
+ return _rpx2Unit(val, unit, unitRatio, unitPrecision)
8008
+ }
8009
+ }
8010
+ }
8011
+
8012
+ var rpx2unit = createRpx2Unit(getRpx2Unit().unit, getRpx2Unit().unitRatio, getRpx2Unit().unitPrecision);
8013
+
7962
8014
  // upx,rpx 正则匹配
7963
8015
  var unitRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g;
7964
8016
 
7965
8017
  var transformUnit = function (val) {
7966
8018
  if (typeof val === 'string') {
8019
+ try {
8020
+ var config = __uniConfig.globalStyle || __uniConfig.window || {};
8021
+ if (config.dynamicRpx === true) {
8022
+ return rpx2unit(val)
8023
+ }
8024
+ } catch (error) {}
7967
8025
  return val.replace(unitRE, function (a, b) {
7968
8026
  /* eslint-disable no-undef */
7969
8027
  return uni.upx2px(b) + 'px'
@@ -11586,12 +11644,17 @@ function genScopedSlot (
11586
11644
  el,
11587
11645
  state
11588
11646
  ) {
11647
+ state.isInScopeSlot = true;
11589
11648
  var isLegacySyntax = el.attrsMap['slot-scope'];
11590
11649
  if (el.if && !el.ifProcessed && !isLegacySyntax) {
11591
- return genIf(el, state, genScopedSlot, "null")
11650
+ var res$1 = genIf(el, state, genScopedSlot, "null");
11651
+ state.isInScopeSlot = false;
11652
+ return res$1
11592
11653
  }
11593
11654
  if (el.for && !el.forProcessed) {
11594
- return genFor(el, state, genScopedSlot)
11655
+ var res$2 = genFor(el, state, genScopedSlot);
11656
+ state.isInScopeSlot = false;
11657
+ return res$2
11595
11658
  }
11596
11659
  var slotScope = el.slotScope === emptySlotScopeToken
11597
11660
  ? ""
@@ -11604,7 +11667,9 @@ function genScopedSlot (
11604
11667
  : genElement(el, state)) + "}";
11605
11668
  // reverse proxy v-slot without scope on this.$slots
11606
11669
  var reverseProxy = slotScope ? "" : ",proxy:true";
11607
- return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
11670
+ var res = "{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}";
11671
+ state.isInScopeSlot = false;
11672
+ return res
11608
11673
  }
11609
11674
 
11610
11675
  function genChildren (
@@ -11690,7 +11755,6 @@ function genComment (comment) {
11690
11755
  function genSlot (el, state) {
11691
11756
  var slotName = el.slotName || '"default"';
11692
11757
  var children = genChildren(el, state);
11693
- var res = "_t(" + slotName + (children ? ("," + children) : '');
11694
11758
  var attrs = el.attrs || el.dynamicAttrs
11695
11759
  ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11696
11760
  // slot props are camelized
@@ -11700,16 +11764,16 @@ function genSlot (el, state) {
11700
11764
  }); }))
11701
11765
  : null;
11702
11766
  var bind$$1 = el.attrsMap['v-bind'];
11703
- if ((attrs || bind$$1) && !children) {
11704
- res += ",null";
11705
- }
11706
- if (attrs) {
11707
- res += "," + attrs;
11708
- }
11709
- if (bind$$1) {
11710
- res += (attrs ? '' : ',null') + "," + bind$$1;
11711
- }
11712
- return res + ')'
11767
+
11768
+ var args = [];
11769
+ args.push(slotName);
11770
+ args.push(children || 'null');
11771
+ args.push(attrs || 'null');
11772
+ args.push(bind$$1 || 'null');
11773
+ if (state.isInScopeSlot) {
11774
+ args.push('_svm');
11775
+ }
11776
+ return ("_t(" + (args.join(',')) + ")")
11713
11777
  }
11714
11778
 
11715
11779
  // componentName is el.component, take it as argument to shun flow's pessimistic refinement
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Vue.js v2.6.11
3
- * (c) 2014-2022 Evan You
3
+ * (c) 2014-2026 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -530,7 +530,7 @@
530
530
  var inBrowser = typeof window !== 'undefined';
531
531
  var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
532
532
  var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
533
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
533
+ var UA = inBrowser && window.navigator && window.navigator.userAgent && window.navigator.userAgent.toLowerCase();
534
534
  var isIE = UA && /msie|trident/.test(UA);
535
535
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
536
536
  var isEdge = UA && UA.indexOf('edge/') > 0;
@@ -1008,7 +1008,8 @@
1008
1008
  !isServerRendering() &&
1009
1009
  (Array.isArray(value) || isPlainObject(value)) &&
1010
1010
  Object.isExtensible(value) &&
1011
- !value._isVue
1011
+ !value._isVue &&
1012
+ !value.__v_isMPComponent
1012
1013
  ) {
1013
1014
  ob = new Observer(value);
1014
1015
  }
@@ -2722,7 +2723,8 @@
2722
2723
  name,
2723
2724
  fallback,
2724
2725
  props,
2725
- bindObject
2726
+ bindObject,
2727
+ slotVm
2726
2728
  ) {
2727
2729
  var scopedSlotFn = this.$scopedSlots[name];
2728
2730
  var nodes;
@@ -2738,7 +2740,7 @@
2738
2740
  props = extend(extend({}, bindObject), props);
2739
2741
  }
2740
2742
  // fixed by xxxxxx app-plus scopedSlot
2741
- nodes = scopedSlotFn(props, this, props._i) || fallback;
2743
+ nodes = scopedSlotFn(props, slotVm || this, props._i) || fallback;
2742
2744
  } else {
2743
2745
  nodes = this.$slots[name] || fallback;
2744
2746
  }
@@ -7941,11 +7943,67 @@
7941
7943
  var cssVarRE = /^--/;
7942
7944
  var importantRE = /\s*!important$/;
7943
7945
 
7946
+ // rpx2rem
7947
+ var defaultRpx2Unit = {
7948
+ unit: 'rem',
7949
+ unitRatio: 10 / 320,
7950
+ unitPrecision: 5
7951
+ };
7952
+
7953
+ var Rpx2Unit = Object.assign({}, defaultRpx2Unit);
7954
+
7955
+ function getRpx2Unit () {
7956
+ return Rpx2Unit
7957
+ }
7958
+
7959
+ function toFixed (number, precision) {
7960
+ var multiplier = Math.pow(10, precision + 1);
7961
+ var wholeNumber = Math.floor(number * multiplier);
7962
+ return (Math.round(wholeNumber / 10) * 10) / multiplier
7963
+ }
7964
+
7965
+ function _rpx2Unit (rpx, unit, unitRatio, unitPrecision) {
7966
+ if (unitRatio === 1) {
7967
+ return ("" + rpx + unit)
7968
+ }
7969
+ var value = toFixed(rpx * unitRatio, unitPrecision);
7970
+ return value === 0 ? '0' : ("" + value + unit)
7971
+ }
7972
+
7973
+ function createRpx2Unit (unit, unitRatio, unitPrecision) {
7974
+ // ignore: rpxCalcIncludeWidth
7975
+ /**
7976
+ * @param {string | number} val
7977
+ * @returns {string}
7978
+ */
7979
+ return function (val) {
7980
+ if (typeof val === 'string') {
7981
+ return val.replace(unitRE, function (m, $1) {
7982
+ if (!$1) {
7983
+ return m
7984
+ }
7985
+
7986
+ return _rpx2Unit(parseFloat($1), unit, unitRatio, unitPrecision)
7987
+ })
7988
+ } else if (typeof val === 'number') {
7989
+ return _rpx2Unit(val, unit, unitRatio, unitPrecision)
7990
+ }
7991
+ }
7992
+ }
7993
+
7994
+ var rpx2unit = createRpx2Unit(getRpx2Unit().unit, getRpx2Unit().unitRatio, getRpx2Unit().unitPrecision);
7995
+
7944
7996
  // upx,rpx 正则匹配
7945
7997
  var unitRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g;
7946
7998
 
7947
7999
  var transformUnit = function (val) {
7948
8000
  if (typeof val === 'string') {
8001
+ try {
8002
+ var config = __uniConfig.globalStyle || __uniConfig.window || {};
8003
+ if (config.dynamicRpx === true) {
8004
+ return rpx2unit(val)
8005
+ }
8006
+ } catch (error) {}
7949
8007
  return val.replace(unitRE, function (a, b) {
7950
8008
  /* eslint-disable no-undef */
7951
8009
  return uni.upx2px(b) + 'px'
@@ -11556,12 +11614,17 @@
11556
11614
  el,
11557
11615
  state
11558
11616
  ) {
11617
+ state.isInScopeSlot = true;
11559
11618
  var isLegacySyntax = el.attrsMap['slot-scope'];
11560
11619
  if (el.if && !el.ifProcessed && !isLegacySyntax) {
11561
- return genIf(el, state, genScopedSlot, "null")
11620
+ var res$1 = genIf(el, state, genScopedSlot, "null");
11621
+ state.isInScopeSlot = false;
11622
+ return res$1
11562
11623
  }
11563
11624
  if (el.for && !el.forProcessed) {
11564
- return genFor(el, state, genScopedSlot)
11625
+ var res$2 = genFor(el, state, genScopedSlot);
11626
+ state.isInScopeSlot = false;
11627
+ return res$2
11565
11628
  }
11566
11629
  var slotScope = el.slotScope === emptySlotScopeToken
11567
11630
  ? ""
@@ -11574,7 +11637,9 @@
11574
11637
  : genElement(el, state)) + "}";
11575
11638
  // reverse proxy v-slot without scope on this.$slots
11576
11639
  var reverseProxy = slotScope ? "" : ",proxy:true";
11577
- return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
11640
+ var res = "{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}";
11641
+ state.isInScopeSlot = false;
11642
+ return res
11578
11643
  }
11579
11644
 
11580
11645
  function genChildren (
@@ -11660,7 +11725,6 @@
11660
11725
  function genSlot (el, state) {
11661
11726
  var slotName = el.slotName || '"default"';
11662
11727
  var children = genChildren(el, state);
11663
- var res = "_t(" + slotName + (children ? ("," + children) : '');
11664
11728
  var attrs = el.attrs || el.dynamicAttrs
11665
11729
  ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11666
11730
  // slot props are camelized
@@ -11670,16 +11734,16 @@
11670
11734
  }); }))
11671
11735
  : null;
11672
11736
  var bind$$1 = el.attrsMap['v-bind'];
11673
- if ((attrs || bind$$1) && !children) {
11674
- res += ",null";
11675
- }
11676
- if (attrs) {
11677
- res += "," + attrs;
11678
- }
11679
- if (bind$$1) {
11680
- res += (attrs ? '' : ',null') + "," + bind$$1;
11681
- }
11682
- return res + ')'
11737
+
11738
+ var args = [];
11739
+ args.push(slotName);
11740
+ args.push(children || 'null');
11741
+ args.push(attrs || 'null');
11742
+ args.push(bind$$1 || 'null');
11743
+ if (state.isInScopeSlot) {
11744
+ args.push('_svm');
11745
+ }
11746
+ return ("_t(" + (args.join(',')) + ")")
11683
11747
  }
11684
11748
 
11685
11749
  // componentName is el.component, take it as argument to shun flow's pessimistic refinement