@rokkit/states 1.0.5 → 1.1.1
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/src/vibe.svelte.js +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/states",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Contains generic data manipulation functions that can be used in various components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@rokkit/core": "1.
|
|
41
|
-
"@rokkit/data": "1.
|
|
40
|
+
"@rokkit/core": "1.1.1",
|
|
41
|
+
"@rokkit/data": "1.1.1",
|
|
42
42
|
"d3-array": "^3.2.4",
|
|
43
43
|
"ramda": "^0.32.0",
|
|
44
44
|
"svelte": "^5.53.5"
|
package/src/vibe.svelte.js
CHANGED
|
@@ -131,6 +131,9 @@ class Vibe {
|
|
|
131
131
|
* @param {string} key
|
|
132
132
|
*/
|
|
133
133
|
load(key) {
|
|
134
|
+
// SSR-safe: localStorage is undefined in pre-v25 Node and emits a
|
|
135
|
+
// warning under v25+ without --localstorage-file. Skip on the server.
|
|
136
|
+
if (typeof localStorage === 'undefined') return
|
|
134
137
|
try {
|
|
135
138
|
const stored = localStorage.getItem(key)
|
|
136
139
|
if (stored) {
|
|
@@ -138,7 +141,7 @@ class Vibe {
|
|
|
138
141
|
}
|
|
139
142
|
} catch (e) {
|
|
140
143
|
// eslint-disable-next-line no-console
|
|
141
|
-
console.warn(
|
|
144
|
+
console.warn('Failed to load theme from storage for key "%s"', key, e.message)
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
|
|
@@ -148,6 +151,7 @@ class Vibe {
|
|
|
148
151
|
*/
|
|
149
152
|
save(key) {
|
|
150
153
|
if (!key) throw new Error('Key is required')
|
|
154
|
+
if (typeof localStorage === 'undefined') return
|
|
151
155
|
|
|
152
156
|
try {
|
|
153
157
|
const config = {
|
|
@@ -159,7 +163,7 @@ class Vibe {
|
|
|
159
163
|
localStorage.setItem(key, JSON.stringify(config))
|
|
160
164
|
} catch (e) {
|
|
161
165
|
// eslint-disable-next-line no-console
|
|
162
|
-
console.warn(
|
|
166
|
+
console.warn('Failed to save theme to storage for key "%s"', key, e.message)
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
|