@react-stately/tree 3.8.8 → 3.8.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAiDX,CAAC,CAAC,OAAO,QAAQ,CAAC,
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAiDX,CAAC,CAAC,OAAO,QAAQ,CAAC,GAA8B;QAC9C,OAAO,IAAI,CAAC,QAAQ;IACtB;IAEA,IAAI,OAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,UAAiC;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,aAAa,GAAQ,EAAc;QACjC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;YACb;QAAd,OAAO,OAAO,CAAA,gBAAA,KAAK,OAAO,cAAZ,2BAAA,gBAAgB,OAAO;IACvC;IAEA,YAAY,GAAQ,EAAc;QAChC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;YACb;QAAd,OAAO,OAAO,CAAA,gBAAA,KAAK,OAAO,cAAZ,2BAAA,gBAAgB,OAAO;IACvC;IAEA,cAA0B;QACxB,OAAO,IAAI,CAAC,QAAQ;IACtB;IAEA,aAAyB;QACvB,OAAO,IAAI,CAAC,OAAO;IACrB;IAEA,QAAQ,GAAQ,EAAkB;YACzB;QAAP,OAAO,CAAA,mBAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAhB,8BAAA,mBAAwB;IACjC;IAEA,GAAG,GAAW,EAAkB;QAC9B,MAAM,OAAO;eAAI,IAAI,CAAC,OAAO;SAAG;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;IAC/B;IAhFA,YAAY,KAAwB,EAAE,gBAAC,YAAY,EAA4B,GAAG,CAAC,CAAC,CAAE;aAL9E,SAA4B,IAAI;aAEhC,WAAuB;aACvB,UAAsB;QAG5B,IAAI,CAAC,QAAQ,GAAG;QAChB,eAAe,gBAAgB,IAAI;QAEnC,IAAI,QAAQ,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;YAE1B,IAAI,KAAK,UAAU,IAAK,CAAA,KAAK,IAAI,KAAK,aAAa,aAAa,GAAG,CAAC,KAAK,GAAG,CAAA,GAC1E,KAAK,IAAI,SAAS,KAAK,UAAU,CAC/B,MAAM;QAGZ;QAEA,KAAK,IAAI,QAAQ,MACf,MAAM;QAGR,IAAI,OAAuB;QAC3B,IAAI,QAAQ;QACZ,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,CAAE;YACnC,IAAI,MAAM;gBACR,KAAK,OAAO,GAAG;gBACf,KAAK,OAAO,GAAG,KAAK,GAAG;YACzB,OAAO;gBACL,IAAI,CAAC,QAAQ,GAAG;gBAChB,KAAK,OAAO,GAAG;YACjB;YAEA,IAAI,KAAK,IAAI,KAAK,QAChB,KAAK,KAAK,GAAG;YAGf,OAAO;YAEP,6DAA6D;YAC7D,iFAAiF;YACjF,KAAK,OAAO,GAAG;QACjB;YAEe;QAAf,IAAI,CAAC,OAAO,GAAG,CAAA,YAAA,iBAAA,2BAAA,KAAM,GAAG,cAAT,uBAAA,YAAa;IAC9B;AAwCF","sources":["packages/@react-stately/tree/src/TreeCollection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key, Node} from '@react-types/shared';\n\nexport class TreeCollection<T> implements Collection<Node<T>> {\n private keyMap: Map<Key, Node<T>> = new Map();\n private iterable: Iterable<Node<T>>;\n private firstKey: Key | null = null;\n private lastKey: Key | null = null;\n\n constructor(nodes: Iterable<Node<T>>, {expandedKeys}: {expandedKeys?: Set<Key>} = {}) {\n this.iterable = nodes;\n expandedKeys = expandedKeys || new Set();\n\n let visit = (node: Node<T>) => {\n this.keyMap.set(node.key, node);\n\n if (node.childNodes && (node.type === 'section' || expandedKeys.has(node.key))) {\n for (let child of node.childNodes) {\n visit(child);\n }\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let last: Node<T> | null = null;\n let index = 0;\n for (let [key, node] of this.keyMap) {\n if (last) {\n last.nextKey = key;\n node.prevKey = last.key;\n } else {\n this.firstKey = key;\n node.prevKey = undefined;\n }\n\n if (node.type === 'item') {\n node.index = index++;\n }\n\n last = node;\n\n // Set nextKey as undefined since this might be the last node\n // If it isn't the last node, last.nextKey will properly set at start of new loop\n last.nextKey = undefined;\n }\n\n this.lastKey = last?.key ?? null;\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n yield* this.iterable;\n }\n\n get size(): number {\n return this.keyMap.size;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.prevKey ?? null : null;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.nextKey ?? null : null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n return this.lastKey;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number): Node<T> | null {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n}\n"],"names":[],"version":3,"file":"TreeCollection.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-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AQ,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;YAE1B,IAAI,KAAK,UAAU,IAAK,CAAA,KAAK,IAAI,KAAK,aAAa,aAAa,GAAG,CAAC,KAAK,GAAG,CAAA,GAC1E,KAAK,IAAI,SAAS,KAAK,UAAU,CAC/B,MAAM;QAGZ;QAEA,KAAK,IAAI,QAAQ,MACf,MAAM;QAGR,IAAI,OAAuB;QAC3B,IAAI,QAAQ;QACZ,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,CAAE;YACnC,IAAI,MAAM;gBACR,KAAK,OAAO,GAAG;gBACf,KAAK,OAAO,GAAG,KAAK,GAAG;YACzB,OAAO;gBACL,IAAI,CAAC,QAAQ,GAAG;gBAChB,KAAK,OAAO,GAAG;YACjB;YAEA,IAAI,KAAK,IAAI,KAAK,QAChB,KAAK,KAAK,GAAG;YAGf,OAAO;YAEP,6DAA6D;YAC7D,iFAAiF;YACjF,KAAK,OAAO,GAAG;QACjB;YAEe;QAAf,IAAI,CAAC,OAAO,GAAG,CAAA,YAAA,iBAAA,2BAAA,KAAM,GAAG,cAAT,uBAAA,YAAa;IAC9B;AAwCF","sources":["packages/@react-stately/tree/src/TreeCollection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key, Node} from '@react-types/shared';\n\nexport class TreeCollection<T> implements Collection<Node<T>> {\n private keyMap: Map<Key, Node<T>> = new Map();\n private iterable: Iterable<Node<T>>;\n private firstKey: Key | null = null;\n private lastKey: Key | null = null;\n\n constructor(nodes: Iterable<Node<T>>, {expandedKeys}: {expandedKeys?: Set<Key>} = {}) {\n this.iterable = nodes;\n expandedKeys = expandedKeys || new Set();\n\n let visit = (node: Node<T>) => {\n this.keyMap.set(node.key, node);\n\n if (node.childNodes && (node.type === 'section' || expandedKeys.has(node.key))) {\n for (let child of node.childNodes) {\n visit(child);\n }\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let last: Node<T> | null = null;\n let index = 0;\n for (let [key, node] of this.keyMap) {\n if (last) {\n last.nextKey = key;\n node.prevKey = last.key;\n } else {\n this.firstKey = key;\n node.prevKey = undefined;\n }\n\n if (node.type === 'item') {\n node.index = index++;\n }\n\n last = node;\n\n // Set nextKey as undefined since this might be the last node\n // If it isn't the last node, last.nextKey will properly set at start of new loop\n last.nextKey = undefined;\n }\n\n this.lastKey = last?.key ?? null;\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n yield* this.iterable;\n }\n\n get size(): number {\n return this.keyMap.size;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.prevKey ?? null : null;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n return node ? node.nextKey ?? null : null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n return this.lastKey;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number): Node<T> | null {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n}\n"],"names":[],"version":3,"file":"TreeCollection.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export class TreeCollection<T> implements Collection<Node<T>> {
|
|
|
4
4
|
constructor(nodes: Iterable<Node<T>>, { expandedKeys }?: {
|
|
5
5
|
expandedKeys?: Set<Key>;
|
|
6
6
|
});
|
|
7
|
-
[Symbol.iterator]():
|
|
7
|
+
[Symbol.iterator](): IterableIterator<Node<T>>;
|
|
8
8
|
get size(): number;
|
|
9
9
|
getKeys(): IterableIterator<Key>;
|
|
10
10
|
getKeyBefore(key: Key): Key | null;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAcA,4BAA4B,CAAC,CAAE,YAAW,WAAW,KAAK,CAAC,CAAC,CAAC;gBAM/C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAC,YAAY,EAAC,GAAE;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;KAAM;IA2CnF,CAAC,MAAM,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"mappings":";;AAcA,4BAA4B,CAAC,CAAE,YAAW,WAAW,KAAK,CAAC,CAAC,CAAC;gBAM/C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAC,YAAY,EAAC,GAAE;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;KAAM;IA2CnF,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAI/C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,IAAI,gBAAgB,CAAC,GAAG,CAAC;IAIhC,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI;IAKlC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI;IAKjC,WAAW,IAAI,GAAG,GAAG,IAAI;IAIzB,UAAU,IAAI,GAAG,GAAG,IAAI;IAIxB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI;IAIjC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI;CAIhC;AClFD,2BAA2B,CAAC,CAAE,SAAQ,oBAAoB,CAAC,CAAC,EAAE,UAAU,EAAE,iBAAiB;IACzF,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AACD,2BAA2B,CAAC;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC;IAEzC,iDAAiD;IACjD,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhC,iDAAiD;IACjD,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhC,yDAAyD;IACzD,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAE1B,yCAAyC;IACzC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAEtC,uEAAuE;IACvE,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;CAC5C;AAED;;;GAGG;AACH,6BAA6B,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAsChF","sources":["packages/@react-stately/tree/src/packages/@react-stately/tree/src/TreeCollection.ts","packages/@react-stately/tree/src/packages/@react-stately/tree/src/useTreeState.ts","packages/@react-stately/tree/src/packages/@react-stately/tree/src/index.ts","packages/@react-stately/tree/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {TreeProps, TreeState} from './useTreeState';\nexport {useTreeState} from './useTreeState';\nexport {TreeCollection} from './TreeCollection';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/tree",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.10",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-stately/collections": "^3.12.
|
|
26
|
-
"@react-stately/selection": "^3.20.
|
|
27
|
-
"@react-stately/utils": "^3.10.
|
|
28
|
-
"@react-types/shared": "^3.
|
|
25
|
+
"@react-stately/collections": "^3.12.4",
|
|
26
|
+
"@react-stately/selection": "^3.20.2",
|
|
27
|
+
"@react-stately/utils": "^3.10.6",
|
|
28
|
+
"@react-types/shared": "^3.29.1",
|
|
29
29
|
"@swc/helpers": "^0.5.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "9c77d4e8267ed39469c65f65da94ece7be509874"
|
|
38
38
|
}
|
package/src/TreeCollection.ts
CHANGED
|
@@ -61,41 +61,41 @@ export class TreeCollection<T> implements Collection<Node<T>> {
|
|
|
61
61
|
this.lastKey = last?.key ?? null;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
*[Symbol.iterator]() {
|
|
64
|
+
*[Symbol.iterator](): IterableIterator<Node<T>> {
|
|
65
65
|
yield* this.iterable;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
get size() {
|
|
68
|
+
get size(): number {
|
|
69
69
|
return this.keyMap.size;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
getKeys() {
|
|
72
|
+
getKeys(): IterableIterator<Key> {
|
|
73
73
|
return this.keyMap.keys();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
getKeyBefore(key: Key) {
|
|
76
|
+
getKeyBefore(key: Key): Key | null {
|
|
77
77
|
let node = this.keyMap.get(key);
|
|
78
78
|
return node ? node.prevKey ?? null : null;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
getKeyAfter(key: Key) {
|
|
81
|
+
getKeyAfter(key: Key): Key | null {
|
|
82
82
|
let node = this.keyMap.get(key);
|
|
83
83
|
return node ? node.nextKey ?? null : null;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
getFirstKey() {
|
|
86
|
+
getFirstKey(): Key | null {
|
|
87
87
|
return this.firstKey;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
getLastKey() {
|
|
90
|
+
getLastKey(): Key | null {
|
|
91
91
|
return this.lastKey;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
getItem(key: Key) {
|
|
94
|
+
getItem(key: Key): Node<T> | null {
|
|
95
95
|
return this.keyMap.get(key) ?? null;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
at(idx: number) {
|
|
98
|
+
at(idx: number): Node<T> | null {
|
|
99
99
|
const keys = [...this.getKeys()];
|
|
100
100
|
return this.getItem(keys[idx]);
|
|
101
101
|
}
|