Socket
Socket
Sign inDemoInstall

@react-stately/collections

Package Overview
Dependencies
Maintainers
2
Versions
744
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.0.0-nightly.3086 to 3.0.0-nightly.3094

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.

6

package.json
{
"name": "@react-stately/collections",
"version": "3.0.0-nightly.3086+8f3c0ea09",
"version": "3.0.0-nightly.3094+b4093dfef",
"description": "Spectrum UI components in React",

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

"dependencies": {
"@react-types/shared": "3.0.0-nightly.3086+8f3c0ea09",
"@react-types/shared": "3.0.0-nightly.3094+b4093dfef",
"@swc/helpers": "^0.5.0"

@@ -35,3 +35,3 @@ },

},
"gitHead": "8f3c0ea0931107eceba0127fb524b79b46eb838b"
"gitHead": "b4093dfef3eff0e5fe60d00c53fe2478b96e662f"
}

@@ -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