Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-stately/collections

Package Overview
Dependencies
Maintainers
2
Versions
813
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/collections - npm Package Compare versions

Comparing version 3.10.9 to 3.11.0

18

dist/CollectionBuilder.main.js

@@ -31,3 +31,7 @@ var $ioO2y$react = require("react");

let { children: children, items: items } = props;
if (typeof children === 'function') {
if ((0, ($parcel$interopDefault($ioO2y$react))).isValidElement(children) && children.type === (0, ($parcel$interopDefault($ioO2y$react))).Fragment) yield* this.iterateCollection({
children: children.props.children,
items: items
});
else if (typeof children === 'function') {
if (!items) throw new Error('props.children was a function but props.items is missing');

@@ -75,2 +79,14 @@ for (let item of props.items)yield* this.getFullNode({

*getFullNode(partialNode, state, parentKey, parentNode) {
if ((0, ($parcel$interopDefault($ioO2y$react))).isValidElement(partialNode.element) && partialNode.element.type === (0, ($parcel$interopDefault($ioO2y$react))).Fragment) {
let children = [];
(0, ($parcel$interopDefault($ioO2y$react))).Children.forEach(partialNode.element.props.children, (child)=>{
children.push(child);
});
let index = partialNode.index;
for (const child of children)yield* this.getFullNode({
element: child,
index: index++
}, state, parentKey, parentNode);
return;
}
// If there's a value instead of an element on the node, and a parent renderer function is available,

@@ -77,0 +93,0 @@ // use it to render an element for the value.

@@ -21,3 +21,7 @@ import $fzaAv$react from "react";

let { children: children, items: items } = props;
if (typeof children === 'function') {
if ((0, $fzaAv$react).isValidElement(children) && children.type === (0, $fzaAv$react).Fragment) yield* this.iterateCollection({
children: children.props.children,
items: items
});
else if (typeof children === 'function') {
if (!items) throw new Error('props.children was a function but props.items is missing');

@@ -65,2 +69,14 @@ for (let item of props.items)yield* this.getFullNode({

*getFullNode(partialNode, state, parentKey, parentNode) {
if ((0, $fzaAv$react).isValidElement(partialNode.element) && partialNode.element.type === (0, $fzaAv$react).Fragment) {
let children = [];
(0, $fzaAv$react).Children.forEach(partialNode.element.props.children, (child)=>{
children.push(child);
});
let index = partialNode.index;
for (const child of children)yield* this.getFullNode({
element: child,
index: index++
}, state, parentKey, parentNode);
return;
}
// If there's a value instead of an element on the node, and a parent renderer function is available,

@@ -67,0 +83,0 @@ // use it to render an element for the value.

9

package.json
{
"name": "@react-stately/collections",
"version": "3.10.9",
"version": "3.11.0",
"description": "Spectrum UI components in React",

@@ -25,3 +25,3 @@ "license": "Apache-2.0",

"dependencies": {
"@react-types/shared": "^3.24.1",
"@react-types/shared": "^3.25.0",
"@swc/helpers": "^0.5.0"

@@ -34,4 +34,3 @@ },

"access": "public"
},
"gitHead": "f0aa6aacee60af265dc8994b9274ccf072a850aa"
}
}
}

@@ -30,6 +30,11 @@ /*

private *iterateCollection(props: CollectionBase<T>) {
private *iterateCollection(props: CollectionBase<T>): Generator<Node<T>> {
let {children, items} = props;
if (typeof children === 'function') {
if (React.isValidElement<{children: CollectionElement<T>}>(children) && children.type === React.Fragment) {
yield* this.iterateCollection({
children: children.props.children,
items
});
} else if (typeof children === 'function') {
if (!items) {

@@ -94,2 +99,21 @@ throw new Error('props.children was a function but props.items is missing');

private *getFullNode(partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key, parentNode?: Node<T>): Generator<Node<T>> {
if (React.isValidElement<{children: CollectionElement<T>}>(partialNode.element) && partialNode.element.type === React.Fragment) {
let children: CollectionElement<T>[] = [];
React.Children.forEach(partialNode.element.props.children, child => {
children.push(child);
});
let index = partialNode.index;
for (const child of children) {
yield* this.getFullNode({
element: child,
index: index++
}, state, parentKey, parentNode);
}
return;
}
// If there's a value instead of an element on the node, and a parent renderer function is available,

@@ -96,0 +120,0 @@ // use it to render an element for the value.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc