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