@react-aria/collections 3.0.3 → 3.1.0
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/import.mjs +7 -5
- package/dist/main.js +20 -18
- package/dist/main.js.map +1 -1
- package/dist/module.js +7 -5
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +8 -0
- package/package.json +14 -15
- package/src/index.ts +8 -7
- package/dist/BaseCollection.main.js +0 -271
- package/dist/BaseCollection.main.js.map +0 -1
- package/dist/BaseCollection.mjs +0 -260
- package/dist/BaseCollection.module.js +0 -260
- package/dist/BaseCollection.module.js.map +0 -1
- package/dist/CollectionBuilder.main.js +0 -242
- package/dist/CollectionBuilder.main.js.map +0 -1
- package/dist/CollectionBuilder.mjs +0 -230
- package/dist/CollectionBuilder.module.js +0 -230
- package/dist/CollectionBuilder.module.js.map +0 -1
- package/dist/Document.main.js +0 -369
- package/dist/Document.main.js.map +0 -1
- package/dist/Document.mjs +0 -364
- package/dist/Document.module.js +0 -364
- package/dist/Document.module.js.map +0 -1
- package/dist/Hidden.main.js +0 -90
- package/dist/Hidden.main.js.map +0 -1
- package/dist/Hidden.mjs +0 -79
- package/dist/Hidden.module.js +0 -79
- package/dist/Hidden.module.js.map +0 -1
- package/dist/types.d.ts +0 -119
- package/dist/types.d.ts.map +0 -1
- package/dist/useCachedChildren.main.js +0 -61
- package/dist/useCachedChildren.main.js.map +0 -1
- package/dist/useCachedChildren.mjs +0 -56
- package/dist/useCachedChildren.module.js +0 -56
- package/dist/useCachedChildren.module.js.map +0 -1
- package/src/BaseCollection.ts +0 -353
- package/src/CollectionBuilder.tsx +0 -265
- package/src/Document.ts +0 -569
- package/src/Hidden.tsx +0 -97
- package/src/useCachedChildren.ts +0 -70
package/dist/import.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {CollectionBuilder as $7002825fa533f066$re_export$CollectionBuilder, createLeafComponent as $7002825fa533f066$re_export$createLeafComponent, createBranchComponent as $7002825fa533f066$re_export$createBranchComponent} from "react-aria/CollectionBuilder";
|
|
2
|
+
import {Collection as $7002825fa533f066$re_export$Collection} from "react-aria/Collection";
|
|
3
|
+
import {createHideableComponent as $7002825fa533f066$re_export$createHideableComponent, useIsHidden as $7002825fa533f066$re_export$useIsHidden} from "react-aria/private/collections/Hidden";
|
|
4
|
+
import {useCachedChildren as $7002825fa533f066$re_export$useCachedChildren} from "react-aria/private/collections/useCachedChildren";
|
|
5
|
+
import {BaseCollection as $7002825fa533f066$re_export$BaseCollection, CollectionNode as $7002825fa533f066$re_export$CollectionNode, ItemNode as $7002825fa533f066$re_export$ItemNode, SectionNode as $7002825fa533f066$re_export$SectionNode, FilterableNode as $7002825fa533f066$re_export$FilterableNode, LoaderNode as $7002825fa533f066$re_export$LoaderNode, HeaderNode as $7002825fa533f066$re_export$HeaderNode} from "react-aria/private/collections/BaseCollection";
|
|
5
6
|
|
|
6
7
|
/*
|
|
7
8
|
* Copyright 2024 Adobe. All rights reserved.
|
|
@@ -19,5 +20,6 @@ import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionN
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
export {$7002825fa533f066$re_export$CollectionBuilder as CollectionBuilder, $7002825fa533f066$re_export$createLeafComponent as createLeafComponent, $7002825fa533f066$re_export$createBranchComponent as createBranchComponent, $7002825fa533f066$re_export$Collection as Collection, $7002825fa533f066$re_export$createHideableComponent as createHideableComponent, $7002825fa533f066$re_export$useIsHidden as useIsHidden, $7002825fa533f066$re_export$useCachedChildren as useCachedChildren, $7002825fa533f066$re_export$BaseCollection as BaseCollection, $7002825fa533f066$re_export$CollectionNode as CollectionNode, $7002825fa533f066$re_export$ItemNode as ItemNode, $7002825fa533f066$re_export$SectionNode as SectionNode, $7002825fa533f066$re_export$FilterableNode as FilterableNode, $7002825fa533f066$re_export$LoaderNode as LoaderNode, $7002825fa533f066$re_export$HeaderNode as HeaderNode};
|
|
23
25
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
1
|
+
var $dS9xC$reactariaCollectionBuilder = require("react-aria/CollectionBuilder");
|
|
2
|
+
var $dS9xC$reactariaCollection = require("react-aria/Collection");
|
|
3
|
+
var $dS9xC$reactariaprivatecollectionsHidden = require("react-aria/private/collections/Hidden");
|
|
4
|
+
var $dS9xC$reactariaprivatecollectionsuseCachedChildren = require("react-aria/private/collections/useCachedChildren");
|
|
5
|
+
var $dS9xC$reactariaprivatecollectionsBaseCollection = require("react-aria/private/collections/BaseCollection");
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
function $parcel$export(e, n, v, s) {
|
|
8
9
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
$parcel$export(module.exports, "CollectionBuilder", ()
|
|
12
|
-
$parcel$export(module.exports, "
|
|
13
|
-
$parcel$export(module.exports, "
|
|
14
|
-
$parcel$export(module.exports, "
|
|
15
|
-
$parcel$export(module.exports, "createHideableComponent", ()
|
|
16
|
-
$parcel$export(module.exports, "useIsHidden", ()
|
|
17
|
-
$parcel$export(module.exports, "useCachedChildren", ()
|
|
18
|
-
$parcel$export(module.exports, "BaseCollection", ()
|
|
19
|
-
$parcel$export(module.exports, "CollectionNode", ()
|
|
20
|
-
$parcel$export(module.exports, "ItemNode", ()
|
|
21
|
-
$parcel$export(module.exports, "SectionNode", ()
|
|
22
|
-
$parcel$export(module.exports, "FilterableNode", ()
|
|
23
|
-
$parcel$export(module.exports, "LoaderNode", ()
|
|
24
|
-
$parcel$export(module.exports, "HeaderNode", ()
|
|
12
|
+
$parcel$export(module.exports, "CollectionBuilder", function () { return $dS9xC$reactariaCollectionBuilder.CollectionBuilder; });
|
|
13
|
+
$parcel$export(module.exports, "createLeafComponent", function () { return $dS9xC$reactariaCollectionBuilder.createLeafComponent; });
|
|
14
|
+
$parcel$export(module.exports, "createBranchComponent", function () { return $dS9xC$reactariaCollectionBuilder.createBranchComponent; });
|
|
15
|
+
$parcel$export(module.exports, "Collection", function () { return $dS9xC$reactariaCollection.Collection; });
|
|
16
|
+
$parcel$export(module.exports, "createHideableComponent", function () { return $dS9xC$reactariaprivatecollectionsHidden.createHideableComponent; });
|
|
17
|
+
$parcel$export(module.exports, "useIsHidden", function () { return $dS9xC$reactariaprivatecollectionsHidden.useIsHidden; });
|
|
18
|
+
$parcel$export(module.exports, "useCachedChildren", function () { return $dS9xC$reactariaprivatecollectionsuseCachedChildren.useCachedChildren; });
|
|
19
|
+
$parcel$export(module.exports, "BaseCollection", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.BaseCollection; });
|
|
20
|
+
$parcel$export(module.exports, "CollectionNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.CollectionNode; });
|
|
21
|
+
$parcel$export(module.exports, "ItemNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.ItemNode; });
|
|
22
|
+
$parcel$export(module.exports, "SectionNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.SectionNode; });
|
|
23
|
+
$parcel$export(module.exports, "FilterableNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.FilterableNode; });
|
|
24
|
+
$parcel$export(module.exports, "LoaderNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.LoaderNode; });
|
|
25
|
+
$parcel$export(module.exports, "HeaderNode", function () { return $dS9xC$reactariaprivatecollectionsBaseCollection.HeaderNode; });
|
|
25
26
|
/*
|
|
26
27
|
* Copyright 2024 Adobe. All rights reserved.
|
|
27
28
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -38,4 +39,5 @@ $parcel$export(module.exports, "HeaderNode", () => $499e2959ba1abacc$exports.Hea
|
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
|
|
41
43
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/collections/src/index.ts"],"sourcesContent":["/*\n * Copyright 2024 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\nexport {CollectionBuilder, createLeafComponent, createBranchComponent} from 'react-aria/CollectionBuilder';\nexport {Collection} from 'react-aria/Collection';\nexport {createHideableComponent, useIsHidden} from 'react-aria/private/collections/Hidden';\nexport {useCachedChildren} from 'react-aria/private/collections/useCachedChildren';\nexport {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from 'react-aria/private/collections/BaseCollection';\nexport type {CollectionProps} from 'react-aria/Collection';\nexport type {CollectionBuilderProps} from 'react-aria/CollectionBuilder';\nexport type {CachedChildrenOptions} from 'react-aria/private/collections/useCachedChildren';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import {CollectionBuilder as $7002825fa533f066$re_export$CollectionBuilder, createLeafComponent as $7002825fa533f066$re_export$createLeafComponent, createBranchComponent as $7002825fa533f066$re_export$createBranchComponent} from "react-aria/CollectionBuilder";
|
|
2
|
+
import {Collection as $7002825fa533f066$re_export$Collection} from "react-aria/Collection";
|
|
3
|
+
import {createHideableComponent as $7002825fa533f066$re_export$createHideableComponent, useIsHidden as $7002825fa533f066$re_export$useIsHidden} from "react-aria/private/collections/Hidden";
|
|
4
|
+
import {useCachedChildren as $7002825fa533f066$re_export$useCachedChildren} from "react-aria/private/collections/useCachedChildren";
|
|
5
|
+
import {BaseCollection as $7002825fa533f066$re_export$BaseCollection, CollectionNode as $7002825fa533f066$re_export$CollectionNode, ItemNode as $7002825fa533f066$re_export$ItemNode, SectionNode as $7002825fa533f066$re_export$SectionNode, FilterableNode as $7002825fa533f066$re_export$FilterableNode, LoaderNode as $7002825fa533f066$re_export$LoaderNode, HeaderNode as $7002825fa533f066$re_export$HeaderNode} from "react-aria/private/collections/BaseCollection";
|
|
5
6
|
|
|
6
7
|
/*
|
|
7
8
|
* Copyright 2024 Adobe. All rights reserved.
|
|
@@ -19,5 +20,6 @@ import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionN
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
export {$7002825fa533f066$re_export$CollectionBuilder as CollectionBuilder, $7002825fa533f066$re_export$createLeafComponent as createLeafComponent, $7002825fa533f066$re_export$createBranchComponent as createBranchComponent, $7002825fa533f066$re_export$Collection as Collection, $7002825fa533f066$re_export$createHideableComponent as createHideableComponent, $7002825fa533f066$re_export$useIsHidden as useIsHidden, $7002825fa533f066$re_export$useCachedChildren as useCachedChildren, $7002825fa533f066$re_export$BaseCollection as BaseCollection, $7002825fa533f066$re_export$CollectionNode as CollectionNode, $7002825fa533f066$re_export$ItemNode as ItemNode, $7002825fa533f066$re_export$SectionNode as SectionNode, $7002825fa533f066$re_export$FilterableNode as FilterableNode, $7002825fa533f066$re_export$LoaderNode as LoaderNode, $7002825fa533f066$re_export$HeaderNode as HeaderNode};
|
|
23
25
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/collections/src/index.ts"],"sourcesContent":["/*\n * Copyright 2024 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\nexport {CollectionBuilder, createLeafComponent, createBranchComponent} from 'react-aria/CollectionBuilder';\nexport {Collection} from 'react-aria/Collection';\nexport {createHideableComponent, useIsHidden} from 'react-aria/private/collections/Hidden';\nexport {useCachedChildren} from 'react-aria/private/collections/useCachedChildren';\nexport {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from 'react-aria/private/collections/BaseCollection';\nexport type {CollectionProps} from 'react-aria/Collection';\nexport type {CollectionBuilderProps} from 'react-aria/CollectionBuilder';\nexport type {CachedChildrenOptions} from 'react-aria/private/collections/useCachedChildren';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CollectionBuilder, createLeafComponent, createBranchComponent } from 'react-aria/CollectionBuilder';
|
|
2
|
+
export { Collection } from 'react-aria/Collection';
|
|
3
|
+
export { createHideableComponent, useIsHidden } from 'react-aria/private/collections/Hidden';
|
|
4
|
+
export { useCachedChildren } from 'react-aria/private/collections/useCachedChildren';
|
|
5
|
+
export { BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode } from 'react-aria/private/collections/BaseCollection';
|
|
6
|
+
export type { CollectionProps } from 'react-aria/Collection';
|
|
7
|
+
export type { CollectionBuilderProps } from 'react-aria/CollectionBuilder';
|
|
8
|
+
export type { CachedChildrenOptions } from 'react-aria/private/collections/useCachedChildren';
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/collections",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
-
"types": "dist/types.d.ts",
|
|
8
|
+
"types": "dist/types/src/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"./dist/types.d.ts",
|
|
13
|
-
"./
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./dist/types/src/index.d.ts",
|
|
13
|
+
"import": "./dist/import.mjs",
|
|
14
|
+
"require": "./dist/main.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
@@ -26,12 +26,8 @@
|
|
|
26
26
|
"url": "https://github.com/adobe/react-spectrum"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@react-aria/interactions": "^3.27.1",
|
|
30
|
-
"@react-aria/ssr": "^3.9.10",
|
|
31
|
-
"@react-aria/utils": "^3.33.1",
|
|
32
|
-
"@react-types/shared": "^3.33.1",
|
|
33
29
|
"@swc/helpers": "^0.5.0",
|
|
34
|
-
"
|
|
30
|
+
"react-aria": "3.48.0"
|
|
35
31
|
},
|
|
36
32
|
"peerDependencies": {
|
|
37
33
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -40,5 +36,8 @@
|
|
|
40
36
|
"publishConfig": {
|
|
41
37
|
"access": "public"
|
|
42
38
|
},
|
|
43
|
-
"
|
|
39
|
+
"targets": {
|
|
40
|
+
"types": false
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
44
43
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export {CollectionBuilder,
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
export type {
|
|
19
|
-
export type {
|
|
13
|
+
export {CollectionBuilder, createLeafComponent, createBranchComponent} from 'react-aria/CollectionBuilder';
|
|
14
|
+
export {Collection} from 'react-aria/Collection';
|
|
15
|
+
export {createHideableComponent, useIsHidden} from 'react-aria/private/collections/Hidden';
|
|
16
|
+
export {useCachedChildren} from 'react-aria/private/collections/useCachedChildren';
|
|
17
|
+
export {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from 'react-aria/private/collections/BaseCollection';
|
|
18
|
+
export type {CollectionProps} from 'react-aria/Collection';
|
|
19
|
+
export type {CollectionBuilderProps} from 'react-aria/CollectionBuilder';
|
|
20
|
+
export type {CachedChildrenOptions} from 'react-aria/private/collections/useCachedChildren';
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function $parcel$export(e, n, v, s) {
|
|
3
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
$parcel$export(module.exports, "CollectionNode", () => $499e2959ba1abacc$export$d68d59712b04d9d1);
|
|
7
|
-
$parcel$export(module.exports, "FilterableNode", () => $499e2959ba1abacc$export$b1918e978f1ee46f);
|
|
8
|
-
$parcel$export(module.exports, "HeaderNode", () => $499e2959ba1abacc$export$5ae2504e948afce5);
|
|
9
|
-
$parcel$export(module.exports, "LoaderNode", () => $499e2959ba1abacc$export$8258a0665a675899);
|
|
10
|
-
$parcel$export(module.exports, "ItemNode", () => $499e2959ba1abacc$export$fd11f34e1d07f134);
|
|
11
|
-
$parcel$export(module.exports, "SectionNode", () => $499e2959ba1abacc$export$437f11dc9b403b78);
|
|
12
|
-
$parcel$export(module.exports, "BaseCollection", () => $499e2959ba1abacc$export$408d25a4e12db025);
|
|
13
|
-
/*
|
|
14
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
15
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
-
* governing permissions and limitations under the License.
|
|
23
|
-
*/ class $499e2959ba1abacc$export$d68d59712b04d9d1 {
|
|
24
|
-
get childNodes() {
|
|
25
|
-
throw new Error('childNodes is not supported');
|
|
26
|
-
}
|
|
27
|
-
clone() {
|
|
28
|
-
let node = new this.constructor(this.key);
|
|
29
|
-
node.value = this.value;
|
|
30
|
-
node.level = this.level;
|
|
31
|
-
node.hasChildNodes = this.hasChildNodes;
|
|
32
|
-
node.rendered = this.rendered;
|
|
33
|
-
node.textValue = this.textValue;
|
|
34
|
-
node['aria-label'] = this['aria-label'];
|
|
35
|
-
node.index = this.index;
|
|
36
|
-
node.parentKey = this.parentKey;
|
|
37
|
-
node.prevKey = this.prevKey;
|
|
38
|
-
node.nextKey = this.nextKey;
|
|
39
|
-
node.firstChildKey = this.firstChildKey;
|
|
40
|
-
node.lastChildKey = this.lastChildKey;
|
|
41
|
-
node.props = this.props;
|
|
42
|
-
node.render = this.render;
|
|
43
|
-
node.colSpan = this.colSpan;
|
|
44
|
-
node.colIndex = this.colIndex;
|
|
45
|
-
return node;
|
|
46
|
-
}
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
|
-
filter(collection, newCollection, filterFn) {
|
|
49
|
-
let clone = this.clone();
|
|
50
|
-
newCollection.addDescendants(clone, collection);
|
|
51
|
-
return clone;
|
|
52
|
-
}
|
|
53
|
-
constructor(key){
|
|
54
|
-
this.value = null;
|
|
55
|
-
this.level = 0;
|
|
56
|
-
this.hasChildNodes = false;
|
|
57
|
-
this.rendered = null;
|
|
58
|
-
this.textValue = '';
|
|
59
|
-
this['aria-label'] = undefined;
|
|
60
|
-
this.index = 0;
|
|
61
|
-
this.parentKey = null;
|
|
62
|
-
this.prevKey = null;
|
|
63
|
-
this.nextKey = null;
|
|
64
|
-
this.firstChildKey = null;
|
|
65
|
-
this.lastChildKey = null;
|
|
66
|
-
this.props = {};
|
|
67
|
-
this.colSpan = null;
|
|
68
|
-
this.colIndex = null;
|
|
69
|
-
this.type = this.constructor.type;
|
|
70
|
-
this.key = key;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
class $499e2959ba1abacc$export$b1918e978f1ee46f extends $499e2959ba1abacc$export$d68d59712b04d9d1 {
|
|
74
|
-
filter(collection, newCollection, filterFn) {
|
|
75
|
-
let [firstKey, lastKey] = $499e2959ba1abacc$var$filterChildren(collection, newCollection, this.firstChildKey, filterFn);
|
|
76
|
-
let newNode = this.clone();
|
|
77
|
-
newNode.firstChildKey = firstKey;
|
|
78
|
-
newNode.lastChildKey = lastKey;
|
|
79
|
-
return newNode;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
class $499e2959ba1abacc$export$5ae2504e948afce5 extends $499e2959ba1abacc$export$d68d59712b04d9d1 {
|
|
83
|
-
}
|
|
84
|
-
$499e2959ba1abacc$export$5ae2504e948afce5.type = 'header';
|
|
85
|
-
class $499e2959ba1abacc$export$8258a0665a675899 extends $499e2959ba1abacc$export$d68d59712b04d9d1 {
|
|
86
|
-
}
|
|
87
|
-
$499e2959ba1abacc$export$8258a0665a675899.type = 'loader';
|
|
88
|
-
class $499e2959ba1abacc$export$fd11f34e1d07f134 extends $499e2959ba1abacc$export$b1918e978f1ee46f {
|
|
89
|
-
filter(collection, newCollection, filterFn) {
|
|
90
|
-
if (filterFn(this.textValue, this)) {
|
|
91
|
-
let clone = this.clone();
|
|
92
|
-
newCollection.addDescendants(clone, collection);
|
|
93
|
-
return clone;
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
$499e2959ba1abacc$export$fd11f34e1d07f134.type = 'item';
|
|
99
|
-
class $499e2959ba1abacc$export$437f11dc9b403b78 extends $499e2959ba1abacc$export$b1918e978f1ee46f {
|
|
100
|
-
filter(collection, newCollection, filterFn) {
|
|
101
|
-
let filteredSection = super.filter(collection, newCollection, filterFn);
|
|
102
|
-
if (filteredSection) {
|
|
103
|
-
if (filteredSection.lastChildKey !== null) {
|
|
104
|
-
let lastChild = collection.getItem(filteredSection.lastChildKey);
|
|
105
|
-
if (lastChild && lastChild.type !== 'header') return filteredSection;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
$499e2959ba1abacc$export$437f11dc9b403b78.type = 'section';
|
|
112
|
-
class $499e2959ba1abacc$export$408d25a4e12db025 {
|
|
113
|
-
get size() {
|
|
114
|
-
return this.itemCount;
|
|
115
|
-
}
|
|
116
|
-
getKeys() {
|
|
117
|
-
return this.keyMap.keys();
|
|
118
|
-
}
|
|
119
|
-
*[Symbol.iterator]() {
|
|
120
|
-
let node = this.firstKey != null ? this.keyMap.get(this.firstKey) : undefined;
|
|
121
|
-
while(node){
|
|
122
|
-
yield node;
|
|
123
|
-
node = node.nextKey != null ? this.keyMap.get(node.nextKey) : undefined;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
getChildren(key) {
|
|
127
|
-
let keyMap = this.keyMap;
|
|
128
|
-
return {
|
|
129
|
-
*[Symbol.iterator] () {
|
|
130
|
-
let parent = keyMap.get(key);
|
|
131
|
-
let node = (parent === null || parent === void 0 ? void 0 : parent.firstChildKey) != null ? keyMap.get(parent.firstChildKey) : null;
|
|
132
|
-
while(node){
|
|
133
|
-
yield node;
|
|
134
|
-
node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
getKeyBefore(key) {
|
|
140
|
-
let node = this.keyMap.get(key);
|
|
141
|
-
if (!node) return null;
|
|
142
|
-
if (node.prevKey != null) {
|
|
143
|
-
node = this.keyMap.get(node.prevKey);
|
|
144
|
-
while(node && node.type !== 'item' && node.lastChildKey != null)node = this.keyMap.get(node.lastChildKey);
|
|
145
|
-
var _node_key;
|
|
146
|
-
return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
|
|
147
|
-
}
|
|
148
|
-
return node.parentKey;
|
|
149
|
-
}
|
|
150
|
-
getKeyAfter(key) {
|
|
151
|
-
let node = this.keyMap.get(key);
|
|
152
|
-
if (!node) return null;
|
|
153
|
-
if (node.type !== 'item' && node.firstChildKey != null) return node.firstChildKey;
|
|
154
|
-
while(node){
|
|
155
|
-
if (node.nextKey != null) return node.nextKey;
|
|
156
|
-
if (node.parentKey != null) node = this.keyMap.get(node.parentKey);
|
|
157
|
-
else return null;
|
|
158
|
-
}
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
getFirstKey() {
|
|
162
|
-
return this.firstKey;
|
|
163
|
-
}
|
|
164
|
-
getLastKey() {
|
|
165
|
-
let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null;
|
|
166
|
-
while((node === null || node === void 0 ? void 0 : node.lastChildKey) != null)node = this.keyMap.get(node.lastChildKey);
|
|
167
|
-
var _node_key;
|
|
168
|
-
return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
|
|
169
|
-
}
|
|
170
|
-
getItem(key) {
|
|
171
|
-
var _this_keyMap_get;
|
|
172
|
-
return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
|
|
173
|
-
}
|
|
174
|
-
at() {
|
|
175
|
-
throw new Error('Not implemented');
|
|
176
|
-
}
|
|
177
|
-
clone() {
|
|
178
|
-
// We need to clone using this.constructor so that subclasses have the right prototype.
|
|
179
|
-
// TypeScript isn't happy about this yet.
|
|
180
|
-
// https://github.com/microsoft/TypeScript/issues/3841
|
|
181
|
-
let Constructor = this.constructor;
|
|
182
|
-
let collection = new Constructor();
|
|
183
|
-
collection.keyMap = new Map(this.keyMap);
|
|
184
|
-
collection.firstKey = this.firstKey;
|
|
185
|
-
collection.lastKey = this.lastKey;
|
|
186
|
-
collection.itemCount = this.itemCount;
|
|
187
|
-
return collection;
|
|
188
|
-
}
|
|
189
|
-
addNode(node) {
|
|
190
|
-
if (this.frozen) throw new Error('Cannot add a node to a frozen collection');
|
|
191
|
-
if (node.type === 'item' && this.keyMap.get(node.key) == null) this.itemCount++;
|
|
192
|
-
this.keyMap.set(node.key, node);
|
|
193
|
-
}
|
|
194
|
-
// Deeply add a node and its children to the collection from another collection, primarily used when filtering a collection
|
|
195
|
-
addDescendants(node, oldCollection) {
|
|
196
|
-
this.addNode(node);
|
|
197
|
-
let children = oldCollection.getChildren(node.key);
|
|
198
|
-
for (let child of children)this.addDescendants(child, oldCollection);
|
|
199
|
-
}
|
|
200
|
-
removeNode(key) {
|
|
201
|
-
if (this.frozen) throw new Error('Cannot remove a node to a frozen collection');
|
|
202
|
-
let node = this.keyMap.get(key);
|
|
203
|
-
if (node != null && node.type === 'item') this.itemCount--;
|
|
204
|
-
this.keyMap.delete(key);
|
|
205
|
-
}
|
|
206
|
-
commit(firstKey, lastKey, isSSR = false) {
|
|
207
|
-
if (this.frozen) throw new Error('Cannot commit a frozen collection');
|
|
208
|
-
this.firstKey = firstKey;
|
|
209
|
-
this.lastKey = lastKey;
|
|
210
|
-
this.frozen = !isSSR;
|
|
211
|
-
}
|
|
212
|
-
filter(filterFn) {
|
|
213
|
-
let newCollection = new this.constructor();
|
|
214
|
-
let [firstKey, lastKey] = $499e2959ba1abacc$var$filterChildren(this, newCollection, this.firstKey, filterFn);
|
|
215
|
-
newCollection === null || newCollection === void 0 ? void 0 : newCollection.commit(firstKey, lastKey);
|
|
216
|
-
return newCollection;
|
|
217
|
-
}
|
|
218
|
-
constructor(){
|
|
219
|
-
this.keyMap = new Map();
|
|
220
|
-
this.firstKey = null;
|
|
221
|
-
this.lastKey = null;
|
|
222
|
-
this.frozen = false;
|
|
223
|
-
this.itemCount = 0;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function $499e2959ba1abacc$var$filterChildren(collection, newCollection, firstChildKey, filterFn) {
|
|
227
|
-
// loop over the siblings for firstChildKey
|
|
228
|
-
// create new nodes based on calling node.filter for each child
|
|
229
|
-
// if it returns null then don't include it, otherwise update its prev/next keys
|
|
230
|
-
// add them to the newCollection
|
|
231
|
-
if (firstChildKey == null) return [
|
|
232
|
-
null,
|
|
233
|
-
null
|
|
234
|
-
];
|
|
235
|
-
let firstNode = null;
|
|
236
|
-
let lastNode = null;
|
|
237
|
-
let currentNode = collection.getItem(firstChildKey);
|
|
238
|
-
while(currentNode != null){
|
|
239
|
-
let newNode = currentNode.filter(collection, newCollection, filterFn);
|
|
240
|
-
if (newNode != null) {
|
|
241
|
-
newNode.nextKey = null;
|
|
242
|
-
if (lastNode) {
|
|
243
|
-
newNode.prevKey = lastNode.key;
|
|
244
|
-
lastNode.nextKey = newNode.key;
|
|
245
|
-
}
|
|
246
|
-
if (firstNode == null) firstNode = newNode;
|
|
247
|
-
newCollection.addNode(newNode);
|
|
248
|
-
lastNode = newNode;
|
|
249
|
-
}
|
|
250
|
-
currentNode = currentNode.nextKey ? collection.getItem(currentNode.nextKey) : null;
|
|
251
|
-
}
|
|
252
|
-
// TODO: this is pretty specific to dividers but doesn't feel like there is a good way to get around it since we only can know
|
|
253
|
-
// to filter the last separator in a collection only after performing a filter for the rest of the contents after it
|
|
254
|
-
// Its gross that it needs to live here, might be nice if somehow we could have this live in the separator code
|
|
255
|
-
if (lastNode && lastNode.type === 'separator') {
|
|
256
|
-
let prevKey = lastNode.prevKey;
|
|
257
|
-
newCollection.removeNode(lastNode.key);
|
|
258
|
-
if (prevKey) {
|
|
259
|
-
lastNode = newCollection.getItem(prevKey);
|
|
260
|
-
lastNode.nextKey = null;
|
|
261
|
-
} else lastNode = null;
|
|
262
|
-
}
|
|
263
|
-
var _firstNode_key, _lastNode_key;
|
|
264
|
-
return [
|
|
265
|
-
(_firstNode_key = firstNode === null || firstNode === void 0 ? void 0 : firstNode.key) !== null && _firstNode_key !== void 0 ? _firstNode_key : null,
|
|
266
|
-
(_lastNode_key = lastNode === null || lastNode === void 0 ? void 0 : lastNode.key) !== null && _lastNode_key !== void 0 ? _lastNode_key : null
|
|
267
|
-
];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
//# sourceMappingURL=BaseCollection.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAYM,MAAM;IA0BX,IAAI,aAAgC;QAClC,MAAM,IAAI,MAAM;IAClB;IAEA,QAAc;QACZ,IAAI,OAAsB,IAAK,IAAI,CAAC,WAAW,CAAS,IAAI,CAAC,GAAG;QAChE,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK;QACvB,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK;QACvB,KAAK,aAAa,GAAG,IAAI,CAAC,aAAa;QACvC,KAAK,QAAQ,GAAG,IAAI,CAAC,QAAQ;QAC7B,KAAK,SAAS,GAAG,IAAI,CAAC,SAAS;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa;Q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B,WAAW;QACb;QAEA,cAAc,YAAY,OAAO,GAAG,WAAW,OAAO,CAAC,YAAY,OAAO,IAAI;IAChF;IAEA,8HAA8H;IAC9H,oHAAoH;IACpH,+GAA+G;IAC/G,IAAI,YAAY,SAAS,IAAI,KAAK,aAAa;QAC7C,IAAI,UAAU,SAAS,OAAO;QAC9B,cAAc,UAAU,CAAC,SAAS,GAAG;QAErC,IAAI,SAAS;YACX,WAAW,cAAc,OAAO,CAAC;YACjC,SAAS,OAAO,GAAG;QACrB,OACE,WAAW;IAEf;QAEQ,gBAAwB;IAAhC,OAAO;QAAC,CAAA,iBAAA,sBAAA,gCAAA,UAAW,GAAG,cAAd,4BAAA,iBAAkB;QAAM,CAAA,gBAAA,qBAAA,+BAAA,SAAU,GAAG,cAAb,2BAAA,gBAAiB;KAAK;AACxD","sources":["packages/@react-aria/collections/src/BaseCollection.ts"],"sourcesContent":["/*\n * Copyright 2024 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 as ICollection, Key, Node} from '@react-types/shared';\nimport {ReactElement, ReactNode} from 'react';\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n}\n\ntype FilterFn<T> = (textValue: string, node: Node<T>) => boolean;\n\n/** An immutable object representing a Node in a Collection. */\nexport class CollectionNode<T> implements Node<T> {\n static readonly type: string;\n readonly type: string;\n readonly key: Key;\n readonly value: T | null = null;\n readonly level: number = 0;\n readonly hasChildNodes: boolean = false;\n readonly rendered: ReactNode = null;\n readonly textValue: string = '';\n readonly 'aria-label'?: string = undefined;\n readonly index: number = 0;\n readonly parentKey: Key | null = null;\n readonly prevKey: Key | null = null;\n readonly nextKey: Key | null = null;\n readonly firstChildKey: Key | null = null;\n readonly lastChildKey: Key | null = null;\n readonly props: any = {};\n readonly render?: (node: Node<any>) => ReactElement;\n readonly colSpan: number | null = null;\n readonly colIndex: number | null = null;\n\n constructor(key: Key) {\n this.type = (this.constructor as typeof CollectionNode).type;\n this.key = key;\n }\n\n get childNodes(): Iterable<Node<T>> {\n throw new Error('childNodes is not supported');\n }\n\n clone(): this {\n let node: Mutable<this> = new (this.constructor as any)(this.key);\n node.value = this.value;\n node.level = this.level;\n node.hasChildNodes = this.hasChildNodes;\n node.rendered = this.rendered;\n node.textValue = this.textValue;\n node['aria-label'] = this['aria-label'];\n node.index = this.index;\n node.parentKey = this.parentKey;\n node.prevKey = this.prevKey;\n node.nextKey = this.nextKey;\n node.firstChildKey = this.firstChildKey;\n node.lastChildKey = this.lastChildKey;\n node.props = this.props;\n node.render = this.render;\n node.colSpan = this.colSpan;\n node.colIndex = this.colIndex;\n return node;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null {\n let clone = this.clone();\n newCollection.addDescendants(clone, collection);\n return clone;\n }\n}\n\nexport class FilterableNode<T> extends CollectionNode<T> {\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null {\n let [firstKey, lastKey] = filterChildren(collection, newCollection, this.firstChildKey, filterFn);\n let newNode: Mutable<CollectionNode<T>> = this.clone();\n newNode.firstChildKey = firstKey;\n newNode.lastChildKey = lastKey;\n return newNode;\n }\n}\n\nexport class HeaderNode extends CollectionNode<unknown> {\n static readonly type = 'header';\n}\n\nexport class LoaderNode extends CollectionNode<unknown> {\n static readonly type = 'loader';\n}\n\nexport class ItemNode<T> extends FilterableNode<T> {\n static readonly type = 'item';\n\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): ItemNode<T> | null {\n if (filterFn(this.textValue, this)) {\n let clone = this.clone();\n newCollection.addDescendants(clone, collection);\n return clone;\n }\n\n return null;\n }\n}\n\nexport class SectionNode<T> extends FilterableNode<T> {\n static readonly type = 'section';\n\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): SectionNode<T> | null {\n let filteredSection = super.filter(collection, newCollection, filterFn);\n if (filteredSection) {\n if (filteredSection.lastChildKey !== null) {\n let lastChild = collection.getItem(filteredSection.lastChildKey);\n if (lastChild && lastChild.type !== 'header') {\n return filteredSection;\n }\n }\n }\n\n return null;\n }\n}\n\n/**\n * An immutable Collection implementation. Updates are only allowed\n * when it is not marked as frozen. This can be subclassed to implement\n * custom collection behaviors.\n */\nexport class BaseCollection<T> implements ICollection<Node<T>> {\n protected keyMap: Map<Key, CollectionNode<T>> = new Map();\n protected firstKey: Key | null = null;\n protected lastKey: Key | null = null;\n protected frozen = false;\n protected itemCount: number = 0;\n\n get size(): number {\n return this.itemCount;\n }\n\n getKeys(): IterableIterator<Key> {\n return this.keyMap.keys();\n }\n\n *[Symbol.iterator](): IterableIterator<Node<T>> {\n let node: Node<T> | undefined = this.firstKey != null ? this.keyMap.get(this.firstKey) : undefined;\n while (node) {\n yield node;\n node = node.nextKey != null ? this.keyMap.get(node.nextKey) : undefined;\n }\n }\n\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getKeyBefore(key: Key): Key | null {\n let node = this.keyMap.get(key);\n if (!node) {\n return null;\n }\n\n if (node.prevKey != null) {\n node = this.keyMap.get(node.prevKey);\n\n while (node && node.type !== 'item' && node.lastChildKey != null) {\n node = this.keyMap.get(node.lastChildKey);\n }\n\n return node?.key ?? null;\n }\n\n return node.parentKey;\n }\n\n getKeyAfter(key: Key): Key | null {\n let node = this.keyMap.get(key);\n if (!node) {\n return null;\n }\n\n if (node.type !== 'item' && node.firstChildKey != null) {\n return node.firstChildKey;\n }\n\n while (node) {\n if (node.nextKey != null) {\n return node.nextKey;\n }\n\n if (node.parentKey != null) {\n node = this.keyMap.get(node.parentKey);\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n getFirstKey(): Key | null {\n return this.firstKey;\n }\n\n getLastKey(): Key | null {\n let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null;\n while (node?.lastChildKey != null) {\n node = this.keyMap.get(node.lastChildKey);\n }\n\n return node?.key ?? null;\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(): Node<T> {\n throw new Error('Not implemented');\n }\n\n clone(): this {\n // We need to clone using this.constructor so that subclasses have the right prototype.\n // TypeScript isn't happy about this yet.\n // https://github.com/microsoft/TypeScript/issues/3841\n let Constructor: any = this.constructor;\n let collection: this = new Constructor();\n collection.keyMap = new Map(this.keyMap);\n collection.firstKey = this.firstKey;\n collection.lastKey = this.lastKey;\n collection.itemCount = this.itemCount;\n return collection;\n }\n\n addNode(node: CollectionNode<T>): void {\n if (this.frozen) {\n throw new Error('Cannot add a node to a frozen collection');\n }\n\n if (node.type === 'item' && this.keyMap.get(node.key) == null) {\n this.itemCount++;\n }\n\n this.keyMap.set(node.key, node);\n }\n\n // Deeply add a node and its children to the collection from another collection, primarily used when filtering a collection\n addDescendants(node: CollectionNode<T>, oldCollection: BaseCollection<T>): void {\n this.addNode(node);\n let children = oldCollection.getChildren(node.key);\n for (let child of children) {\n this.addDescendants(child as CollectionNode<T>, oldCollection);\n }\n }\n\n removeNode(key: Key): void {\n if (this.frozen) {\n throw new Error('Cannot remove a node to a frozen collection');\n }\n\n let node = this.keyMap.get(key);\n if (node != null && node.type === 'item') {\n this.itemCount--;\n }\n\n this.keyMap.delete(key);\n }\n\n commit(firstKey: Key | null, lastKey: Key | null, isSSR = false): void {\n if (this.frozen) {\n throw new Error('Cannot commit a frozen collection');\n }\n\n this.firstKey = firstKey;\n this.lastKey = lastKey;\n this.frozen = !isSSR;\n }\n\n filter(filterFn: FilterFn<T>): this {\n let newCollection = new (this.constructor as any)();\n let [firstKey, lastKey] = filterChildren(this, newCollection, this.firstKey, filterFn);\n newCollection?.commit(firstKey, lastKey);\n return newCollection;\n }\n}\n\nfunction filterChildren<T>(collection: BaseCollection<T>, newCollection: BaseCollection<T>, firstChildKey: Key | null, filterFn: FilterFn<T>): [Key | null, Key | null] {\n // loop over the siblings for firstChildKey\n // create new nodes based on calling node.filter for each child\n // if it returns null then don't include it, otherwise update its prev/next keys\n // add them to the newCollection\n if (firstChildKey == null) {\n return [null, null];\n }\n\n let firstNode: Node<T> | null = null;\n let lastNode: Node<T> | null = null;\n let currentNode = collection.getItem(firstChildKey);\n\n while (currentNode != null) {\n let newNode: Mutable<CollectionNode<T>> | null = (currentNode as CollectionNode<T>).filter(collection, newCollection, filterFn);\n if (newNode != null) {\n newNode.nextKey = null;\n if (lastNode) {\n newNode.prevKey = lastNode.key;\n lastNode.nextKey = newNode.key;\n }\n\n if (firstNode == null) {\n firstNode = newNode;\n }\n\n newCollection.addNode(newNode);\n lastNode = newNode;\n }\n\n currentNode = currentNode.nextKey ? collection.getItem(currentNode.nextKey) : null;\n }\n\n // TODO: this is pretty specific to dividers but doesn't feel like there is a good way to get around it since we only can know\n // to filter the last separator in a collection only after performing a filter for the rest of the contents after it\n // Its gross that it needs to live here, might be nice if somehow we could have this live in the separator code\n if (lastNode && lastNode.type === 'separator') {\n let prevKey = lastNode.prevKey;\n newCollection.removeNode(lastNode.key);\n\n if (prevKey) {\n lastNode = newCollection.getItem(prevKey) as Mutable<CollectionNode<T>>;\n lastNode.nextKey = null;\n } else {\n lastNode = null;\n }\n }\n\n return [firstNode?.key ?? null, lastNode?.key ?? null];\n}\n"],"names":[],"version":3,"file":"BaseCollection.main.js.map"}
|