@thinkpixellab-public/px-vue 4.0.29 → 4.1.0
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/package.json +3 -3
- package/utils/utilsSsr.js +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkpixellab-public/px-vue",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "General purpose Vue components and helpers that can be used across projects.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Pixel Lab"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@floating-ui/dom": "^1.6.11",
|
|
24
24
|
"@popperjs/core": "^2.11.8",
|
|
25
25
|
"@storybook/test": "^8.3.4",
|
|
26
|
-
"@thinkpixellab-public/px-styles": "^4.0
|
|
26
|
+
"@thinkpixellab-public/px-styles": "^4.1.0",
|
|
27
27
|
"@thinkpixellab-public/px-vue-tester": "^2.0.0",
|
|
28
28
|
"@thinkpixellab-public/vue-resize-directive": "^1.2.2",
|
|
29
29
|
"body-scroll-lock": "^3.1.5",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
60
60
|
"@vue/test-utils": "^2.4.6",
|
|
61
61
|
"babel-eslint": "^10.1.0",
|
|
62
|
-
"sass": "^1.77.6",
|
|
63
62
|
"babel-loader": "^9.2.1",
|
|
64
63
|
"chromatic": "^11.11.0",
|
|
65
64
|
"eslint": "^9.11.1",
|
|
@@ -67,6 +66,7 @@
|
|
|
67
66
|
"eslint-plugin-vue": "^9.28.0",
|
|
68
67
|
"jsdom": "^25.0.1",
|
|
69
68
|
"prettier": "^3.3.3",
|
|
69
|
+
"sass": "^1.77.6",
|
|
70
70
|
"storybook": "^8.3.4",
|
|
71
71
|
"storybook-addon-pseudo-states": "^4.0.2",
|
|
72
72
|
"vite": "^5.4.8",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useSSRContext } from 'vue';
|
|
2
|
+
|
|
3
|
+
export function getQueryParams() {
|
|
4
|
+
// Function to parse query params from URL
|
|
5
|
+
const getQueryParams = url => {
|
|
6
|
+
const params = {};
|
|
7
|
+
new URL(url, 'http://example.com').searchParams.forEach((value, key) => {
|
|
8
|
+
params[key] = value;
|
|
9
|
+
});
|
|
10
|
+
return params;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let queryParams;
|
|
14
|
+
|
|
15
|
+
let ctx;
|
|
16
|
+
|
|
17
|
+
if (typeof window === 'undefined') {
|
|
18
|
+
ctx = useSSRContext();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (ctx) {
|
|
22
|
+
queryParams = getQueryParams(ctx.url);
|
|
23
|
+
} else {
|
|
24
|
+
const { search } = window.location;
|
|
25
|
+
|
|
26
|
+
queryParams = getQueryParams(search);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return queryParams;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getQueryParam(name, fallback = null) {
|
|
33
|
+
let params = getQueryParams();
|
|
34
|
+
|
|
35
|
+
return params[name] || fallback;
|
|
36
|
+
}
|