@rokkit/states 1.0.0-next.123 → 1.0.0-next.125

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.123",
3
+ "version": "1.0.0-next.125",
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.123",
34
+ "@rokkit/core": "1.0.0-next.125",
35
35
  "d3-array": "^3.2.4",
36
36
  "d3-collection": "^1.0.7",
37
37
  "ramda": "^0.31.3",
package/src/index.js CHANGED
@@ -1,7 +1,4 @@
1
1
  export { TableWrapper } from './tabular.svelte.js'
2
- // export { NodeProxy } from './node-proxy.svelte'
3
- // export { ListProxy } from './list-proxy.svelte'
4
- // export { NestedProxy } from './nested-proxy.svelte'
5
2
  export { Proxy } from './proxy.svelte.js'
6
3
  export { vibe } from './vibe.svelte.js'
7
4
  export { ListController } from './list-controller.svelte.js'
@@ -17,7 +17,7 @@ export class Proxy {
17
17
  }
18
18
 
19
19
  #processChildren() {
20
- if (isNil(this.fields) || isNil(this.#value)) return []
20
+ if (isNil(this.#value)) return []
21
21
 
22
22
  const children = this.#value[this.fields.children] ?? []
23
23
  if (Array.isArray(children)) {
@@ -59,7 +59,7 @@ export class Proxy {
59
59
  delete this.#value[key]
60
60
  })
61
61
  } else {
62
- this.#value = typeof value === 'object' ? value : { [this.fields.text]: value }
62
+ this.#value = { [this.fields.text]: value }
63
63
  this.#original = value
64
64
  }
65
65
  }
package/src/hierarchy.js DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * @typedef {Object} HierarchyItem
3
- * @property {number} depth - The depth of the item in the hierarchy.
4
- * @property {Array<number>} path - The path of the item in the hierarchy.
5
- * @property {any} item - The item itself.
6
- * @property {HierarchyItem} parent - The reference to the parent item.
7
- */
8
-
9
- /**
10
- * Converts a hierarchy of items into a flat array of objects.
11
-
12
- * @param {Array<any>} items - The array of items to convert.
13
- * @param {import('@rokkit/core').FieldMapper} mapping - The field mapper to use for mapping.
14
- * @param {HierarchyItem} parent - The current path of the item.
15
- * @returns {Array<Object>} - The flat array of objects.
16
- */
17
- export function flatHierarchy(items, mapping, parent = null) {
18
- const data = []
19
- const path = parent?.path ?? []
20
-
21
- items.forEach((item, index) => {
22
- const props = {
23
- depth: path.length,
24
- path: [...path, index],
25
- item,
26
- parent
27
- }
28
-
29
- const children = flatHierarchy(mapping.getChildren(item), mapping, props)
30
- data.push(props, ...children)
31
- })
32
-
33
- return data
34
- }