@skaldapp/flat-json-tree 2.3.0 → 2.3.1

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/dist/index.d.ts CHANGED
@@ -10,6 +10,13 @@ declare const _default: (tree: MaybeRef<unObject[]>, { branch: keyBranch, childr
10
10
  prev?: string | undefined;
11
11
  siblings?: string | undefined;
12
12
  }) => {
13
+ add: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
14
+ addChild: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
15
+ down: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
16
+ left: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
17
+ remove: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
18
+ right: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
19
+ up: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
13
20
  kvNodes: import("vue").ComputedRef<{
14
21
  [k: string]: unObject;
15
22
  }>;
package/dist/index.js CHANGED
@@ -1,6 +1,14 @@
1
1
  import { generateSlug } from "random-word-slugs";
2
2
  import { computed, toRef } from "vue";
3
- const configurable = true, getItems = (siblings, parent) => [...siblings].reverse().map((node) => ({ node, parent, siblings }));
3
+ const actionNames = [
4
+ "add",
5
+ "addChild",
6
+ "down",
7
+ "left",
8
+ "remove",
9
+ "right",
10
+ "up",
11
+ ], configurable = true, getItems = (siblings, parent) => [...siblings].reverse().map((node) => ({ node, parent, siblings }));
4
12
  export default (tree, { branch: keyBranch = "branch", children: keyChildren = "children", id: keyId = "id", index: keyIndex = "index", next: keyNext = "next", parent: keyParent = "parent", prev: keyPrev = "prev", siblings: keySiblings = "siblings", } = {}) => {
5
13
  const properties = {
6
14
  [keyBranch]: {
@@ -110,6 +118,6 @@ export default (tree, { branch: keyBranch = "branch", children: keyChildren = "c
110
118
  return {
111
119
  kvNodes,
112
120
  nodes,
113
- ...Object.fromEntries(["add", "addChild", "down", "left", "remove", "right", "up"].map((key) => [key, (pId) => run(pId, key)])),
121
+ ...Object.fromEntries(actionNames.map((key) => [key, (pId) => run(pId, key)])),
114
122
  };
115
123
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package",
3
3
  "name": "@skaldapp/flat-json-tree",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "description": "A Vue 3 composable that transforms JSON tree objects into flat arrays for easy manipulation with standard array operations while maintaining tree structure through computed properties",
6
6
  "keywords": [
7
7
  "vue",