@thinkpixellab-public/px-vue 5.3.6 → 5.3.8

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.
@@ -1,19 +1,23 @@
1
1
  <script>
2
+ import { useId } from 'vue';
3
+
2
4
  export default {
3
5
  beforeCreate() {
4
- const id = this.$.uid || Math.floor(Math.random() * 1000);
5
- this.$__uniqueId = String(id).padStart(4, '0');
6
+ // useId() (Vue 3.5+) yields an id that is stable across SSR and client
7
+ // renders, avoiding hydration mismatches. The old source (this.$.uid) is
8
+ // a per-render-pass counter that differs between server and client.
9
+ this.$__uniqueId = useId();
6
10
  },
7
11
  methods: {
8
12
  /**
9
- * Get a unique id derived from vue's unique component identifier (this.$.uid) for use when
10
- * an id is required for an inputs, labels, etc.
13
+ * Get a unique, SSR-stable id for use when an id is required for inputs,
14
+ * labels, etc. Optionally prefixed.
11
15
  *
12
16
  * @param {string} prefix = null
13
17
  * @returns {string}
14
18
  *
15
19
  * @example
16
- * this.uniqueId('label') => 'label-0003'
20
+ * this.uniqueId('label') => 'label-v-3-0'
17
21
  */
18
22
 
19
23
  uniqueId(prefix = null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "5.3.6",
3
+ "version": "5.3.8",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": {
6
6
  "name": "Pixel Lab"
@@ -69,14 +69,14 @@
69
69
  "@vitejs/plugin-vue": "^6.0.7",
70
70
  "@vue/test-utils": "^2.4.11",
71
71
  "@vueless/storybook-dark-mode": "^10.0.8",
72
- "chromatic": "^17.7.2",
72
+ "chromatic": "^18.0.0",
73
73
  "jsdom": "^29.1.1",
74
- "oxfmt": "^0.56.0",
75
- "oxlint": "^1.71.0",
74
+ "oxfmt": "^0.57.0",
75
+ "oxlint": "^1.72.0",
76
76
  "sass": "^1.101.0",
77
77
  "storybook": "^10.4.6",
78
78
  "storybook-addon-pseudo-states": "^10.4.6",
79
- "vite": "^8.1.0",
79
+ "vite": "^8.1.3",
80
80
  "vitest": "^4.1.9",
81
81
  "vue": "^3.5.39"
82
82
  },
package/plugins/common.js CHANGED
@@ -17,7 +17,6 @@ import slug from './filters/slug.js';
17
17
  import spacenator from './filters/spacenator.js';
18
18
  import date from './filters/date.js';
19
19
  import isServer from '../utils/isServer.js';
20
- import uniqueId from '../utils/uniqueId.js';
21
20
 
22
21
  import { nextTick } from 'vue';
23
22
 
@@ -36,7 +35,6 @@ export default {
36
35
  app.config.globalProperties.cssToNull = cssToNull;
37
36
  app.config.globalProperties.hasSlot = hasSlot;
38
37
  app.config.globalProperties.isServer = isServer;
39
- app.config.globalProperties.uniqueId = uniqueId;
40
38
 
41
39
  /**
42
40
  * Collection of common filters.
package/utils/uniqueId.js DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Get a unique id derived from vue's unique component identifier (this._uid) for use when
3
- * an id is required for an inputs, labels, etc.
4
- *
5
- * @example
6
- * uniqueId('label') => 'label-0003'
7
- */
8
-
9
- function uniqueId(prefix = null) {
10
- let id = this?.$?.uid;
11
- if (prefix) {
12
- return prefix + '-' + id;
13
- }
14
- return id.toString();
15
- }
16
-
17
- export default uniqueId;