@rokkit/states 1.0.0-next.128 → 1.0.0-next.129
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/derive.svelte.js +2 -2
- package/src/proxy-item.svelte.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/states",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.129",
|
|
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",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rokkit/core": "1.0.0-next.
|
|
34
|
-
"@rokkit/data": "1.0.0-next.
|
|
33
|
+
"@rokkit/core": "1.0.0-next.129",
|
|
34
|
+
"@rokkit/data": "1.0.0-next.129",
|
|
35
35
|
"d3-array": "^3.2.4",
|
|
36
36
|
"ramda": "^0.32.0",
|
|
37
37
|
"svelte": "^5.53.5"
|
package/src/derive.svelte.js
CHANGED
|
@@ -48,11 +48,11 @@ export function deriveLookupWithProxy(items, fields = DEFAULT_FIELDS, path = [])
|
|
|
48
48
|
items.forEach((item, index) => {
|
|
49
49
|
const itemPath = [...path, index]
|
|
50
50
|
const key = getKeyFromPath(itemPath)
|
|
51
|
-
const norm = typeof item === 'object' && item !== null ? item : { [fields.
|
|
51
|
+
const norm = typeof item === 'object' && item !== null ? item : { [fields.label]: item }
|
|
52
52
|
const entry = {
|
|
53
53
|
value: item,
|
|
54
54
|
original: item,
|
|
55
|
-
label: String(norm[fields.
|
|
55
|
+
label: String(norm[fields.label] ?? ''),
|
|
56
56
|
get: (fieldName) => norm[fields[fieldName] ?? fieldName]
|
|
57
57
|
}
|
|
58
58
|
|
package/src/proxy-item.svelte.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* #raw — always the original input, never mutated.
|
|
7
7
|
* #item — the object used for all field accesses:
|
|
8
8
|
* for objects: same reference as #raw
|
|
9
|
-
* for primitives: { [fields.
|
|
9
|
+
* for primitives: { [fields.label]: raw, [fields.value]: raw }
|
|
10
10
|
* This normalisation means get() and all getters work through the
|
|
11
11
|
* same field-mapping path with no special-casing.
|
|
12
12
|
* #key — path-based identifier ('0', '0-1', '0-1-2', …) assigned by
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* (1 = root, 2 = first-level children, 3 = grandchildren, …)
|
|
16
16
|
*
|
|
17
17
|
* get(fieldName) — maps semantic name → raw key → #item value.
|
|
18
|
-
* For field-mapped attributes only (
|
|
18
|
+
* For field-mapped attributes only (label, value, icon, …).
|
|
19
19
|
* Structural props (key, level) and control state
|
|
20
20
|
* (expanded, selected) are accessed directly as properties.
|
|
21
21
|
*
|