@thinkpixellab-public/px-vue 3.0.34 → 3.0.36

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.
@@ -85,6 +85,12 @@ export default {
85
85
  }
86
86
  return null;
87
87
  },
88
+ isSafari() {
89
+ if (isServer()) {
90
+ return false;
91
+ }
92
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
93
+ },
88
94
  },
89
95
  watch: {
90
96
  enabled() {
@@ -104,6 +110,11 @@ export default {
104
110
  return;
105
111
  }
106
112
 
113
+ if (this.isSafari) {
114
+ this.balanced = true;
115
+ return;
116
+ }
117
+
107
118
  if (this.enabled) {
108
119
  try {
109
120
  this.balanceFailed = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "3.0.34",
3
+ "version": "3.0.36",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",
package/utils/cssStr.js CHANGED
@@ -65,22 +65,37 @@ Add the specified unit if no other unit is specified.
65
65
  cssUnitFallback('10', 'em') => '10em'
66
66
  cssUnitFallback(10, 'em') => '10em'
67
67
  */
68
- function cssUnitFallback(val, fallback) {
68
+ function cssUnitFallback(val, fallback, allowNumberless = false) {
69
69
  if (!val) {
70
70
  return val;
71
71
  }
72
72
 
73
+ let num = typeof val == 'number' ? val : parseFloat(val.toString());
74
+
73
75
  val = val.toString().trim();
74
- const num = typeof val == 'number' ? val : parseFloat(val.toString().trim());
75
- const unit = val.replace(/[0-9]/g, '').trim() || fallback;
76
+
77
+ if (isNaN(num)) {
78
+ if (allowNumberless) {
79
+ num = '';
80
+ } else {
81
+ return null;
82
+ }
83
+ }
84
+
85
+ const unit =
86
+ val
87
+ .replace(num, '')
88
+ .replace(/[0-9]|-|\./g, '')
89
+ .trim() || fallback;
90
+
76
91
  return `${num}${unit}`;
77
92
  }
78
93
 
79
94
  /*
80
95
  Ems version of cssUnitFallback
81
96
  */
82
- function cssEmFallback(val) {
83
- return cssUnitFallback(val, 'em');
97
+ function cssEmFallback(val, allowNumberless = false) {
98
+ return cssUnitFallback(val, 'em', allowNumberless);
84
99
  }
85
100
 
86
101
  export { cssPx, cssEm, cssPcnt, cssUrl, cssVar, cssUnitFallback, cssEmFallback };