@tamagui/collection 1.70.0 → 1.72.0

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.
@@ -25,32 +25,36 @@ __export(Collection_exports, {
25
25
  createCollection: () => createCollection
26
26
  });
27
27
  module.exports = __toCommonJS(Collection_exports);
28
- var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_react = __toESM(require("react")), import_jsx_runtime = require("react/jsx-runtime");
28
+ var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_react = __toESM(require("react")), import_jsx_runtime = require("react/jsx-runtime");
29
29
  function createCollection(name) {
30
- const PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = (0, import_create_context.createContextScope)(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
30
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } = (0, import_core.createStyledContext)({
31
31
  collectionRef: { current: null },
32
32
  itemMap: /* @__PURE__ */ new Map()
33
33
  }), CollectionProvider = (props) => {
34
- const { scope, children } = props, ref = import_react.default.useRef(null), itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
35
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
34
+ const { __scopeCollection, children } = props, ref = import_react.default.useRef(null), itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
35
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
36
+ CollectionProviderImpl,
37
+ {
38
+ scope: __scopeCollection,
39
+ itemMap,
40
+ collectionRef: ref,
41
+ children
42
+ }
43
+ );
36
44
  };
37
- CollectionProvider.displayName = PROVIDER_NAME;
38
- const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = import_react.default.forwardRef(
39
- (props, forwardedRef) => {
40
- const { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
41
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { ref: composedRefs, children });
42
- }
43
- );
45
+ CollectionProvider.displayName = "CollectionProvider";
46
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = import_react.default.forwardRef((props, forwardedRef) => {
47
+ const { __scopeCollection, children } = props, context = useCollectionContext(__scopeCollection), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { ref: composedRefs, children });
49
+ });
44
50
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
45
- const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = import_react.default.forwardRef(
46
- (props, forwardedRef) => {
47
- const { scope, children, ...itemData } = props, ref = import_react.default.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
48
- return import_react.default.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
49
- }
50
- );
51
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = import_react.default.forwardRef((props, forwardedRef) => {
52
+ const { __scopeCollection, children, ...itemData } = props, ref = import_react.default.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), context = useCollectionContext(__scopeCollection);
53
+ return import_react.default.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
54
+ });
51
55
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
52
- function useCollection(scope) {
53
- const context = useCollectionContext(name + "CollectionConsumer", scope);
56
+ function useCollection(__scopeCollection) {
57
+ const context = useCollectionContext(__scopeCollection);
54
58
  return import_react.default.useCallback(() => {
55
59
  if (!import_core.isWeb)
56
60
  return [];
@@ -67,8 +71,7 @@ function createCollection(name) {
67
71
  }
68
72
  return [
69
73
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
70
- useCollection,
71
- createCollectionScope
74
+ useCollection
72
75
  ];
73
76
  }
74
77
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Collection.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgC,kCAChC,cAA4C,0BAC5C,wBAAmC,oCACnC,eAAkB,2BA6CZ;AAhCN,SAAS,iBACP,MACA;AAKA,QAAM,gBAAgB,OAAO,sBACvB,CAAC,yBAAyB,qBAAqB,QACnD,0CAAmB,aAAa,GAU5B,CAAC,wBAAwB,oBAAoB,IACjD,wBAAsC,eAAe;AAAA,IACnD,eAAe,EAAE,SAAS,KAAK;AAAA,IAC/B,SAAS,oBAAI,IAAI;AAAA,EACnB,CAAC,GAEG,qBAA2E,CAC/E,UACG;AACH,UAAM,EAAE,OAAO,SAAS,IAAI,OACtB,MAAM,aAAAA,QAAM,OAA0B,IAAI,GAC1C,UAAU,aAAAA,QAAM,OAAgC,oBAAI,IAAI,CAAC,EAAE;AACjE,WACE,4CAAC,0BAAuB,OAAc,SAAkB,eAAe,KACpE,UACH;AAAA,EAEJ;AAEA,qBAAmB,cAAc;AAMjC,QAAM,uBAAuB,OAAO,kBAE9B,iBAAiB,aAAAA,QAAM;AAAA,IAC3B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,SAAS,IAA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AAA,QAAM,UAAU,OACd,QAAQ,QAAQ,IAAI,KAAK,EAAE,KAAK,GAAI,SAAiC,CAAC,GAC/D,MAAM,KAAK,QAAQ,QAAQ,OAAO,GAAG,EAC7C,GAGC,4CAAC,oBAAW,CAAC,cAAc,GAAG,IAAM,KAAK,cACtC,UACH;AAAA,EAEJ,CAAC;AAED,qBAAmB,cAAc;AAMjC,WAAS,cAAc,mBAAwB;AAC7C,UAAM,UAAU,qBAAqB,iBAAiB;AAqBtD,WAnBiB,aAAAA,QAAM,YAAY,MAAM;AACvC,UAAI,CAAC;AACH,eAAO,CAAC;AAGV,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC;AAAgB,eAAO,CAAC;AAC7B,YAAM,eAAe,MAAM;AAAA,QACzB,eAAe,iBAAiB,IAAI,cAAc,GAAG;AAAA,MACvD;AAOA,aANc,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC,EACtB;AAAA,QACzB,CAAC,GAAG,MACF,aAAa,QAAQ,EAAE,IAAI,OAAuB,IAClD,aAAa,QAAQ,EAAE,IAAI,OAAuB;AAAA,MACtD;AAAA,IAEF,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAAA,EAG7C;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,EACF;AACF;",
5
5
  "names": ["React"]
6
6
  }
@@ -26,32 +26,36 @@ __export(Collection_exports, {
26
26
  createCollection: () => createCollection
27
27
  });
28
28
  module.exports = __toCommonJS(Collection_exports);
29
- var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_react = __toESM(require("react")), import_jsx_runtime = require("react/jsx-runtime");
29
+ var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_react = __toESM(require("react")), import_jsx_runtime = require("react/jsx-runtime");
30
30
  function createCollection(name) {
31
- const PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = (0, import_create_context.createContextScope)(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
31
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } = (0, import_core.createStyledContext)({
32
32
  collectionRef: { current: null },
33
33
  itemMap: /* @__PURE__ */ new Map()
34
34
  }), CollectionProvider = (props) => {
35
- const { scope, children } = props, ref = import_react.default.useRef(null), itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
36
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
35
+ const { __scopeCollection, children } = props, ref = import_react.default.useRef(null), itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
37
+ CollectionProviderImpl,
38
+ {
39
+ scope: __scopeCollection,
40
+ itemMap,
41
+ collectionRef: ref,
42
+ children
43
+ }
44
+ );
37
45
  };
38
- CollectionProvider.displayName = PROVIDER_NAME;
39
- const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = import_react.default.forwardRef(
40
- (props, forwardedRef) => {
41
- const { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
42
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { ref: composedRefs, children });
43
- }
44
- );
46
+ CollectionProvider.displayName = "CollectionProvider";
47
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = import_react.default.forwardRef((props, forwardedRef) => {
48
+ const { __scopeCollection, children } = props, context = useCollectionContext(__scopeCollection), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
49
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { ref: composedRefs, children });
50
+ });
45
51
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
46
- const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = import_react.default.forwardRef(
47
- (props, forwardedRef) => {
48
- const { scope, children, ...itemData } = props, ref = import_react.default.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
49
- return import_react.default.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
50
- }
51
- );
52
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = import_react.default.forwardRef((props, forwardedRef) => {
53
+ const { __scopeCollection, children, ...itemData } = props, ref = import_react.default.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), context = useCollectionContext(__scopeCollection);
54
+ return import_react.default.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
55
+ });
52
56
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
53
- function useCollection(scope) {
54
- const context = useCollectionContext(name + "CollectionConsumer", scope);
57
+ function useCollection(__scopeCollection) {
58
+ const context = useCollectionContext(__scopeCollection);
55
59
  return import_react.default.useCallback(() => {
56
60
  if (!import_core.isWeb)
57
61
  return [];
@@ -68,8 +72,7 @@ function createCollection(name) {
68
72
  }
69
73
  return [
70
74
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
71
- useCollection,
72
- createCollectionScope
75
+ useCollection
73
76
  ];
74
77
  }
75
78
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,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7B,YAAM,eAAe,MAAM;AAAA,QACzB,eAAe,iBAAiB,IAAI,cAAc,GAAG;AAAA,MACvD;AAOA,aANc,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC,EACtB;AAAA,QACzB,CAAC,GAAG,MACF,aAAa,QAAQ,EAAE,IAAI,OAAuB,IAClD,aAAa,QAAQ,EAAE,IAAI,OAAuB;AAAA,MACtD;AAAA,IAEF,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAAA,EAG7C;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,EACF;AACF;",
5
5
  "names": ["React"]
6
6
  }
@@ -1,33 +1,40 @@
1
1
  import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { Slot, isWeb } from "@tamagui/core";
3
- import { createContextScope } from "@tamagui/create-context";
2
+ import {
3
+ Slot,
4
+ createStyledContext,
5
+ isWeb
6
+ } from "@tamagui/core";
4
7
  import React from "react";
5
8
  import { jsx } from "react/jsx-runtime";
6
9
  function createCollection(name) {
7
- const PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
10
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } = createStyledContext({
8
11
  collectionRef: { current: null },
9
12
  itemMap: /* @__PURE__ */ new Map()
10
13
  }), CollectionProvider = (props) => {
11
- const { scope, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
12
- return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
14
+ const { __scopeCollection, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
15
+ return /* @__PURE__ */ jsx(
16
+ CollectionProviderImpl,
17
+ {
18
+ scope: __scopeCollection,
19
+ itemMap,
20
+ collectionRef: ref,
21
+ children
22
+ }
23
+ );
13
24
  };
14
- CollectionProvider.displayName = PROVIDER_NAME;
15
- const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef(
16
- (props, forwardedRef) => {
17
- const { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
18
- return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });
19
- }
20
- );
25
+ CollectionProvider.displayName = "CollectionProvider";
26
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef((props, forwardedRef) => {
27
+ const { __scopeCollection, children } = props, context = useCollectionContext(__scopeCollection), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
28
+ return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });
29
+ });
21
30
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
22
- const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef(
23
- (props, forwardedRef) => {
24
- const { scope, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
25
- return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ jsx(Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
26
- }
27
- );
31
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef((props, forwardedRef) => {
32
+ const { __scopeCollection, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(__scopeCollection);
33
+ return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), /* @__PURE__ */ jsx(Slot, { [ITEM_DATA_ATTR]: "", ref: composedRefs, children });
34
+ });
28
35
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
29
- function useCollection(scope) {
30
- const context = useCollectionContext(name + "CollectionConsumer", scope);
36
+ function useCollection(__scopeCollection) {
37
+ const context = useCollectionContext(__scopeCollection);
31
38
  return React.useCallback(() => {
32
39
  if (!isWeb)
33
40
  return [];
@@ -44,8 +51,7 @@ function createCollection(name) {
44
51
  }
45
52
  return [
46
53
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
47
- useCollection,
48
- createCollectionScope
54
+ useCollection
49
55
  ];
50
56
  }
51
57
  export {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Collection.tsx"],
4
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,MAAsB,aAAa;AAC5C,SAAS,0BAA0B;AACnC,OAAO,WAAW;AA6CZ;AAhCN,SAAS,iBACP,MACA;AAKA,QAAM,gBAAgB,OAAO,sBACvB,CAAC,yBAAyB,qBAAqB,IACnD,mBAAmB,aAAa,GAU5B,CAAC,wBAAwB,oBAAoB,IACjD,wBAAsC,eAAe;AAAA,IACnD,eAAe,EAAE,SAAS,KAAK;AAAA,IAC/B,SAAS,oBAAI,IAAI;AAAA,EACnB,CAAC,GAEG,qBAA2E,CAC/E,UACG;AACH,UAAM,EAAE,OAAO,SAAS,IAAI,OACtB,MAAM,MAAM,OAA0B,IAAI,GAC1C,UAAU,MAAM,OAAgC,oBAAI,IAAI,CAAC,EAAE;AACjE,WACE,oBAAC,0BAAuB,OAAc,SAAkB,eAAe,KACpE,UACH;AAAA,EAEJ;AAEA,qBAAmB,cAAc;AAMjC,QAAM,uBAAuB,OAAO,kBAE9B,iBAAiB,MAAM;AAAA,IAC3B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,SAAS,IAAI,OACtB,UAAU,qBAAqB,sBAAsB,KAAK,GAC1D,eAAe,gBAAgB,cAAc,QAAQ,aAAa;AACxE,aAAO,oBAAC,Q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ACH;AAAA,EAEJ,CAAC;AAED,qBAAmB,cAAc;AAMjC,WAAS,cAAc,mBAAwB;AAC7C,UAAM,UAAU,qBAAqB,iBAAiB;AAqBtD,WAnBiB,MAAM,YAAY,MAAM;AACvC,UAAI,CAAC;AACH,eAAO,CAAC;AAGV,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC;AAAgB,eAAO,CAAC;AAC7B,YAAM,eAAe,MAAM;AAAA,QACzB,eAAe,iBAAiB,IAAI,cAAc,GAAG;AAAA,MACvD;AAOA,aANc,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC,EACtB;AAAA,QACzB,CAAC,GAAG,MACF,aAAa,QAAQ,EAAE,IAAI,OAAuB,IAClD,aAAa,QAAQ,EAAE,IAAI,OAAuB;AAAA,MACtD;AAAA,IAEF,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAAA,EAG7C;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,EACF;AACF;",
5
5
  "names": []
6
6
  }
@@ -1,32 +1,35 @@
1
1
  import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { Slot, isWeb } from "@tamagui/core";
3
- import { createContextScope } from "@tamagui/create-context";
2
+ import {
3
+ Slot,
4
+ createStyledContext,
5
+ isWeb
6
+ } from "@tamagui/core";
4
7
  import React from "react";
5
8
  function createCollection(name) {
6
- const PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
9
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } = createStyledContext({
7
10
  collectionRef: { current: null },
8
11
  itemMap: /* @__PURE__ */ new Map()
9
12
  }), CollectionProvider = (props) => {
10
- const { scope, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
11
- return <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>{children}</CollectionProviderImpl>;
13
+ const { __scopeCollection, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
14
+ return <CollectionProviderImpl
15
+ scope={__scopeCollection}
16
+ itemMap={itemMap}
17
+ collectionRef={ref}
18
+ >{children}</CollectionProviderImpl>;
12
19
  };
13
- CollectionProvider.displayName = PROVIDER_NAME;
14
- const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef(
15
- (props, forwardedRef) => {
16
- const { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
17
- return <Slot ref={composedRefs}>{children}</Slot>;
18
- }
19
- );
20
+ CollectionProvider.displayName = "CollectionProvider";
21
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef((props, forwardedRef) => {
22
+ const { __scopeCollection, children } = props, context = useCollectionContext(__scopeCollection), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
23
+ return <Slot ref={composedRefs}>{children}</Slot>;
24
+ });
20
25
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
21
- const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef(
22
- (props, forwardedRef) => {
23
- const { scope, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
24
- return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), <Slot {...{ [ITEM_DATA_ATTR]: "" }} ref={composedRefs}>{children}</Slot>;
25
- }
26
- );
26
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef((props, forwardedRef) => {
27
+ const { __scopeCollection, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(__scopeCollection);
28
+ return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), <Slot {...{ [ITEM_DATA_ATTR]: "" }} ref={composedRefs}>{children}</Slot>;
29
+ });
27
30
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
28
- function useCollection(scope) {
29
- const context = useCollectionContext(name + "CollectionConsumer", scope);
31
+ function useCollection(__scopeCollection) {
32
+ const context = useCollectionContext(__scopeCollection);
30
33
  return React.useCallback(() => {
31
34
  if (!isWeb)
32
35
  return [];
@@ -43,8 +46,7 @@ function createCollection(name) {
43
46
  }
44
47
  return [
45
48
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
46
- useCollection,
47
- createCollectionScope
49
+ useCollection
48
50
  ];
49
51
  }
50
52
  export {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Collection.tsx"],
4
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,MAAsB,aAAa;AAC5C,SAAS,0BAA0B;AACnC,OAAO,WAAW;AAalB,SAAS,iBACP,MACA;AAKA,QAAM,gBAAgB,OAAO,sBACvB,CAAC,yBAAyB,qBAAqB,IACnD,mBAAmB,aAAa,GAU5B,CAAC,wBAAwB,oBAAoB,IACjD,wBAAsC,eAAe;AAAA,IACnD,eAAe,EAAE,SAAS,KAAK;AAAA,IAC/B,SAAS,oBAAI,IAAI;AAAA,EACnB,CAAC,GAEG,qBAA2E,CAC/E,UACG;AACH,UAAM,EAAE,OAAO,SAAS,IAAI,OACtB,MAAM,MAAM,OAA0B,IAAI,GAC1C,UAAU,MAAM,OAAgC,oBAAI,IAAI,CAAC,EAAE;AACjE,WACE,CAAC,uBAAuB,OAAO,OAAO,SAAS,SAAS,eAAe,MACpE,SACH,EAFC;AAAA,EAIL;AAEA,qBAAmB,cAAc;AAMjC,QAAM,uBAAuB,OAAO,kB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AQ,QAAQ,IAAI,KAAK,EAAE,KAAK,GAAI,SAAiC,CAAC,GAC/D,MAAM,KAAK,QAAQ,QAAQ,OAAO,GAAG,EAC7C,GAGC,CAAC,YAAY,iBAAiB,MAAM,KAAK,eACtC,SACH,EAFC;AAAA,EAIL,CAAC;AAED,qBAAmB,cAAc;AAMjC,WAAS,cAAc,mBAAwB;AAC7C,UAAM,UAAU,qBAAqB,iBAAiB;AAqBtD,WAnBiB,MAAM,YAAY,MAAM;AACvC,UAAI,CAAC;AACH,eAAO,CAAC;AAGV,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC;AAAgB,eAAO,CAAC;AAC7B,YAAM,eAAe,MAAM;AAAA,QACzB,eAAe,iBAAiB,IAAI,cAAc,GAAG;AAAA,MACvD;AAOA,aANc,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC,EACtB;AAAA,QACzB,CAAC,GAAG,MACF,aAAa,QAAQ,EAAE,IAAI,OAAuB,IAClD,aAAa,QAAQ,EAAE,IAAI,OAAuB;AAAA,MACtD;AAAA,IAEF,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAAA,EAG7C;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,EACF;AACF;",
5
5
  "names": []
6
6
  }
@@ -1,32 +1,35 @@
1
1
  import { useComposedRefs } from "@tamagui/compose-refs";
2
- import { Slot, isWeb } from "@tamagui/core";
3
- import { createContextScope } from "@tamagui/create-context";
2
+ import {
3
+ Slot,
4
+ createStyledContext,
5
+ isWeb
6
+ } from "@tamagui/core";
4
7
  import React from "react";
5
8
  function createCollection(name) {
6
- const PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
9
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } = createStyledContext({
7
10
  collectionRef: { current: null },
8
11
  itemMap: /* @__PURE__ */ new Map()
9
12
  }), CollectionProvider = (props) => {
10
- const { scope, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
11
- return <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>{children}</CollectionProviderImpl>;
13
+ const { __scopeCollection, children } = props, ref = React.useRef(null), itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
14
+ return <CollectionProviderImpl
15
+ scope={__scopeCollection}
16
+ itemMap={itemMap}
17
+ collectionRef={ref}
18
+ >{children}</CollectionProviderImpl>;
12
19
  };
13
- CollectionProvider.displayName = PROVIDER_NAME;
14
- const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef(
15
- (props, forwardedRef) => {
16
- const { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
17
- return <Slot ref={composedRefs}>{children}</Slot>;
18
- }
19
- );
20
+ CollectionProvider.displayName = "CollectionProvider";
21
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = React.forwardRef((props, forwardedRef) => {
22
+ const { __scopeCollection, children } = props, context = useCollectionContext(__scopeCollection), composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
23
+ return <Slot ref={composedRefs}>{children}</Slot>;
24
+ });
20
25
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
21
- const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef(
22
- (props, forwardedRef) => {
23
- const { scope, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
24
- return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), <Slot {...{ [ITEM_DATA_ATTR]: "" }} ref={composedRefs}>{children}</Slot>;
25
- }
26
- );
26
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-collection-item", CollectionItemSlot = React.forwardRef((props, forwardedRef) => {
27
+ const { __scopeCollection, children, ...itemData } = props, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), context = useCollectionContext(__scopeCollection);
28
+ return React.useEffect(() => (context.itemMap.set(ref, { ref, ...itemData }), () => void context.itemMap.delete(ref))), <Slot {...{ [ITEM_DATA_ATTR]: "" }} ref={composedRefs}>{children}</Slot>;
29
+ });
27
30
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
28
- function useCollection(scope) {
29
- const context = useCollectionContext(name + "CollectionConsumer", scope);
31
+ function useCollection(__scopeCollection) {
32
+ const context = useCollectionContext(__scopeCollection);
30
33
  return React.useCallback(() => {
31
34
  if (!isWeb)
32
35
  return [];
@@ -43,8 +46,7 @@ function createCollection(name) {
43
46
  }
44
47
  return [
45
48
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
46
- useCollection,
47
- createCollectionScope
49
+ useCollection
48
50
  ];
49
51
  }
50
52
  export {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Collection.tsx"],
4
- "mappings": "AAAA,SAAS,uBAAuB;AAChC,SAAS,MAAsB,aAAa;AAC5C,SAAS,0BAA0B;AACnC,OAAO,WAAW;AAalB,SAAS,iBACP,MACA;AAKA,QAAM,gBAAgB,OAAO,sBACvB,CAAC,yBAAyB,qBAAqB,IACnD,mBAAmB,aAAa,GAU5B,CAAC,wBAAwB,oBAAoB,IACjD,wBAAsC,eAAe;AAAA,IACnD,eAAe,EAAE,SAAS,KAAK;AAAA,IAC/B,SAAS,oBAAI,IAAI;AAAA,EACnB,CAAC,GAEG,qBAA2E,CAC/E,UACG;AACH,UAAM,EAAE,OAAO,SAAS,IAAI,OACtB,MAAM,MAAM,OAA0B,IAAI,GAC1C,UAAU,MAAM,OAAgC,o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AAE,mBAAmB,UAAU,GAAG,SAAS,IAAI,OAC/C,MAAM,MAAM,OAAoB,IAAI,GACpC,eAAe,gBAAgB,cAAc,GAAG,GAChD,UAAU,qBAAqB,iBAAiB;AAEtD,iBAAM,UAAU,OACd,QAAQ,QAAQ,IAAI,KAAK,EAAE,KAAK,GAAI,SAAiC,CAAC,GAC/D,MAAM,KAAK,QAAQ,QAAQ,OAAO,GAAG,EAC7C,GAGC,CAAC,YAAY,iBAAiB,MAAM,KAAK,eACtC,SACH,EAFC;AAAA,EAIL,CAAC;AAED,qBAAmB,cAAc;AAMjC,WAAS,cAAc,mBAAwB;AAC7C,UAAM,UAAU,qBAAqB,iBAAiB;AAqBtD,WAnBiB,MAAM,YAAY,MAAM;AACvC,UAAI,CAAC;AACH,eAAO,CAAC;AAGV,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC;AAAgB,eAAO,CAAC;AAC7B,YAAM,eAAe,MAAM;AAAA,QACzB,eAAe,iBAAiB,IAAI,cAAc,GAAG;AAAA,MACvD;AAOA,aANc,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC,EACtB;AAAA,QACzB,CAAC,GAAG,MACF,aAAa,QAAQ,EAAE,IAAI,OAAuB,IAClD,aAAa,QAAQ,EAAE,IAAI,OAAuB;AAAA,MACtD;AAAA,IAEF,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAAA,EAG7C;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,EACF;AACF;",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/collection",
3
- "version": "1.70.0",
3
+ "version": "1.72.0",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -27,18 +27,18 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@tamagui/compose-refs": "1.70.0",
31
- "@tamagui/core": "1.70.0",
32
- "@tamagui/create-context": "1.70.0",
33
- "@tamagui/polyfill-dev": "1.70.0",
34
- "@tamagui/stacks": "1.70.0",
35
- "@tamagui/use-controllable-state": "1.70.0"
30
+ "@tamagui/compose-refs": "1.72.0",
31
+ "@tamagui/core": "1.72.0",
32
+ "@tamagui/create-context": "1.72.0",
33
+ "@tamagui/polyfill-dev": "1.72.0",
34
+ "@tamagui/stacks": "1.72.0",
35
+ "@tamagui/use-controllable-state": "1.72.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "*"
39
39
  },
40
40
  "devDependencies": {
41
- "@tamagui/build": "1.70.0",
41
+ "@tamagui/build": "1.72.0",
42
42
  "react": "^18.2.0"
43
43
  },
44
44
  "publishConfig": {
@@ -1,13 +1,16 @@
1
1
  import { useComposedRefs } from '@tamagui/compose-refs'
2
- import { Slot, TamaguiElement, isWeb } from '@tamagui/core'
3
- import { createContextScope } from '@tamagui/create-context'
2
+ import {
3
+ ScopedProps,
4
+ Slot,
5
+ TamaguiElement,
6
+ createStyledContext,
7
+ isWeb,
8
+ } from '@tamagui/core'
4
9
  import React from 'react'
5
10
 
6
11
  type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>
7
12
  type CollectionElement = TamaguiElement
8
- interface CollectionProps extends SlotProps {
9
- scope: any
10
- }
13
+ interface CollectionProps extends SlotProps {}
11
14
 
12
15
  // We have resorted to returning slots directly rather than exposing primitives that can then
13
16
  // be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
@@ -21,9 +24,9 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
21
24
  * CollectionProvider
22
25
  * ---------------------------------------------------------------------------------------------*/
23
26
 
24
- const PROVIDER_NAME = name + 'CollectionProvider'
25
- const [createCollectionContext, createCollectionScope] =
26
- createContextScope(PROVIDER_NAME)
27
+ // const PROVIDER_NAME = name + 'CollectionProvider'
28
+ // const [createCollectionContext, createCollectionScope] =
29
+ // createContextScope(PROVIDER_NAME)
27
30
 
28
31
  type ContextValue = {
29
32
  collectionRef: React.RefObject<CollectionElement>
@@ -33,26 +36,33 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
33
36
  >
34
37
  }
35
38
 
36
- const [CollectionProviderImpl, useCollectionContext] =
37
- createCollectionContext<ContextValue>(PROVIDER_NAME, {
39
+ type ScopedCollectionProps<P> = ScopedProps<P, 'Collection'>
40
+
41
+ const { Provider: CollectionProviderImpl, useStyledContext: useCollectionContext } =
42
+ createStyledContext<ContextValue>({
38
43
  collectionRef: { current: null },
39
44
  itemMap: new Map(),
40
45
  })
41
46
 
42
- const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (
43
- props
44
- ) => {
45
- const { scope, children } = props
47
+ const CollectionProvider: React.FC<{
48
+ children?: React.ReactNode
49
+ __scopeCollection: string
50
+ }> = (props) => {
51
+ const { __scopeCollection, children } = props
46
52
  const ref = React.useRef<CollectionElement>(null)
47
53
  const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current
48
54
  return (
49
- <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>
55
+ <CollectionProviderImpl
56
+ scope={__scopeCollection}
57
+ itemMap={itemMap}
58
+ collectionRef={ref}
59
+ >
50
60
  {children}
51
61
  </CollectionProviderImpl>
52
62
  )
53
63
  }
54
64
 
55
- CollectionProvider.displayName = PROVIDER_NAME
65
+ CollectionProvider.displayName = 'CollectionProvider'
56
66
 
57
67
  /* -----------------------------------------------------------------------------------------------
58
68
  * CollectionSlot
@@ -60,14 +70,15 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
60
70
 
61
71
  const COLLECTION_SLOT_NAME = name + 'CollectionSlot'
62
72
 
63
- const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(
64
- (props, forwardedRef) => {
65
- const { scope, children } = props
66
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope)
67
- const composedRefs = useComposedRefs(forwardedRef, context.collectionRef)
68
- return <Slot ref={composedRefs}>{children}</Slot>
69
- }
70
- )
73
+ const CollectionSlot = React.forwardRef<
74
+ CollectionElement,
75
+ ScopedCollectionProps<CollectionProps>
76
+ >((props, forwardedRef) => {
77
+ const { __scopeCollection, children } = props
78
+ const context = useCollectionContext(__scopeCollection)
79
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef)
80
+ return <Slot ref={composedRefs}>{children}</Slot>
81
+ })
71
82
 
72
83
  CollectionSlot.displayName = COLLECTION_SLOT_NAME
73
84
 
@@ -80,28 +91,28 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
80
91
 
81
92
  type CollectionItemSlotProps = ItemData & {
82
93
  children: React.ReactNode
83
- scope: any
84
94
  }
85
95
 
86
- const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(
87
- (props, forwardedRef) => {
88
- const { scope, children, ...itemData } = props
89
- const ref = React.useRef<ItemElement>(null)
90
- const composedRefs = useComposedRefs(forwardedRef, ref)
91
- const context = useCollectionContext(ITEM_SLOT_NAME, scope)
92
-
93
- React.useEffect(() => {
94
- context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) })
95
- return () => void context.itemMap.delete(ref)
96
- })
97
-
98
- return (
99
- <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>
100
- {children}
101
- </Slot>
102
- )
103
- }
104
- )
96
+ const CollectionItemSlot = React.forwardRef<
97
+ ItemElement,
98
+ ScopedCollectionProps<CollectionItemSlotProps>
99
+ >((props, forwardedRef) => {
100
+ const { __scopeCollection, children, ...itemData } = props
101
+ const ref = React.useRef<ItemElement>(null)
102
+ const composedRefs = useComposedRefs(forwardedRef, ref)
103
+ const context = useCollectionContext(__scopeCollection)
104
+
105
+ React.useEffect(() => {
106
+ context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) })
107
+ return () => void context.itemMap.delete(ref)
108
+ })
109
+
110
+ return (
111
+ <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>
112
+ {children}
113
+ </Slot>
114
+ )
115
+ })
105
116
 
106
117
  CollectionItemSlot.displayName = ITEM_SLOT_NAME
107
118
 
@@ -109,8 +120,8 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
109
120
  * useCollection
110
121
  * ---------------------------------------------------------------------------------------------*/
111
122
 
112
- function useCollection(scope: any) {
113
- const context = useCollectionContext(name + 'CollectionConsumer', scope)
123
+ function useCollection(__scopeCollection: any) {
124
+ const context = useCollectionContext(__scopeCollection)
114
125
 
115
126
  const getItems = React.useCallback(() => {
116
127
  if (!isWeb) {
@@ -137,7 +148,6 @@ function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(
137
148
  return [
138
149
  { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
139
150
  useCollection,
140
- createCollectionScope,
141
151
  ] as const
142
152
  }
143
153
 
@@ -1,22 +1,22 @@
1
- import { Slot, TamaguiElement } from '@tamagui/core';
1
+ import { ScopedProps, Slot, TamaguiElement } from '@tamagui/core';
2
2
  import React from 'react';
3
3
  type SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;
4
4
  interface CollectionProps extends SlotProps {
5
- scope: any;
6
5
  }
7
6
  declare function createCollection<ItemElement extends TamaguiElement, ItemData = {}>(name: string): readonly [{
8
7
  readonly Provider: React.FC<{
9
8
  children?: React.ReactNode;
10
- scope: any;
9
+ __scopeCollection: string;
11
10
  }>;
12
- readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<TamaguiElement>>;
13
- readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
11
+ readonly Slot: React.ForwardRefExoticComponent<CollectionProps & {
12
+ __scopeCollection?: string | undefined;
13
+ } & React.RefAttributes<TamaguiElement>>;
14
+ readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ScopedProps<ItemData & {
14
15
  children: React.ReactNode;
15
- scope: any;
16
- }> & React.RefAttributes<ItemElement>>;
17
- }, (scope: any) => () => ({
16
+ }, "Collection">> & React.RefAttributes<ItemElement>>;
17
+ }, (__scopeCollection: any) => () => ({
18
18
  ref: React.RefObject<ItemElement>;
19
- } & ItemData)[], import("@tamagui/create-context").CreateScope];
19
+ } & ItemData)[]];
20
20
  export { createCollection };
21
21
  export type { CollectionProps };
22
22
  //# sourceMappingURL=Collection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAS,MAAM,eAAe,CAAA;AAE3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE5D,UAAU,eAAgB,SAAQ,SAAS;IACzC,KAAK,EAAE,GAAG,CAAA;CACX;AAOD,iBAAS,gBAAgB,CAAC,WAAW,SAAS,cAAc,EAAE,QAAQ,GAAG,EAAE,EACzE,IAAI,EAAE,MAAM;;mBAwBoC,MAAM,SAAS;eAAS,GAAG;;;;kBAwC/D,MAAM,SAAS;eAClB,GAAG;;WA6BkB,GAAG;SAhFtB,MAAM,SAAS,CAAC,WAAW,CAAC;gEA8GxC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC3B,YAAY,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,IAAI,EACJ,cAAc,EAGf,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE5D,UAAU,eAAgB,SAAQ,SAAS;CAAG;AAO9C,iBAAS,gBAAgB,CAAC,WAAW,SAAS,cAAc,EAAE,QAAQ,GAAG,EAAE,EACzE,IAAI,EAAE,MAAM;;mBA2BC,MAAM,SAAS;2BACP,MAAM;;;;;;kBA4Cf,MAAM,SAAS;;uBA8Be,GAAG;SAxFlC,MAAM,SAAS,CAAC,WAAW,CAAC;iBAqHxC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC3B,YAAY,EAAE,eAAe,EAAE,CAAA"}