@blimu/react 1.1.0 → 1.1.1

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.
Files changed (451) hide show
  1. package/dist/_virtual/index.cjs +5 -1
  2. package/dist/_virtual/index.cjs.map +1 -1
  3. package/dist/_virtual/index.js +3 -3
  4. package/dist/_virtual/index2.cjs +4 -1
  5. package/dist/_virtual/index2.cjs.map +1 -1
  6. package/dist/_virtual/index2.js +2 -2
  7. package/dist/_virtual/use-sync-external-store-shim.development.cjs +4 -1
  8. package/dist/_virtual/use-sync-external-store-shim.development.cjs.map +1 -1
  9. package/dist/_virtual/use-sync-external-store-shim.development.js +2 -2
  10. package/dist/_virtual/use-sync-external-store-shim.production.cjs +4 -1
  11. package/dist/_virtual/use-sync-external-store-shim.production.cjs.map +1 -1
  12. package/dist/_virtual/use-sync-external-store-shim.production.js +2 -2
  13. package/dist/client/auth.service.cjs +249 -1
  14. package/dist/client/auth.service.cjs.map +1 -1
  15. package/dist/client/auth.service.js +194 -96
  16. package/dist/client/auth.service.js.map +1 -1
  17. package/dist/client/external-store.cjs +26 -1
  18. package/dist/client/external-store.cjs.map +1 -1
  19. package/dist/client/external-store.js +22 -8
  20. package/dist/client/external-store.js.map +1 -1
  21. package/dist/client/runtime-client.cjs +136 -1
  22. package/dist/client/runtime-client.cjs.map +1 -1
  23. package/dist/client/runtime-client.js +85 -51
  24. package/dist/client/runtime-client.js.map +1 -1
  25. package/dist/components/index.cjs +13 -0
  26. package/dist/components/index.cjs.map +1 -0
  27. package/dist/components/index.js +13 -0
  28. package/dist/components/index.js.map +1 -0
  29. package/dist/components/members-list.cjs +132 -1
  30. package/dist/components/members-list.cjs.map +1 -1
  31. package/dist/components/members-list.js +69 -64
  32. package/dist/components/members-list.js.map +1 -1
  33. package/dist/components/redirect-to-sign-in.cjs +34 -1
  34. package/dist/components/redirect-to-sign-in.cjs.map +1 -1
  35. package/dist/components/redirect-to-sign-in.js +28 -20
  36. package/dist/components/redirect-to-sign-in.js.map +1 -1
  37. package/dist/components/sign-in-button.cjs +36 -1
  38. package/dist/components/sign-in-button.cjs.map +1 -1
  39. package/dist/components/sign-in-button.js +25 -21
  40. package/dist/components/sign-in-button.js.map +1 -1
  41. package/dist/components/ui/avatar.cjs +42 -1
  42. package/dist/components/ui/avatar.cjs.map +1 -1
  43. package/dist/components/ui/avatar.js +23 -23
  44. package/dist/components/ui/avatar.js.map +1 -1
  45. package/dist/components/ui/dropdown-menu.cjs +148 -1
  46. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  47. package/dist/components/ui/dropdown-menu.js +83 -81
  48. package/dist/components/ui/dropdown-menu.js.map +1 -1
  49. package/dist/components/user-avatar.cjs +22 -1
  50. package/dist/components/user-avatar.cjs.map +1 -1
  51. package/dist/components/user-avatar.js +16 -16
  52. package/dist/components/user-avatar.js.map +1 -1
  53. package/dist/components/user-button/styles.cjs +39 -1
  54. package/dist/components/user-button/styles.cjs.map +1 -1
  55. package/dist/components/user-button/styles.js +6 -5
  56. package/dist/components/user-button/styles.js.map +1 -1
  57. package/dist/components/user-button/user-button.cjs +98 -1
  58. package/dist/components/user-button/user-button.cjs.map +1 -1
  59. package/dist/components/user-button/user-button.js +64 -58
  60. package/dist/components/user-button/user-button.js.map +1 -1
  61. package/dist/hooks/index.cjs +14 -0
  62. package/dist/hooks/index.cjs.map +1 -0
  63. package/dist/hooks/index.d.ts +1 -0
  64. package/dist/hooks/index.d.ts.map +1 -1
  65. package/dist/hooks/index.js +14 -0
  66. package/dist/hooks/index.js.map +1 -0
  67. package/dist/hooks/use-auth.cjs +44 -1
  68. package/dist/hooks/use-auth.cjs.map +1 -1
  69. package/dist/hooks/use-auth.d.ts +13 -15
  70. package/dist/hooks/use-auth.d.ts.map +1 -1
  71. package/dist/hooks/use-auth.js +30 -26
  72. package/dist/hooks/use-auth.js.map +1 -1
  73. package/dist/hooks/use-client.cjs +9 -1
  74. package/dist/hooks/use-client.cjs.map +1 -1
  75. package/dist/hooks/use-client.d.ts +1 -1
  76. package/dist/hooks/use-client.d.ts.map +1 -1
  77. package/dist/hooks/use-client.js +6 -5
  78. package/dist/hooks/use-client.js.map +1 -1
  79. package/dist/hooks/use-members.cjs +60 -1
  80. package/dist/hooks/use-members.cjs.map +1 -1
  81. package/dist/hooks/use-members.js +53 -41
  82. package/dist/hooks/use-members.js.map +1 -1
  83. package/dist/hooks/use-store.cjs +17 -1
  84. package/dist/hooks/use-store.cjs.map +1 -1
  85. package/dist/hooks/use-store.js +7 -7
  86. package/dist/hooks/use-store.js.map +1 -1
  87. package/dist/index.cjs +37 -1
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.ts +1 -1
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +35 -35
  92. package/dist/lib/utils.cjs +8 -1
  93. package/dist/lib/utils.cjs.map +1 -1
  94. package/dist/lib/utils.js +5 -5
  95. package/dist/lib/utils.js.map +1 -1
  96. package/dist/lib/variants.cjs +46 -1
  97. package/dist/lib/variants.cjs.map +1 -1
  98. package/dist/lib/variants.js +6 -5
  99. package/dist/lib/variants.js.map +1 -1
  100. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +721 -1
  101. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.map +1 -1
  102. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +571 -377
  103. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -1
  104. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +625 -1
  105. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.map +1 -1
  106. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +539 -316
  107. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -1
  108. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +313 -1
  109. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.map +1 -1
  110. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +261 -172
  111. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -1
  112. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +154 -1
  113. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.map +1 -1
  114. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +173 -1
  115. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.map +1 -1
  116. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +144 -107
  117. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -1
  118. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +111 -87
  119. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -1
  120. package/dist/node_modules/@radix-ui/primitive/dist/index.cjs +11 -1
  121. package/dist/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -1
  122. package/dist/node_modules/@radix-ui/primitive/dist/index.js +7 -5
  123. package/dist/node_modules/@radix-ui/primitive/dist/index.js.map +1 -1
  124. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs +42 -1
  125. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -1
  126. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +17 -16
  127. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -1
  128. package/dist/node_modules/@radix-ui/react-avatar/dist/index.cjs +140 -1
  129. package/dist/node_modules/@radix-ui/react-avatar/dist/index.cjs.map +1 -1
  130. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +105 -57
  131. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js.map +1 -1
  132. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.cjs +80 -1
  133. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  134. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.js +49 -41
  135. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
  136. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.cjs +56 -1
  137. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  138. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.js +17 -10
  139. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
  140. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.cjs +119 -1
  141. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  142. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.js +86 -42
  143. package/dist/node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
  144. package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs +70 -1
  145. package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs.map +1 -1
  146. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +57 -37
  147. package/dist/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -1
  148. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +56 -1
  149. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -1
  150. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -19
  151. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -1
  152. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +79 -1
  153. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  154. package/dist/node_modules/@radix-ui/react-context/dist/index.js +48 -39
  155. package/dist/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
  156. package/dist/node_modules/@radix-ui/react-direction/dist/index.cjs +27 -1
  157. package/dist/node_modules/@radix-ui/react-direction/dist/index.cjs.map +1 -1
  158. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +6 -6
  159. package/dist/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -1
  160. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +229 -1
  161. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -1
  162. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +182 -97
  163. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -1
  164. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +296 -1
  165. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs.map +1 -1
  166. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +232 -167
  167. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js.map +1 -1
  168. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +46 -1
  169. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
  170. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +23 -11
  171. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -1
  172. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +224 -1
  173. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  174. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +169 -98
  175. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -1
  176. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +31 -1
  177. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
  178. package/dist/node_modules/@radix-ui/react-id/dist/index.js +11 -10
  179. package/dist/node_modules/@radix-ui/react-id/dist/index.js.map +1 -1
  180. package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs +845 -1
  181. package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs.map +1 -1
  182. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +662 -442
  183. package/dist/node_modules/@radix-ui/react-menu/dist/index.js.map +1 -1
  184. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +308 -1
  185. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -1
  186. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +209 -137
  187. package/dist/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -1
  188. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs +34 -1
  189. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -1
  190. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +14 -12
  191. package/dist/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -1
  192. package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs +145 -1
  193. package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -1
  194. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +103 -45
  195. package/dist/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -1
  196. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +61 -1
  197. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  198. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +21 -14
  199. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
  200. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +244 -1
  201. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs.map +1 -1
  202. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +179 -135
  203. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -1
  204. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +105 -1
  205. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  206. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +74 -35
  207. package/dist/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
  208. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +28 -1
  209. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -1
  210. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +8 -7
  211. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -1
  212. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +86 -1
  213. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -1
  214. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +57 -40
  215. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -1
  216. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +34 -1
  217. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs.map +1 -1
  218. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +13 -10
  219. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -1
  220. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs +15 -1
  221. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs.map +1 -1
  222. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +8 -8
  223. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js.map +1 -1
  224. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +23 -1
  225. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -1
  226. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +3 -3
  227. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -1
  228. package/dist/node_modules/@radix-ui/react-use-size/dist/index.cjs +56 -1
  229. package/dist/node_modules/@radix-ui/react-use-size/dist/index.cjs.map +1 -1
  230. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +34 -22
  231. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -1
  232. package/dist/node_modules/aria-hidden/dist/es2015/index.cjs +122 -1
  233. package/dist/node_modules/aria-hidden/dist/es2015/index.cjs.map +1 -1
  234. package/dist/node_modules/aria-hidden/dist/es2015/index.js +111 -41
  235. package/dist/node_modules/aria-hidden/dist/es2015/index.js.map +1 -1
  236. package/dist/node_modules/class-variance-authority/dist/index.cjs +45 -1
  237. package/dist/node_modules/class-variance-authority/dist/index.cjs.map +1 -1
  238. package/dist/node_modules/class-variance-authority/dist/index.js +40 -30
  239. package/dist/node_modules/class-variance-authority/dist/index.js.map +1 -1
  240. package/dist/node_modules/clsx/dist/clsx.cjs +17 -1
  241. package/dist/node_modules/clsx/dist/clsx.cjs.map +1 -1
  242. package/dist/node_modules/clsx/dist/clsx.js +13 -13
  243. package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
  244. package/dist/node_modules/get-nonce/dist/es2015/index.cjs +9 -1
  245. package/dist/node_modules/get-nonce/dist/es2015/index.cjs.map +1 -1
  246. package/dist/node_modules/get-nonce/dist/es2015/index.js +5 -3
  247. package/dist/node_modules/get-nonce/dist/es2015/index.js.map +1 -1
  248. package/dist/node_modules/js-cookie/dist/js.cookie.cjs +98 -1
  249. package/dist/node_modules/js-cookie/dist/js.cookie.cjs.map +1 -1
  250. package/dist/node_modules/js-cookie/dist/js.cookie.js +69 -43
  251. package/dist/node_modules/js-cookie/dist/js.cookie.js.map +1 -1
  252. package/dist/node_modules/jwt-decode/build/esm/index.cjs +58 -1
  253. package/dist/node_modules/jwt-decode/build/esm/index.cjs.map +1 -1
  254. package/dist/node_modules/jwt-decode/build/esm/index.js +36 -30
  255. package/dist/node_modules/jwt-decode/build/esm/index.js.map +1 -1
  256. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +34 -1
  257. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.map +1 -1
  258. package/dist/node_modules/lucide-react/dist/esm/Icon.js +25 -25
  259. package/dist/node_modules/lucide-react/dist/esm/Icon.js.map +1 -1
  260. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +21 -1
  261. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs.map +1 -1
  262. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +16 -15
  263. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js.map +1 -1
  264. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +13 -1
  265. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs.map +1 -1
  266. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +2 -2
  267. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js.map +1 -1
  268. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +7 -1
  269. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs.map +1 -1
  270. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +5 -4
  271. package/dist/node_modules/lucide-react/dist/esm/icons/check.js.map +1 -1
  272. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs +7 -1
  273. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs.map +1 -1
  274. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +5 -4
  275. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js.map +1 -1
  276. package/dist/node_modules/lucide-react/dist/esm/icons/circle.cjs +7 -1
  277. package/dist/node_modules/lucide-react/dist/esm/icons/circle.cjs.map +1 -1
  278. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +5 -4
  279. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js.map +1 -1
  280. package/dist/node_modules/lucide-react/dist/esm/icons/log-out.cjs +11 -1
  281. package/dist/node_modules/lucide-react/dist/esm/icons/log-out.cjs.map +1 -1
  282. package/dist/node_modules/lucide-react/dist/esm/icons/log-out.js +6 -5
  283. package/dist/node_modules/lucide-react/dist/esm/icons/log-out.js.map +1 -1
  284. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +26 -1
  285. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs.map +1 -1
  286. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +22 -14
  287. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js.map +1 -1
  288. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +27 -1
  289. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.cjs.map +1 -1
  290. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +8 -8
  291. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -1
  292. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +197 -4
  293. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
  294. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +163 -98
  295. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -1
  296. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs +55 -1
  297. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs.map +1 -1
  298. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -24
  299. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -1
  300. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +19 -1
  301. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs.map +1 -1
  302. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +12 -9
  303. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -1
  304. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +102 -1
  305. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs.map +1 -1
  306. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +85 -51
  307. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -1
  308. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.cjs +5 -1
  309. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.cjs.map +1 -1
  310. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +3 -3
  311. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -1
  312. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +6 -1
  313. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs.map +1 -1
  314. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +5 -5
  315. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -1
  316. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +62 -36
  317. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs.map +1 -1
  318. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +41 -65
  319. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -1
  320. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +10 -1
  321. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs.map +1 -1
  322. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +8 -5
  323. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -1
  324. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +37 -1
  325. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs.map +1 -1
  326. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +28 -16
  327. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -1
  328. package/dist/node_modules/react-style-singleton/dist/es2015/component.cjs +13 -1
  329. package/dist/node_modules/react-style-singleton/dist/es2015/component.cjs.map +1 -1
  330. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +9 -7
  331. package/dist/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -1
  332. package/dist/node_modules/react-style-singleton/dist/es2015/hook.cjs +33 -1
  333. package/dist/node_modules/react-style-singleton/dist/es2015/hook.cjs.map +1 -1
  334. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +11 -10
  335. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -1
  336. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.cjs +48 -1
  337. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.cjs.map +1 -1
  338. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +35 -17
  339. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -1
  340. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs +3014 -1
  341. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs.map +1 -1
  342. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +804 -555
  343. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  344. package/dist/node_modules/tailwindcss/dist/plugin.cjs +12 -1
  345. package/dist/node_modules/tailwindcss/dist/plugin.cjs.map +1 -1
  346. package/dist/node_modules/tailwindcss/dist/plugin.js +8 -8
  347. package/dist/node_modules/tailwindcss/dist/plugin.js.map +1 -1
  348. package/dist/node_modules/tslib/tslib.es6.cjs +38 -1
  349. package/dist/node_modules/tslib/tslib.es6.cjs.map +1 -1
  350. package/dist/node_modules/tslib/tslib.es6.js +33 -21
  351. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  352. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +11 -1
  353. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.cjs.map +1 -1
  354. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +8 -3
  355. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -1
  356. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +52 -1
  357. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs.map +1 -1
  358. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +28 -19
  359. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -1
  360. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.cjs +29 -1
  361. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.cjs.map +1 -1
  362. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +15 -11
  363. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -1
  364. package/dist/node_modules/use-sidecar/dist/es2015/exports.cjs +38 -1
  365. package/dist/node_modules/use-sidecar/dist/es2015/exports.cjs.map +1 -1
  366. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +15 -12
  367. package/dist/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -1
  368. package/dist/node_modules/use-sidecar/dist/es2015/medium.cjs +88 -1
  369. package/dist/node_modules/use-sidecar/dist/es2015/medium.cjs.map +1 -1
  370. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +64 -43
  371. package/dist/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
  372. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +68 -1
  373. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map +1 -1
  374. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +49 -39
  375. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  376. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +53 -1
  377. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs.map +1 -1
  378. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +39 -32
  379. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -1
  380. package/dist/node_modules/use-sync-external-store/shim/index.cjs +17 -1
  381. package/dist/node_modules/use-sync-external-store/shim/index.cjs.map +1 -1
  382. package/dist/node_modules/use-sync-external-store/shim/index.js +14 -7
  383. package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  384. package/dist/providers/auth/auth.context.cjs +5 -1
  385. package/dist/providers/auth/auth.context.cjs.map +1 -1
  386. package/dist/providers/auth/auth.context.js +3 -3
  387. package/dist/providers/auth/auth.context.js.map +1 -1
  388. package/dist/providers/auth/auth.hook.cjs +12 -1
  389. package/dist/providers/auth/auth.hook.cjs.map +1 -1
  390. package/dist/providers/auth/auth.hook.js +8 -7
  391. package/dist/providers/auth/auth.hook.js.map +1 -1
  392. package/dist/providers/auth/auth.provider.cjs +37 -1
  393. package/dist/providers/auth/auth.provider.cjs.map +1 -1
  394. package/dist/providers/auth/auth.provider.js +31 -22
  395. package/dist/providers/auth/auth.provider.js.map +1 -1
  396. package/dist/providers/blimu/blimu.context.cjs +5 -1
  397. package/dist/providers/blimu/blimu.context.cjs.map +1 -1
  398. package/dist/providers/blimu/blimu.context.js +3 -3
  399. package/dist/providers/blimu/blimu.context.js.map +1 -1
  400. package/dist/providers/blimu/blimu.hook.cjs +12 -1
  401. package/dist/providers/blimu/blimu.hook.cjs.map +1 -1
  402. package/dist/providers/blimu/blimu.hook.js +8 -7
  403. package/dist/providers/blimu/blimu.hook.js.map +1 -1
  404. package/dist/providers/blimu/blimu.provider.cjs +71 -1
  405. package/dist/providers/blimu/blimu.provider.cjs.map +1 -1
  406. package/dist/providers/blimu/blimu.provider.js +32 -27
  407. package/dist/providers/blimu/blimu.provider.js.map +1 -1
  408. package/dist/providers/index.cjs +13 -0
  409. package/dist/providers/index.cjs.map +1 -0
  410. package/dist/providers/index.js +13 -0
  411. package/dist/providers/index.js.map +1 -0
  412. package/dist/providers/theme/theme.context.cjs +5 -1
  413. package/dist/providers/theme/theme.context.cjs.map +1 -1
  414. package/dist/providers/theme/theme.context.js +3 -3
  415. package/dist/providers/theme/theme.context.js.map +1 -1
  416. package/dist/providers/theme/theme.hook.cjs +12 -1
  417. package/dist/providers/theme/theme.hook.cjs.map +1 -1
  418. package/dist/providers/theme/theme.hook.js +8 -7
  419. package/dist/providers/theme/theme.hook.js.map +1 -1
  420. package/dist/providers/theme/theme.provider.cjs +104 -1
  421. package/dist/providers/theme/theme.provider.cjs.map +1 -1
  422. package/dist/providers/theme/theme.provider.js +85 -48
  423. package/dist/providers/theme/theme.provider.js.map +1 -1
  424. package/dist/tailwind.cjs +200 -0
  425. package/dist/tailwind.cjs.map +1 -0
  426. package/dist/{tailwind.plugin.js → tailwind.js} +6 -6
  427. package/dist/tailwind.js.map +1 -0
  428. package/dist/types/index.cjs +11 -1
  429. package/dist/types/index.cjs.map +1 -1
  430. package/dist/types/index.js +8 -8
  431. package/dist/types/index.js.map +1 -1
  432. package/dist/utils/publishable-key.cjs +62 -1
  433. package/dist/utils/publishable-key.cjs.map +1 -1
  434. package/dist/utils/publishable-key.js +52 -27
  435. package/dist/utils/publishable-key.js.map +1 -1
  436. package/package.json +41 -42
  437. package/dist/components.cjs +0 -2
  438. package/dist/components.cjs.map +0 -1
  439. package/dist/components.js +0 -13
  440. package/dist/components.js.map +0 -1
  441. package/dist/hooks.cjs +0 -2
  442. package/dist/hooks.cjs.map +0 -1
  443. package/dist/hooks.js +0 -14
  444. package/dist/hooks.js.map +0 -1
  445. package/dist/providers.cjs +0 -2
  446. package/dist/providers.cjs.map +0 -1
  447. package/dist/providers.js +0 -13
  448. package/dist/providers.js.map +0 -1
  449. package/dist/tailwind.plugin.cjs +0 -2
  450. package/dist/tailwind.plugin.cjs.map +0 -1
  451. package/dist/tailwind.plugin.js.map +0 -1
@@ -1,59 +1,103 @@
1
- import * as e from "react";
2
- import { composeRefs as E } from "../../../../../react-compose-refs/dist/index.js";
3
- import { jsx as y } from "react/jsx-runtime";
4
- var g = /* @__PURE__ */ Symbol.for("react.lazy"), p = e[" use ".trim().toString()];
5
- function C(r) {
6
- return typeof r == "object" && r !== null && "then" in r;
1
+ import * as React from "react";
2
+ import { composeRefs } from "../../../../../react-compose-refs/dist/index.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
5
+ var use = React[" use ".trim().toString()];
6
+ function isPromiseLike(value) {
7
+ return typeof value === "object" && value !== null && "then" in value;
7
8
  }
8
- function d(r) {
9
- return r != null && typeof r == "object" && "$$typeof" in r && r.$$typeof === g && "_payload" in r && C(r._payload);
9
+ function isLazyComponent(element) {
10
+ return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
10
11
  }
11
12
  // @__NO_SIDE_EFFECTS__
12
- function A(r) {
13
- const n = /* @__PURE__ */ S(r), o = e.forwardRef((i, t) => {
14
- let { children: l, ...a } = i;
15
- d(l) && typeof p == "function" && (l = p(l._payload));
16
- const s = e.Children.toArray(l), f = s.find(R);
17
- if (f) {
18
- const c = f.props.children, m = s.map((u) => u === f ? e.Children.count(c) > 1 ? e.Children.only(null) : e.isValidElement(c) ? c.props.children : null : u);
19
- return /* @__PURE__ */ y(n, { ...a, ref: t, children: e.isValidElement(c) ? e.cloneElement(c, void 0, m) : null });
13
+ function createSlot(ownerName) {
14
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
15
+ const Slot2 = React.forwardRef((props, forwardedRef) => {
16
+ let { children, ...slotProps } = props;
17
+ if (isLazyComponent(children) && typeof use === "function") {
18
+ children = use(children._payload);
20
19
  }
21
- return /* @__PURE__ */ y(n, { ...a, ref: t, children: l });
20
+ const childrenArray = React.Children.toArray(children);
21
+ const slottable = childrenArray.find(isSlottable);
22
+ if (slottable) {
23
+ const newElement = slottable.props.children;
24
+ const newChildren = childrenArray.map((child) => {
25
+ if (child === slottable) {
26
+ if (React.Children.count(newElement) > 1) return React.Children.only(null);
27
+ return React.isValidElement(newElement) ? newElement.props.children : null;
28
+ } else {
29
+ return child;
30
+ }
31
+ });
32
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
33
+ }
34
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
22
35
  });
23
- return o.displayName = `${r}.Slot`, o;
36
+ Slot2.displayName = `${ownerName}.Slot`;
37
+ return Slot2;
24
38
  }
25
39
  // @__NO_SIDE_EFFECTS__
26
- function S(r) {
27
- const n = e.forwardRef((o, i) => {
28
- let { children: t, ...l } = o;
29
- if (d(t) && typeof p == "function" && (t = p(t._payload)), e.isValidElement(t)) {
30
- const a = h(t), s = b(l, t.props);
31
- return t.type !== e.Fragment && (s.ref = i ? E(i, a) : a), e.cloneElement(t, s);
40
+ function createSlotClone(ownerName) {
41
+ const SlotClone = React.forwardRef((props, forwardedRef) => {
42
+ let { children, ...slotProps } = props;
43
+ if (isLazyComponent(children) && typeof use === "function") {
44
+ children = use(children._payload);
45
+ }
46
+ if (React.isValidElement(children)) {
47
+ const childrenRef = getElementRef(children);
48
+ const props2 = mergeProps(slotProps, children.props);
49
+ if (children.type !== React.Fragment) {
50
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
51
+ }
52
+ return React.cloneElement(children, props2);
32
53
  }
33
- return e.Children.count(t) > 1 ? e.Children.only(null) : null;
54
+ return React.Children.count(children) > 1 ? React.Children.only(null) : null;
34
55
  });
35
- return n.displayName = `${r}.SlotClone`, n;
56
+ SlotClone.displayName = `${ownerName}.SlotClone`;
57
+ return SlotClone;
36
58
  }
37
- var _ = /* @__PURE__ */ Symbol("radix.slottable");
38
- function R(r) {
39
- return e.isValidElement(r) && typeof r.type == "function" && "__radixId" in r.type && r.type.__radixId === _;
59
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
60
+ function isSlottable(child) {
61
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
40
62
  }
41
- function b(r, n) {
42
- const o = { ...n };
43
- for (const i in n) {
44
- const t = r[i], l = n[i];
45
- /^on[A-Z]/.test(i) ? t && l ? o[i] = (...s) => {
46
- const f = l(...s);
47
- return t(...s), f;
48
- } : t && (o[i] = t) : i === "style" ? o[i] = { ...t, ...l } : i === "className" && (o[i] = [t, l].filter(Boolean).join(" "));
63
+ function mergeProps(slotProps, childProps) {
64
+ const overrideProps = { ...childProps };
65
+ for (const propName in childProps) {
66
+ const slotPropValue = slotProps[propName];
67
+ const childPropValue = childProps[propName];
68
+ const isHandler = /^on[A-Z]/.test(propName);
69
+ if (isHandler) {
70
+ if (slotPropValue && childPropValue) {
71
+ overrideProps[propName] = (...args) => {
72
+ const result = childPropValue(...args);
73
+ slotPropValue(...args);
74
+ return result;
75
+ };
76
+ } else if (slotPropValue) {
77
+ overrideProps[propName] = slotPropValue;
78
+ }
79
+ } else if (propName === "style") {
80
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
81
+ } else if (propName === "className") {
82
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
83
+ }
49
84
  }
50
- return { ...r, ...o };
85
+ return { ...slotProps, ...overrideProps };
51
86
  }
52
- function h(r) {
53
- let n = Object.getOwnPropertyDescriptor(r.props, "ref")?.get, o = n && "isReactWarning" in n && n.isReactWarning;
54
- return o ? r.ref : (n = Object.getOwnPropertyDescriptor(r, "ref")?.get, o = n && "isReactWarning" in n && n.isReactWarning, o ? r.props.ref : r.props.ref || r.ref);
87
+ function getElementRef(element) {
88
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
89
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
90
+ if (mayWarn) {
91
+ return element.ref;
92
+ }
93
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
94
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
95
+ if (mayWarn) {
96
+ return element.props.ref;
97
+ }
98
+ return element.props.ref || element.ref;
55
99
  }
56
100
  export {
57
- A as createSlot
101
+ createSlot
58
102
  };
59
103
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../../../../node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["REACT_LAZY_TYPE","use","React","isPromiseLike","value","isLazyComponent","element","createSlot","ownerName","SlotClone","createSlotClone","Slot2","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","childrenRef","getElementRef","props2","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","childProps","overrideProps","propName","slotPropValue","childPropValue","args","result","getter","mayWarn"],"mappings":";;;AAIA,IAAIA,IAAkB,uBAAO,IAAI,YAAY,GACzCC,IAAMC,EAAM,QAAQ,KAAI,EAAG,SAAQ,CAAE;AACzC,SAASC,EAAcC,GAAO;AAC5B,SAAO,OAAOA,KAAU,YAAYA,MAAU,QAAQ,UAAUA;AAClE;AACA,SAASC,EAAgBC,GAAS;AAChC,SAAOA,KAAW,QAAQ,OAAOA,KAAY,YAAY,cAAcA,KAAWA,EAAQ,aAAaN,KAAmB,cAAcM,KAAWH,EAAcG,EAAQ,QAAQ;AACnL;AAAA;AAEA,SAASC,EAAWC,GAAW;AAC7B,QAAMC,IAA4B,gBAAAC,EAAgBF,CAAS,GACrDG,IAAQT,EAAM,WAAW,CAACU,GAAOC,MAAiB;AACtD,QAAI,EAAE,UAAAC,GAAU,GAAGC,EAAS,IAAKH;AACjC,IAAIP,EAAgBS,CAAQ,KAAK,OAAOb,KAAQ,eAC9Ca,IAAWb,EAAIa,EAAS,QAAQ;AAElC,UAAME,IAAgBd,EAAM,SAAS,QAAQY,CAAQ,GAC/CG,IAAYD,EAAc,KAAKE,CAAW;AAChD,QAAID,GAAW;AACb,YAAME,IAAaF,EAAU,MAAM,UAC7BG,IAAcJ,EAAc,IAAI,CAACK,MACjCA,MAAUJ,IACRf,EAAM,SAAS,MAAMiB,CAAU,IAAI,IAAUjB,EAAM,SAAS,KAAK,IAAI,IAClEA,EAAM,eAAeiB,CAAU,IAAIA,EAAW,MAAM,WAAW,OAE/DE,CAEV;AACD,aAAuB,gBAAAC,EAAIb,GAAW,EAAE,GAAGM,GAAW,KAAKF,GAAc,UAAUX,EAAM,eAAeiB,CAAU,IAAIjB,EAAM,aAAaiB,GAAY,QAAQC,CAAW,IAAI,MAAM;AAAA,IACpL;AACA,WAAuB,gBAAAE,EAAIb,GAAW,EAAE,GAAGM,GAAW,KAAKF,GAAc,UAAAC,GAAU;AAAA,EACrF,CAAC;AACD,SAAAH,EAAM,cAAc,GAAGH,CAAS,SACzBG;AACT;AAAA;AAGA,SAASD,EAAgBF,GAAW;AAClC,QAAMC,IAAYP,EAAM,WAAW,CAACU,GAAOC,MAAiB;AAC1D,QAAI,EAAE,UAAAC,GAAU,GAAGC,EAAS,IAAKH;AAIjC,QAHIP,EAAgBS,CAAQ,KAAK,OAAOb,KAAQ,eAC9Ca,IAAWb,EAAIa,EAAS,QAAQ,IAE9BZ,EAAM,eAAeY,CAAQ,GAAG;AAClC,YAAMS,IAAcC,EAAcV,CAAQ,GACpCW,IAASC,EAAWX,GAAWD,EAAS,KAAK;AACnD,aAAIA,EAAS,SAASZ,EAAM,aAC1BuB,EAAO,MAAMZ,IAAec,EAAYd,GAAcU,CAAW,IAAIA,IAEhErB,EAAM,aAAaY,GAAUW,CAAM;AAAA,IAC5C;AACA,WAAOvB,EAAM,SAAS,MAAMY,CAAQ,IAAI,IAAIZ,EAAM,SAAS,KAAK,IAAI,IAAI;AAAA,EAC1E,CAAC;AACD,SAAAO,EAAU,cAAc,GAAGD,CAAS,cAC7BC;AACT;AACA,IAAImB,IAAuB,uBAAO,iBAAiB;AAWnD,SAASV,EAAYG,GAAO;AAC1B,SAAOnB,EAAM,eAAemB,CAAK,KAAK,OAAOA,EAAM,QAAS,cAAc,eAAeA,EAAM,QAAQA,EAAM,KAAK,cAAcO;AAClI;AACA,SAASF,EAAWX,GAAWc,GAAY;AACzC,QAAMC,IAAgB,EAAE,GAAGD,EAAU;AACrC,aAAWE,KAAYF,GAAY;AACjC,UAAMG,IAAgBjB,EAAUgB,CAAQ,GAClCE,IAAiBJ,EAAWE,CAAQ;AAE1C,IADkB,WAAW,KAAKA,CAAQ,IAEpCC,KAAiBC,IACnBH,EAAcC,CAAQ,IAAI,IAAIG,MAAS;AACrC,YAAMC,IAASF,EAAe,GAAGC,CAAI;AACrC,aAAAF,EAAc,GAAGE,CAAI,GACdC;AAAA,IACT,IACSH,MACTF,EAAcC,CAAQ,IAAIC,KAEnBD,MAAa,UACtBD,EAAcC,CAAQ,IAAI,EAAE,GAAGC,GAAe,GAAGC,EAAc,IACtDF,MAAa,gBACtBD,EAAcC,CAAQ,IAAI,CAACC,GAAeC,CAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,EAEtF;AACA,SAAO,EAAE,GAAGlB,GAAW,GAAGe,EAAa;AACzC;AACA,SAASN,EAAclB,GAAS;AAC9B,MAAI8B,IAAS,OAAO,yBAAyB9B,EAAQ,OAAO,KAAK,GAAG,KAChE+B,IAAUD,KAAU,oBAAoBA,KAAUA,EAAO;AAC7D,SAAIC,IACK/B,EAAQ,OAEjB8B,IAAS,OAAO,yBAAyB9B,GAAS,KAAK,GAAG,KAC1D+B,IAAUD,KAAU,oBAAoBA,KAAUA,EAAO,gBACrDC,IACK/B,EAAQ,MAAM,MAEhBA,EAAQ,MAAM,OAAOA,EAAQ;AACtC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../../../node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;AAIA,IAAI,kBAAkB,uBAAO,IAAI,YAAY;AAC7C,IAAI,MAAM,MAAM,QAAQ,KAAI,EAAG,SAAQ,CAAE;AACzC,SAAS,cAAc,OAAO;AAC5B,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AAClE;AACA,SAAS,gBAAgB,SAAS;AAChC,SAAO,WAAW,QAAQ,OAAO,YAAY,YAAY,cAAc,WAAW,QAAQ,aAAa,mBAAmB,cAAc,WAAW,cAAc,QAAQ,QAAQ;AACnL;AAAA;AAEA,SAAS,WAAW,WAAW;AAC7B,QAAM,YAA4B,gCAAgB,SAAS;AAC3D,QAAM,QAAQ,MAAM,WAAW,CAAC,OAAO,iBAAiB;AACtD,QAAI,EAAE,UAAU,GAAG,UAAS,IAAK;AACjC,QAAI,gBAAgB,QAAQ,KAAK,OAAO,QAAQ,YAAY;AAC1D,iBAAW,IAAI,SAAS,QAAQ;AAAA,IAClC;AACA,UAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;AACrD,UAAM,YAAY,cAAc,KAAK,WAAW;AAChD,QAAI,WAAW;AACb,YAAM,aAAa,UAAU,MAAM;AACnC,YAAM,cAAc,cAAc,IAAI,CAAC,UAAU;AAC/C,YAAI,UAAU,WAAW;AACvB,cAAI,MAAM,SAAS,MAAM,UAAU,IAAI,EAAG,QAAO,MAAM,SAAS,KAAK,IAAI;AACzE,iBAAO,MAAM,eAAe,UAAU,IAAI,WAAW,MAAM,WAAW;AAAA,QACxE,OAAO;AACL,iBAAO;AAAA,QACT;AAAA,MACF,CAAC;AACD,aAAuB,oBAAI,WAAW,EAAE,GAAG,WAAW,KAAK,cAAc,UAAU,MAAM,eAAe,UAAU,IAAI,MAAM,aAAa,YAAY,QAAQ,WAAW,IAAI,MAAM;AAAA,IACpL;AACA,WAAuB,oBAAI,WAAW,EAAE,GAAG,WAAW,KAAK,cAAc,UAAU;AAAA,EACrF,CAAC;AACD,QAAM,cAAc,GAAG,SAAS;AAChC,SAAO;AACT;AAAA;AAGA,SAAS,gBAAgB,WAAW;AAClC,QAAM,YAAY,MAAM,WAAW,CAAC,OAAO,iBAAiB;AAC1D,QAAI,EAAE,UAAU,GAAG,UAAS,IAAK;AACjC,QAAI,gBAAgB,QAAQ,KAAK,OAAO,QAAQ,YAAY;AAC1D,iBAAW,IAAI,SAAS,QAAQ;AAAA,IAClC;AACA,QAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,YAAM,cAAc,cAAc,QAAQ;AAC1C,YAAM,SAAS,WAAW,WAAW,SAAS,KAAK;AACnD,UAAI,SAAS,SAAS,MAAM,UAAU;AACpC,eAAO,MAAM,eAAe,YAAY,cAAc,WAAW,IAAI;AAAA,MACvE;AACA,aAAO,MAAM,aAAa,UAAU,MAAM;AAAA,IAC5C;AACA,WAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAAA,EAC1E,CAAC;AACD,YAAU,cAAc,GAAG,SAAS;AACpC,SAAO;AACT;AACA,IAAI,uBAAuB,uBAAO,iBAAiB;AAWnD,SAAS,YAAY,OAAO;AAC1B,SAAO,MAAM,eAAe,KAAK,KAAK,OAAO,MAAM,SAAS,cAAc,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc;AAClI;AACA,SAAS,WAAW,WAAW,YAAY;AACzC,QAAM,gBAAgB,EAAE,GAAG,WAAU;AACrC,aAAW,YAAY,YAAY;AACjC,UAAM,gBAAgB,UAAU,QAAQ;AACxC,UAAM,iBAAiB,WAAW,QAAQ;AAC1C,UAAM,YAAY,WAAW,KAAK,QAAQ;AAC1C,QAAI,WAAW;AACb,UAAI,iBAAiB,gBAAgB;AACnC,sBAAc,QAAQ,IAAI,IAAI,SAAS;AACrC,gBAAM,SAAS,eAAe,GAAG,IAAI;AACrC,wBAAc,GAAG,IAAI;AACrB,iBAAO;AAAA,QACT;AAAA,MACF,WAAW,eAAe;AACxB,sBAAc,QAAQ,IAAI;AAAA,MAC5B;AAAA,IACF,WAAW,aAAa,SAAS;AAC/B,oBAAc,QAAQ,IAAI,EAAE,GAAG,eAAe,GAAG,eAAc;AAAA,IACjE,WAAW,aAAa,aAAa;AACnC,oBAAc,QAAQ,IAAI,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AACA,SAAO,EAAE,GAAG,WAAW,GAAG,cAAa;AACzC;AACA,SAAS,cAAc,SAAS;AAC9B,MAAI,SAAS,OAAO,yBAAyB,QAAQ,OAAO,KAAK,GAAG;AACpE,MAAI,UAAU,UAAU,oBAAoB,UAAU,OAAO;AAC7D,MAAI,SAAS;AACX,WAAO,QAAQ;AAAA,EACjB;AACA,WAAS,OAAO,yBAAyB,SAAS,KAAK,GAAG;AAC1D,YAAU,UAAU,oBAAoB,UAAU,OAAO;AACzD,MAAI,SAAS;AACX,WAAO,QAAQ,MAAM;AAAA,EACvB;AACA,SAAO,QAAQ,MAAM,OAAO,QAAQ;AACtC;","x_google_ignoreList":[0]}
@@ -1,2 +1,71 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),_=require("../../react-context/dist/index.cjs"),I=require("../../react-compose-refs/dist/index.cjs"),M=require("../../react-slot/dist/index.cjs"),m=require("react/jsx-runtime");function q(s){const u=s+"CollectionProvider",[A,N]=_.createContextScope(u),[T,d]=A(u,{collectionRef:{current:null},itemMap:new Map}),C=c=>{const{scope:e,children:l}=c,t=r.useRef(null),o=r.useRef(new Map).current;return m.jsx(T,{scope:e,itemMap:o,collectionRef:t,children:l})};C.displayName=u;const a=s+"CollectionSlot",y=M.createSlot(a),p=r.forwardRef((c,e)=>{const{scope:l,children:t}=c,o=d(a,l),n=I.useComposedRefs(e,o.collectionRef);return m.jsx(y,{ref:n,children:t})});p.displayName=a;const f=s+"CollectionItemSlot",R="data-radix-collection-item",E=M.createSlot(f),S=r.forwardRef((c,e)=>{const{scope:l,children:t,...o}=c,n=r.useRef(null),x=I.useComposedRefs(e,n),i=d(f,l);return r.useEffect(()=>(i.itemMap.set(n,{ref:n,...o}),()=>{i.itemMap.delete(n)})),m.jsx(E,{[R]:"",ref:x,children:t})});S.displayName=f;function O(c){const e=d(s+"CollectionConsumer",c);return r.useCallback(()=>{const t=e.collectionRef.current;if(!t)return[];const o=Array.from(t.querySelectorAll(`[${R}]`));return Array.from(e.itemMap.values()).sort((i,v)=>o.indexOf(i.ref.current)-o.indexOf(v.ref.current))},[e.collectionRef,e.itemMap])}return[{Provider:C,Slot:p,ItemSlot:S},O,N]}exports.createCollection=q;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const index = require("../../react-context/dist/index.cjs");
5
+ const index$1 = require("../../react-compose-refs/dist/index.cjs");
6
+ const index$2 = require("../../react-slot/dist/index.cjs");
7
+ const jsxRuntime = require("react/jsx-runtime");
8
+ function createCollection(name) {
9
+ const PROVIDER_NAME = name + "CollectionProvider";
10
+ const [createCollectionContext, createCollectionScope] = index.createContextScope(PROVIDER_NAME);
11
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
12
+ PROVIDER_NAME,
13
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
14
+ );
15
+ const CollectionProvider = (props) => {
16
+ const { scope, children } = props;
17
+ const ref = React.useRef(null);
18
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
19
+ return /* @__PURE__ */ jsxRuntime.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
20
+ };
21
+ CollectionProvider.displayName = PROVIDER_NAME;
22
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
23
+ const CollectionSlotImpl = index$2.createSlot(COLLECTION_SLOT_NAME);
24
+ const CollectionSlot = React.forwardRef(
25
+ (props, forwardedRef) => {
26
+ const { scope, children } = props;
27
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
28
+ const composedRefs = index$1.useComposedRefs(forwardedRef, context.collectionRef);
29
+ return /* @__PURE__ */ jsxRuntime.jsx(CollectionSlotImpl, { ref: composedRefs, children });
30
+ }
31
+ );
32
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
33
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
34
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
35
+ const CollectionItemSlotImpl = index$2.createSlot(ITEM_SLOT_NAME);
36
+ const CollectionItemSlot = React.forwardRef(
37
+ (props, forwardedRef) => {
38
+ const { scope, children, ...itemData } = props;
39
+ const ref = React.useRef(null);
40
+ const composedRefs = index$1.useComposedRefs(forwardedRef, ref);
41
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
42
+ React.useEffect(() => {
43
+ context.itemMap.set(ref, { ref, ...itemData });
44
+ return () => void context.itemMap.delete(ref);
45
+ });
46
+ return /* @__PURE__ */ jsxRuntime.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
47
+ }
48
+ );
49
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
50
+ function useCollection(scope) {
51
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
52
+ const getItems = React.useCallback(() => {
53
+ const collectionNode = context.collectionRef.current;
54
+ if (!collectionNode) return [];
55
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
56
+ const items = Array.from(context.itemMap.values());
57
+ const orderedItems = items.sort(
58
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
59
+ );
60
+ return orderedItems;
61
+ }, [context.collectionRef, context.itemMap]);
62
+ return getItems;
63
+ }
64
+ return [
65
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
66
+ useCollection,
67
+ createCollectionScope
68
+ ];
69
+ }
70
+ exports.createCollection = createCollection;
2
71
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../../../../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\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 /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\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 return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\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 insert(index, key, value) {\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 if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\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 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 with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\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 first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 find(predicate, thisArg) {\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 void 0;\n }\n findIndex(predicate, thisArg) {\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 filter(predicate, thisArg) {\n const entries = [];\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 map(callbackfn, thisArg) {\n const entries = [];\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 reduce(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\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 toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\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 every(predicate, thisArg) {\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 some(predicate, thisArg) {\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};\nfunction at(array, index) {\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 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\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}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\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 const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\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 return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\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}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\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 return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createCollection","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","createContextScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","scope","children","ref","React","itemMap","jsx","COLLECTION_SLOT_NAME","CollectionSlotImpl","createSlot","CollectionSlot","forwardedRef","context","composedRefs","useComposedRefs","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlotImpl","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","a","b"],"mappings":"0RAQA,SAASA,EAAiBC,EAAM,CAC9B,MAAMC,EAAgBD,EAAO,qBACvB,CAACE,EAAyBC,CAAqB,EAAIC,EAAAA,mBAAmBH,CAAa,EACnF,CAACI,EAAwBC,CAAoB,EAAIJ,EACrDD,EACA,CAAE,cAAe,CAAE,QAAS,IAAI,EAAI,QAAyB,IAAI,GAAK,CAC1E,EACQM,EAAsBC,GAAU,CACpC,KAAM,CAAE,MAAAC,EAAO,SAAAC,CAAQ,EAAKF,EACtBG,EAAMC,EAAM,OAAO,IAAI,EACvBC,EAAUD,EAAM,OAAuB,IAAI,GAAK,EAAE,QACxD,OAAuBE,EAAAA,IAAIT,EAAwB,CAAE,MAAAI,EAAO,QAAAI,EAAS,cAAeF,EAAK,SAAAD,EAAU,CACrG,EACAH,EAAmB,YAAcN,EACjC,MAAMc,EAAuBf,EAAO,iBAC9BgB,EAAqBC,EAAAA,WAAWF,CAAoB,EACpDG,EAAiBN,EAAM,WAC3B,CAACJ,EAAOW,IAAiB,CACvB,KAAM,CAAE,MAAAV,EAAO,SAAAC,CAAQ,EAAKF,EACtBY,EAAUd,EAAqBS,EAAsBN,CAAK,EAC1DY,EAAeC,EAAAA,gBAAgBH,EAAcC,EAAQ,aAAa,EACxE,OAAuBN,EAAAA,IAAIE,EAAoB,CAAE,IAAKK,EAAc,SAAAX,CAAQ,CAAE,CAChF,CACJ,EACEQ,EAAe,YAAcH,EAC7B,MAAMQ,EAAiBvB,EAAO,qBACxBwB,EAAiB,6BACjBC,EAAyBR,EAAAA,WAAWM,CAAc,EAClDG,EAAqBd,EAAM,WAC/B,CAACJ,EAAOW,IAAiB,CACvB,KAAM,CAAE,MAAAV,EAAO,SAAAC,EAAU,GAAGiB,CAAQ,EAAKnB,EACnCG,EAAMC,EAAM,OAAO,IAAI,EACvBS,EAAeC,EAAAA,gBAAgBH,EAAcR,CAAG,EAChDS,EAAUd,EAAqBiB,EAAgBd,CAAK,EAC1D,OAAAG,EAAM,UAAU,KACdQ,EAAQ,QAAQ,IAAIT,EAAK,CAAE,IAAAA,EAAK,GAAGgB,EAAU,EACtC,IAAA,CAAWP,EAAQ,QAAQ,OAAOT,CAAG,GAC7C,EACsBG,MAAIW,EAAwB,CAAO,CAACD,CAAc,EAAG,GAAM,IAAKH,EAAc,SAAAX,EAAU,CACjH,CACJ,EACEgB,EAAmB,YAAcH,EACjC,SAASK,EAAcnB,EAAO,CAC5B,MAAMW,EAAUd,EAAqBN,EAAO,qBAAsBS,CAAK,EAWvE,OAViBG,EAAM,YAAY,IAAM,CACvC,MAAMiB,EAAiBT,EAAQ,cAAc,QAC7C,GAAI,CAACS,EAAgB,MAAO,CAAA,EAC5B,MAAMC,EAAe,MAAM,KAAKD,EAAe,iBAAiB,IAAIL,CAAc,GAAG,CAAC,EAKtF,OAJc,MAAM,KAAKJ,EAAQ,QAAQ,QAAQ,EACtB,KACzB,CAACW,EAAGC,IAAMF,EAAa,QAAQC,EAAE,IAAI,OAAO,EAAID,EAAa,QAAQE,EAAE,IAAI,OAAO,CAC1F,CAEI,EAAG,CAACZ,EAAQ,cAAeA,EAAQ,OAAO,CAAC,CAE7C,CACA,MAAO,CACL,CAAE,SAAUb,EAAoB,KAAMW,EAAgB,SAAUQ,CAAkB,EAClFE,EACAzB,CACJ,CACA","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../../../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\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 /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\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 return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\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 insert(index, key, value) {\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 if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\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 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 with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\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 first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 find(predicate, thisArg) {\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 void 0;\n }\n findIndex(predicate, thisArg) {\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 filter(predicate, thisArg) {\n const entries = [];\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 map(callbackfn, thisArg) {\n const entries = [];\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 reduce(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\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 toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\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 every(predicate, thisArg) {\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 some(predicate, thisArg) {\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};\nfunction at(array, index) {\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 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\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}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\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 const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\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 return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\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}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\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 return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createContextScope","jsx","createSlot","useComposedRefs"],"mappings":";;;;;;;AAQA,SAAS,iBAAiB,MAAM;AAC9B,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,IAAIA,MAAAA,mBAAmB,aAAa;AACzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,IACrD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAI,GAAI,SAAyB,oBAAI,IAAG,EAAE;AAAA,EAC1E;AACE,QAAM,qBAAqB,CAAC,UAAU;AACpC,UAAM,EAAE,OAAO,SAAQ,IAAK;AAC5B,UAAM,MAAM,MAAM,OAAO,IAAI;AAC7B,UAAM,UAAU,MAAM,OAAuB,oBAAI,IAAG,CAAE,EAAE;AACxD,WAAuBC,2BAAAA,IAAI,wBAAwB,EAAE,OAAO,SAAS,eAAe,KAAK,UAAU;AAAA,EACrG;AACA,qBAAmB,cAAc;AACjC,QAAM,uBAAuB,OAAO;AACpC,QAAM,qBAAqBC,QAAAA,WAAW,oBAAoB;AAC1D,QAAM,iBAAiB,MAAM;AAAA,IAC3B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,SAAQ,IAAK;AAC5B,YAAM,UAAU,qBAAqB,sBAAsB,KAAK;AAChE,YAAM,eAAeC,QAAAA,gBAAgB,cAAc,QAAQ,aAAa;AACxE,aAAuBF,2BAAAA,IAAI,oBAAoB,EAAE,KAAK,cAAc,SAAQ,CAAE;AAAA,IAChF;AAAA,EACJ;AACE,iBAAe,cAAc;AAC7B,QAAM,iBAAiB,OAAO;AAC9B,QAAM,iBAAiB;AACvB,QAAM,yBAAyBC,QAAAA,WAAW,cAAc;AACxD,QAAM,qBAAqB,MAAM;AAAA,IAC/B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,UAAU,GAAG,SAAQ,IAAK;AACzC,YAAM,MAAM,MAAM,OAAO,IAAI;AAC7B,YAAM,eAAeC,QAAAA,gBAAgB,cAAc,GAAG;AACtD,YAAM,UAAU,qBAAqB,gBAAgB,KAAK;AAC1D,YAAM,UAAU,MAAM;AACpB,gBAAQ,QAAQ,IAAI,KAAK,EAAE,KAAK,GAAG,UAAU;AAC7C,eAAO,MAAM,KAAK,QAAQ,QAAQ,OAAO,GAAG;AAAA,MAC9C,CAAC;AACD,aAAuBF,+BAAI,wBAAwB,EAAE,GAAG,EAAE,CAAC,cAAc,GAAG,GAAE,GAAI,KAAK,cAAc,UAAU;AAAA,IACjH;AAAA,EACJ;AACE,qBAAmB,cAAc;AACjC,WAAS,cAAc,OAAO;AAC5B,UAAM,UAAU,qBAAqB,OAAO,sBAAsB,KAAK;AACvE,UAAM,WAAW,MAAM,YAAY,MAAM;AACvC,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC,eAAgB,QAAO,CAAA;AAC5B,YAAM,eAAe,MAAM,KAAK,eAAe,iBAAiB,IAAI,cAAc,GAAG,CAAC;AACtF,YAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ,QAAQ;AACjD,YAAM,eAAe,MAAM;AAAA,QACzB,CAAC,GAAG,MAAM,aAAa,QAAQ,EAAE,IAAI,OAAO,IAAI,aAAa,QAAQ,EAAE,IAAI,OAAO;AAAA,MAC1F;AACM,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAkB;AAAA,IAClF;AAAA,IACA;AAAA,EACJ;AACA;;","x_google_ignoreList":[0]}
@@ -1,51 +1,71 @@
1
- import r from "react";
2
- import { createContextScope as y } from "../../react-context/dist/index.js";
3
- import { useComposedRefs as M } from "../../react-compose-refs/dist/index.js";
4
- import { createSlot as x } from "../../react-slot/dist/index.js";
5
- import { jsx as u } from "react/jsx-runtime";
6
- function g(s) {
7
- const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
8
- m,
1
+ import React__default from "react";
2
+ import { createContextScope } from "../../react-context/dist/index.js";
3
+ import { useComposedRefs } from "../../react-compose-refs/dist/index.js";
4
+ import { createSlot } from "../../react-slot/dist/index.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ function createCollection(name) {
7
+ const PROVIDER_NAME = name + "CollectionProvider";
8
+ const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
9
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
10
+ PROVIDER_NAME,
9
11
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
10
- ), p = (c) => {
11
- const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
12
- return /* @__PURE__ */ u(_, { scope: e, itemMap: t, collectionRef: o, children: l });
12
+ );
13
+ const CollectionProvider = (props) => {
14
+ const { scope, children } = props;
15
+ const ref = React__default.useRef(null);
16
+ const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
17
+ return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
13
18
  };
14
- p.displayName = m;
15
- const a = s + "CollectionSlot", E = x(a), C = r.forwardRef(
16
- (c, e) => {
17
- const { scope: l, children: o } = c, t = f(a, l), n = M(e, t.collectionRef);
18
- return /* @__PURE__ */ u(E, { ref: n, children: o });
19
+ CollectionProvider.displayName = PROVIDER_NAME;
20
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
21
+ const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
22
+ const CollectionSlot = React__default.forwardRef(
23
+ (props, forwardedRef) => {
24
+ const { scope, children } = props;
25
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
26
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
27
+ return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
19
28
  }
20
29
  );
21
- C.displayName = a;
22
- const d = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(d), I = r.forwardRef(
23
- (c, e) => {
24
- const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(d, l);
25
- return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => {
26
- i.itemMap.delete(n);
27
- })), /* @__PURE__ */ u(T, { [R]: "", ref: S, children: o });
30
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
31
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
32
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
33
+ const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
34
+ const CollectionItemSlot = React__default.forwardRef(
35
+ (props, forwardedRef) => {
36
+ const { scope, children, ...itemData } = props;
37
+ const ref = React__default.useRef(null);
38
+ const composedRefs = useComposedRefs(forwardedRef, ref);
39
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
40
+ React__default.useEffect(() => {
41
+ context.itemMap.set(ref, { ref, ...itemData });
42
+ return () => void context.itemMap.delete(ref);
43
+ });
44
+ return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
28
45
  }
29
46
  );
30
- I.displayName = d;
31
- function O(c) {
32
- const e = f(s + "CollectionConsumer", c);
33
- return r.useCallback(() => {
34
- const o = e.collectionRef.current;
35
- if (!o) return [];
36
- const t = Array.from(o.querySelectorAll(`[${R}]`));
37
- return Array.from(e.itemMap.values()).sort(
38
- (i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
47
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
48
+ function useCollection(scope) {
49
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
50
+ const getItems = React__default.useCallback(() => {
51
+ const collectionNode = context.collectionRef.current;
52
+ if (!collectionNode) return [];
53
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
54
+ const items = Array.from(context.itemMap.values());
55
+ const orderedItems = items.sort(
56
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
39
57
  );
40
- }, [e.collectionRef, e.itemMap]);
58
+ return orderedItems;
59
+ }, [context.collectionRef, context.itemMap]);
60
+ return getItems;
41
61
  }
42
62
  return [
43
- { Provider: p, Slot: C, ItemSlot: I },
44
- O,
45
- N
63
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
64
+ useCollection,
65
+ createCollectionScope
46
66
  ];
47
67
  }
48
68
  export {
49
- g as createCollection
69
+ createCollection
50
70
  };
51
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\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 /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\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 return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\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 insert(index, key, value) {\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 if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\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 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 with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\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 first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 find(predicate, thisArg) {\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 void 0;\n }\n findIndex(predicate, thisArg) {\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 filter(predicate, thisArg) {\n const entries = [];\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 map(callbackfn, thisArg) {\n const entries = [];\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 reduce(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\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 toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\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 every(predicate, thisArg) {\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 some(predicate, thisArg) {\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};\nfunction at(array, index) {\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 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\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}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\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 const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\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 return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\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}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\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 return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createCollection","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","createContextScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","scope","children","ref","React","itemMap","jsx","COLLECTION_SLOT_NAME","CollectionSlotImpl","createSlot","CollectionSlot","forwardedRef","context","composedRefs","useComposedRefs","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlotImpl","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","a","b"],"mappings":";;;;;AAQA,SAASA,EAAiBC,GAAM;AAC9B,QAAMC,IAAgBD,IAAO,sBACvB,CAACE,GAAyBC,CAAqB,IAAIC,EAAmBH,CAAa,GACnF,CAACI,GAAwBC,CAAoB,IAAIJ;AAAA,IACrDD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAI,GAAI,SAAyB,oBAAI,IAAG,EAAE;AAAA,EAC1E,GACQM,IAAqB,CAACC,MAAU;AACpC,UAAM,EAAE,OAAAC,GAAO,UAAAC,EAAQ,IAAKF,GACtBG,IAAMC,EAAM,OAAO,IAAI,GACvBC,IAAUD,EAAM,OAAuB,oBAAI,IAAG,CAAE,EAAE;AACxD,WAAuB,gBAAAE,EAAIT,GAAwB,EAAE,OAAAI,GAAO,SAAAI,GAAS,eAAeF,GAAK,UAAAD,GAAU;AAAA,EACrG;AACA,EAAAH,EAAmB,cAAcN;AACjC,QAAMc,IAAuBf,IAAO,kBAC9BgB,IAAqBC,EAAWF,CAAoB,GACpDG,IAAiBN,EAAM;AAAA,IAC3B,CAACJ,GAAOW,MAAiB;AACvB,YAAM,EAAE,OAAAV,GAAO,UAAAC,EAAQ,IAAKF,GACtBY,IAAUd,EAAqBS,GAAsBN,CAAK,GAC1DY,IAAeC,EAAgBH,GAAcC,EAAQ,aAAa;AACxE,aAAuB,gBAAAN,EAAIE,GAAoB,EAAE,KAAKK,GAAc,UAAAX,EAAQ,CAAE;AAAA,IAChF;AAAA,EACJ;AACE,EAAAQ,EAAe,cAAcH;AAC7B,QAAMQ,IAAiBvB,IAAO,sBACxBwB,IAAiB,8BACjBC,IAAyBR,EAAWM,CAAc,GAClDG,IAAqBd,EAAM;AAAA,IAC/B,CAACJ,GAAOW,MAAiB;AACvB,YAAM,EAAE,OAAAV,GAAO,UAAAC,GAAU,GAAGiB,EAAQ,IAAKnB,GACnCG,IAAMC,EAAM,OAAO,IAAI,GACvBS,IAAeC,EAAgBH,GAAcR,CAAG,GAChDS,IAAUd,EAAqBiB,GAAgBd,CAAK;AAC1DG,aAAAA,EAAM,UAAU,OACdQ,EAAQ,QAAQ,IAAIT,GAAK,EAAE,KAAAA,GAAK,GAAGgB,GAAU,GACtC,MAAA;AAAM,QAAKP,EAAQ,QAAQ,OAAOT,CAAG;AAAA,QAC7C,GACsB,gBAAAG,EAAIW,GAAwB,EAAO,CAACD,CAAc,GAAG,IAAM,KAAKH,GAAc,UAAAX,GAAU;AAAA,IACjH;AAAA,EACJ;AACE,EAAAgB,EAAmB,cAAcH;AACjC,WAASK,EAAcnB,GAAO;AAC5B,UAAMW,IAAUd,EAAqBN,IAAO,sBAAsBS,CAAK;AAWvE,WAViBG,EAAM,YAAY,MAAM;AACvC,YAAMiB,IAAiBT,EAAQ,cAAc;AAC7C,UAAI,CAACS,EAAgB,QAAO,CAAA;AAC5B,YAAMC,IAAe,MAAM,KAAKD,EAAe,iBAAiB,IAAIL,CAAc,GAAG,CAAC;AAKtF,aAJc,MAAM,KAAKJ,EAAQ,QAAQ,QAAQ,EACtB;AAAA,QACzB,CAACW,GAAGC,MAAMF,EAAa,QAAQC,EAAE,IAAI,OAAO,IAAID,EAAa,QAAQE,EAAE,IAAI,OAAO;AAAA,MAC1F;AAAA,IAEI,GAAG,CAACZ,EAAQ,eAAeA,EAAQ,OAAO,CAAC;AAAA,EAE7C;AACA,SAAO;AAAA,IACL,EAAE,UAAUb,GAAoB,MAAMW,GAAgB,UAAUQ,EAAkB;AAAA,IAClFE;AAAA,IACAzB;AAAA,EACJ;AACA;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\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 /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\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 return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\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 insert(index, key, value) {\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 if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\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 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 with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\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 first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\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 find(predicate, thisArg) {\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 void 0;\n }\n findIndex(predicate, thisArg) {\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 filter(predicate, thisArg) {\n const entries = [];\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 map(callbackfn, thisArg) {\n const entries = [];\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 reduce(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\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;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\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 toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\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 every(predicate, thisArg) {\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 some(predicate, thisArg) {\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};\nfunction at(array, index) {\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 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\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}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\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 const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\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 return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\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}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\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 return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React"],"mappings":";;;;;AAQA,SAAS,iBAAiB,MAAM;AAC9B,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,IAAI,mBAAmB,aAAa;AACzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,IACrD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAI,GAAI,SAAyB,oBAAI,IAAG,EAAE;AAAA,EAC1E;AACE,QAAM,qBAAqB,CAAC,UAAU;AACpC,UAAM,EAAE,OAAO,SAAQ,IAAK;AAC5B,UAAM,MAAMA,eAAM,OAAO,IAAI;AAC7B,UAAM,UAAUA,eAAM,OAAuB,oBAAI,IAAG,CAAE,EAAE;AACxD,WAAuB,oBAAI,wBAAwB,EAAE,OAAO,SAAS,eAAe,KAAK,UAAU;AAAA,EACrG;AACA,qBAAmB,cAAc;AACjC,QAAM,uBAAuB,OAAO;AACpC,QAAM,qBAAqB,WAAW,oBAAoB;AAC1D,QAAM,iBAAiBA,eAAM;AAAA,IAC3B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,SAAQ,IAAK;AAC5B,YAAM,UAAU,qBAAqB,sBAAsB,KAAK;AAChE,YAAM,eAAe,gBAAgB,cAAc,QAAQ,aAAa;AACxE,aAAuB,oBAAI,oBAAoB,EAAE,KAAK,cAAc,SAAQ,CAAE;AAAA,IAChF;AAAA,EACJ;AACE,iBAAe,cAAc;AAC7B,QAAM,iBAAiB,OAAO;AAC9B,QAAM,iBAAiB;AACvB,QAAM,yBAAyB,WAAW,cAAc;AACxD,QAAM,qBAAqBA,eAAM;AAAA,IAC/B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,UAAU,GAAG,SAAQ,IAAK;AACzC,YAAM,MAAMA,eAAM,OAAO,IAAI;AAC7B,YAAM,eAAe,gBAAgB,cAAc,GAAG;AACtD,YAAM,UAAU,qBAAqB,gBAAgB,KAAK;AAC1DA,qBAAM,UAAU,MAAM;AACpB,gBAAQ,QAAQ,IAAI,KAAK,EAAE,KAAK,GAAG,UAAU;AAC7C,eAAO,MAAM,KAAK,QAAQ,QAAQ,OAAO,GAAG;AAAA,MAC9C,CAAC;AACD,aAAuB,oBAAI,wBAAwB,EAAE,GAAG,EAAE,CAAC,cAAc,GAAG,GAAE,GAAI,KAAK,cAAc,UAAU;AAAA,IACjH;AAAA,EACJ;AACE,qBAAmB,cAAc;AACjC,WAAS,cAAc,OAAO;AAC5B,UAAM,UAAU,qBAAqB,OAAO,sBAAsB,KAAK;AACvE,UAAM,WAAWA,eAAM,YAAY,MAAM;AACvC,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC,eAAgB,QAAO,CAAA;AAC5B,YAAM,eAAe,MAAM,KAAK,eAAe,iBAAiB,IAAI,cAAc,GAAG,CAAC;AACtF,YAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ,QAAQ;AACjD,YAAM,eAAe,MAAM;AAAA,QACzB,CAAC,GAAG,MAAM,aAAa,QAAQ,EAAE,IAAI,OAAO,IAAI,aAAa,QAAQ,EAAE,IAAI,OAAO;AAAA,MAC1F;AACM,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAC3C,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAkB;AAAA,IAClF;AAAA,IACA;AAAA,EACJ;AACA;","x_google_ignoreList":[0]}