@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 @@ const hasProto = '__proto__' in {};
524
524
  const inBrowser = typeof window !== 'undefined';
525
525
  const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
526
526
  const weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
527
- const UA = inBrowser && window.navigator.userAgent.toLowerCase();
527
+ const UA = inBrowser && window.navigator && window.navigator.userAgent && window.navigator.userAgent.toLowerCase();
528
528
  const isIE = UA && /msie|trident/.test(UA);
529
529
  const isIE9 = UA && UA.indexOf('msie 9.0') > 0;
530
530
  const isEdge = UA && UA.indexOf('edge/') > 0;
@@ -1038,7 +1038,8 @@ function observe (value, asRootData) {
1038
1038
  !isServerRendering() &&
1039
1039
  (Array.isArray(value) || isPlainObject(value)) &&
1040
1040
  Object.isExtensible(value) &&
1041
- !value._isVue
1041
+ !value._isVue &&
1042
+ !value.__v_isMPComponent
1042
1043
  ) {
1043
1044
  ob = new Observer(value);
1044
1045
  }
@@ -2748,7 +2749,8 @@ function renderSlot (
2748
2749
  name,
2749
2750
  fallback,
2750
2751
  props,
2751
- bindObject
2752
+ bindObject,
2753
+ slotVm
2752
2754
  ) {
2753
2755
  const scopedSlotFn = this.$scopedSlots[name];
2754
2756
  let nodes;
@@ -2764,7 +2766,7 @@ function renderSlot (
2764
2766
  props = extend(extend({}, bindObject), props);
2765
2767
  }
2766
2768
  // fixed by xxxxxx app-plus scopedSlot
2767
- nodes = scopedSlotFn(props, this, props._i) || fallback;
2769
+ nodes = scopedSlotFn(props, slotVm || this, props._i) || fallback;
2768
2770
  } else {
2769
2771
  nodes = this.$slots[name] || fallback;
2770
2772
  }
@@ -7962,11 +7964,67 @@ function getStyle (vnode, checkChild) {
7962
7964
  const cssVarRE = /^--/;
7963
7965
  const importantRE = /\s*!important$/;
7964
7966
 
7967
+ // rpx2rem
7968
+ const defaultRpx2Unit = {
7969
+ unit: 'rem',
7970
+ unitRatio: 10 / 320,
7971
+ unitPrecision: 5
7972
+ };
7973
+
7974
+ const Rpx2Unit = Object.assign({}, defaultRpx2Unit);
7975
+
7976
+ function getRpx2Unit () {
7977
+ return Rpx2Unit
7978
+ }
7979
+
7980
+ function toFixed (number, precision) {
7981
+ const multiplier = Math.pow(10, precision + 1);
7982
+ const wholeNumber = Math.floor(number * multiplier);
7983
+ return (Math.round(wholeNumber / 10) * 10) / multiplier
7984
+ }
7985
+
7986
+ function _rpx2Unit (rpx, unit, unitRatio, unitPrecision) {
7987
+ if (unitRatio === 1) {
7988
+ return `${rpx}${unit}`
7989
+ }
7990
+ const value = toFixed(rpx * unitRatio, unitPrecision);
7991
+ return value === 0 ? '0' : `${value}${unit}`
7992
+ }
7993
+
7994
+ function createRpx2Unit (unit, unitRatio, unitPrecision) {
7995
+ // ignore: rpxCalcIncludeWidth
7996
+ /**
7997
+ * @param {string | number} val
7998
+ * @returns {string}
7999
+ */
8000
+ return (val) => {
8001
+ if (typeof val === 'string') {
8002
+ return val.replace(unitRE, (m, $1) => {
8003
+ if (!$1) {
8004
+ return m
8005
+ }
8006
+
8007
+ return _rpx2Unit(parseFloat($1), unit, unitRatio, unitPrecision)
8008
+ })
8009
+ } else if (typeof val === 'number') {
8010
+ return _rpx2Unit(val, unit, unitRatio, unitPrecision)
8011
+ }
8012
+ }
8013
+ }
8014
+
8015
+ const rpx2unit = createRpx2Unit(getRpx2Unit().unit, getRpx2Unit().unitRatio, getRpx2Unit().unitPrecision);
8016
+
7965
8017
  // upx,rpx 正则匹配
7966
8018
  const unitRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g;
7967
8019
 
7968
8020
  const transformUnit = (val) => {
7969
8021
  if (typeof val === 'string') {
8022
+ try {
8023
+ const config = __uniConfig.globalStyle || __uniConfig.window || {};
8024
+ if (config.dynamicRpx === true) {
8025
+ return rpx2unit(val)
8026
+ }
8027
+ } catch (error) {}
7970
8028
  return val.replace(unitRE, (a, b) => {
7971
8029
  /* eslint-disable no-undef */
7972
8030
  return uni.upx2px(b) + 'px'
@@ -11205,7 +11263,7 @@ class CodegenState {
11205
11263
 
11206
11264
 
11207
11265
 
11208
-
11266
+
11209
11267
  constructor (options) {
11210
11268
  this.options = options;
11211
11269
  this.warn = options.warn || baseWarn;
@@ -11617,12 +11675,17 @@ function genScopedSlot (
11617
11675
  el,
11618
11676
  state
11619
11677
  ) {
11678
+ state.isInScopeSlot = true;
11620
11679
  const isLegacySyntax = el.attrsMap['slot-scope'];
11621
11680
  if (el.if && !el.ifProcessed && !isLegacySyntax) {
11622
- return genIf(el, state, genScopedSlot, `null`)
11681
+ const res = genIf(el, state, genScopedSlot, `null`);
11682
+ state.isInScopeSlot = false;
11683
+ return res
11623
11684
  }
11624
11685
  if (el.for && !el.forProcessed) {
11625
- return genFor(el, state, genScopedSlot)
11686
+ const res = genFor(el, state, genScopedSlot);
11687
+ state.isInScopeSlot = false;
11688
+ return res
11626
11689
  }
11627
11690
  const slotScope = el.slotScope === emptySlotScopeToken
11628
11691
  ? ``
@@ -11636,7 +11699,9 @@ function genScopedSlot (
11636
11699
  }}`;
11637
11700
  // reverse proxy v-slot without scope on this.$slots
11638
11701
  const reverseProxy = slotScope ? `` : `,proxy:true`;
11639
- return `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`
11702
+ const res = `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`;
11703
+ state.isInScopeSlot = false;
11704
+ return res
11640
11705
  }
11641
11706
 
11642
11707
  function genChildren (
@@ -11725,7 +11790,6 @@ function genComment (comment) {
11725
11790
  function genSlot (el, state) {
11726
11791
  const slotName = el.slotName || '"default"';
11727
11792
  const children = genChildren(el, state);
11728
- let res = `_t(${slotName}${children ? `,${children}` : ''}`;
11729
11793
  const attrs = el.attrs || el.dynamicAttrs
11730
11794
  ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
11731
11795
  // slot props are camelized
@@ -11735,16 +11799,16 @@ function genSlot (el, state) {
11735
11799
  })))
11736
11800
  : null;
11737
11801
  const bind$$1 = el.attrsMap['v-bind'];
11738
- if ((attrs || bind$$1) && !children) {
11739
- res += `,null`;
11740
- }
11741
- if (attrs) {
11742
- res += `,${attrs}`;
11743
- }
11744
- if (bind$$1) {
11745
- res += `${attrs ? '' : ',null'},${bind$$1}`;
11746
- }
11747
- return res + ')'
11802
+
11803
+ const args = [];
11804
+ args.push(slotName);
11805
+ args.push(children || 'null');
11806
+ args.push(attrs || 'null');
11807
+ args.push(bind$$1 || 'null');
11808
+ if (state.isInScopeSlot) {
11809
+ args.push('_svm');
11810
+ }
11811
+ return `_t(${args.join(',')})`
11748
11812
  }
11749
11813
 
11750
11814
  // componentName is el.component, take it as argument to shun flow's pessimistic refinement