@rokkit/states 1.0.0-next.139 → 1.0.0-next.141
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
package/src/proxy-item.svelte.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* signals stable so $derived computations track them correctly.
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
import { BASE_FIELDS
|
|
38
|
+
import { BASE_FIELDS } from '@rokkit/core'
|
|
39
39
|
export { BASE_FIELDS }
|
|
40
40
|
|
|
41
41
|
// Auto-increment counter for generating stable unique IDs.
|
|
@@ -93,7 +93,7 @@ export class ProxyItem {
|
|
|
93
93
|
* @param {number} [level] Nesting depth (1 = root)
|
|
94
94
|
*/
|
|
95
95
|
constructor(raw, fields = {}, key = '', level = 0) {
|
|
96
|
-
this.#fields = { ...BASE_FIELDS, ...
|
|
96
|
+
this.#fields = { ...BASE_FIELDS, ...(fields && typeof fields === 'object' ? fields : {}) }
|
|
97
97
|
this.#raw = raw
|
|
98
98
|
this.#key = key
|
|
99
99
|
this.#level = level
|
package/src/proxy-tree.svelte.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* expansion or children change anywhere in the tree.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { BASE_FIELDS
|
|
17
|
+
import { BASE_FIELDS } from '@rokkit/core'
|
|
18
18
|
import { SvelteMap } from 'svelte/reactivity'
|
|
19
19
|
import { ProxyItem } from './proxy-item.svelte.js'
|
|
20
20
|
|
|
@@ -129,7 +129,7 @@ export class ProxyTree {
|
|
|
129
129
|
* @param {{ createProxy?: (raw: *, fields: object, key: string, level: number) => ProxyItem }} [options]
|
|
130
130
|
*/
|
|
131
131
|
constructor(items = [], fields = {}, options = {}) {
|
|
132
|
-
this.#fields = { ...BASE_FIELDS, ...
|
|
132
|
+
this.#fields = { ...BASE_FIELDS, ...(fields && typeof fields === 'object' ? fields : {}) }
|
|
133
133
|
this.#factory = this.#resolveFactory(options.createProxy)
|
|
134
134
|
this.#rootProxies = (items ?? []).map((raw, i) =>
|
|
135
135
|
this.#factory(raw, this.#fields, String(i), 1)
|