@thinkpixellab-public/px-vue 3.0.86 → 3.0.88

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.
@@ -2,8 +2,9 @@
2
2
  Automatically computes line clamp based on the available height and current line height.
3
3
  -->
4
4
  <template>
5
- <component :is="tag" :class="bem()" :style="{}">
5
+ <component :is="tag" :class="bem()">
6
6
  <span
7
+ v-if="enabled"
7
8
  :class="bem('clamp')"
8
9
  :style="{
9
10
  '-webkit-line-clamp': lineCount,
@@ -15,6 +16,11 @@
15
16
  {{ text }}
16
17
  </slot>
17
18
  </span>
19
+ <span v-else>
20
+ <slot>
21
+ {{ text }}
22
+ </slot>
23
+ </span>
18
24
  </component>
19
25
  </template>
20
26
 
@@ -25,6 +31,7 @@ export default {
25
31
  name: 'px-auto-clamp',
26
32
  mixins: [PxBaseResize],
27
33
  props: {
34
+ enabled: { type: Boolean, default: true },
28
35
  text: { type: String, default: null },
29
36
  tag: { type: String, default: 'div' },
30
37
  },
@@ -17,11 +17,7 @@ export default {
17
17
  return this.mediaQuery.currentBreakpoint;
18
18
  },
19
19
  },
20
- mounted() {
21
- // setTimeout(() => {
22
- // console.log(this.mediaQuery.breakpoints);
23
- // }, 100);
24
- },
20
+
25
21
  methods: {
26
22
  isBreakpointOrSmaller(breakpoint) {
27
23
  if (this.currentBreakpoint === null) {
@@ -18,7 +18,7 @@ export default {
18
18
  variantValue() {
19
19
  return (
20
20
  (this.variantBase ? `${this.variantBase} ` : '') +
21
- (this.variant !== 'default' ? this.variant : this.variantDefault)
21
+ (this.variant && this.variant !== 'default' ? this.variant : this.variantDefault)
22
22
  );
23
23
  },
24
24
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "3.0.86",
3
+ "version": "3.0.88",
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/bem.js CHANGED
@@ -32,7 +32,8 @@ function hyphenate(str, shouldHyphenate = true) {
32
32
  // Get block name
33
33
  function getBlockName(component) {
34
34
  if (!component.$options._blockName) {
35
- let block = component.$options.name || component.$options._componentTag;
35
+ let block = 'bemBlockName' in component && component.bemBlockName();
36
+ block = block || component.$options.name || component.$options._componentTag;
36
37
  if (block && block.indexOf('/') > -1) {
37
38
  block = block.split('/').pop().split('.')[0];
38
39
  }
package/utils/utils.js CHANGED
@@ -27,6 +27,16 @@ export default {
27
27
  return Array.isArray(value) ? value : [value];
28
28
  },
29
29
 
30
+ /**
31
+ * Returns a new array containing the specified number of items generated by the provided
32
+ * function.
33
+ * @param {*} count The number of items to be generated.
34
+ * @param {*} fn The function to be called to generate each item.
35
+ */
36
+ arrayFill: function (count, fn) {
37
+ return Array.from({ count }, (_, i) => fn(i));
38
+ },
39
+
30
40
  /**
31
41
  * Safely gets an item from an array, otherwise returns a fallback value.
32
42
  * @param {*} arr The array.