UEA-PRODEM
This commit is contained in:
+7
-7
@@ -1,5 +1,5 @@
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
|
||||
type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
@@ -78,21 +78,21 @@ type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTML
|
||||
element: ItemElement;
|
||||
};
|
||||
type ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends BaseItemData = BaseItemData>(name: string): readonly [{
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData & BaseItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData & BaseItemData>>>];
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & BaseItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, {
|
||||
createCollectionScope: _radix_ui_react_context.CreateScope;
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData & BaseItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData & BaseItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData & BaseItemData>>>];
|
||||
}];
|
||||
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps$1 as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
import * as _radix_ui_react_context from '@radix-ui/react-context';
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Slot } from '@radix-ui/react-slot';
|
||||
|
||||
type SlotProps$1 = React.ComponentPropsWithoutRef<typeof Slot>;
|
||||
@@ -78,21 +78,21 @@ type ItemDataWithElement<ItemData extends BaseItemData, ItemElement extends HTML
|
||||
element: ItemElement;
|
||||
};
|
||||
type ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<ItemElement, ItemDataWithElement<ItemData, ItemElement>>;
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends BaseItemData = BaseItemData>(name: string): readonly [{
|
||||
declare function createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string): readonly [{
|
||||
readonly Provider: React.FC<{
|
||||
children?: React.ReactNode;
|
||||
scope: any;
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
state?: [ItemMap: ItemMap<ItemElement, ItemData & BaseItemData>, SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData & BaseItemData>>>];
|
||||
}>;
|
||||
readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
|
||||
readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & BaseItemData & {
|
||||
children: React.ReactNode;
|
||||
scope: any;
|
||||
}> & React.RefAttributes<ItemElement>>;
|
||||
}, {
|
||||
createCollectionScope: _radix_ui_react_context.CreateScope;
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>];
|
||||
useCollection: (scope: any) => ItemMap<ItemElement, ItemData & BaseItemData>;
|
||||
useInitCollection: () => [ItemMap<ItemElement, ItemData & BaseItemData>, React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData & BaseItemData>>>];
|
||||
}];
|
||||
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps$1 as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
export { type CollectionProps$1 as CollectionProps, createCollection$1 as createCollection, type CollectionProps as unstable_CollectionProps, createCollection as unstable_createCollection };
|
||||
|
||||
+19
-19
@@ -37,7 +37,7 @@ __export(index_exports, {
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/collection-legacy.tsx
|
||||
var import_react = __toESM(require("react"));
|
||||
var React = __toESM(require("react"));
|
||||
var import_react_context = require("@radix-ui/react-context");
|
||||
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
||||
var import_react_slot = require("@radix-ui/react-slot");
|
||||
@@ -51,14 +51,14 @@ function createCollection(name) {
|
||||
);
|
||||
const CollectionProvider = (props) => {
|
||||
const { scope, children } = props;
|
||||
const ref = import_react.default.useRef(null);
|
||||
const itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
|
||||
const ref = React.useRef(null);
|
||||
const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
||||
};
|
||||
CollectionProvider.displayName = PROVIDER_NAME;
|
||||
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
||||
const CollectionSlotImpl = (0, import_react_slot.createSlot)(COLLECTION_SLOT_NAME);
|
||||
const CollectionSlot = import_react.default.forwardRef(
|
||||
const CollectionSlot = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children } = props;
|
||||
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
||||
@@ -70,13 +70,13 @@ function createCollection(name) {
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = (0, import_react_slot.createSlot)(ITEM_SLOT_NAME);
|
||||
const CollectionItemSlot = import_react.default.forwardRef(
|
||||
const CollectionItemSlot = React.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children, ...itemData } = props;
|
||||
const ref = import_react.default.useRef(null);
|
||||
const ref = React.useRef(null);
|
||||
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
||||
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
||||
import_react.default.useEffect(() => {
|
||||
React.useEffect(() => {
|
||||
context.itemMap.set(ref, { ref, ...itemData });
|
||||
return () => void context.itemMap.delete(ref);
|
||||
});
|
||||
@@ -86,7 +86,7 @@ function createCollection(name) {
|
||||
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
||||
function useCollection(scope) {
|
||||
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
||||
const getItems = import_react.default.useCallback(() => {
|
||||
const getItems = React.useCallback(() => {
|
||||
const collectionNode = context.collectionRef.current;
|
||||
if (!collectionNode) return [];
|
||||
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
||||
@@ -106,7 +106,7 @@ function createCollection(name) {
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
var import_react2 = __toESM(require("react"));
|
||||
var React2 = __toESM(require("react"));
|
||||
var import_react_context2 = require("@radix-ui/react-context");
|
||||
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
||||
var import_react_slot2 = require("@radix-ui/react-slot");
|
||||
@@ -442,13 +442,13 @@ function createCollection2(name) {
|
||||
CollectionInit.displayName = PROVIDER_NAME + "Init";
|
||||
const CollectionProviderImpl = (props) => {
|
||||
const { scope, children, state } = props;
|
||||
const ref = import_react2.default.useRef(null);
|
||||
const [collectionElement, setCollectionElement] = import_react2.default.useState(
|
||||
const ref = React2.useRef(null);
|
||||
const [collectionElement, setCollectionElement] = React2.useState(
|
||||
null
|
||||
);
|
||||
const composeRefs = (0, import_react_compose_refs2.useComposedRefs)(ref, setCollectionElement);
|
||||
const [itemMap, setItemMap] = state;
|
||||
import_react2.default.useEffect(() => {
|
||||
React2.useEffect(() => {
|
||||
if (!collectionElement) return;
|
||||
const observer = getChildListObserver(() => {
|
||||
});
|
||||
@@ -476,7 +476,7 @@ function createCollection2(name) {
|
||||
CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
|
||||
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
||||
const CollectionSlotImpl = (0, import_react_slot2.createSlot)(COLLECTION_SLOT_NAME);
|
||||
const CollectionSlot = import_react2.default.forwardRef(
|
||||
const CollectionSlot = React2.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children } = props;
|
||||
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
||||
@@ -488,20 +488,20 @@ function createCollection2(name) {
|
||||
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
||||
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
||||
const CollectionItemSlotImpl = (0, import_react_slot2.createSlot)(ITEM_SLOT_NAME);
|
||||
const CollectionItemSlot = import_react2.default.forwardRef(
|
||||
const CollectionItemSlot = React2.forwardRef(
|
||||
(props, forwardedRef) => {
|
||||
const { scope, children, ...itemData } = props;
|
||||
const ref = import_react2.default.useRef(null);
|
||||
const [element, setElement] = import_react2.default.useState(null);
|
||||
const ref = React2.useRef(null);
|
||||
const [element, setElement] = React2.useState(null);
|
||||
const composedRefs = (0, import_react_compose_refs2.useComposedRefs)(forwardedRef, ref, setElement);
|
||||
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
||||
const { setItemMap } = context;
|
||||
const itemDataRef = import_react2.default.useRef(itemData);
|
||||
const itemDataRef = React2.useRef(itemData);
|
||||
if (!shallowEqual(itemDataRef.current, itemData)) {
|
||||
itemDataRef.current = itemData;
|
||||
}
|
||||
const memoizedItemData = itemDataRef.current;
|
||||
import_react2.default.useEffect(() => {
|
||||
React2.useEffect(() => {
|
||||
const itemData2 = memoizedItemData;
|
||||
setItemMap((map) => {
|
||||
if (!element) {
|
||||
@@ -528,7 +528,7 @@ function createCollection2(name) {
|
||||
);
|
||||
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
||||
function useInitCollection() {
|
||||
return import_react2.default.useState(new OrderedDict());
|
||||
return React2.useState(new OrderedDict());
|
||||
}
|
||||
function useCollection(scope) {
|
||||
const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
// src/collection-legacy.tsx
|
||||
import React from "react";
|
||||
import * as React from "react";
|
||||
import { createContextScope } from "@radix-ui/react-context";
|
||||
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
||||
import { createSlot } from "@radix-ui/react-slot";
|
||||
@@ -70,7 +70,7 @@ function createCollection(name) {
|
||||
}
|
||||
|
||||
// src/collection.tsx
|
||||
import React2 from "react";
|
||||
import * as React2 from "react";
|
||||
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
||||
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
||||
import { createSlot as createSlot2 } from "@radix-ui/react-slot";
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user