@radix-ui/react-collection 1.1.12 → 1.1.13-rc.1784603841447

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/index.js CHANGED
@@ -6,6 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
10
  var __export = (target, all) => {
10
11
  for (var name in all)
11
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -42,6 +43,7 @@ var import_react_context = require("@radix-ui/react-context");
42
43
  var import_react_compose_refs = require("@radix-ui/react-compose-refs");
43
44
  var import_react_slot = require("@radix-ui/react-slot");
44
45
  var import_jsx_runtime = require("react/jsx-runtime");
46
+ // @__NO_SIDE_EFFECTS__
45
47
  function createCollection(name) {
46
48
  const PROVIDER_NAME = name + "CollectionProvider";
47
49
  const [createCollectionContext, createCollectionScope] = (0, import_react_context.createContextScope)(PROVIDER_NAME);
@@ -49,12 +51,12 @@ function createCollection(name) {
49
51
  PROVIDER_NAME,
50
52
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
51
53
  );
52
- const CollectionProvider = (props) => {
54
+ const CollectionProvider = /* @__PURE__ */ __name((props) => {
53
55
  const { scope, children } = props;
54
56
  const ref = React.useRef(null);
55
57
  const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
56
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
57
- };
59
+ }, "CollectionProvider");
58
60
  CollectionProvider.displayName = PROVIDER_NAME;
59
61
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
60
62
  const CollectionSlotImpl = (0, import_react_slot.createSlot)(COLLECTION_SLOT_NAME);
@@ -98,12 +100,14 @@ function createCollection(name) {
98
100
  }, [context.collectionRef, context.itemMap]);
99
101
  return getItems;
100
102
  }
103
+ __name(useCollection, "useCollection");
101
104
  return [
102
105
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
103
106
  useCollection,
104
107
  createCollectionScope
105
108
  ];
106
109
  }
110
+ __name(createCollection, "createCollection");
107
111
 
108
112
  // src/collection.tsx
109
113
  var React2 = __toESM(require("react"));
@@ -114,6 +118,9 @@ var import_react_slot2 = require("@radix-ui/react-slot");
114
118
  // src/ordered-dictionary.ts
115
119
  var __instanciated = /* @__PURE__ */ new WeakMap();
116
120
  var OrderedDict = class _OrderedDict extends Map {
121
+ static {
122
+ __name(this, "OrderedDict");
123
+ }
117
124
  #keys;
118
125
  constructor(entries) {
119
126
  super(entries);
@@ -406,18 +413,22 @@ function at(array, index) {
406
413
  const actualIndex = toSafeIndex(array, index);
407
414
  return actualIndex === -1 ? void 0 : array[actualIndex];
408
415
  }
416
+ __name(at, "at");
409
417
  function toSafeIndex(array, index) {
410
418
  const length = array.length;
411
419
  const relativeIndex = toSafeInteger(index);
412
420
  const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
413
421
  return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
414
422
  }
423
+ __name(toSafeIndex, "toSafeIndex");
415
424
  function toSafeInteger(number) {
416
425
  return number !== number || number === 0 ? 0 : Math.trunc(number);
417
426
  }
427
+ __name(toSafeInteger, "toSafeInteger");
418
428
 
419
429
  // src/collection.tsx
420
430
  var import_jsx_runtime2 = require("react/jsx-runtime");
431
+ // @__NO_SIDE_EFFECTS__
421
432
  function createCollection2(name) {
422
433
  const PROVIDER_NAME = name + "CollectionProvider";
423
434
  const [createCollectionContext, createCollectionScope] = (0, import_react_context2.createContextScope)(PROVIDER_NAME);
@@ -428,19 +439,19 @@ function createCollection2(name) {
428
439
  collectionRef: { current: null },
429
440
  collectionRefObject: { current: null },
430
441
  itemMap: new OrderedDict(),
431
- setItemMap: () => void 0
442
+ setItemMap: /* @__PURE__ */ __name(() => void 0, "setItemMap")
432
443
  }
433
444
  );
434
- const CollectionProvider = ({ state, ...props }) => {
445
+ const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => {
435
446
  return state ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionInit, { ...props });
436
- };
447
+ }, "CollectionProvider");
437
448
  CollectionProvider.displayName = PROVIDER_NAME;
438
- const CollectionInit = (props) => {
449
+ const CollectionInit = /* @__PURE__ */ __name((props) => {
439
450
  const state = useInitCollection();
440
451
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollectionProviderImpl, { ...props, state });
441
- };
452
+ }, "CollectionInit");
442
453
  CollectionInit.displayName = PROVIDER_NAME + "Init";
443
- const CollectionProviderImpl = (props) => {
454
+ const CollectionProviderImpl = /* @__PURE__ */ __name((props) => {
444
455
  const { scope, children, state } = props;
445
456
  const ref = React2.useRef(null);
446
457
  const [collectionElement, setCollectionElement] = React2.useState(
@@ -472,7 +483,7 @@ function createCollection2(name) {
472
483
  children
473
484
  }
474
485
  );
475
- };
486
+ }, "CollectionProviderImpl");
476
487
  CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
477
488
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
478
489
  const CollectionSlotImpl = (0, import_react_slot2.createSlot)(COLLECTION_SLOT_NAME);
@@ -530,10 +541,12 @@ function createCollection2(name) {
530
541
  function useInitCollection() {
531
542
  return React2.useState(new OrderedDict());
532
543
  }
544
+ __name(useInitCollection, "useInitCollection");
533
545
  function useCollection(scope) {
534
546
  const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
535
547
  return itemMap;
536
548
  }
549
+ __name(useCollection, "useCollection");
537
550
  const functions = {
538
551
  createCollectionScope,
539
552
  useCollection,
@@ -544,6 +557,7 @@ function createCollection2(name) {
544
557
  functions
545
558
  ];
546
559
  }
560
+ __name(createCollection2, "createCollection");
547
561
  function shallowEqual(a, b) {
548
562
  if (a === b) return true;
549
563
  if (typeof a !== "object" || typeof b !== "object") return false;
@@ -557,12 +571,15 @@ function shallowEqual(a, b) {
557
571
  }
558
572
  return true;
559
573
  }
574
+ __name(shallowEqual, "shallowEqual");
560
575
  function isElementPreceding(a, b) {
561
576
  return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
562
577
  }
578
+ __name(isElementPreceding, "isElementPreceding");
563
579
  function sortByDocumentPosition(a, b) {
564
580
  return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
565
581
  }
582
+ __name(sortByDocumentPosition, "sortByDocumentPosition");
566
583
  function getChildListObserver(callback) {
567
584
  const observer = new MutationObserver((mutationsList) => {
568
585
  for (const mutation of mutationsList) {
@@ -574,4 +591,5 @@ function getChildListObserver(callback) {
574
591
  });
575
592
  return observer;
576
593
  }
594
+ __name(getChildListObserver, "getChildListObserver");
577
595
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"],
4
- "sourcesContent": ["'use client';\nexport { createCollection } from './collection-legacy';\nexport type { CollectionProps } from './collection-legacy';\n\nexport { createCollection as unstable_createCollection } from './collection';\nexport type { CollectionProps as unstable_CollectionProps } from './collection';\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData, ItemElement>\n>;\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface ContextValue {\n collectionElement: CollectionElement | null;\n collectionRef: React.Ref<CollectionElement | null>;\n collectionRefObject: React.RefObject<CollectionElement | null>;\n itemMap: ItemMap<ItemElement, AllItemData>;\n setItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>;\n }\n\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0,\n },\n );\n\n type CollectionState = [\n ItemMap: ItemMap<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state?: CollectionState;\n }> = ({ state, ...props }) => {\n return state ? (\n <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return <CollectionProviderImpl {...props} state={state} />;\n };\n CollectionInit.displayName = PROVIDER_NAME + 'Init';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n\n React.useEffect(() => {\n if (!collectionElement) return;\n\n const observer = getChildListObserver(() => {\n // setItemMap((map) => {\n // const copy = new OrderedDict(map).toSorted(([, a], [, b]) =>\n // !a.element || !b.element ? 0 : isElementPreceding(a.element, b.element) ? -1 : 1\n // );\n // // check if the order has changed\n // let index = -1;\n // for (const entry of copy) {\n // index++;\n // const key = map.keyAt(index)!;\n // const [copyKey] = entry;\n // if (key !== copyKey) {\n // // order has changed!\n // return copy;\n // }\n // }\n // return map;\n // });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n\n return (\n <CollectionContextProvider\n scope={scope}\n itemMap={itemMap}\n setItemMap={setItemMap}\n collectionRef={composeRefs}\n collectionRefObject={ref}\n collectionElement={collectionElement}\n >\n {children}\n </CollectionContextProvider>\n );\n };\n\n CollectionProviderImpl.displayName = PROVIDER_NAME + 'Impl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const [element, setElement] = React.useState<ItemElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setItemMap } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n React.useEffect(() => {\n const itemData = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n\n if (!map.has(element)) {\n map.set(element, { ...(itemData as unknown as AllItemData), element });\n return map.toSorted(sortByDocumentPosition);\n }\n\n return map\n .set(element, { ...(itemData as unknown as AllItemData), element })\n .toSorted(sortByDocumentPosition);\n });\n\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<ItemMap<ItemElement, AllItemData>>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { itemMap } = useCollectionContext(name + 'CollectionConsumer', scope);\n\n return itemMap;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction sortByDocumentPosition<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<ItemMap<E, T>>,\n b: EntryOf<ItemMap<E, T>>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n\n if (safeIndex === this.size || (has && safeIndex === this.size - 1) || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n\n const size = this.size + (has ? 0 : 1);\n\n // If you insert at, say, -2, without this bit you'd replace the\n // second-to-last item and push the rest up one, which means the new item is\n // 3rd to last. This isn't very intuitive; inserting at -2 is more like\n // saying \"make this item the second to last\".\n if (relativeIndex < 0) {\n actualIndex++;\n }\n\n const keys = [...this.#keys];\n let nextValue: V | undefined;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i]!;\n if (keys[i] === key) {\n nextKey = keys[i + 1]!;\n }\n if (has) {\n // delete first to ensure that the item is moved to the end\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1]!;\n const currentValue = nextValue!;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0)!;\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: [K, V],\n currentValue: U,\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1)!;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index)!;\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V> {\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict<K, V> {\n const reversed = new OrderedDict<K, V>();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict<K, V>();\n let stop = this.size - 1;\n\n if (start === undefined) {\n return result;\n }\n\n if (start < 0) {\n start = start + this.size;\n }\n\n if (end !== undefined && end > 0) {\n stop = end - 1;\n }\n\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n result.set(key, element);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike<any>, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mCAAAA;AAAA;AAAA;;;ACAA,YAAuB;AACv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O;AAC1D,QAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAEA,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAEA,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AAEA,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
4
+ "sourcesContent": ["'use client';\nexport { createCollection } from './collection-legacy';\nexport type { CollectionProps } from './collection-legacy';\n\nexport { createCollection as unstable_createCollection } from './collection';\nexport type { CollectionProps as unstable_CollectionProps } from './collection';\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData = {},\n>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData, ItemElement>\n>;\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData extends {} = {},\n>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface ContextValue {\n collectionElement: CollectionElement | null;\n collectionRef: React.Ref<CollectionElement | null>;\n collectionRefObject: React.RefObject<CollectionElement | null>;\n itemMap: ItemMap<ItemElement, AllItemData>;\n setItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>;\n }\n\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0,\n },\n );\n\n type CollectionState = [\n ItemMap: ItemMap<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state?: CollectionState;\n }> = ({ state, ...props }) => {\n return state ? (\n <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return <CollectionProviderImpl {...props} state={state} />;\n };\n CollectionInit.displayName = PROVIDER_NAME + 'Init';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n\n React.useEffect(() => {\n if (!collectionElement) return;\n\n const observer = getChildListObserver(() => {\n // setItemMap((map) => {\n // const copy = new OrderedDict(map).toSorted(([, a], [, b]) =>\n // !a.element || !b.element ? 0 : isElementPreceding(a.element, b.element) ? -1 : 1\n // );\n // // check if the order has changed\n // let index = -1;\n // for (const entry of copy) {\n // index++;\n // const key = map.keyAt(index)!;\n // const [copyKey] = entry;\n // if (key !== copyKey) {\n // // order has changed!\n // return copy;\n // }\n // }\n // return map;\n // });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n\n return (\n <CollectionContextProvider\n scope={scope}\n itemMap={itemMap}\n setItemMap={setItemMap}\n collectionRef={composeRefs}\n collectionRefObject={ref}\n collectionElement={collectionElement}\n >\n {children}\n </CollectionContextProvider>\n );\n };\n\n CollectionProviderImpl.displayName = PROVIDER_NAME + 'Impl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const [element, setElement] = React.useState<ItemElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setItemMap } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n React.useEffect(() => {\n const itemData = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n\n if (!map.has(element)) {\n map.set(element, { ...(itemData as unknown as AllItemData), element });\n return map.toSorted(sortByDocumentPosition);\n }\n\n return map\n .set(element, { ...(itemData as unknown as AllItemData), element })\n .toSorted(sortByDocumentPosition);\n });\n\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<ItemMap<ItemElement, AllItemData>>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { itemMap } = useCollectionContext(name + 'CollectionConsumer', scope);\n\n return itemMap;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction sortByDocumentPosition<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<ItemMap<E, T>>,\n b: EntryOf<ItemMap<E, T>>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n\n if (safeIndex === this.size || (has && safeIndex === this.size - 1) || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n\n const size = this.size + (has ? 0 : 1);\n\n // If you insert at, say, -2, without this bit you'd replace the\n // second-to-last item and push the rest up one, which means the new item is\n // 3rd to last. This isn't very intuitive; inserting at -2 is more like\n // saying \"make this item the second to last\".\n if (relativeIndex < 0) {\n actualIndex++;\n }\n\n const keys = [...this.#keys];\n let nextValue: V | undefined;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i]!;\n if (keys[i] === key) {\n nextKey = keys[i + 1]!;\n }\n if (has) {\n // delete first to ensure that the item is moved to the end\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1]!;\n const currentValue = nextValue!;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0)!;\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: [K, V],\n currentValue: U,\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1)!;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index)!;\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V> {\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict<K, V> {\n const reversed = new OrderedDict<K, V>();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict<K, V>();\n let stop = this.size - 1;\n\n if (start === undefined) {\n return result;\n }\n\n if (start < 0) {\n start = start + this.size;\n }\n\n if (end !== undefined && end > 0) {\n stop = end - 1;\n }\n\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n result.set(key, element);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike<any>, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mCAAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,gCAAgC;AAChC,wBAAsC;AA0ChC;AAAA;AA7BqB,SAAS,iBAGlC,MAAc;AAKd,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,QAAI,yCAAmB,aAAa;AAUzF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,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAZS;AAcT,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAFS;AAIT,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AATS;AAWT,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAXS;",
6
6
  "names": ["createCollection", "React", "import_react_context", "import_react_compose_refs", "import_react_slot", "import_jsx_runtime", "createCollection", "itemData"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
2
4
 
3
5
  // src/collection-legacy.tsx
4
6
  import * as React from "react";
@@ -6,6 +8,7 @@ import { createContextScope } from "@radix-ui/react-context";
6
8
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
7
9
  import { createSlot } from "@radix-ui/react-slot";
8
10
  import { jsx } from "react/jsx-runtime";
11
+ // @__NO_SIDE_EFFECTS__
9
12
  function createCollection(name) {
10
13
  const PROVIDER_NAME = name + "CollectionProvider";
11
14
  const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
@@ -13,12 +16,12 @@ function createCollection(name) {
13
16
  PROVIDER_NAME,
14
17
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
15
18
  );
16
- const CollectionProvider = (props) => {
19
+ const CollectionProvider = /* @__PURE__ */ __name((props) => {
17
20
  const { scope, children } = props;
18
21
  const ref = React.useRef(null);
19
22
  const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
20
23
  return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
21
- };
24
+ }, "CollectionProvider");
22
25
  CollectionProvider.displayName = PROVIDER_NAME;
23
26
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
24
27
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
@@ -62,12 +65,14 @@ function createCollection(name) {
62
65
  }, [context.collectionRef, context.itemMap]);
63
66
  return getItems;
64
67
  }
68
+ __name(useCollection, "useCollection");
65
69
  return [
66
70
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
67
71
  useCollection,
68
72
  createCollectionScope
69
73
  ];
70
74
  }
75
+ __name(createCollection, "createCollection");
71
76
 
72
77
  // src/collection.tsx
73
78
  import * as React2 from "react";
@@ -78,6 +83,9 @@ import { createSlot as createSlot2 } from "@radix-ui/react-slot";
78
83
  // src/ordered-dictionary.ts
79
84
  var __instanciated = /* @__PURE__ */ new WeakMap();
80
85
  var OrderedDict = class _OrderedDict extends Map {
86
+ static {
87
+ __name(this, "OrderedDict");
88
+ }
81
89
  #keys;
82
90
  constructor(entries) {
83
91
  super(entries);
@@ -370,18 +378,22 @@ function at(array, index) {
370
378
  const actualIndex = toSafeIndex(array, index);
371
379
  return actualIndex === -1 ? void 0 : array[actualIndex];
372
380
  }
381
+ __name(at, "at");
373
382
  function toSafeIndex(array, index) {
374
383
  const length = array.length;
375
384
  const relativeIndex = toSafeInteger(index);
376
385
  const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
377
386
  return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
378
387
  }
388
+ __name(toSafeIndex, "toSafeIndex");
379
389
  function toSafeInteger(number) {
380
390
  return number !== number || number === 0 ? 0 : Math.trunc(number);
381
391
  }
392
+ __name(toSafeInteger, "toSafeInteger");
382
393
 
383
394
  // src/collection.tsx
384
395
  import { jsx as jsx2 } from "react/jsx-runtime";
396
+ // @__NO_SIDE_EFFECTS__
385
397
  function createCollection2(name) {
386
398
  const PROVIDER_NAME = name + "CollectionProvider";
387
399
  const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);
@@ -392,19 +404,19 @@ function createCollection2(name) {
392
404
  collectionRef: { current: null },
393
405
  collectionRefObject: { current: null },
394
406
  itemMap: new OrderedDict(),
395
- setItemMap: () => void 0
407
+ setItemMap: /* @__PURE__ */ __name(() => void 0, "setItemMap")
396
408
  }
397
409
  );
398
- const CollectionProvider = ({ state, ...props }) => {
410
+ const CollectionProvider = /* @__PURE__ */ __name(({ state, ...props }) => {
399
411
  return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });
400
- };
412
+ }, "CollectionProvider");
401
413
  CollectionProvider.displayName = PROVIDER_NAME;
402
- const CollectionInit = (props) => {
414
+ const CollectionInit = /* @__PURE__ */ __name((props) => {
403
415
  const state = useInitCollection();
404
416
  return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });
405
- };
417
+ }, "CollectionInit");
406
418
  CollectionInit.displayName = PROVIDER_NAME + "Init";
407
- const CollectionProviderImpl = (props) => {
419
+ const CollectionProviderImpl = /* @__PURE__ */ __name((props) => {
408
420
  const { scope, children, state } = props;
409
421
  const ref = React2.useRef(null);
410
422
  const [collectionElement, setCollectionElement] = React2.useState(
@@ -436,7 +448,7 @@ function createCollection2(name) {
436
448
  children
437
449
  }
438
450
  );
439
- };
451
+ }, "CollectionProviderImpl");
440
452
  CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
441
453
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
442
454
  const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);
@@ -494,10 +506,12 @@ function createCollection2(name) {
494
506
  function useInitCollection() {
495
507
  return React2.useState(new OrderedDict());
496
508
  }
509
+ __name(useInitCollection, "useInitCollection");
497
510
  function useCollection(scope) {
498
511
  const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope);
499
512
  return itemMap;
500
513
  }
514
+ __name(useCollection, "useCollection");
501
515
  const functions = {
502
516
  createCollectionScope,
503
517
  useCollection,
@@ -508,6 +522,7 @@ function createCollection2(name) {
508
522
  functions
509
523
  ];
510
524
  }
525
+ __name(createCollection2, "createCollection");
511
526
  function shallowEqual(a, b) {
512
527
  if (a === b) return true;
513
528
  if (typeof a !== "object" || typeof b !== "object") return false;
@@ -521,12 +536,15 @@ function shallowEqual(a, b) {
521
536
  }
522
537
  return true;
523
538
  }
539
+ __name(shallowEqual, "shallowEqual");
524
540
  function isElementPreceding(a, b) {
525
541
  return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
526
542
  }
543
+ __name(isElementPreceding, "isElementPreceding");
527
544
  function sortByDocumentPosition(a, b) {
528
545
  return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
529
546
  }
547
+ __name(sortByDocumentPosition, "sortByDocumentPosition");
530
548
  function getChildListObserver(callback) {
531
549
  const observer = new MutationObserver((mutationsList) => {
532
550
  for (const mutation of mutationsList) {
@@ -538,6 +556,7 @@ function getChildListObserver(callback) {
538
556
  });
539
557
  return observer;
540
558
  }
559
+ __name(getChildListObserver, "getChildListObserver");
541
560
  export {
542
561
  createCollection,
543
562
  createCollection2 as unstable_createCollection
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/collection-legacy.tsx", "../src/collection.tsx", "../src/ordered-dictionary.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData, ItemElement>\n>;\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData extends {} = {}>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface ContextValue {\n collectionElement: CollectionElement | null;\n collectionRef: React.Ref<CollectionElement | null>;\n collectionRefObject: React.RefObject<CollectionElement | null>;\n itemMap: ItemMap<ItemElement, AllItemData>;\n setItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>;\n }\n\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0,\n },\n );\n\n type CollectionState = [\n ItemMap: ItemMap<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state?: CollectionState;\n }> = ({ state, ...props }) => {\n return state ? (\n <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return <CollectionProviderImpl {...props} state={state} />;\n };\n CollectionInit.displayName = PROVIDER_NAME + 'Init';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n\n React.useEffect(() => {\n if (!collectionElement) return;\n\n const observer = getChildListObserver(() => {\n // setItemMap((map) => {\n // const copy = new OrderedDict(map).toSorted(([, a], [, b]) =>\n // !a.element || !b.element ? 0 : isElementPreceding(a.element, b.element) ? -1 : 1\n // );\n // // check if the order has changed\n // let index = -1;\n // for (const entry of copy) {\n // index++;\n // const key = map.keyAt(index)!;\n // const [copyKey] = entry;\n // if (key !== copyKey) {\n // // order has changed!\n // return copy;\n // }\n // }\n // return map;\n // });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n\n return (\n <CollectionContextProvider\n scope={scope}\n itemMap={itemMap}\n setItemMap={setItemMap}\n collectionRef={composeRefs}\n collectionRefObject={ref}\n collectionElement={collectionElement}\n >\n {children}\n </CollectionContextProvider>\n );\n };\n\n CollectionProviderImpl.displayName = PROVIDER_NAME + 'Impl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const [element, setElement] = React.useState<ItemElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setItemMap } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n React.useEffect(() => {\n const itemData = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n\n if (!map.has(element)) {\n map.set(element, { ...(itemData as unknown as AllItemData), element });\n return map.toSorted(sortByDocumentPosition);\n }\n\n return map\n .set(element, { ...(itemData as unknown as AllItemData), element })\n .toSorted(sortByDocumentPosition);\n });\n\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<ItemMap<ItemElement, AllItemData>>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { itemMap } = useCollectionContext(name + 'CollectionConsumer', scope);\n\n return itemMap;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction sortByDocumentPosition<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<ItemMap<E, T>>,\n b: EntryOf<ItemMap<E, T>>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n\n if (safeIndex === this.size || (has && safeIndex === this.size - 1) || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n\n const size = this.size + (has ? 0 : 1);\n\n // If you insert at, say, -2, without this bit you'd replace the\n // second-to-last item and push the rest up one, which means the new item is\n // 3rd to last. This isn't very intuitive; inserting at -2 is more like\n // saying \"make this item the second to last\".\n if (relativeIndex < 0) {\n actualIndex++;\n }\n\n const keys = [...this.#keys];\n let nextValue: V | undefined;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i]!;\n if (keys[i] === key) {\n nextKey = keys[i + 1]!;\n }\n if (has) {\n // delete first to ensure that the item is moved to the end\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1]!;\n const currentValue = nextValue!;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0)!;\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: [K, V],\n currentValue: U,\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1)!;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index)!;\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V> {\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict<K, V> {\n const reversed = new OrderedDict<K, V>();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict<K, V>();\n let stop = this.size - 1;\n\n if (start === undefined) {\n return result;\n }\n\n if (start < 0) {\n start = start + this.size;\n }\n\n if (end !== undefined && end > 0) {\n stop = end - 1;\n }\n\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n result.set(key, element);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike<any>, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 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CAAC;AAC3B,MAAI,MAAM,WAAW,MAAM,OAAQ,QAAO;AAC1C,aAAW,OAAO,OAAO;AACvB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,GAAG,GAAG,EAAG,QAAO;AAC1D,QAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAEA,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAEA,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AAEA,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData = {},\n>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() },\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData, ItemElement>\n>;\n\n/* @__NO_SIDE_EFFECTS__ */ function createCollection<\n ItemElement extends HTMLElement,\n ItemData extends {} = {},\n>(name: string) {\n type AllItemData = ItemData & BaseItemData;\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n interface ContextValue {\n collectionElement: CollectionElement | null;\n collectionRef: React.Ref<CollectionElement | null>;\n collectionRefObject: React.RefObject<CollectionElement | null>;\n itemMap: ItemMap<ItemElement, AllItemData>;\n setItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>;\n }\n\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0,\n },\n );\n\n type CollectionState = [\n ItemMap: ItemMap<ItemElement, AllItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, AllItemData>>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state?: CollectionState;\n }> = ({ state, ...props }) => {\n return state ? (\n <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return <CollectionProviderImpl {...props} state={state} />;\n };\n CollectionInit.displayName = PROVIDER_NAME + 'Init';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\n null,\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n\n React.useEffect(() => {\n if (!collectionElement) return;\n\n const observer = getChildListObserver(() => {\n // setItemMap((map) => {\n // const copy = new OrderedDict(map).toSorted(([, a], [, b]) =>\n // !a.element || !b.element ? 0 : isElementPreceding(a.element, b.element) ? -1 : 1\n // );\n // // check if the order has changed\n // let index = -1;\n // for (const entry of copy) {\n // index++;\n // const key = map.keyAt(index)!;\n // const [copyKey] = entry;\n // if (key !== copyKey) {\n // // order has changed!\n // return copy;\n // }\n // }\n // return map;\n // });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n\n return (\n <CollectionContextProvider\n scope={scope}\n itemMap={itemMap}\n setItemMap={setItemMap}\n collectionRef={composeRefs}\n collectionRefObject={ref}\n collectionElement={collectionElement}\n >\n {children}\n </CollectionContextProvider>\n );\n };\n\n CollectionProviderImpl.displayName = PROVIDER_NAME + 'Impl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n },\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = AllItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const [element, setElement] = React.useState<ItemElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setItemMap } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n React.useEffect(() => {\n const itemData = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n\n if (!map.has(element)) {\n map.set(element, { ...(itemData as unknown as AllItemData), element });\n return map.toSorted(sortByDocumentPosition);\n }\n\n return map\n .set(element, { ...(itemData as unknown as AllItemData), element })\n .toSorted(sortByDocumentPosition);\n });\n\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n },\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<ItemMap<ItemElement, AllItemData>>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { itemMap } = useCollectionContext(name + 'CollectionConsumer', scope);\n\n return itemMap;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction sortByDocumentPosition<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<ItemMap<E, T>>,\n b: EntryOf<ItemMap<E, T>>,\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n\n if (safeIndex === this.size || (has && safeIndex === this.size - 1) || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n\n const size = this.size + (has ? 0 : 1);\n\n // If you insert at, say, -2, without this bit you'd replace the\n // second-to-last item and push the rest up one, which means the new item is\n // 3rd to last. This isn't very intuitive; inserting at -2 is more like\n // saying \"make this item the second to last\".\n if (relativeIndex < 0) {\n actualIndex++;\n }\n\n const keys = [...this.#keys];\n let nextValue: V | undefined;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i]!;\n if (keys[i] === key) {\n nextKey = keys[i + 1]!;\n }\n if (has) {\n // delete first to ensure that the item is moved to the end\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1]!;\n const currentValue = nextValue!;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any,\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any,\n ): OrderedDict<K, U> {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0)!;\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => [K, V],\n initialValue: [K, V],\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: [K, V],\n currentValue: U,\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n initialValue: U,\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>,\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1)!;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index)!;\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V> {\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict<K, V> {\n const reversed = new OrderedDict<K, V>();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict<K, V>();\n let stop = this.size - 1;\n\n if (start === undefined) {\n return result;\n }\n\n if (start < 0) {\n start = start + this.size;\n }\n\n if (end !== undefined && end > 0) {\n stop = end - 1;\n }\n\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n result.set(key, element);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any,\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike<any>, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n"],
5
+ "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,kBAA6B;AA0ChC;AAAA;AA7BqB,SAAS,iBAGlC,MAAc;AAKd,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,IAAI,mBAAmB,aAAa;AAUzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,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AC1D,QAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAG,QAAO;AAAA,EAChC;AACA,SAAO;AACT;AAZS;AAcT,SAAS,mBAAmB,GAAY,GAAY;AAClD,SAAO,CAAC,EAAE,EAAE,wBAAwB,CAAC,IAAI,KAAK;AAChD;AAFS;AAIT,SAAS,uBACP,GACA,GACA;AACA,SAAO,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,UAC1B,IACA,mBAAmB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,IAC3C,KACA;AACR;AATS;AAWT,SAAS,qBAAqB,UAAsB;AAClD,QAAM,WAAW,IAAI,iBAAiB,CAAC,kBAAkB;AACvD,eAAW,YAAY,eAAe;AACpC,UAAI,SAAS,SAAS,aAAa;AACjC,iBAAS;AACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAXS;",
6
6
  "names": ["React", "createContextScope", "useComposedRefs", "createSlot", "jsx", "createCollection", "createContextScope", "useComposedRefs", "createSlot", "itemData"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-collection",
3
- "version": "1.1.12",
3
+ "version": "1.1.13-rc.1784603841447",
4
4
  "license": "MIT",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -13,14 +13,14 @@
13
13
  "dependencies": {
14
14
  "@radix-ui/react-compose-refs": "1.1.3",
15
15
  "@radix-ui/react-context": "1.2.0",
16
- "@radix-ui/react-primitive": "2.1.7",
17
- "@radix-ui/react-slot": "1.3.0"
16
+ "@radix-ui/react-primitive": "2.1.8-rc.1784603841447",
17
+ "@radix-ui/react-slot": "1.4.0-rc.1784603841447"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/react": "^19.2.2",
21
- "@types/react-dom": "^19.2.2",
22
- "react": "^19.2.0",
23
- "react-dom": "^19.2.0",
20
+ "@types/react": "^19.2.17",
21
+ "@types/react-dom": "^19.2.3",
22
+ "react": "^19.2.7",
23
+ "react-dom": "^19.2.7",
24
24
  "typescript": "^5.9.3",
25
25
  "@repo/builder": "0.0.0",
26
26
  "@repo/typescript-config": "0.0.0"