@rokkit/states 1.0.0-next.114 → 1.0.0-next.116
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 +1 -1
- package/src/proxy.svelte.js +4 -3
package/package.json
CHANGED
package/src/proxy.svelte.js
CHANGED
|
@@ -17,6 +17,7 @@ export class Proxy {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
#processChildren() {
|
|
20
|
+
if (!this.has('children')) return []
|
|
20
21
|
const children = this.#value[this.fields.children] ?? []
|
|
21
22
|
if (Array.isArray(children)) {
|
|
22
23
|
const fields = getNestedFields(this.fields)
|
|
@@ -57,7 +58,7 @@ export class Proxy {
|
|
|
57
58
|
delete this.#value[key]
|
|
58
59
|
})
|
|
59
60
|
} else {
|
|
60
|
-
this.#value.text
|
|
61
|
+
this.#value = typeof value === 'object' ? value : { [this.fields.text]: value }
|
|
61
62
|
this.#original = value
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -66,7 +67,7 @@ export class Proxy {
|
|
|
66
67
|
* Gets a mapped attribute from the original item
|
|
67
68
|
*
|
|
68
69
|
* @param {string} fieldName - Name of the field to get
|
|
69
|
-
* @param {any}
|
|
70
|
+
* @param {any} [defaultValue] - Default value to return if not found
|
|
70
71
|
* @returns {any|undefined} - The attribute value or null if not found
|
|
71
72
|
*/
|
|
72
73
|
get(fieldName, defaultValue) {
|
|
@@ -91,7 +92,7 @@ export class Proxy {
|
|
|
91
92
|
* - No snippet key is configured for this item
|
|
92
93
|
* - The configured snippet key doesn't exist in the snippets collection
|
|
93
94
|
* @param {Object} snippets
|
|
94
|
-
* @param {import('svelte').Snippet|undefined} defaultSnippet
|
|
95
|
+
* @param {import('svelte').Snippet|undefined} [defaultSnippet]
|
|
95
96
|
* @returns {import('svelte').Snippet|undefined}
|
|
96
97
|
*/
|
|
97
98
|
getSnippet(snippets, defaultSnippet) {
|