@react-aria/collections 3.0.0-rc.4 → 3.0.0-rc.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/BaseCollection.main.js +106 -100
- package/dist/BaseCollection.main.js.map +1 -1
- package/dist/BaseCollection.mjs +102 -101
- package/dist/BaseCollection.module.js +102 -101
- package/dist/BaseCollection.module.js.map +1 -1
- package/dist/CollectionBuilder.main.js +20 -10
- package/dist/CollectionBuilder.main.js.map +1 -1
- package/dist/CollectionBuilder.mjs +21 -11
- package/dist/CollectionBuilder.module.js +21 -11
- package/dist/CollectionBuilder.module.js.map +1 -1
- package/dist/Document.main.js +21 -15
- package/dist/Document.main.js.map +1 -1
- package/dist/Document.mjs +21 -15
- package/dist/Document.module.js +21 -15
- package/dist/Document.module.js.map +1 -1
- package/dist/import.mjs +2 -2
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +32 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/BaseCollection.ts +120 -123
- package/src/CollectionBuilder.tsx +32 -15
- package/src/Document.ts +32 -12
- package/src/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAwBM,MAAM;IAaX,CAAC,CAAC,OAAO,QAAQ,CAAC,GAA6B;QAC7C,IAAI,OAAO,IAAI,CAAC,UAAU;QAC1B,MAAO,KAAM;YACX,MAAM;YACN,OAAO,KAAK,WAAW;QACzB;IACF;IAEA,IAAI,aAAoC;QACtC,OAAO,IAAI,CAAC,WAAW;IACzB;IAEA,IAAI,WAAW,UAAiC,EAAE;QAChD,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI;IACnC;IAEA,IAAI,YAAmC;QACrC,OAAO,IAAI,CAAC,UAAU;IACxB;IAEA,IAAI,UA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QAGF,iFAAiF;QACjF,2GAA2G;QAC3G,gGAAgG;QAChG,mGAAmG;QACnG,uCAAuC;QACvC,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,cAAc,GAAG;QACtB,KAAK,IAAI,MAAM,IAAI,CAAC,aAAa,CAC/B;QAEF,IAAI,CAAC,cAAc,GAAG;IACxB;IAEA,UAAU,EAAc,EAAE;QACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QACvB,OAAO,IAAe,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClD;IAEA,gBAAsB;QACpB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG;YACb,IAAI,CAAC,UAAU,GAAG;YAClB,IAAI,CAAC,SAAS,GAAG;YACjB,IAAI,CAAC,MAAM,GAAG;QAChB;IACF;IApIA,YAAY,UAAa,CAAE;QACzB,aAAa;QACb,KAAK,CAAC,YAfR,WAAW,GAAI,yBAAyB;eACxC,gBAAgC,IAAI,OACpC,aAA+B,IAAI,YACnC,QAAQ,YACR,SAAS,QACT,eAAgD,IAAI,gBACpD,YAAY,WAEJ,iBAA2B,WAC3B,gBAAiC,IAAI,YACrC,eAAe,YACf,iBAAiB;QAKvB,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,cAAc,GAAG;IACxB;AAgIF","sources":["packages/@react-aria/collections/src/Document.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 {BaseCollection, CollectionNode, Mutable} from './BaseCollection';\nimport {CSSProperties, ForwardedRef, ReactElement, ReactNode} from 'react';\nimport {Node} from '@react-types/shared';\n\n// This Collection implementation is perhaps a little unusual. It works by rendering the React tree into a\n// Portal to a fake DOM implementation. This gives us efficient access to the tree of rendered objects, and\n// supports React features like composition and context. We use this fake DOM to access the full set of elements\n// before we render into the real DOM, which allows us to render a subset of the elements (e.g. virtualized scrolling),\n// and compute properties like the total number of items. It also enables keyboard navigation, selection, and other features.\n// React takes care of efficiently rendering components and updating the collection for us via this fake DOM.\n//\n// The DOM is a mutable API, and React expects the node instances to remain stable over time. So the implementation is split\n// into two parts. Each mutable fake DOM node owns an instance of an immutable collection node. When a fake DOM node is updated,\n// it queues a second render for the collection. Multiple updates to a collection can be queued at once. Collection nodes are\n// lazily copied on write, so only the changed nodes need to be cloned. During the second render, the new immutable collection\n// is finalized by updating the map of Key -> Node with the new cloned nodes. Then the new collection is frozen so it can no\n// longer be mutated, and returned to the calling component to render.\n\n/**\n * A mutable node in the fake DOM tree. When mutated, it marks itself as dirty\n * and queues an update with the owner document.\n */\nexport class BaseNode<T> {\n private _firstChild: ElementNode<T> | null = null;\n private _lastChild: ElementNode<T> | null = null;\n private _previousSibling: ElementNode<T> | null = null;\n private _nextSibling: ElementNode<T> | null = null;\n private _parentNode: BaseNode<T> | null = null;\n private _minInvalidChildIndex: ElementNode<T> | null = null;\n ownerDocument: Document<T, any>;\n\n constructor(ownerDocument: Document<T, any>) {\n this.ownerDocument = ownerDocument;\n }\n\n *[Symbol.iterator](): Iterator<ElementNode<T>> {\n let node = this.firstChild;\n while (node) {\n yield node;\n node = node.nextSibling;\n }\n }\n\n get firstChild(): ElementNode<T> | null {\n return this._firstChild;\n }\n\n set firstChild(firstChild: ElementNode<T> | null) {\n this._firstChild = firstChild;\n this.ownerDocument.markDirty(this);\n }\n\n get lastChild(): ElementNode<T> | null {\n return this._lastChild;\n }\n\n set lastChild(lastChild: ElementNode<T> | null) {\n this._lastChild = lastChild;\n this.ownerDocument.markDirty(this);\n }\n\n get previousSibling(): ElementNode<T> | null {\n return this._previousSibling;\n }\n\n set previousSibling(previousSibling: ElementNode<T> | null) {\n this._previousSibling = previousSibling;\n this.ownerDocument.markDirty(this);\n }\n\n get nextSibling(): ElementNode<T> | null {\n return this._nextSibling;\n }\n\n set nextSibling(nextSibling: ElementNode<T> | null) {\n this._nextSibling = nextSibling;\n this.ownerDocument.markDirty(this);\n }\n\n get parentNode(): BaseNode<T> | null {\n return this._parentNode;\n }\n\n set parentNode(parentNode: BaseNode<T> | null) {\n this._parentNode = parentNode;\n this.ownerDocument.markDirty(this);\n }\n\n get isConnected(): boolean {\n return this.parentNode?.isConnected || false;\n }\n\n private invalidateChildIndices(child: ElementNode<T>): void {\n if (this._minInvalidChildIndex == null || !this._minInvalidChildIndex.isConnected || child.index < this._minInvalidChildIndex.index) {\n this._minInvalidChildIndex = child;\n this.ownerDocument.markDirty(this);\n }\n }\n\n updateChildIndices(): void {\n let node = this._minInvalidChildIndex;\n while (node) {\n node.index = node.previousSibling ? node.previousSibling.index + 1 : 0;\n node = node.nextSibling;\n }\n this._minInvalidChildIndex = null;\n }\n\n appendChild(child: ElementNode<T>): void {\n if (child.parentNode) {\n child.parentNode.removeChild(child);\n }\n\n if (this.firstChild == null) {\n this.firstChild = child;\n }\n\n if (this.lastChild) {\n this.lastChild.nextSibling = child;\n child.index = this.lastChild.index + 1;\n child.previousSibling = this.lastChild;\n } else {\n child.previousSibling = null;\n child.index = 0;\n }\n\n child.parentNode = this;\n child.nextSibling = null;\n this.lastChild = child;\n\n this.ownerDocument.markDirty(this);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n insertBefore(newNode: ElementNode<T>, referenceNode: ElementNode<T>): void {\n if (referenceNode == null) {\n return this.appendChild(newNode);\n }\n\n if (newNode.parentNode) {\n newNode.parentNode.removeChild(newNode);\n }\n\n newNode.nextSibling = referenceNode;\n newNode.previousSibling = referenceNode.previousSibling;\n // Ensure that the newNode's index is less than that of the reference node so that\n // invalidateChildIndices will properly use the newNode as the _minInvalidChildIndex, thus making sure\n // we will properly update the indexes of all sibiling nodes after the newNode. The value here doesn't matter\n // since updateChildIndices should calculate the proper indexes.\n newNode.index = referenceNode.index - 1;\n if (this.firstChild === referenceNode) {\n this.firstChild = newNode;\n } else if (referenceNode.previousSibling) {\n referenceNode.previousSibling.nextSibling = newNode;\n }\n\n referenceNode.previousSibling = newNode;\n newNode.parentNode = referenceNode.parentNode;\n\n this.invalidateChildIndices(newNode);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n removeChild(child: ElementNode<T>): void {\n if (child.parentNode !== this || !this.ownerDocument.isMounted) {\n return;\n }\n\n if (this._minInvalidChildIndex === child) {\n this._minInvalidChildIndex = null;\n }\n\n if (child.nextSibling) {\n this.invalidateChildIndices(child.nextSibling);\n child.nextSibling.previousSibling = child.previousSibling;\n }\n\n if (child.previousSibling) {\n child.previousSibling.nextSibling = child.nextSibling;\n }\n\n if (this.firstChild === child) {\n this.firstChild = child.nextSibling;\n }\n\n if (this.lastChild === child) {\n this.lastChild = child.previousSibling;\n }\n\n child.parentNode = null;\n child.nextSibling = null;\n child.previousSibling = null;\n child.index = 0;\n\n this.ownerDocument.markDirty(child);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n addEventListener(): void {}\n removeEventListener(): void {}\n\n get previousVisibleSibling(): ElementNode<T> | null {\n let node = this.previousSibling;\n while (node && node.isHidden) {\n node = node.previousSibling;\n }\n return node;\n }\n\n get nextVisibleSibling(): ElementNode<T> | null {\n let node = this.nextSibling;\n while (node && node.isHidden) {\n node = node.nextSibling;\n }\n return node;\n }\n\n get firstVisibleChild(): ElementNode<T> | null {\n let node = this.firstChild;\n while (node && node.isHidden) {\n node = node.nextSibling;\n }\n return node;\n }\n\n get lastVisibleChild(): ElementNode<T> | null {\n let node = this.lastChild;\n while (node && node.isHidden) {\n node = node.previousSibling;\n }\n return node;\n }\n}\n\n/**\n * A mutable element node in the fake DOM tree. It owns an immutable\n * Collection Node which is copied on write.\n */\nexport class ElementNode<T> extends BaseNode<T> {\n nodeType = 8; // COMMENT_NODE (we'd use ELEMENT_NODE but React DevTools will fail to get its dimensions)\n node: CollectionNode<T>;\n isMutated = true;\n private _index: number = 0;\n hasSetProps = false;\n isHidden = false;\n\n constructor(type: string, ownerDocument: Document<T, any>) {\n super(ownerDocument);\n this.node = new CollectionNode(type, `react-aria-${++ownerDocument.nodeId}`);\n }\n\n get index(): number {\n return this._index;\n }\n\n set index(index: number) {\n this._index = index;\n this.ownerDocument.markDirty(this);\n }\n\n get level(): number {\n if (this.parentNode instanceof ElementNode) {\n return this.parentNode.level + (this.node.type === 'item' ? 1 : 0);\n }\n\n return 0;\n }\n\n /**\n * Lazily gets a mutable instance of a Node. If the node has already\n * been cloned during this update cycle, it just returns the existing one.\n */\n private getMutableNode(): Mutable<CollectionNode<T>> {\n if (!this.isMutated) {\n this.node = this.node.clone();\n this.isMutated = true;\n }\n\n this.ownerDocument.markDirty(this);\n return this.node;\n }\n\n updateNode(): void {\n let nextSibling = this.nextVisibleSibling;\n let node = this.getMutableNode();\n node.index = this.index;\n node.level = this.level;\n node.parentKey = this.parentNode instanceof ElementNode ? this.parentNode.node.key : null;\n node.prevKey = this.previousVisibleSibling?.node.key ?? null;\n node.nextKey = nextSibling?.node.key ?? null;\n node.hasChildNodes = !!this.firstChild;\n node.firstChildKey = this.firstVisibleChild?.node.key ?? null;\n node.lastChildKey = this.lastVisibleChild?.node.key ?? null;\n\n // Update the colIndex of sibling nodes if this node has a colSpan.\n if ((node.colSpan != null || node.colIndex != null) && nextSibling) {\n // This queues the next sibling for update, which means this happens recursively.\n let nextColIndex = (node.colIndex ?? node.index) + (node.colSpan ?? 1);\n if (nextColIndex !== nextSibling.node.colIndex) {\n let siblingNode = nextSibling.getMutableNode();\n siblingNode.colIndex = nextColIndex;\n }\n }\n }\n\n setProps<E extends Element>(obj: {[key: string]: any}, ref: ForwardedRef<E>, rendered?: ReactNode, render?: (node: Node<T>) => ReactElement): void {\n let node = this.getMutableNode();\n let {value, textValue, id, ...props} = obj;\n props.ref = ref;\n node.props = props;\n node.rendered = rendered;\n node.render = render;\n node.value = value;\n node.textValue = textValue || (typeof props.children === 'string' ? props.children : '') || obj['aria-label'] || '';\n if (id != null && id !== node.key) {\n if (this.hasSetProps) {\n throw new Error('Cannot change the id of an item');\n }\n node.key = id;\n }\n\n if (props.colSpan != null) {\n node.colSpan = props.colSpan;\n }\n\n this.hasSetProps = true;\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n get style(): CSSProperties {\n // React sets display: none to hide elements during Suspense.\n // We'll handle this by setting the element to hidden and invalidating\n // its siblings/parent. Hidden elements remain in the Document, but\n // are removed from the Collection.\n let element = this;\n return {\n get display() {\n return element.isHidden ? 'none' : '';\n },\n set display(value) {\n let isHidden = value === 'none';\n if (element.isHidden !== isHidden) {\n // Mark parent node dirty if this element is currently the first or last visible child.\n if (element.parentNode?.firstVisibleChild === element || element.parentNode?.lastVisibleChild === element) {\n element.ownerDocument.markDirty(element.parentNode);\n }\n\n // Mark sibling visible elements dirty.\n let prev = element.previousVisibleSibling;\n let next = element.nextVisibleSibling;\n if (prev) {\n element.ownerDocument.markDirty(prev);\n }\n if (next) {\n element.ownerDocument.markDirty(next);\n }\n\n // Mark self dirty.\n element.isHidden = isHidden;\n element.ownerDocument.markDirty(element);\n }\n }\n };\n }\n\n hasAttribute(): void {}\n setAttribute(): void {}\n setAttributeNS(): void {}\n removeAttribute(): void {}\n}\n\n/**\n * A mutable Document in the fake DOM. It owns an immutable Collection instance,\n * which is lazily copied on write during updates.\n */\nexport class Document<T, C extends BaseCollection<T> = BaseCollection<T>> extends BaseNode<T> {\n nodeType = 11; // DOCUMENT_FRAGMENT_NODE\n ownerDocument: Document<T, C> = this;\n dirtyNodes: Set<BaseNode<T>> = new Set();\n isSSR = false;\n nodeId = 0;\n nodesByProps: WeakMap<object, ElementNode<T>> = new WeakMap<object, ElementNode<T>>();\n isMounted = true;\n private collection: C;\n private nextCollection: C | null = null;\n private subscriptions: Set<() => void> = new Set();\n private queuedRender = false;\n private inSubscription = false;\n\n constructor(collection: C) {\n // @ts-ignore\n super(null);\n this.collection = collection;\n this.nextCollection = collection;\n }\n\n get isConnected(): boolean {\n return this.isMounted;\n }\n\n createElement(type: string): ElementNode<T> {\n return new ElementNode(type, this);\n }\n\n private getMutableCollection() {\n if (!this.nextCollection) {\n this.nextCollection = this.collection.clone();\n }\n\n return this.nextCollection;\n }\n\n markDirty(node: BaseNode<T>): void {\n this.dirtyNodes.add(node);\n }\n\n private addNode(element: ElementNode<T>): void {\n if (element.isHidden) {\n return;\n }\n\n let collection = this.getMutableCollection();\n if (!collection.getItem(element.node.key)) {\n for (let child of element) {\n this.addNode(child);\n }\n }\n\n collection.addNode(element.node);\n }\n\n private removeNode(node: ElementNode<T>): void {\n for (let child of node) {\n this.removeNode(child);\n }\n\n let collection = this.getMutableCollection();\n collection.removeNode(node.node.key);\n }\n\n /** Finalizes the collection update, updating all nodes and freezing the collection. */\n getCollection(): C {\n // If in a subscription update, return a clone of the existing collection.\n // This ensures React will queue a render. React will call getCollection again\n // during render, at which point all the updates will be complete and we can return\n // the new collection.\n if (this.inSubscription) {\n return this.collection.clone();\n }\n\n // Reset queuedRender to false when getCollection is called during render.\n this.queuedRender = false;\n\n this.updateCollection();\n return this.collection;\n }\n\n updateCollection(): void {\n // First, remove disconnected nodes and update the indices of dirty element children.\n for (let element of this.dirtyNodes) {\n if (element instanceof ElementNode && (!element.isConnected || element.isHidden)) {\n this.removeNode(element);\n } else {\n element.updateChildIndices();\n }\n }\n\n // Next, update dirty collection nodes.\n for (let element of this.dirtyNodes) {\n if (element instanceof ElementNode) {\n if (element.isConnected && !element.isHidden) {\n element.updateNode();\n this.addNode(element);\n }\n\n element.isMutated = false;\n }\n }\n\n this.dirtyNodes.clear();\n\n // Finally, update the collection.\n if (this.nextCollection) {\n this.nextCollection.commit(this.firstVisibleChild?.node.key ?? null, this.lastVisibleChild?.node.key ?? null, this.isSSR);\n if (!this.isSSR) {\n this.collection = this.nextCollection;\n this.nextCollection = null;\n }\n }\n }\n\n queueUpdate(): void {\n if (this.dirtyNodes.size === 0 || this.queuedRender) {\n return;\n }\n\n // Only trigger subscriptions once during an update, when the first item changes.\n // React's useSyncExternalStore will call getCollection immediately, to check whether the snapshot changed.\n // If so, React will queue a render to happen after the current commit to our fake DOM finishes.\n // We track whether getCollection is called in a subscription, and once it is called during render,\n // we reset queuedRender back to false.\n this.queuedRender = true;\n this.inSubscription = true;\n for (let fn of this.subscriptions) {\n fn();\n }\n this.inSubscription = false;\n }\n\n subscribe(fn: () => void) {\n this.subscriptions.add(fn);\n return (): boolean => this.subscriptions.delete(fn);\n }\n\n resetAfterSSR(): void {\n if (this.isSSR) {\n this.isSSR = false;\n this.firstChild = null;\n this.lastChild = null;\n this.nodeId = 0;\n }\n }\n}\n"],"names":[],"version":3,"file":"Document.module.js.map"}
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAyBM,MAAM;IAaX,CAAC,CAAC,OAAO,QAAQ,CAAC,GAA6B;QAC7C,IAAI,OAAO,IAAI,CAAC,UAAU;QAC1B,MAAO,KAAM;YACX,MAAM;YACN,OAAO,KAAK,WAAW;QACzB;IACF;IAEA,IAAI,aAAoC;QACtC,OAAO,IAAI,CAAC,WAAW;IACzB;IAEA,IAAI,WAAW,UAAiC,EAAE;QAChD,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI;IACnC;IAEA,IAAI,YAAmC;QACrC,OAAO,IAAI,CAAC,UAAU;IACxB;IAEA,IAAI,UAAU,SAAgC,EAAE;QAC9C,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI;IACnC;IAEA,IAAI,kBAAyC;QAC3C,OAAO,IAAI,CAAC,gBAAgB;IAC9B;IAEA,IAAI,gBAAgB,eAAsC,EAAE;QAC1D,IAAI,CA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EA,cAAoB;QAClB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,YAAY,EACjD;QAGF,iFAAiF;QACjF,2GAA2G;QAC3G,gGAAgG;QAChG,mGAAmG;QACnG,uCAAuC;QACvC,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,cAAc,GAAG;QACtB,KAAK,IAAI,MAAM,IAAI,CAAC,aAAa,CAC/B;QAEF,IAAI,CAAC,cAAc,GAAG;IACxB;IAEA,UAAU,EAAc,EAAE;QACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QACvB,OAAO,IAAe,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClD;IAEA,gBAAsB;QACpB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG;YACb,IAAI,CAAC,UAAU,GAAG;YAClB,IAAI,CAAC,SAAS,GAAG;YACjB,IAAI,CAAC,MAAM,GAAG;QAChB;IACF;IAxIA,YAAY,UAAa,CAAE;QACzB,aAAa;QACb,KAAK,CAAC,YAhBR,WAAW,GAAI,yBAAyB;eACxC,gBAAgC,IAAI,OACpC,aAA+B,IAAI,YACnC,QAAQ,YACR,SAAS,QACT,eAAgD,IAAI,gBACpD,YAAY,WACZ,kBAAkB,WAEV,iBAA2B,WAC3B,gBAAiC,IAAI,YACrC,eAAe,YACf,iBAAiB;QAKvB,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,cAAc,GAAG;IACxB;AAoIF","sources":["packages/@react-aria/collections/src/Document.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 {BaseCollection, CollectionNode, Mutable} from './BaseCollection';\nimport {CollectionNodeClass} from './CollectionBuilder';\nimport {CSSProperties, ForwardedRef, ReactElement, ReactNode} from 'react';\nimport {Node} from '@react-types/shared';\n\n// This Collection implementation is perhaps a little unusual. It works by rendering the React tree into a\n// Portal to a fake DOM implementation. This gives us efficient access to the tree of rendered objects, and\n// supports React features like composition and context. We use this fake DOM to access the full set of elements\n// before we render into the real DOM, which allows us to render a subset of the elements (e.g. virtualized scrolling),\n// and compute properties like the total number of items. It also enables keyboard navigation, selection, and other features.\n// React takes care of efficiently rendering components and updating the collection for us via this fake DOM.\n//\n// The DOM is a mutable API, and React expects the node instances to remain stable over time. So the implementation is split\n// into two parts. Each mutable fake DOM node owns an instance of an immutable collection node. When a fake DOM node is updated,\n// it queues a second render for the collection. Multiple updates to a collection can be queued at once. Collection nodes are\n// lazily copied on write, so only the changed nodes need to be cloned. During the second render, the new immutable collection\n// is finalized by updating the map of Key -> Node with the new cloned nodes. Then the new collection is frozen so it can no\n// longer be mutated, and returned to the calling component to render.\n\n/**\n * A mutable node in the fake DOM tree. When mutated, it marks itself as dirty\n * and queues an update with the owner document.\n */\nexport class BaseNode<T> {\n private _firstChild: ElementNode<T> | null = null;\n private _lastChild: ElementNode<T> | null = null;\n private _previousSibling: ElementNode<T> | null = null;\n private _nextSibling: ElementNode<T> | null = null;\n private _parentNode: BaseNode<T> | null = null;\n private _minInvalidChildIndex: ElementNode<T> | null = null;\n ownerDocument: Document<T, any>;\n\n constructor(ownerDocument: Document<T, any>) {\n this.ownerDocument = ownerDocument;\n }\n\n *[Symbol.iterator](): Iterator<ElementNode<T>> {\n let node = this.firstChild;\n while (node) {\n yield node;\n node = node.nextSibling;\n }\n }\n\n get firstChild(): ElementNode<T> | null {\n return this._firstChild;\n }\n\n set firstChild(firstChild: ElementNode<T> | null) {\n this._firstChild = firstChild;\n this.ownerDocument.markDirty(this);\n }\n\n get lastChild(): ElementNode<T> | null {\n return this._lastChild;\n }\n\n set lastChild(lastChild: ElementNode<T> | null) {\n this._lastChild = lastChild;\n this.ownerDocument.markDirty(this);\n }\n\n get previousSibling(): ElementNode<T> | null {\n return this._previousSibling;\n }\n\n set previousSibling(previousSibling: ElementNode<T> | null) {\n this._previousSibling = previousSibling;\n this.ownerDocument.markDirty(this);\n }\n\n get nextSibling(): ElementNode<T> | null {\n return this._nextSibling;\n }\n\n set nextSibling(nextSibling: ElementNode<T> | null) {\n this._nextSibling = nextSibling;\n this.ownerDocument.markDirty(this);\n }\n\n get parentNode(): BaseNode<T> | null {\n return this._parentNode;\n }\n\n set parentNode(parentNode: BaseNode<T> | null) {\n this._parentNode = parentNode;\n this.ownerDocument.markDirty(this);\n }\n\n get isConnected(): boolean {\n return this.parentNode?.isConnected || false;\n }\n\n private invalidateChildIndices(child: ElementNode<T>): void {\n if (this._minInvalidChildIndex == null || !this._minInvalidChildIndex.isConnected || child.index < this._minInvalidChildIndex.index) {\n this._minInvalidChildIndex = child;\n this.ownerDocument.markDirty(this);\n }\n }\n\n updateChildIndices(): void {\n let node = this._minInvalidChildIndex;\n while (node) {\n node.index = node.previousSibling ? node.previousSibling.index + 1 : 0;\n node = node.nextSibling;\n }\n this._minInvalidChildIndex = null;\n }\n\n appendChild(child: ElementNode<T>): void {\n if (child.parentNode) {\n child.parentNode.removeChild(child);\n }\n\n if (this.firstChild == null) {\n this.firstChild = child;\n }\n\n if (this.lastChild) {\n this.lastChild.nextSibling = child;\n child.index = this.lastChild.index + 1;\n child.previousSibling = this.lastChild;\n } else {\n child.previousSibling = null;\n child.index = 0;\n }\n\n child.parentNode = this;\n child.nextSibling = null;\n this.lastChild = child;\n\n this.ownerDocument.markDirty(this);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n insertBefore(newNode: ElementNode<T>, referenceNode: ElementNode<T>): void {\n if (referenceNode == null) {\n return this.appendChild(newNode);\n }\n\n if (newNode.parentNode) {\n newNode.parentNode.removeChild(newNode);\n }\n\n newNode.nextSibling = referenceNode;\n newNode.previousSibling = referenceNode.previousSibling;\n // Ensure that the newNode's index is less than that of the reference node so that\n // invalidateChildIndices will properly use the newNode as the _minInvalidChildIndex, thus making sure\n // we will properly update the indexes of all sibiling nodes after the newNode. The value here doesn't matter\n // since updateChildIndices should calculate the proper indexes.\n newNode.index = referenceNode.index - 1;\n if (this.firstChild === referenceNode) {\n this.firstChild = newNode;\n } else if (referenceNode.previousSibling) {\n referenceNode.previousSibling.nextSibling = newNode;\n }\n\n referenceNode.previousSibling = newNode;\n newNode.parentNode = referenceNode.parentNode;\n\n this.invalidateChildIndices(newNode);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n removeChild(child: ElementNode<T>): void {\n if (child.parentNode !== this || !this.ownerDocument.isMounted) {\n return;\n }\n\n if (this._minInvalidChildIndex === child) {\n this._minInvalidChildIndex = null;\n }\n\n if (child.nextSibling) {\n this.invalidateChildIndices(child.nextSibling);\n child.nextSibling.previousSibling = child.previousSibling;\n }\n\n if (child.previousSibling) {\n child.previousSibling.nextSibling = child.nextSibling;\n }\n\n if (this.firstChild === child) {\n this.firstChild = child.nextSibling;\n }\n\n if (this.lastChild === child) {\n this.lastChild = child.previousSibling;\n }\n\n child.parentNode = null;\n child.nextSibling = null;\n child.previousSibling = null;\n child.index = 0;\n\n this.ownerDocument.markDirty(child);\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n addEventListener(): void {}\n removeEventListener(): void {}\n\n get previousVisibleSibling(): ElementNode<T> | null {\n let node = this.previousSibling;\n while (node && node.isHidden) {\n node = node.previousSibling;\n }\n return node;\n }\n\n get nextVisibleSibling(): ElementNode<T> | null {\n let node = this.nextSibling;\n while (node && node.isHidden) {\n node = node.nextSibling;\n }\n return node;\n }\n\n get firstVisibleChild(): ElementNode<T> | null {\n let node = this.firstChild;\n while (node && node.isHidden) {\n node = node.nextSibling;\n }\n return node;\n }\n\n get lastVisibleChild(): ElementNode<T> | null {\n let node = this.lastChild;\n while (node && node.isHidden) {\n node = node.previousSibling;\n }\n return node;\n }\n}\n\n/**\n * A mutable element node in the fake DOM tree. It owns an immutable\n * Collection Node which is copied on write.\n */\nexport class ElementNode<T> extends BaseNode<T> {\n nodeType = 8; // COMMENT_NODE (we'd use ELEMENT_NODE but React DevTools will fail to get its dimensions)\n private _node: CollectionNode<T> | null;\n isMutated = true;\n private _index: number = 0;\n isHidden = false;\n\n constructor(type: string, ownerDocument: Document<T, any>) {\n super(ownerDocument);\n this._node = null;\n }\n\n get index(): number {\n return this._index;\n }\n\n set index(index: number) {\n this._index = index;\n this.ownerDocument.markDirty(this);\n }\n\n get level(): number {\n if (this.parentNode instanceof ElementNode) {\n return this.parentNode.level + (this.node?.type === 'item' ? 1 : 0);\n }\n\n return 0;\n }\n\n get node(): CollectionNode<T> {\n if (this._node == null) {\n throw Error('Attempted to access node before it was defined. Check if setProps wasn\\'t called before attempting to access the node.');\n }\n\n return this._node;\n }\n\n set node(node: CollectionNode<T>) {\n this._node = node;\n }\n\n /**\n * Lazily gets a mutable instance of a Node. If the node has already\n * been cloned during this update cycle, it just returns the existing one.\n */\n private getMutableNode(): Mutable<CollectionNode<T>> {\n if (!this.isMutated) {\n this.node = this.node.clone();\n this.isMutated = true;\n }\n\n this.ownerDocument.markDirty(this);\n return this.node;\n }\n\n updateNode(): void {\n let nextSibling = this.nextVisibleSibling;\n let node = this.getMutableNode();\n node.index = this.index;\n node.level = this.level;\n node.parentKey = this.parentNode instanceof ElementNode ? this.parentNode.node.key : null;\n node.prevKey = this.previousVisibleSibling?.node.key ?? null;\n node.nextKey = nextSibling?.node.key ?? null;\n node.hasChildNodes = !!this.firstChild;\n node.firstChildKey = this.firstVisibleChild?.node.key ?? null;\n node.lastChildKey = this.lastVisibleChild?.node.key ?? null;\n\n // Update the colIndex of sibling nodes if this node has a colSpan.\n if ((node.colSpan != null || node.colIndex != null) && nextSibling) {\n // This queues the next sibling for update, which means this happens recursively.\n let nextColIndex = (node.colIndex ?? node.index) + (node.colSpan ?? 1);\n if (nextColIndex !== nextSibling.node.colIndex) {\n let siblingNode = nextSibling.getMutableNode();\n siblingNode.colIndex = nextColIndex;\n }\n }\n }\n\n setProps<E extends Element>(obj: {[key: string]: any}, ref: ForwardedRef<E>, CollectionNodeClass: CollectionNodeClass<any>, rendered?: ReactNode, render?: (node: Node<T>) => ReactElement): void {\n let node;\n let {value, textValue, id, ...props} = obj;\n if (this._node == null) {\n node = new CollectionNodeClass(id ?? `react-aria-${++this.ownerDocument.nodeId}`);\n this.node = node;\n } else {\n node = this.getMutableNode();\n }\n\n props.ref = ref;\n node.props = props;\n node.rendered = rendered;\n node.render = render;\n node.value = value;\n node.textValue = textValue || (typeof props.children === 'string' ? props.children : '') || obj['aria-label'] || '';\n if (id != null && id !== node.key) {\n throw new Error('Cannot change the id of an item');\n }\n\n if (props.colSpan != null) {\n node.colSpan = props.colSpan;\n }\n\n if (this.isConnected) {\n this.ownerDocument.queueUpdate();\n }\n }\n\n get style(): CSSProperties {\n // React sets display: none to hide elements during Suspense.\n // We'll handle this by setting the element to hidden and invalidating\n // its siblings/parent. Hidden elements remain in the Document, but\n // are removed from the Collection.\n let element = this;\n return {\n get display() {\n return element.isHidden ? 'none' : '';\n },\n set display(value) {\n let isHidden = value === 'none';\n if (element.isHidden !== isHidden) {\n // Mark parent node dirty if this element is currently the first or last visible child.\n if (element.parentNode?.firstVisibleChild === element || element.parentNode?.lastVisibleChild === element) {\n element.ownerDocument.markDirty(element.parentNode);\n }\n\n // Mark sibling visible elements dirty.\n let prev = element.previousVisibleSibling;\n let next = element.nextVisibleSibling;\n if (prev) {\n element.ownerDocument.markDirty(prev);\n }\n if (next) {\n element.ownerDocument.markDirty(next);\n }\n\n // Mark self dirty.\n element.isHidden = isHidden;\n element.ownerDocument.markDirty(element);\n }\n }\n };\n }\n\n hasAttribute(): void {}\n setAttribute(): void {}\n setAttributeNS(): void {}\n removeAttribute(): void {}\n}\n\n/**\n * A mutable Document in the fake DOM. It owns an immutable Collection instance,\n * which is lazily copied on write during updates.\n */\nexport class Document<T, C extends BaseCollection<T> = BaseCollection<T>> extends BaseNode<T> {\n nodeType = 11; // DOCUMENT_FRAGMENT_NODE\n ownerDocument: Document<T, C> = this;\n dirtyNodes: Set<BaseNode<T>> = new Set();\n isSSR = false;\n nodeId = 0;\n nodesByProps: WeakMap<object, ElementNode<T>> = new WeakMap<object, ElementNode<T>>();\n isMounted = true;\n isInitialRender = true;\n private collection: C;\n private nextCollection: C | null = null;\n private subscriptions: Set<() => void> = new Set();\n private queuedRender = false;\n private inSubscription = false;\n\n constructor(collection: C) {\n // @ts-ignore\n super(null);\n this.collection = collection;\n this.nextCollection = collection;\n }\n\n get isConnected(): boolean {\n return this.isMounted;\n }\n\n createElement(type: string): ElementNode<T> {\n return new ElementNode(type, this);\n }\n\n private getMutableCollection() {\n if (!this.nextCollection) {\n this.nextCollection = this.collection.clone();\n }\n\n return this.nextCollection;\n }\n\n markDirty(node: BaseNode<T>): void {\n this.dirtyNodes.add(node);\n }\n\n private addNode(element: ElementNode<T>): void {\n if (element.isHidden) {\n return;\n }\n\n let collection = this.getMutableCollection();\n if (!collection.getItem(element.node.key)) {\n for (let child of element) {\n this.addNode(child);\n }\n }\n\n collection.addNode(element.node!);\n }\n\n private removeNode(node: ElementNode<T>): void {\n for (let child of node) {\n this.removeNode(child);\n }\n\n let collection = this.getMutableCollection();\n collection.removeNode(node.node.key);\n }\n\n /** Finalizes the collection update, updating all nodes and freezing the collection. */\n getCollection(): C {\n // If in a subscription update, return a clone of the existing collection.\n // This ensures React will queue a render. React will call getCollection again\n // during render, at which point all the updates will be complete and we can return\n // the new collection.\n if (this.inSubscription) {\n return this.collection.clone();\n }\n\n // Reset queuedRender to false when getCollection is called during render.\n this.queuedRender = false;\n\n this.updateCollection();\n return this.collection;\n }\n\n updateCollection(): void {\n // First, remove disconnected nodes and update the indices of dirty element children.\n for (let element of this.dirtyNodes) {\n if (element instanceof ElementNode && (!element.isConnected || element.isHidden)) {\n this.removeNode(element);\n } else {\n element.updateChildIndices();\n }\n }\n\n // Next, update dirty collection nodes.\n for (let element of this.dirtyNodes) {\n if (element instanceof ElementNode) {\n if (element.isConnected && !element.isHidden) {\n element.updateNode();\n this.addNode(element);\n }\n\n element.isMutated = false;\n }\n }\n\n this.dirtyNodes.clear();\n\n // Finally, update the collection.\n if (this.nextCollection) {\n this.nextCollection.commit(this.firstVisibleChild?.node.key ?? null, this.lastVisibleChild?.node.key ?? null, this.isSSR);\n if (!this.isSSR) {\n this.collection = this.nextCollection;\n this.nextCollection = null;\n }\n }\n\n if (this.isInitialRender) {\n this.collection.isComplete = false;\n }\n }\n\n queueUpdate(): void {\n if (this.dirtyNodes.size === 0 || this.queuedRender) {\n return;\n }\n\n // Only trigger subscriptions once during an update, when the first item changes.\n // React's useSyncExternalStore will call getCollection immediately, to check whether the snapshot changed.\n // If so, React will queue a render to happen after the current commit to our fake DOM finishes.\n // We track whether getCollection is called in a subscription, and once it is called during render,\n // we reset queuedRender back to false.\n this.queuedRender = true;\n this.inSubscription = true;\n for (let fn of this.subscriptions) {\n fn();\n }\n this.inSubscription = false;\n }\n\n subscribe(fn: () => void) {\n this.subscriptions.add(fn);\n return (): boolean => this.subscriptions.delete(fn);\n }\n\n resetAfterSSR(): void {\n if (this.isSSR) {\n this.isSSR = false;\n this.firstChild = null;\n this.lastChild = null;\n this.nodeId = 0;\n }\n }\n}\n"],"names":[],"version":3,"file":"Document.module.js.map"}
|
package/dist/import.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Collection as $e1995378a142960e$export$fb8073518f34e6ec, CollectionBuilder as $e1995378a142960e$export$bf788dd355e3a401, createBranchComponent as $e1995378a142960e$export$e953bb1cd0f19726, createLeafComponent as $e1995378a142960e$export$18af5c7a9e9b3664} from "./CollectionBuilder.mjs";
|
|
2
2
|
import {createHideableComponent as $f39a9eba43920ace$export$86427a43e3e48ebb, useIsHidden as $f39a9eba43920ace$export$b5d7cc18bb8d2b59} from "./Hidden.mjs";
|
|
3
3
|
import {useCachedChildren as $e948873055cbafe4$export$727c8fc270210f13} from "./useCachedChildren.mjs";
|
|
4
|
-
import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionNode as $23b9f4fcf0fe224b$export$d68d59712b04d9d1} from "./BaseCollection.mjs";
|
|
4
|
+
import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionNode as $23b9f4fcf0fe224b$export$d68d59712b04d9d1, FilterableNode as $23b9f4fcf0fe224b$export$b1918e978f1ee46f, HeaderNode as $23b9f4fcf0fe224b$export$5ae2504e948afce5, ItemNode as $23b9f4fcf0fe224b$export$fd11f34e1d07f134, LoaderNode as $23b9f4fcf0fe224b$export$8258a0665a675899, SectionNode as $23b9f4fcf0fe224b$export$437f11dc9b403b78} from "./BaseCollection.mjs";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright 2024 Adobe. All rights reserved.
|
|
@@ -19,5 +19,5 @@ import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionN
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
export {$e1995378a142960e$export$bf788dd355e3a401 as CollectionBuilder, $e1995378a142960e$export$fb8073518f34e6ec as Collection, $e1995378a142960e$export$18af5c7a9e9b3664 as createLeafComponent, $e1995378a142960e$export$e953bb1cd0f19726 as createBranchComponent, $f39a9eba43920ace$export$86427a43e3e48ebb as createHideableComponent, $f39a9eba43920ace$export$b5d7cc18bb8d2b59 as useIsHidden, $e948873055cbafe4$export$727c8fc270210f13 as useCachedChildren, $23b9f4fcf0fe224b$export$408d25a4e12db025 as BaseCollection, $23b9f4fcf0fe224b$export$d68d59712b04d9d1 as CollectionNode};
|
|
22
|
+
export {$e1995378a142960e$export$bf788dd355e3a401 as CollectionBuilder, $e1995378a142960e$export$fb8073518f34e6ec as Collection, $e1995378a142960e$export$18af5c7a9e9b3664 as createLeafComponent, $e1995378a142960e$export$e953bb1cd0f19726 as createBranchComponent, $f39a9eba43920ace$export$86427a43e3e48ebb as createHideableComponent, $f39a9eba43920ace$export$b5d7cc18bb8d2b59 as useIsHidden, $e948873055cbafe4$export$727c8fc270210f13 as useCachedChildren, $23b9f4fcf0fe224b$export$408d25a4e12db025 as BaseCollection, $23b9f4fcf0fe224b$export$d68d59712b04d9d1 as CollectionNode, $23b9f4fcf0fe224b$export$fd11f34e1d07f134 as ItemNode, $23b9f4fcf0fe224b$export$437f11dc9b403b78 as SectionNode, $23b9f4fcf0fe224b$export$b1918e978f1ee46f as FilterableNode, $23b9f4fcf0fe224b$export$8258a0665a675899 as LoaderNode, $23b9f4fcf0fe224b$export$5ae2504e948afce5 as HeaderNode};
|
|
23
23
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -17,6 +17,11 @@ $parcel$export(module.exports, "useIsHidden", () => $eaaf60978b89fc58$exports.us
|
|
|
17
17
|
$parcel$export(module.exports, "useCachedChildren", () => $245f3f827bea6653$exports.useCachedChildren);
|
|
18
18
|
$parcel$export(module.exports, "BaseCollection", () => $499e2959ba1abacc$exports.BaseCollection);
|
|
19
19
|
$parcel$export(module.exports, "CollectionNode", () => $499e2959ba1abacc$exports.CollectionNode);
|
|
20
|
+
$parcel$export(module.exports, "ItemNode", () => $499e2959ba1abacc$exports.ItemNode);
|
|
21
|
+
$parcel$export(module.exports, "SectionNode", () => $499e2959ba1abacc$exports.SectionNode);
|
|
22
|
+
$parcel$export(module.exports, "FilterableNode", () => $499e2959ba1abacc$exports.FilterableNode);
|
|
23
|
+
$parcel$export(module.exports, "LoaderNode", () => $499e2959ba1abacc$exports.LoaderNode);
|
|
24
|
+
$parcel$export(module.exports, "HeaderNode", () => $499e2959ba1abacc$exports.HeaderNode);
|
|
20
25
|
/*
|
|
21
26
|
* Copyright 2024 Adobe. All rights reserved.
|
|
22
27
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
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, Collection, createLeafComponent, createBranchComponent} from './CollectionBuilder';\nexport {createHideableComponent, useIsHidden} from './Hidden';\nexport {useCachedChildren} from './useCachedChildren';\nexport {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from './BaseCollection';\n\nexport type {CollectionBuilderProps, CollectionProps} from './CollectionBuilder';\nexport type {CachedChildrenOptions} from './useCachedChildren';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Collection as $e1995378a142960e$export$fb8073518f34e6ec, CollectionBuilder as $e1995378a142960e$export$bf788dd355e3a401, createBranchComponent as $e1995378a142960e$export$e953bb1cd0f19726, createLeafComponent as $e1995378a142960e$export$18af5c7a9e9b3664} from "./CollectionBuilder.module.js";
|
|
2
2
|
import {createHideableComponent as $f39a9eba43920ace$export$86427a43e3e48ebb, useIsHidden as $f39a9eba43920ace$export$b5d7cc18bb8d2b59} from "./Hidden.module.js";
|
|
3
3
|
import {useCachedChildren as $e948873055cbafe4$export$727c8fc270210f13} from "./useCachedChildren.module.js";
|
|
4
|
-
import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionNode as $23b9f4fcf0fe224b$export$d68d59712b04d9d1} from "./BaseCollection.module.js";
|
|
4
|
+
import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionNode as $23b9f4fcf0fe224b$export$d68d59712b04d9d1, FilterableNode as $23b9f4fcf0fe224b$export$b1918e978f1ee46f, HeaderNode as $23b9f4fcf0fe224b$export$5ae2504e948afce5, ItemNode as $23b9f4fcf0fe224b$export$fd11f34e1d07f134, LoaderNode as $23b9f4fcf0fe224b$export$8258a0665a675899, SectionNode as $23b9f4fcf0fe224b$export$437f11dc9b403b78} from "./BaseCollection.module.js";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright 2024 Adobe. All rights reserved.
|
|
@@ -19,5 +19,5 @@ import {BaseCollection as $23b9f4fcf0fe224b$export$408d25a4e12db025, CollectionN
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
export {$e1995378a142960e$export$bf788dd355e3a401 as CollectionBuilder, $e1995378a142960e$export$fb8073518f34e6ec as Collection, $e1995378a142960e$export$18af5c7a9e9b3664 as createLeafComponent, $e1995378a142960e$export$e953bb1cd0f19726 as createBranchComponent, $f39a9eba43920ace$export$86427a43e3e48ebb as createHideableComponent, $f39a9eba43920ace$export$b5d7cc18bb8d2b59 as useIsHidden, $e948873055cbafe4$export$727c8fc270210f13 as useCachedChildren, $23b9f4fcf0fe224b$export$408d25a4e12db025 as BaseCollection, $23b9f4fcf0fe224b$export$d68d59712b04d9d1 as CollectionNode};
|
|
22
|
+
export {$e1995378a142960e$export$bf788dd355e3a401 as CollectionBuilder, $e1995378a142960e$export$fb8073518f34e6ec as Collection, $e1995378a142960e$export$18af5c7a9e9b3664 as createLeafComponent, $e1995378a142960e$export$e953bb1cd0f19726 as createBranchComponent, $f39a9eba43920ace$export$86427a43e3e48ebb as createHideableComponent, $f39a9eba43920ace$export$b5d7cc18bb8d2b59 as useIsHidden, $e948873055cbafe4$export$727c8fc270210f13 as useCachedChildren, $23b9f4fcf0fe224b$export$408d25a4e12db025 as BaseCollection, $23b9f4fcf0fe224b$export$d68d59712b04d9d1 as CollectionNode, $23b9f4fcf0fe224b$export$fd11f34e1d07f134 as ItemNode, $23b9f4fcf0fe224b$export$437f11dc9b403b78 as SectionNode, $23b9f4fcf0fe224b$export$b1918e978f1ee46f as FilterableNode, $23b9f4fcf0fe224b$export$8258a0665a675899 as LoaderNode, $23b9f4fcf0fe224b$export$5ae2504e948afce5 as HeaderNode};
|
|
23
23
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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, Collection, createLeafComponent, createBranchComponent} from './CollectionBuilder';\nexport {createHideableComponent, useIsHidden} from './Hidden';\nexport {useCachedChildren} from './useCachedChildren';\nexport {BaseCollection, CollectionNode} from './BaseCollection';\n\nexport type {CollectionBuilderProps, CollectionProps} from './CollectionBuilder';\nexport type {CachedChildrenOptions} from './useCachedChildren';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
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, Collection, createLeafComponent, createBranchComponent} from './CollectionBuilder';\nexport {createHideableComponent, useIsHidden} from './Hidden';\nexport {useCachedChildren} from './useCachedChildren';\nexport {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from './BaseCollection';\n\nexport type {CollectionBuilderProps, CollectionProps} from './CollectionBuilder';\nexport type {CachedChildrenOptions} from './useCachedChildren';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Collection as _Collection1, Key, Node } from "@react-types/shared";
|
|
2
2
|
import React, { ReactElement, ReactNode, ForwardedRef, JSX } from "react";
|
|
3
|
+
type FilterFn<T> = (textValue: string, node: Node<T>) => boolean;
|
|
3
4
|
/** An immutable object representing a Node in a Collection. */
|
|
4
5
|
export class CollectionNode<T> implements Node<T> {
|
|
6
|
+
static readonly type: string;
|
|
5
7
|
readonly type: string;
|
|
6
8
|
readonly key: Key;
|
|
7
9
|
readonly value: T | null;
|
|
@@ -20,9 +22,27 @@ export class CollectionNode<T> implements Node<T> {
|
|
|
20
22
|
readonly render?: (node: Node<any>) => ReactElement;
|
|
21
23
|
readonly colSpan: number | null;
|
|
22
24
|
readonly colIndex: number | null;
|
|
23
|
-
constructor(
|
|
25
|
+
constructor(key: Key);
|
|
24
26
|
get childNodes(): Iterable<Node<T>>;
|
|
25
|
-
clone():
|
|
27
|
+
clone(): this;
|
|
28
|
+
filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null;
|
|
29
|
+
}
|
|
30
|
+
export class FilterableNode<T> extends CollectionNode<T> {
|
|
31
|
+
filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null;
|
|
32
|
+
}
|
|
33
|
+
export class HeaderNode extends CollectionNode<unknown> {
|
|
34
|
+
static readonly type = "header";
|
|
35
|
+
}
|
|
36
|
+
export class LoaderNode extends CollectionNode<unknown> {
|
|
37
|
+
static readonly type = "loader";
|
|
38
|
+
}
|
|
39
|
+
export class ItemNode<T> extends FilterableNode<T> {
|
|
40
|
+
static readonly type = "item";
|
|
41
|
+
filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): ItemNode<T> | null;
|
|
42
|
+
}
|
|
43
|
+
export class SectionNode<T> extends FilterableNode<T> {
|
|
44
|
+
static readonly type = "section";
|
|
45
|
+
filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): SectionNode<T> | null;
|
|
26
46
|
}
|
|
27
47
|
/**
|
|
28
48
|
* An immutable Collection implementation. Updates are only allowed
|
|
@@ -30,6 +50,7 @@ export class CollectionNode<T> implements Node<T> {
|
|
|
30
50
|
* custom collection behaviors.
|
|
31
51
|
*/
|
|
32
52
|
export class BaseCollection<T> implements _Collection1<Node<T>> {
|
|
53
|
+
isComplete: boolean;
|
|
33
54
|
get size(): number;
|
|
34
55
|
getKeys(): IterableIterator<Key>;
|
|
35
56
|
[Symbol.iterator](): IterableIterator<Node<T>>;
|
|
@@ -42,9 +63,10 @@ export class BaseCollection<T> implements _Collection1<Node<T>> {
|
|
|
42
63
|
at(): Node<T>;
|
|
43
64
|
clone(): this;
|
|
44
65
|
addNode(node: CollectionNode<T>): void;
|
|
66
|
+
addDescendants(node: CollectionNode<T>, oldCollection: BaseCollection<T>): void;
|
|
45
67
|
removeNode(key: Key): void;
|
|
46
68
|
commit(firstKey: Key | null, lastKey: Key | null, isSSR?: boolean): void;
|
|
47
|
-
|
|
69
|
+
filter(filterFn: FilterFn<T>): this;
|
|
48
70
|
}
|
|
49
71
|
export interface CachedChildrenOptions<T> {
|
|
50
72
|
/** Item objects in the collection. */
|
|
@@ -76,11 +98,15 @@ export interface CollectionBuilderProps<C extends BaseCollection<object>> {
|
|
|
76
98
|
* Builds a `Collection` from the children provided to the `content` prop, and passes it to the child render prop function.
|
|
77
99
|
*/
|
|
78
100
|
export function CollectionBuilder<C extends BaseCollection<object>>(props: CollectionBuilderProps<C>): ReactElement;
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
type CollectionNodeClass<T> = {
|
|
102
|
+
new (key: Key): CollectionNode<T>;
|
|
103
|
+
readonly type: string;
|
|
104
|
+
};
|
|
105
|
+
export function createLeafComponent<T extends object, P extends object, E extends Element>(CollectionNodeClass: CollectionNodeClass<any> | string, render: (props: P, ref: ForwardedRef<E>) => ReactElement | null): (props: P & React.RefAttributes<T>) => ReactElement | null;
|
|
106
|
+
export function createLeafComponent<T extends object, P extends object, E extends Element>(CollectionNodeClass: CollectionNodeClass<any> | string, render: (props: P, ref: ForwardedRef<E>, node: Node<T>) => ReactElement | null): (props: P & React.RefAttributes<T>) => ReactElement | null;
|
|
81
107
|
export function createBranchComponent<T extends object, P extends {
|
|
82
108
|
children?: any;
|
|
83
|
-
}, E extends Element>(
|
|
109
|
+
}, E extends Element>(CollectionNodeClass: CollectionNodeClass<any> | string, render: (props: P, ref: ForwardedRef<E>, node: Node<T>) => ReactElement | null, useChildren?: (props: P) => ReactNode): (props: P & React.RefAttributes<E>) => ReactElement | null;
|
|
84
110
|
export interface CollectionProps<T> extends CachedChildrenOptions<T> {
|
|
85
111
|
}
|
|
86
112
|
/** A Collection renders a list of items, automatically managing caching and keys. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAmBA,+DAA+D;AAC/D,4BAA4B,CAAC,CAAE,YAAW,KAAK,CAAC,CAAC;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,KAA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AC,GAAG,MAAM,aAAa,CAAC,CAAC,CAAC,KAAK,YAAY,GAAG,IAAI,CAAC;AAgC/R,sCAAsC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,qBAAqB,oBAAoB,GAAG,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,YAAY,GAAG,IAAI,EAAE,WAAW,GAAE,CAAC,KAAK,EAAE,CAAC,KAAK,SAAiC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,aAAa,CAAC,CAAC,CAAC,KAAK,YAAY,GAAG,IAAI,CASvW;AAMD,iCAAiC,CAAC,CAAE,SAAQ,sBAAsB,CAAC,CAAC;CAAG;AAIvE,qFAAqF;AACrF,2BAA2B,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,OAAO,CA2BnF","sources":["packages/@react-aria/collections/src/packages/@react-aria/collections/src/BaseCollection.ts","packages/@react-aria/collections/src/packages/@react-aria/collections/src/Document.ts","packages/@react-aria/collections/src/packages/@react-aria/collections/src/useCachedChildren.ts","packages/@react-aria/collections/src/packages/@react-aria/collections/src/Hidden.tsx","packages/@react-aria/collections/src/packages/@react-aria/collections/src/CollectionBuilder.tsx","packages/@react-aria/collections/src/packages/@react-aria/collections/src/index.ts","packages/@react-aria/collections/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\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, Collection, createLeafComponent, createBranchComponent} from './CollectionBuilder';\nexport {createHideableComponent, useIsHidden} from './Hidden';\nexport {useCachedChildren} from './useCachedChildren';\nexport {BaseCollection, CollectionNode, ItemNode, SectionNode, FilterableNode, LoaderNode, HeaderNode} from './BaseCollection';\n\nexport type {CollectionBuilderProps, CollectionProps} from './CollectionBuilder';\nexport type {CachedChildrenOptions} from './useCachedChildren';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/collections",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.5",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"url": "https://github.com/adobe/react-spectrum"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@react-aria/interactions": "^3.25.
|
|
29
|
+
"@react-aria/interactions": "^3.25.5",
|
|
30
30
|
"@react-aria/ssr": "^3.9.10",
|
|
31
|
-
"@react-aria/utils": "^3.30.
|
|
32
|
-
"@react-types/shared": "^3.
|
|
31
|
+
"@react-aria/utils": "^3.30.1",
|
|
32
|
+
"@react-types/shared": "^3.32.0",
|
|
33
33
|
"@swc/helpers": "^0.5.0",
|
|
34
34
|
"use-sync-external-store": "^1.4.0"
|
|
35
35
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
|
|
44
44
|
}
|