@thinkpixellab-public/px-vue 3.0.37 → 3.0.39
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/components/PxBalancedText.vue +12 -3
- package/components/PxCardGrid.vue +2 -2
- package/components/PxFloat.vue +7 -0
- package/components/PxSvg.vue +2 -2
- package/package.json +1 -1
- package/utils/cssStr.js +36 -1
- package/utils/variants.js +4 -0
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
<!-- html -->
|
|
8
8
|
<component
|
|
9
9
|
v-if="hasHtml"
|
|
10
|
-
:class="bem('inner', { html: true })"
|
|
10
|
+
:class="[bem('inner', { html: true }), innerClass]"
|
|
11
11
|
:is="innerTag"
|
|
12
12
|
ref="text"
|
|
13
13
|
v-html="html"
|
|
14
14
|
/>
|
|
15
15
|
|
|
16
16
|
<!-- slot -->
|
|
17
|
-
<component v-else :class="bem('inner')" :is="innerTag" ref="text">
|
|
17
|
+
<component v-else :class="[bem('inner'), innerClass]" :is="innerTag" ref="text">
|
|
18
18
|
<slot />
|
|
19
19
|
</component>
|
|
20
20
|
</component>
|
|
@@ -35,6 +35,9 @@ export default {
|
|
|
35
35
|
// the inner tag element
|
|
36
36
|
innerTag: { type: String, default: 'span' },
|
|
37
37
|
|
|
38
|
+
// the inner tag element
|
|
39
|
+
innerClass: { type: String, default: null },
|
|
40
|
+
|
|
38
41
|
// html that gets set on the inner tag element
|
|
39
42
|
html: { type: String, default: null },
|
|
40
43
|
|
|
@@ -91,6 +94,12 @@ export default {
|
|
|
91
94
|
}
|
|
92
95
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
93
96
|
},
|
|
97
|
+
isHeadless() {
|
|
98
|
+
if (isServer()) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return /HeadlessChrome/i.test(navigator.userAgent);
|
|
102
|
+
},
|
|
94
103
|
},
|
|
95
104
|
watch: {
|
|
96
105
|
enabled() {
|
|
@@ -110,7 +119,7 @@ export default {
|
|
|
110
119
|
return;
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
if (this.isSafari) {
|
|
122
|
+
if (this.isSafari || this.isHeadless) {
|
|
114
123
|
this.balanced = true;
|
|
115
124
|
return;
|
|
116
125
|
}
|
|
@@ -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/components/PxFloat.vue
CHANGED
|
@@ -273,6 +273,13 @@ export default {
|
|
|
273
273
|
document.removeEventListener('keydown', this.onKey);
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
if (nv) {
|
|
277
|
+
let reference = this.getReferenceElement();
|
|
278
|
+
let popup = this.$refs.popup;
|
|
279
|
+
|
|
280
|
+
this.updatePosition(reference, popup);
|
|
281
|
+
}
|
|
282
|
+
|
|
276
283
|
// delayed actions (settimeout seems to work but $nextTick doesn't)
|
|
277
284
|
|
|
278
285
|
setTimeout(() => {
|
package/components/PxSvg.vue
CHANGED
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 };
|