@thinkpixellab-public/px-vue 3.0.36 → 3.0.38
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.
|
@@ -91,6 +91,12 @@ export default {
|
|
|
91
91
|
}
|
|
92
92
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
93
93
|
},
|
|
94
|
+
isHeadless() {
|
|
95
|
+
if (isServer()) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return /HeadlessChrome/i.test(navigator.userAgent);
|
|
99
|
+
},
|
|
94
100
|
},
|
|
95
101
|
watch: {
|
|
96
102
|
enabled() {
|
|
@@ -110,7 +116,7 @@ export default {
|
|
|
110
116
|
return;
|
|
111
117
|
}
|
|
112
118
|
|
|
113
|
-
if (this.isSafari) {
|
|
119
|
+
if (this.isSafari || this.isHeadless) {
|
|
114
120
|
this.balanced = true;
|
|
115
121
|
return;
|
|
116
122
|
}
|
|
@@ -109,8 +109,8 @@ You can define a template using space notation like this:
|
|
|
109
109
|
:key="spaceIndex"
|
|
110
110
|
>
|
|
111
111
|
<div
|
|
112
|
-
v-for="
|
|
113
|
-
:key="
|
|
112
|
+
v-for="item in space.cards"
|
|
113
|
+
:key="getItemKey(item)"
|
|
114
114
|
:class="bem('card')"
|
|
115
115
|
:ref="cardRefFromItem(item)"
|
|
116
116
|
>
|
package/package.json
CHANGED
package/utils/cssStr.js
CHANGED
|
@@ -58,6 +58,41 @@ function cssVar(val) {
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/*
|
|
62
|
+
Extract the unit from a css value
|
|
63
|
+
cssUnit('10px') => 'px'
|
|
64
|
+
cssUnit(10) => ''
|
|
65
|
+
*/
|
|
66
|
+
function cssUnit(val) {
|
|
67
|
+
if (!val) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
const allowedUnits = ['em', 'px', '%', 'rem', 'vw', 'vh', 'ex', 'ch', 'vmin', 'vmax'];
|
|
71
|
+
|
|
72
|
+
val = val
|
|
73
|
+
.toString()
|
|
74
|
+
.replace(/[0-9]|-|\./g, '')
|
|
75
|
+
.trim();
|
|
76
|
+
|
|
77
|
+
if (allowedUnits.includes(val)) {
|
|
78
|
+
return val;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
Extract the number from a css value
|
|
86
|
+
cssNum('10px') => 10
|
|
87
|
+
cssNum(10) => 10
|
|
88
|
+
cssNum('auto') => 0
|
|
89
|
+
cssNum('auto', null) => null
|
|
90
|
+
*/
|
|
91
|
+
function cssNum(val, nanValue = 0) {
|
|
92
|
+
const num = parseFloat(val);
|
|
93
|
+
return isNaN(num) ? nanValue : num;
|
|
94
|
+
}
|
|
95
|
+
|
|
61
96
|
/*
|
|
62
97
|
Add the specified unit if no other unit is specified.
|
|
63
98
|
|
|
@@ -98,4 +133,4 @@ function cssEmFallback(val, allowNumberless = false) {
|
|
|
98
133
|
return cssUnitFallback(val, 'em', allowNumberless);
|
|
99
134
|
}
|
|
100
135
|
|
|
101
|
-
export { cssPx, cssEm, cssPcnt, cssUrl, cssVar, cssUnitFallback, cssEmFallback };
|
|
136
|
+
export { cssPx, cssEm, cssPcnt, cssUrl, cssVar, cssNum, cssUnit, cssUnitFallback, cssEmFallback };
|