@react-stately/collections 3.3.4 → 3.3.5

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/module.js CHANGED
@@ -1,417 +1,307 @@
1
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
2
- import _react, { useMemo, useRef } from "react";
1
+ import $hGDng$react, {useMemo as $hGDng$useMemo, useRef as $hGDng$useRef} from "react";
3
2
 
4
- function $e92117d6e5313ef8e7c10fac1de193ce$var$Item(props) {
5
- // eslint-disable-line @typescript-eslint/no-unused-vars
6
- return null;
3
+ function $parcel$export(e, n, v, s) {
4
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
5
  }
6
+ var $d80587bf41d0fb18$exports = {};
8
7
 
9
- $e92117d6e5313ef8e7c10fac1de193ce$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
10
- let {
11
- childItems,
12
- title,
13
- children
14
- } = props;
15
- let rendered = props.title || props.children;
16
- let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || ''; // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.
8
+ $parcel$export($d80587bf41d0fb18$exports, "Item", () => $d80587bf41d0fb18$export$6d08773d2e66f8f2);
17
9
 
18
- if (!textValue && !(context != null && context.suppressTextValueWarning)) {
19
- console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');
20
- }
21
-
22
- yield {
23
- type: 'item',
24
- props: props,
25
- rendered,
26
- textValue,
27
- 'aria-label': props['aria-label'],
28
- hasChildNodes: $e92117d6e5313ef8e7c10fac1de193ce$var$hasChildItems(props),
29
-
30
- *childNodes() {
31
- if (childItems) {
32
- for (let child of childItems) {
33
- yield {
34
- type: 'item',
35
- value: child
36
- };
10
+ function $d80587bf41d0fb18$var$Item(props) {
11
+ return null;
12
+ }
13
+ $d80587bf41d0fb18$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
14
+ let { childItems: childItems , title: title , children: children } = props;
15
+ let rendered = props.title || props.children;
16
+ let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';
17
+ // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.
18
+ if (!textValue && !context?.suppressTextValueWarning) console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');
19
+ yield {
20
+ type: 'item',
21
+ props: props,
22
+ rendered: rendered,
23
+ textValue: textValue,
24
+ 'aria-label': props['aria-label'],
25
+ hasChildNodes: $d80587bf41d0fb18$var$hasChildItems(props),
26
+ *childNodes () {
27
+ if (childItems) for (let child1 of childItems)yield {
28
+ type: 'item',
29
+ value: child1
30
+ };
31
+ else if (title) {
32
+ let items = [];
33
+ $hGDng$react.Children.forEach(children, (child)=>{
34
+ items.push({
35
+ type: 'item',
36
+ element: child
37
+ });
38
+ });
39
+ yield* items;
40
+ }
37
41
  }
38
- } else if (title) {
39
- let items = [];
40
-
41
- _react.Children.forEach(children, child => {
42
- items.push({
43
- type: 'item',
44
- element: child
45
- });
46
- });
47
-
48
- yield* items;
49
- }
50
- }
51
-
52
- };
42
+ };
53
43
  };
44
+ function $d80587bf41d0fb18$var$hasChildItems(props) {
45
+ if (props.hasChildItems != null) return props.hasChildItems;
46
+ if (props.childItems) return true;
47
+ if (props.title && $hGDng$react.Children.count(props.children) > 0) return true;
48
+ return false;
49
+ }
50
+ // We don't want getCollectionNode to show up in the type definition
51
+ let $d80587bf41d0fb18$export$6d08773d2e66f8f2 = $d80587bf41d0fb18$var$Item;
54
52
 
55
- function $e92117d6e5313ef8e7c10fac1de193ce$var$hasChildItems(props) {
56
- if (props.hasChildItems != null) {
57
- return props.hasChildItems;
58
- }
59
-
60
- if (props.childItems) {
61
- return true;
62
- }
63
-
64
- if (props.title && _react.Children.count(props.children) > 0) {
65
- return true;
66
- }
67
-
68
- return false;
69
- } // We don't want getCollectionNode to show up in the type definition
70
53
 
54
+ var $591e4228be66f7fb$exports = {};
71
55
 
72
- export let Item = $e92117d6e5313ef8e7c10fac1de193ce$var$Item;
56
+ $parcel$export($591e4228be66f7fb$exports, "Section", () => $591e4228be66f7fb$export$6e2c8f0811a474ce);
73
57
 
74
- function $b2e76f05d3356a2e1df6ac80570fcd9$var$Section(props) {
75
- // eslint-disable-line @typescript-eslint/no-unused-vars
76
- return null;
58
+ function $591e4228be66f7fb$var$Section(props) {
59
+ return null;
77
60
  }
78
-
79
- $b2e76f05d3356a2e1df6ac80570fcd9$var$Section.getCollectionNode = function* getCollectionNode(props) {
80
- let {
81
- children,
82
- title,
83
- items
84
- } = props;
85
- yield {
86
- type: 'section',
87
- hasChildNodes: true,
88
- rendered: title,
89
- 'aria-label': props['aria-label'],
90
-
91
- *childNodes() {
92
- if (typeof children === 'function') {
93
- if (!items) {
94
- throw new Error('props.children was a function but props.items is missing');
95
- }
96
-
97
- for (let item of items) {
98
- yield {
99
- type: 'item',
100
- value: item,
101
- renderer: children
102
- };
61
+ $591e4228be66f7fb$var$Section.getCollectionNode = function* getCollectionNode(props) {
62
+ let { children: children , title: title , items: items1 } = props;
63
+ yield {
64
+ type: 'section',
65
+ hasChildNodes: true,
66
+ rendered: title,
67
+ 'aria-label': props['aria-label'],
68
+ *childNodes () {
69
+ if (typeof children === 'function') {
70
+ if (!items1) throw new Error('props.children was a function but props.items is missing');
71
+ for (let item of items1)yield {
72
+ type: 'item',
73
+ value: item,
74
+ renderer: children
75
+ };
76
+ } else {
77
+ let items = [];
78
+ $hGDng$react.Children.forEach(children, (child)=>{
79
+ items.push({
80
+ type: 'item',
81
+ element: child
82
+ });
83
+ });
84
+ yield* items;
85
+ }
103
86
  }
104
- } else {
105
- let items = [];
106
-
107
- _react.Children.forEach(children, child => {
108
- items.push({
109
- type: 'item',
110
- element: child
111
- });
112
- });
113
-
114
- yield* items;
115
- }
116
- }
117
-
118
- };
119
- }; // We don't want getCollectionNode to show up in the type definition
120
-
121
-
122
- export let Section = $b2e76f05d3356a2e1df6ac80570fcd9$var$Section;
123
-
124
- class $f8429209754fda4b9142d514065f4$export$CollectionBuilder {
125
- constructor() {
126
- this.context = void 0;
127
- this.cache = new WeakMap();
128
- }
129
-
130
- build(props, context) {
131
- this.context = context;
132
- return $f8429209754fda4b9142d514065f4$var$iterable(() => this.iterateCollection(props));
133
- }
134
-
135
- *iterateCollection(props) {
136
- let {
137
- children,
138
- items
139
- } = props;
87
+ };
88
+ };
89
+ // We don't want getCollectionNode to show up in the type definition
90
+ let $591e4228be66f7fb$export$6e2c8f0811a474ce = $591e4228be66f7fb$var$Section;
140
91
 
141
- if (typeof children === 'function') {
142
- if (!items) {
143
- throw new Error('props.children was a function but props.items is missing');
144
- }
145
92
 
146
- for (let item of props.items) {
147
- yield* this.getFullNode({
148
- value: item
149
- }, {
150
- renderer: children
151
- });
152
- }
153
- } else {
154
- let items = [];
93
+ var $b8582cc7aa33d0e8$exports = {};
155
94
 
156
- _react.Children.forEach(children, child => {
157
- items.push(child);
158
- });
159
95
 
160
- let index = 0;
96
+ var $b0e94ff142179e1f$exports = {};
161
97
 
162
- for (let item of items) {
163
- let nodes = this.getFullNode({
164
- element: item,
165
- index: index
166
- }, {});
98
+ $parcel$export($b0e94ff142179e1f$exports, "useCollection", () => $b0e94ff142179e1f$export$6cd28814d92fa9c9);
167
99
 
168
- for (let node of nodes) {
169
- index++;
170
- yield node;
171
- }
172
- }
100
+ class $0ef13e8a225e58db$export$bf788dd355e3a401 {
101
+ build(props, context) {
102
+ this.context = context;
103
+ return $0ef13e8a225e58db$var$iterable(()=>this.iterateCollection(props)
104
+ );
173
105
  }
174
- }
175
-
176
- getKey(item, partialNode, state, parentKey) {
177
- if (item.key != null) {
178
- return item.key;
106
+ *iterateCollection(props) {
107
+ let { children: children , items: items } = props;
108
+ if (typeof children === 'function') {
109
+ if (!items) throw new Error('props.children was a function but props.items is missing');
110
+ for (let item of props.items)yield* this.getFullNode({
111
+ value: item
112
+ }, {
113
+ renderer: children
114
+ });
115
+ } else {
116
+ let items = [];
117
+ $hGDng$react.Children.forEach(children, (child)=>{
118
+ items.push(child);
119
+ });
120
+ let index = 0;
121
+ for (let item of items){
122
+ let nodes = this.getFullNode({
123
+ element: item,
124
+ index: index
125
+ }, {
126
+ });
127
+ for (let node of nodes){
128
+ index++;
129
+ yield node;
130
+ }
131
+ }
132
+ }
179
133
  }
180
-
181
- if (partialNode.type === 'cell' && partialNode.key != null) {
182
- return "" + parentKey + partialNode.key;
134
+ getKey(item, partialNode, state, parentKey) {
135
+ if (item.key != null) return item.key;
136
+ if (partialNode.type === 'cell' && partialNode.key != null) return `${parentKey}${partialNode.key}`;
137
+ let v = partialNode.value;
138
+ if (v != null) {
139
+ let key = v.key ?? v.id;
140
+ if (key == null) throw new Error('No key found for item');
141
+ return key;
142
+ }
143
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
183
144
  }
184
-
185
- let v = partialNode.value;
186
-
187
- if (v != null) {
188
- var _v$key;
189
-
190
- let key = (_v$key = v.key) != null ? _v$key : v.id;
191
-
192
- if (key == null) {
193
- throw new Error('No key found for item');
194
- }
195
-
196
- return key;
145
+ getChildState(state, partialNode) {
146
+ return {
147
+ renderer: partialNode.renderer || state.renderer
148
+ };
197
149
  }
198
-
199
- return parentKey ? parentKey + "." + partialNode.index : "$." + partialNode.index;
200
- }
201
-
202
- getChildState(state, partialNode) {
203
- return {
204
- renderer: partialNode.renderer || state.renderer
205
- };
206
- }
207
-
208
- *getFullNode(partialNode, state, parentKey, parentNode) {
209
- // If there's a value instead of an element on the node, and a parent renderer function is available,
210
- // use it to render an element for the value.
211
- let element = partialNode.element;
212
-
213
- if (!element && partialNode.value && state && state.renderer) {
214
- let cached = this.cache.get(partialNode.value);
215
-
216
- if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
217
- cached.index = partialNode.index;
218
- cached.parentKey = parentNode ? parentNode.key : null;
219
- yield cached;
220
- return;
221
- }
222
-
223
- element = state.renderer(partialNode.value);
224
- } // If there's an element with a getCollectionNode function on its type, then it's a supported component.
225
- // Call this function to get a partial node, and recursively build a full node from there.
226
-
227
-
228
- if ( /*#__PURE__*/_react.isValidElement(element)) {
229
- let type = element.type;
230
-
231
- if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {
232
- let name = typeof element.type === 'function' ? element.type.name : element.type;
233
- throw new Error("Unknown element <" + name + "> in collection.");
234
- }
235
-
236
- let childNodes = type.getCollectionNode(element.props, this.context);
237
- let index = partialNode.index;
238
- let result = childNodes.next();
239
-
240
- while (!result.done && result.value) {
241
- let childNode = result.value;
242
- partialNode.index = index;
243
- let nodeKey = childNode.key;
244
-
245
- if (!nodeKey) {
246
- nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
247
- }
248
-
249
- let nodes = this.getFullNode(_babelRuntimeHelpersEsmExtends({}, childNode, {
250
- key: nodeKey,
251
- index,
252
- wrapper: $f8429209754fda4b9142d514065f4$var$compose(partialNode.wrapper, childNode.wrapper)
253
- }), this.getChildState(state, childNode), parentKey ? "" + parentKey + element.key : element.key, parentNode);
254
- let children = [...nodes];
255
-
256
- for (let node of children) {
257
- // Cache the node based on its value
258
- node.value = childNode.value || partialNode.value;
259
-
260
- if (node.value) {
261
- this.cache.set(node.value, node);
262
- } // The partial node may have specified a type for the child in order to specify a constraint.
263
- // Verify that the full node that was built recursively matches this type.
264
-
265
-
266
- if (partialNode.type && node.type !== partialNode.type) {
267
- throw new Error("Unsupported type <" + $f8429209754fda4b9142d514065f4$var$capitalize(node.type) + "> in <" + $f8429209754fda4b9142d514065f4$var$capitalize(parentNode.type) + ">. Only <" + $f8429209754fda4b9142d514065f4$var$capitalize(partialNode.type) + "> is supported.");
268
- }
269
-
270
- index++;
271
- yield node;
150
+ *getFullNode(partialNode, state, parentKey, parentNode) {
151
+ // If there's a value instead of an element on the node, and a parent renderer function is available,
152
+ // use it to render an element for the value.
153
+ let element = partialNode.element;
154
+ if (!element && partialNode.value && state && state.renderer) {
155
+ let cached = this.cache.get(partialNode.value);
156
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
157
+ cached.index = partialNode.index;
158
+ cached.parentKey = parentNode ? parentNode.key : null;
159
+ yield cached;
160
+ return;
161
+ }
162
+ element = state.renderer(partialNode.value);
272
163
  }
273
-
274
- result = childNodes.next(children);
275
- }
276
-
277
- return;
278
- } // Ignore invalid elements
279
-
280
-
281
- if (partialNode.key == null) {
282
- return;
283
- } // Create full node
284
-
285
-
286
- let builder = this;
287
- let node = {
288
- type: partialNode.type,
289
- props: partialNode.props,
290
- key: partialNode.key,
291
- parentKey: parentNode ? parentNode.key : null,
292
- value: partialNode.value,
293
- level: parentNode ? parentNode.level + 1 : 0,
294
- index: partialNode.index,
295
- rendered: partialNode.rendered,
296
- textValue: partialNode.textValue,
297
- 'aria-label': partialNode['aria-label'],
298
- wrapper: partialNode.wrapper,
299
- shouldInvalidate: partialNode.shouldInvalidate,
300
- hasChildNodes: partialNode.hasChildNodes,
301
- childNodes: $f8429209754fda4b9142d514065f4$var$iterable(function* () {
302
- if (!partialNode.hasChildNodes) {
303
- return;
164
+ // If there's an element with a getCollectionNode function on its type, then it's a supported component.
165
+ // Call this function to get a partial node, and recursively build a full node from there.
166
+ if ($hGDng$react.isValidElement(element)) {
167
+ let type = element.type;
168
+ if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {
169
+ let name = typeof element.type === 'function' ? element.type.name : element.type;
170
+ throw new Error(`Unknown element <${name}> in collection.`);
171
+ }
172
+ let childNodes = type.getCollectionNode(element.props, this.context);
173
+ let index = partialNode.index;
174
+ let result = childNodes.next();
175
+ while(!result.done && result.value){
176
+ let childNode = result.value;
177
+ partialNode.index = index;
178
+ let nodeKey = childNode.key;
179
+ if (!nodeKey) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
180
+ let nodes = this.getFullNode({
181
+ ...childNode,
182
+ key: nodeKey,
183
+ index: index,
184
+ wrapper: $0ef13e8a225e58db$var$compose(partialNode.wrapper, childNode.wrapper)
185
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
186
+ let children = [
187
+ ...nodes
188
+ ];
189
+ for (let node of children){
190
+ // Cache the node based on its value
191
+ node.value = childNode.value || partialNode.value;
192
+ if (node.value) this.cache.set(node.value, node);
193
+ // The partial node may have specified a type for the child in order to specify a constraint.
194
+ // Verify that the full node that was built recursively matches this type.
195
+ if (partialNode.type && node.type !== partialNode.type) throw new Error(`Unsupported type <${$0ef13e8a225e58db$var$capitalize(node.type)}> in <${$0ef13e8a225e58db$var$capitalize(parentNode.type)}>. Only <${$0ef13e8a225e58db$var$capitalize(partialNode.type)}> is supported.`);
196
+ index++;
197
+ yield node;
198
+ }
199
+ result = childNodes.next(children);
200
+ }
201
+ return;
304
202
  }
305
-
306
- let index = 0;
307
-
308
- for (let child of partialNode.childNodes()) {
309
- // Ensure child keys are globally unique by prepending the parent node's key
310
- if (child.key != null) {
311
- child.key = "" + node.key + child.key;
312
- }
313
-
314
- child.index = index;
315
- let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);
316
-
317
- for (let node of nodes) {
318
- index++;
319
- yield node;
320
- }
203
+ // Ignore invalid elements
204
+ if (partialNode.key == null) return;
205
+ // Create full node
206
+ let builder = this;
207
+ let node = {
208
+ type: partialNode.type,
209
+ props: partialNode.props,
210
+ key: partialNode.key,
211
+ parentKey: parentNode ? parentNode.key : null,
212
+ value: partialNode.value,
213
+ level: parentNode ? parentNode.level + 1 : 0,
214
+ index: partialNode.index,
215
+ rendered: partialNode.rendered,
216
+ textValue: partialNode.textValue,
217
+ 'aria-label': partialNode['aria-label'],
218
+ wrapper: partialNode.wrapper,
219
+ shouldInvalidate: partialNode.shouldInvalidate,
220
+ hasChildNodes: partialNode.hasChildNodes,
221
+ childNodes: $0ef13e8a225e58db$var$iterable(function*() {
222
+ if (!partialNode.hasChildNodes) return;
223
+ let index = 0;
224
+ for (let child of partialNode.childNodes()){
225
+ // Ensure child keys are globally unique by prepending the parent node's key
226
+ if (child.key != null) child.key = `${node.key}${child.key}`;
227
+ child.index = index;
228
+ let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);
229
+ for (let node1 of nodes){
230
+ index++;
231
+ yield node1;
232
+ }
233
+ }
234
+ })
235
+ };
236
+ yield node;
237
+ }
238
+ constructor(){
239
+ this.cache = new WeakMap();
240
+ }
241
+ }
242
+ // Wraps an iterator function as an iterable object, and caches the results.
243
+ function $0ef13e8a225e58db$var$iterable(iterator) {
244
+ let cache = [];
245
+ let iterable = null;
246
+ return {
247
+ *[Symbol.iterator] () {
248
+ for (let item of cache)yield item;
249
+ if (!iterable) iterable = iterator();
250
+ for (let item1 of iterable){
251
+ cache.push(item1);
252
+ yield item1;
253
+ }
321
254
  }
322
- })
323
255
  };
324
- yield node;
325
- }
326
-
327
- } // Wraps an iterator function as an iterable object, and caches the results.
328
-
329
-
330
- function $f8429209754fda4b9142d514065f4$var$iterable(iterator) {
331
- let cache = [];
332
- let iterable = null;
333
- return {
334
- *[Symbol.iterator]() {
335
- for (let item of cache) {
336
- yield item;
337
- }
338
-
339
- if (!iterable) {
340
- iterable = iterator();
341
- }
342
-
343
- for (let item of iterable) {
344
- cache.push(item);
345
- yield item;
346
- }
347
- }
348
-
349
- };
350
256
  }
351
-
352
- function $f8429209754fda4b9142d514065f4$var$compose(outer, inner) {
353
- if (outer && inner) {
354
- return element => outer(inner(element));
355
- }
356
-
357
- if (outer) {
358
- return outer;
359
- }
360
-
361
- if (inner) {
362
- return inner;
363
- }
257
+ function $0ef13e8a225e58db$var$compose(outer, inner) {
258
+ if (outer && inner) return (element)=>outer(inner(element))
259
+ ;
260
+ if (outer) return outer;
261
+ if (inner) return inner;
364
262
  }
365
-
366
- function $f8429209754fda4b9142d514065f4$var$capitalize(str) {
367
- return str[0].toUpperCase() + str.slice(1);
263
+ function $0ef13e8a225e58db$var$capitalize(str) {
264
+ return str[0].toUpperCase() + str.slice(1);
368
265
  }
369
266
 
370
- export function useCollection(props, factory, context, invalidators) {
371
- if (invalidators === void 0) {
372
- invalidators = [];
373
- }
374
267
 
375
- let builder = useMemo(() => new $f8429209754fda4b9142d514065f4$export$CollectionBuilder(), []);
376
- let prev = useRef(null);
377
- return useMemo(() => {
378
- let nodes = builder.build(props, context);
379
- prev.current = factory(nodes, prev.current);
380
- return prev.current; // Don't invalidate when any prop changes, just the two we care about.
268
+
269
+ function $b0e94ff142179e1f$export$6cd28814d92fa9c9(props, factory, context, invalidators = []) {
270
+ let builder = $hGDng$useMemo(()=>new $0ef13e8a225e58db$export$bf788dd355e3a401()
271
+ , []);
272
+ let prev = $hGDng$useRef(null);
273
+ return $hGDng$useMemo(()=>{
274
+ let nodes = builder.build(props, context);
275
+ prev.current = factory(nodes, prev.current);
276
+ return prev.current;
277
+ // Don't invalidate when any prop changes, just the two we care about.
381
278
  // eslint-disable-next-line react-hooks/exhaustive-deps
382
- }, [builder, props.children, props.items, context, ...invalidators]);
279
+ }, [
280
+ builder,
281
+ props.children,
282
+ props.items,
283
+ context,
284
+ ...invalidators
285
+ ]);
383
286
  }
384
287
 
385
- /*
386
- * Copyright 2020 Adobe. All rights reserved.
387
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
388
- * you may not use this file except in compliance with the License. You may obtain a copy
389
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
390
- *
391
- * Unless required by applicable law or agreed to in writing, software distributed under
392
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
393
- * OF ANY KIND, either express or implied. See the License for the specific language
394
- * governing permissions and limitations under the License.
395
- */
396
- const $c10674539d06c96e1a2fbb6a54340$var$cache = new WeakMap();
397
- export function getItemCount(collection) {
398
- let count = $c10674539d06c96e1a2fbb6a54340$var$cache.get(collection);
399
288
 
400
- if (count != null) {
289
+ var $a5bc6066b2ba167e$exports = {};
290
+
291
+ $parcel$export($a5bc6066b2ba167e$exports, "getItemCount", () => $a5bc6066b2ba167e$export$77d5aafae4e095b2);
292
+ const $a5bc6066b2ba167e$var$cache = new WeakMap();
293
+ function $a5bc6066b2ba167e$export$77d5aafae4e095b2(collection) {
294
+ let count = $a5bc6066b2ba167e$var$cache.get(collection);
295
+ if (count != null) return count;
296
+ count = 0;
297
+ for (let item of collection)if (item.type === 'section') count += $a5bc6066b2ba167e$export$77d5aafae4e095b2(item.childNodes);
298
+ else count++;
299
+ $a5bc6066b2ba167e$var$cache.set(collection, count);
401
300
  return count;
402
- }
301
+ }
403
302
 
404
- count = 0;
405
303
 
406
- for (let item of collection) {
407
- if (item.type === 'section') {
408
- count += getItemCount(item.childNodes);
409
- } else {
410
- count++;
411
- }
412
- }
413
304
 
414
- $c10674539d06c96e1a2fbb6a54340$var$cache.set(collection, count);
415
- return count;
416
- }
305
+
306
+ export {$d80587bf41d0fb18$export$6d08773d2e66f8f2 as Item, $591e4228be66f7fb$export$6e2c8f0811a474ce as Section, $b0e94ff142179e1f$export$6cd28814d92fa9c9 as useCollection, $a5bc6066b2ba167e$export$77d5aafae4e095b2 as getItemCount};
417
307
  //# sourceMappingURL=module.js.map