@dcloudio/vue-cli-plugin-uni 2.0.2-alpha-5000720260327001 → 2.0.2-alpha-5000820260422001

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-alpha-5000720260327001",
3
+ "version": "2.0.2-alpha-5000820260422001",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.2-alpha-5000720260327001",
20
+ "@dcloudio/uni-stat": "^2.0.2-alpha-5000820260422001",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "cross-env": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "copy-webpack-plugin": ">=5",
42
42
  "postcss": ">=7"
43
43
  },
44
- "gitHead": "14489ff43cbf4e79691c9b87f057a3d7f3419f3c"
44
+ "gitHead": "966d2d976263f8712e8aaeca1109725c1a5e6266"
45
45
  }
@@ -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
  'use strict';
@@ -526,7 +526,7 @@ var hasProto = '__proto__' in {};
526
526
  var inBrowser = typeof window !== 'undefined';
527
527
  var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
528
528
  var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
529
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
529
+ var UA = inBrowser && window.navigator && window.navigator.userAgent && window.navigator.userAgent.toLowerCase();
530
530
  var isIE = UA && /msie|trident/.test(UA);
531
531
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
532
532
  var isEdge = UA && UA.indexOf('edge/') > 0;
@@ -1004,7 +1004,8 @@ function observe (value, asRootData) {
1004
1004
  !isServerRendering() &&
1005
1005
  (Array.isArray(value) || isPlainObject(value)) &&
1006
1006
  Object.isExtensible(value) &&
1007
- !value._isVue
1007
+ !value._isVue &&
1008
+ !value.__v_isMPComponent
1008
1009
  ) {
1009
1010
  ob = new Observer(value);
1010
1011
  }
@@ -2718,7 +2719,8 @@ function renderSlot (
2718
2719
  name,
2719
2720
  fallback,
2720
2721
  props,
2721
- bindObject
2722
+ bindObject,
2723
+ slotVm
2722
2724
  ) {
2723
2725
  var scopedSlotFn = this.$scopedSlots[name];
2724
2726
  var nodes;
@@ -2734,7 +2736,7 @@ function renderSlot (
2734
2736
  props = extend(extend({}, bindObject), props);
2735
2737
  }
2736
2738
  // fixed by xxxxxx app-plus scopedSlot
2737
- nodes = scopedSlotFn(props, this, props._i) || fallback;
2739
+ nodes = scopedSlotFn(props, slotVm || this, props._i) || fallback;
2738
2740
  } else {
2739
2741
  nodes = this.$slots[name] || fallback;
2740
2742
  }
@@ -7937,11 +7939,67 @@ function getStyle (vnode, checkChild) {
7937
7939
  var cssVarRE = /^--/;
7938
7940
  var importantRE = /\s*!important$/;
7939
7941
 
7942
+ // rpx2rem
7943
+ var defaultRpx2Unit = {
7944
+ unit: 'rem',
7945
+ unitRatio: 10 / 320,
7946
+ unitPrecision: 5
7947
+ };
7948
+
7949
+ var Rpx2Unit = Object.assign({}, defaultRpx2Unit);
7950
+
7951
+ function getRpx2Unit () {
7952
+ return Rpx2Unit
7953
+ }
7954
+
7955
+ function toFixed (number, precision) {
7956
+ var multiplier = Math.pow(10, precision + 1);
7957
+ var wholeNumber = Math.floor(number * multiplier);
7958
+ return (Math.round(wholeNumber / 10) * 10) / multiplier
7959
+ }
7960
+
7961
+ function _rpx2Unit (rpx, unit, unitRatio, unitPrecision) {
7962
+ if (unitRatio === 1) {
7963
+ return ("" + rpx + unit)
7964
+ }
7965
+ var value = toFixed(rpx * unitRatio, unitPrecision);
7966
+ return value === 0 ? '0' : ("" + value + unit)
7967
+ }
7968
+
7969
+ function createRpx2Unit (unit, unitRatio, unitPrecision) {
7970
+ // ignore: rpxCalcIncludeWidth
7971
+ /**
7972
+ * @param {string | number} val
7973
+ * @returns {string}
7974
+ */
7975
+ return function (val) {
7976
+ if (typeof val === 'string') {
7977
+ return val.replace(unitRE, function (m, $1) {
7978
+ if (!$1) {
7979
+ return m
7980
+ }
7981
+
7982
+ return _rpx2Unit(parseFloat($1), unit, unitRatio, unitPrecision)
7983
+ })
7984
+ } else if (typeof val === 'number') {
7985
+ return _rpx2Unit(val, unit, unitRatio, unitPrecision)
7986
+ }
7987
+ }
7988
+ }
7989
+
7990
+ var rpx2unit = createRpx2Unit(getRpx2Unit().unit, getRpx2Unit().unitRatio, getRpx2Unit().unitPrecision);
7991
+
7940
7992
  // upx,rpx 正则匹配
7941
7993
  var unitRE = /\b([+-]?\d+(\.\d+)?)[r|u]px\b/g;
7942
7994
 
7943
7995
  var transformUnit = function (val) {
7944
7996
  if (typeof val === 'string') {
7997
+ try {
7998
+ var config = __uniConfig.globalStyle || __uniConfig.window || {};
7999
+ if (config.dynamicRpx === true) {
8000
+ return rpx2unit(val)
8001
+ }
8002
+ } catch (error) {}
7945
8003
  return val.replace(unitRE, function (a, b) {
7946
8004
  /* eslint-disable no-undef */
7947
8005
  return uni.upx2px(b) + 'px'
@@ -11552,12 +11610,17 @@ function genScopedSlot (
11552
11610
  el,
11553
11611
  state
11554
11612
  ) {
11613
+ state.isInScopeSlot = true;
11555
11614
  var isLegacySyntax = el.attrsMap['slot-scope'];
11556
11615
  if (el.if && !el.ifProcessed && !isLegacySyntax) {
11557
- return genIf(el, state, genScopedSlot, "null")
11616
+ var res$1 = genIf(el, state, genScopedSlot, "null");
11617
+ state.isInScopeSlot = false;
11618
+ return res$1
11558
11619
  }
11559
11620
  if (el.for && !el.forProcessed) {
11560
- return genFor(el, state, genScopedSlot)
11621
+ var res$2 = genFor(el, state, genScopedSlot);
11622
+ state.isInScopeSlot = false;
11623
+ return res$2
11561
11624
  }
11562
11625
  var slotScope = el.slotScope === emptySlotScopeToken
11563
11626
  ? ""
@@ -11570,7 +11633,9 @@ function genScopedSlot (
11570
11633
  : genElement(el, state)) + "}";
11571
11634
  // reverse proxy v-slot without scope on this.$slots
11572
11635
  var reverseProxy = slotScope ? "" : ",proxy:true";
11573
- return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
11636
+ var res = "{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}";
11637
+ state.isInScopeSlot = false;
11638
+ return res
11574
11639
  }
11575
11640
 
11576
11641
  function genChildren (
@@ -11656,7 +11721,6 @@ function genComment (comment) {
11656
11721
  function genSlot (el, state) {
11657
11722
  var slotName = el.slotName || '"default"';
11658
11723
  var children = genChildren(el, state);
11659
- var res = "_t(" + slotName + (children ? ("," + children) : '');
11660
11724
  var attrs = el.attrs || el.dynamicAttrs
11661
11725
  ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11662
11726
  // slot props are camelized
@@ -11666,16 +11730,16 @@ function genSlot (el, state) {
11666
11730
  }); }))
11667
11731
  : null;
11668
11732
  var bind$$1 = el.attrsMap['v-bind'];
11669
- if ((attrs || bind$$1) && !children) {
11670
- res += ",null";
11671
- }
11672
- if (attrs) {
11673
- res += "," + attrs;
11674
- }
11675
- if (bind$$1) {
11676
- res += (attrs ? '' : ',null') + "," + bind$$1;
11677
- }
11678
- return res + ')'
11733
+
11734
+ var args = [];
11735
+ args.push(slotName);
11736
+ args.push(children || 'null');
11737
+ args.push(attrs || 'null');
11738
+ args.push(bind$$1 || 'null');
11739
+ if (state.isInScopeSlot) {
11740
+ args.push('_svm');
11741
+ }
11742
+ return ("_t(" + (args.join(',')) + ")")
11679
11743
  }
11680
11744
 
11681
11745
  // componentName is el.component, take it as argument to shun flow's pessimistic refinement