@rokkit/states 1.0.0-next.120 → 1.0.0-next.122

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/states",
3
- "version": "1.0.0-next.120",
3
+ "version": "1.0.0-next.122",
4
4
  "description": "Contains generic data manipulation functions that can be used in various components.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@lukeed/uuid": "^2.0.1",
34
- "@rokkit/core": "1.0.0-next.119",
34
+ "@rokkit/core": "1.0.0-next.121",
35
35
  "d3-array": "^3.2.4",
36
36
  "d3-collection": "^1.0.7",
37
37
  "ramda": "^0.30.1",
package/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { TableWrapper } from './tabular.svelte'
1
+ export { TableWrapper } from './tabular.svelte.js'
2
2
  // export { NodeProxy } from './node-proxy.svelte'
3
3
  // export { ListProxy } from './list-proxy.svelte'
4
4
  // export { NestedProxy } from './nested-proxy.svelte'
5
- export { Proxy } from './proxy.svelte'
6
- export { vibe } from './vibe.svelte'
7
- export { ListController } from './list-controller.svelte'
8
- export { NestedController } from './nested-controller.svelte'
5
+ export { Proxy } from './proxy.svelte.js'
6
+ export { vibe } from './vibe.svelte.js'
7
+ export { ListController } from './list-controller.svelte.js'
8
+ export { NestedController } from './nested-controller.svelte.js'
@@ -44,6 +44,10 @@ export class ListController {
44
44
  return this.focusedKey
45
45
  }
46
46
 
47
+ get currentIndex() {
48
+ return this.#currentIndex
49
+ }
50
+
47
51
  /**
48
52
  * @private
49
53
  * @param {*} value
@@ -174,4 +178,8 @@ export class ListController {
174
178
  return this.select(key)
175
179
  }
176
180
  }
181
+
182
+ update(items) {
183
+ this.items = items
184
+ }
177
185
  }
@@ -1,4 +1,4 @@
1
- import { getKeyFromPath, getPathFromKey, getNestedFields } from '@rokkit/core'
1
+ import { getKeyFromPath, getPathFromKey } from '@rokkit/core'
2
2
  import { equals } from 'ramda'
3
3
  import { ListController } from './list-controller.svelte'
4
4
 
@@ -5,18 +5,6 @@ import { defaultColors, defaultThemeMapping, themeRules } from '@rokkit/core'
5
5
  import { DEFAULT_STYLES, VALID_DENSITIES, VALID_MODES } from './constants'
6
6
  import { has } from 'ramda'
7
7
 
8
- /**
9
- * Transforms theme rules array into an object grouped by mode
10
- * @param {Array<[string, Object.<string, string>]>} themeRules
11
- * @returns {Object.<string, Object.<string, string>>}
12
- */
13
- function groupThemeRulesByMode(themeRules) {
14
- return themeRules.reduce((acc, [name, variables]) => {
15
- const mode = name.includes('light') ? 'light' : 'dark'
16
- return { ...acc, [mode]: variables }
17
- }, {})
18
- }
19
-
20
8
  /**
21
9
  * Checks if a value is allowed based on a list of allowed values and the current value
22
10
  * @param {string} value
@@ -38,11 +26,7 @@ class Vibe {
38
26
  #colors = $state(defaultColors)
39
27
  #density = $state('comfortable')
40
28
  #colorMap = $state(defaultThemeMapping)
41
- #palette = $derived.by(() => {
42
- const grouped = groupThemeRulesByMode(themeRules(this.#style, this.#colorMap, this.#colors))
43
- return grouped[this.#mode]
44
- })
45
- #hasChanged = false
29
+ #palette = $derived.by(() => themeRules(this.#colorMap, this.#colors))
46
30
 
47
31
  /**
48
32
  * Private constructor to enforce singleton pattern