@rokkit/states 1.1.14 → 1.1.15

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/vibe.svelte.js +22 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/states",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
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.1.14",
41
- "@rokkit/data": "1.1.14",
40
+ "@rokkit/core": "1.1.15",
41
+ "@rokkit/data": "1.1.15",
42
42
  "d3-array": "^3.2.4",
43
43
  "ramda": "^0.32.0",
44
44
  "svelte": "^5.53.5"
@@ -22,8 +22,10 @@ function isAllowedValue(value, allowed, current) {
22
22
  */
23
23
  class Vibe {
24
24
  #allowedStyles = $state(DEFAULT_STYLES)
25
+ #allowedSkins = $state(['default'])
25
26
  #mode = $state('dark')
26
27
  #style = $state('rokkit')
28
+ #skin = $state('default')
27
29
  #colors = $state(defaultColors)
28
30
  #density = $state('comfortable')
29
31
  #direction = $state(detectDirection())
@@ -53,6 +55,23 @@ class Vibe {
53
55
  }
54
56
  }
55
57
 
58
+ get allowedSkins() {
59
+ return this.#allowedSkins
60
+ }
61
+
62
+ set allowedSkins(input) {
63
+ const skins = (Array.isArray(input) ? input : [input]).filter(Boolean)
64
+ if (skins.length > 0) this.#allowedSkins = skins
65
+ }
66
+
67
+ get skin() {
68
+ return this.#skin
69
+ }
70
+
71
+ set skin(value) {
72
+ if (isAllowedValue(value, this.#allowedSkins, this.#skin)) this.#skin = value
73
+ }
74
+
56
75
  get colorMap() {
57
76
  return this.#colorMap
58
77
  }
@@ -158,7 +177,8 @@ class Vibe {
158
177
  style: this.#style,
159
178
  mode: this.#mode,
160
179
  density: this.#density,
161
- direction: this.#direction
180
+ direction: this.#direction,
181
+ skin: this.#skin
162
182
  }
163
183
  localStorage.setItem(key, JSON.stringify(config))
164
184
  } catch (e) {
@@ -176,6 +196,7 @@ class Vibe {
176
196
  this.mode = value.mode
177
197
  this.density = value.density
178
198
  this.direction = value.direction
199
+ if (value.skin) this.skin = value.skin
179
200
  }
180
201
 
181
202
  /**