@oxy.so/bloom 7.19.2 → 7.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/docs/adoption-matrix.mdx +10 -9
  2. package/docs/bottom-sheet.mdx +15 -0
  3. package/docs/dialog.mdx +51 -0
  4. package/docs/overlay.mdx +18 -0
  5. package/docs/rating.mdx +2 -0
  6. package/docs/stat-bar.mdx +10 -0
  7. package/docs/viewport.mdx +47 -0
  8. package/lib/commonjs/bottom-sheet/BottomSheetBase.js +27 -10
  9. package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
  10. package/lib/commonjs/dialog/Dialog.js +21 -8
  11. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  12. package/lib/commonjs/dialog/Dialog.web.js +37 -18
  13. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  14. package/lib/commonjs/dialog/DialogBottomSheet.js +4 -0
  15. package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
  16. package/lib/commonjs/dialog/placement.js +8 -1
  17. package/lib/commonjs/dialog/placement.js.map +1 -1
  18. package/lib/commonjs/index.js +12 -0
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/index.web.js +12 -0
  21. package/lib/commonjs/index.web.js.map +1 -1
  22. package/lib/commonjs/motion/surface-transition.js +18 -0
  23. package/lib/commonjs/motion/surface-transition.js.map +1 -0
  24. package/lib/commonjs/motion/use-surface-transition.js +24 -0
  25. package/lib/commonjs/motion/use-surface-transition.js.map +1 -0
  26. package/lib/commonjs/overlay/Overlay.js +11 -11
  27. package/lib/commonjs/overlay/Overlay.js.map +1 -1
  28. package/lib/commonjs/overlay/backdrop-paint.js +34 -0
  29. package/lib/commonjs/overlay/backdrop-paint.js.map +1 -0
  30. package/lib/commonjs/rating/RatingBar.js +2 -0
  31. package/lib/commonjs/rating/RatingBar.js.map +1 -1
  32. package/lib/commonjs/rating/RatingBar.web.js +2 -0
  33. package/lib/commonjs/rating/RatingBar.web.js.map +1 -1
  34. package/lib/commonjs/stat-bar/Meter.js +7 -4
  35. package/lib/commonjs/stat-bar/Meter.js.map +1 -1
  36. package/lib/commonjs/stat-bar/Meter.web.js +11 -4
  37. package/lib/commonjs/stat-bar/Meter.web.js.map +1 -1
  38. package/lib/commonjs/stat-bar/use-meter-reveal-policy.js +29 -0
  39. package/lib/commonjs/stat-bar/use-meter-reveal-policy.js.map +1 -0
  40. package/lib/commonjs/stat-bar/use-meter-reveal.js +39 -0
  41. package/lib/commonjs/stat-bar/use-meter-reveal.js.map +1 -0
  42. package/lib/commonjs/stat-bar/use-meter-reveal.web.js +38 -0
  43. package/lib/commonjs/stat-bar/use-meter-reveal.web.js.map +1 -0
  44. package/lib/commonjs/viewport/ViewportProvider.js +28 -0
  45. package/lib/commonjs/viewport/ViewportProvider.js.map +1 -0
  46. package/lib/commonjs/viewport/context.js +9 -0
  47. package/lib/commonjs/viewport/context.js.map +1 -0
  48. package/lib/commonjs/viewport/geometry.js +31 -0
  49. package/lib/commonjs/viewport/geometry.js.map +1 -0
  50. package/lib/commonjs/viewport/index.js +27 -0
  51. package/lib/commonjs/viewport/index.js.map +1 -0
  52. package/lib/commonjs/viewport/index.web.js +27 -0
  53. package/lib/commonjs/viewport/index.web.js.map +1 -0
  54. package/lib/commonjs/viewport/types.js +6 -0
  55. package/lib/commonjs/viewport/types.js.map +1 -0
  56. package/lib/commonjs/viewport/use-in-view.js +106 -0
  57. package/lib/commonjs/viewport/use-in-view.js.map +1 -0
  58. package/lib/commonjs/viewport/use-in-view.web.js +49 -0
  59. package/lib/commonjs/viewport/use-in-view.web.js.map +1 -0
  60. package/lib/commonjs/viewport/use-viewport-binding.js +55 -0
  61. package/lib/commonjs/viewport/use-viewport-binding.js.map +1 -0
  62. package/lib/module/bottom-sheet/BottomSheetBase.js +27 -10
  63. package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
  64. package/lib/module/dialog/Dialog.js +22 -9
  65. package/lib/module/dialog/Dialog.js.map +1 -1
  66. package/lib/module/dialog/Dialog.web.js +38 -19
  67. package/lib/module/dialog/Dialog.web.js.map +1 -1
  68. package/lib/module/dialog/DialogBottomSheet.js +4 -0
  69. package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
  70. package/lib/module/dialog/placement.js +7 -1
  71. package/lib/module/dialog/placement.js.map +1 -1
  72. package/lib/module/index.js +1 -0
  73. package/lib/module/index.js.map +1 -1
  74. package/lib/module/index.web.js +1 -0
  75. package/lib/module/index.web.js.map +1 -1
  76. package/lib/module/motion/surface-transition.js +14 -0
  77. package/lib/module/motion/surface-transition.js.map +1 -0
  78. package/lib/module/motion/use-surface-transition.js +20 -0
  79. package/lib/module/motion/use-surface-transition.js.map +1 -0
  80. package/lib/module/overlay/Overlay.js +11 -11
  81. package/lib/module/overlay/Overlay.js.map +1 -1
  82. package/lib/module/overlay/backdrop-paint.js +29 -0
  83. package/lib/module/overlay/backdrop-paint.js.map +1 -0
  84. package/lib/module/rating/RatingBar.js +2 -0
  85. package/lib/module/rating/RatingBar.js.map +1 -1
  86. package/lib/module/rating/RatingBar.web.js +2 -0
  87. package/lib/module/rating/RatingBar.web.js.map +1 -1
  88. package/lib/module/stat-bar/Meter.js +9 -4
  89. package/lib/module/stat-bar/Meter.js.map +1 -1
  90. package/lib/module/stat-bar/Meter.web.js +11 -4
  91. package/lib/module/stat-bar/Meter.web.js.map +1 -1
  92. package/lib/module/stat-bar/use-meter-reveal-policy.js +25 -0
  93. package/lib/module/stat-bar/use-meter-reveal-policy.js.map +1 -0
  94. package/lib/module/stat-bar/use-meter-reveal.js +35 -0
  95. package/lib/module/stat-bar/use-meter-reveal.js.map +1 -0
  96. package/lib/module/stat-bar/use-meter-reveal.web.js +34 -0
  97. package/lib/module/stat-bar/use-meter-reveal.web.js.map +1 -0
  98. package/lib/module/viewport/ViewportProvider.js +23 -0
  99. package/lib/module/viewport/ViewportProvider.js.map +1 -0
  100. package/lib/module/viewport/context.js +5 -0
  101. package/lib/module/viewport/context.js.map +1 -0
  102. package/lib/module/viewport/geometry.js +25 -0
  103. package/lib/module/viewport/geometry.js.map +1 -0
  104. package/lib/module/viewport/index.js +6 -0
  105. package/lib/module/viewport/index.js.map +1 -0
  106. package/lib/module/viewport/index.web.js +11 -0
  107. package/lib/module/viewport/index.web.js.map +1 -0
  108. package/lib/module/viewport/types.js +4 -0
  109. package/lib/module/viewport/types.js.map +1 -0
  110. package/lib/module/viewport/use-in-view.js +102 -0
  111. package/lib/module/viewport/use-in-view.js.map +1 -0
  112. package/lib/module/viewport/use-in-view.web.js +45 -0
  113. package/lib/module/viewport/use-in-view.web.js.map +1 -0
  114. package/lib/module/viewport/use-viewport-binding.js +51 -0
  115. package/lib/module/viewport/use-viewport-binding.js.map +1 -0
  116. package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/bottom-sheet/types.d.ts +6 -0
  118. package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
  122. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/dialog/placement.d.ts +3 -1
  124. package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/dialog/types.d.ts +8 -0
  126. package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/index.d.ts +1 -0
  128. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/index.web.d.ts +1 -0
  130. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/motion/index.d.ts +1 -1
  132. package/lib/typescript/commonjs/motion/index.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/motion/index.web.d.ts +1 -1
  134. package/lib/typescript/commonjs/motion/index.web.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/motion/surface-transition.d.ts +8 -0
  136. package/lib/typescript/commonjs/motion/surface-transition.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/motion/types.d.ts +7 -0
  138. package/lib/typescript/commonjs/motion/types.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/motion/use-surface-transition.d.ts +9 -0
  140. package/lib/typescript/commonjs/motion/use-surface-transition.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/overlay/Overlay.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts +7 -0
  143. package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/overlay/index.d.ts +1 -1
  145. package/lib/typescript/commonjs/overlay/index.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/overlay/types.d.ts +23 -9
  147. package/lib/typescript/commonjs/overlay/types.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/rating/RatingBar.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/rating/types.d.ts +3 -0
  150. package/lib/typescript/commonjs/rating/types.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/stat-bar/Meter.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/stat-bar/Meter.web.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/stat-bar/index.d.ts +1 -0
  154. package/lib/typescript/commonjs/stat-bar/index.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/stat-bar/index.web.d.ts +1 -0
  156. package/lib/typescript/commonjs/stat-bar/index.web.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/stat-bar/types.d.ts +14 -0
  158. package/lib/typescript/commonjs/stat-bar/types.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/stat-bar/use-meter-reveal-policy.d.ts +10 -0
  160. package/lib/typescript/commonjs/stat-bar/use-meter-reveal-policy.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/stat-bar/use-meter-reveal.d.ts +5 -0
  162. package/lib/typescript/commonjs/stat-bar/use-meter-reveal.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/stat-bar/use-meter-reveal.web.d.ts +9 -0
  164. package/lib/typescript/commonjs/stat-bar/use-meter-reveal.web.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/viewport/ViewportProvider.d.ts +4 -0
  166. package/lib/typescript/commonjs/viewport/ViewportProvider.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/viewport/context.d.ts +8 -0
  168. package/lib/typescript/commonjs/viewport/context.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/viewport/geometry.d.ts +10 -0
  170. package/lib/typescript/commonjs/viewport/geometry.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/viewport/index.d.ts +5 -0
  172. package/lib/typescript/commonjs/viewport/index.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/viewport/index.web.d.ts +5 -0
  174. package/lib/typescript/commonjs/viewport/index.web.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/viewport/types.d.ts +25 -0
  176. package/lib/typescript/commonjs/viewport/types.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/viewport/use-in-view.d.ts +11 -0
  178. package/lib/typescript/commonjs/viewport/use-in-view.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/viewport/use-in-view.web.d.ts +10 -0
  180. package/lib/typescript/commonjs/viewport/use-in-view.web.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/viewport/use-viewport-binding.d.ts +9 -0
  182. package/lib/typescript/commonjs/viewport/use-viewport-binding.d.ts.map +1 -0
  183. package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  184. package/lib/typescript/module/bottom-sheet/types.d.ts +6 -0
  185. package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
  186. package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
  187. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  188. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
  189. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
  190. package/lib/typescript/module/dialog/placement.d.ts +3 -1
  191. package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
  192. package/lib/typescript/module/dialog/types.d.ts +8 -0
  193. package/lib/typescript/module/dialog/types.d.ts.map +1 -1
  194. package/lib/typescript/module/index.d.ts +1 -0
  195. package/lib/typescript/module/index.d.ts.map +1 -1
  196. package/lib/typescript/module/index.web.d.ts +1 -0
  197. package/lib/typescript/module/index.web.d.ts.map +1 -1
  198. package/lib/typescript/module/motion/index.d.ts +1 -1
  199. package/lib/typescript/module/motion/index.d.ts.map +1 -1
  200. package/lib/typescript/module/motion/index.web.d.ts +1 -1
  201. package/lib/typescript/module/motion/index.web.d.ts.map +1 -1
  202. package/lib/typescript/module/motion/surface-transition.d.ts +8 -0
  203. package/lib/typescript/module/motion/surface-transition.d.ts.map +1 -0
  204. package/lib/typescript/module/motion/types.d.ts +7 -0
  205. package/lib/typescript/module/motion/types.d.ts.map +1 -1
  206. package/lib/typescript/module/motion/use-surface-transition.d.ts +9 -0
  207. package/lib/typescript/module/motion/use-surface-transition.d.ts.map +1 -0
  208. package/lib/typescript/module/overlay/Overlay.d.ts.map +1 -1
  209. package/lib/typescript/module/overlay/backdrop-paint.d.ts +7 -0
  210. package/lib/typescript/module/overlay/backdrop-paint.d.ts.map +1 -0
  211. package/lib/typescript/module/overlay/index.d.ts +1 -1
  212. package/lib/typescript/module/overlay/index.d.ts.map +1 -1
  213. package/lib/typescript/module/overlay/types.d.ts +23 -9
  214. package/lib/typescript/module/overlay/types.d.ts.map +1 -1
  215. package/lib/typescript/module/rating/RatingBar.d.ts.map +1 -1
  216. package/lib/typescript/module/rating/types.d.ts +3 -0
  217. package/lib/typescript/module/rating/types.d.ts.map +1 -1
  218. package/lib/typescript/module/stat-bar/Meter.d.ts.map +1 -1
  219. package/lib/typescript/module/stat-bar/Meter.web.d.ts.map +1 -1
  220. package/lib/typescript/module/stat-bar/index.d.ts +1 -0
  221. package/lib/typescript/module/stat-bar/index.d.ts.map +1 -1
  222. package/lib/typescript/module/stat-bar/index.web.d.ts +1 -0
  223. package/lib/typescript/module/stat-bar/index.web.d.ts.map +1 -1
  224. package/lib/typescript/module/stat-bar/types.d.ts +14 -0
  225. package/lib/typescript/module/stat-bar/types.d.ts.map +1 -1
  226. package/lib/typescript/module/stat-bar/use-meter-reveal-policy.d.ts +10 -0
  227. package/lib/typescript/module/stat-bar/use-meter-reveal-policy.d.ts.map +1 -0
  228. package/lib/typescript/module/stat-bar/use-meter-reveal.d.ts +5 -0
  229. package/lib/typescript/module/stat-bar/use-meter-reveal.d.ts.map +1 -0
  230. package/lib/typescript/module/stat-bar/use-meter-reveal.web.d.ts +9 -0
  231. package/lib/typescript/module/stat-bar/use-meter-reveal.web.d.ts.map +1 -0
  232. package/lib/typescript/module/viewport/ViewportProvider.d.ts +4 -0
  233. package/lib/typescript/module/viewport/ViewportProvider.d.ts.map +1 -0
  234. package/lib/typescript/module/viewport/context.d.ts +8 -0
  235. package/lib/typescript/module/viewport/context.d.ts.map +1 -0
  236. package/lib/typescript/module/viewport/geometry.d.ts +10 -0
  237. package/lib/typescript/module/viewport/geometry.d.ts.map +1 -0
  238. package/lib/typescript/module/viewport/index.d.ts +5 -0
  239. package/lib/typescript/module/viewport/index.d.ts.map +1 -0
  240. package/lib/typescript/module/viewport/index.web.d.ts +5 -0
  241. package/lib/typescript/module/viewport/index.web.d.ts.map +1 -0
  242. package/lib/typescript/module/viewport/types.d.ts +25 -0
  243. package/lib/typescript/module/viewport/types.d.ts.map +1 -0
  244. package/lib/typescript/module/viewport/use-in-view.d.ts +11 -0
  245. package/lib/typescript/module/viewport/use-in-view.d.ts.map +1 -0
  246. package/lib/typescript/module/viewport/use-in-view.web.d.ts +10 -0
  247. package/lib/typescript/module/viewport/use-in-view.web.d.ts.map +1 -0
  248. package/lib/typescript/module/viewport/use-viewport-binding.d.ts +9 -0
  249. package/lib/typescript/module/viewport/use-viewport-binding.d.ts.map +1 -0
  250. package/package.json +23 -1
  251. package/src/bottom-sheet/BottomSheetBase.tsx +18 -8
  252. package/src/bottom-sheet/types.ts +6 -0
  253. package/src/dialog/Dialog.tsx +24 -8
  254. package/src/dialog/Dialog.web.tsx +40 -16
  255. package/src/dialog/DialogBottomSheet.tsx +6 -0
  256. package/src/dialog/placement.ts +9 -1
  257. package/src/dialog/types.ts +8 -0
  258. package/src/index.ts +2 -0
  259. package/src/index.web.ts +2 -0
  260. package/src/motion/index.ts +1 -1
  261. package/src/motion/index.web.ts +1 -1
  262. package/src/motion/surface-transition.ts +15 -0
  263. package/src/motion/types.ts +8 -0
  264. package/src/motion/use-surface-transition.ts +14 -0
  265. package/src/overlay/Overlay.tsx +12 -8
  266. package/src/overlay/backdrop-paint.ts +25 -0
  267. package/src/overlay/index.ts +1 -1
  268. package/src/overlay/types.ts +22 -9
  269. package/src/rating/RatingBar.tsx +2 -1
  270. package/src/rating/RatingBar.web.tsx +2 -2
  271. package/src/rating/types.ts +3 -0
  272. package/src/stat-bar/Meter.tsx +7 -3
  273. package/src/stat-bar/Meter.web.tsx +7 -4
  274. package/src/stat-bar/index.ts +2 -0
  275. package/src/stat-bar/index.web.ts +2 -0
  276. package/src/stat-bar/types.ts +15 -0
  277. package/src/stat-bar/use-meter-reveal-policy.ts +19 -0
  278. package/src/stat-bar/use-meter-reveal.ts +21 -0
  279. package/src/stat-bar/use-meter-reveal.web.ts +24 -0
  280. package/src/viewport/ViewportProvider.tsx +11 -0
  281. package/src/viewport/context.ts +9 -0
  282. package/src/viewport/geometry.ts +18 -0
  283. package/src/viewport/index.ts +4 -0
  284. package/src/viewport/index.web.ts +9 -0
  285. package/src/viewport/types.ts +23 -0
  286. package/src/viewport/use-in-view.ts +69 -0
  287. package/src/viewport/use-in-view.web.ts +33 -0
  288. package/src/viewport/use-viewport-binding.ts +34 -0
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ViewportProvider = ViewportProvider;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _context = require("./context.js");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ /** Scope native clipping geometry without inserting a layout wrapper. */
12
+ function ViewportProvider({
13
+ children,
14
+ root = false
15
+ }) {
16
+ const inherited = (0, _react.useContext)(_context.ViewportContext);
17
+ const parent = root ? null : inherited;
18
+ const scope = (0, _react.useMemo)(() => ({
19
+ parent,
20
+ getNode: null,
21
+ listeners: new Set()
22
+ }), [parent]);
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ViewportContext.Provider, {
24
+ value: scope,
25
+ children: children
26
+ });
27
+ }
28
+ //# sourceMappingURL=ViewportProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ViewportProvider","children","root","inherited","useContext","ViewportContext","parent","scope","useMemo","getNode","listeners","Set","jsx","Provider","value"],"sourceRoot":"../../../src","sources":["viewport/ViewportProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,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AC,cAAO,EAAgB,OAAO;IAAEF,MAAM;IAAEG,OAAO,EAAE,IAAI;IAAEC,SAAS,EAAE,IAAIC,GAAG,CAAC;EAAE,CAAC,CAAC,EAAE,CAACL,MAAM,CAAC,CAAC;EACvG,oBAAO,IAAA1B,WAAA,CAAAgC,GAAA,EAACjC,QAAA,CAAA0B,eAAe,CAACQ,QAAQ;IAACC,KAAK,EAAEP,KAAM;IAAAN,QAAA,EAAEA;EAAQ,CAA2B,CAAC;AACtF","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ViewportContext = void 0;
7
+ var _react = require("react");
8
+ const ViewportContext = exports.ViewportContext = /*#__PURE__*/(0, _react.createContext)(null);
9
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","ViewportContext","exports","createContext"],"sourceRoot":"../../../src","sources":["viewport/context.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,oBAAa,EAAuB,IAAI,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.intersectionRatio = intersectionRatio;
7
+ exports.validVisibilityRect = validVisibilityRect;
8
+ exports.visibilityThreshold = visibilityThreshold;
9
+ function validVisibilityRect(rect) {
10
+ return Object.values(rect).every(Number.isFinite) && rect.width > 0 && rect.height > 0;
11
+ }
12
+ function intersectionRatio(target, clips) {
13
+ if (!validVisibilityRect(target) || clips.some(clip => !validVisibilityRect(clip))) return 0;
14
+ let left = target.x,
15
+ top = target.y,
16
+ right = left + target.width,
17
+ bottom = top + target.height;
18
+ for (const clip of clips) {
19
+ left = Math.max(left, clip.x);
20
+ top = Math.max(top, clip.y);
21
+ right = Math.min(right, clip.x + clip.width);
22
+ bottom = Math.min(bottom, clip.y + clip.height);
23
+ }
24
+ if (left === target.x && top === target.y && right === target.x + target.width && bottom === target.y + target.height) return 1;
25
+ return Math.max(0, right - left) * Math.max(0, bottom - top) / (target.width * target.height);
26
+ }
27
+ function visibilityThreshold(value = 0) {
28
+ if (!Number.isFinite(value) || value < 0 || value > 1) throw new Error('Bloom visibility threshold must be between 0 and 1.');
29
+ return value;
30
+ }
31
+ //# sourceMappingURL=geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["validVisibilityRect","rect","Object","values","every","Number","isFinite","width","height","intersectionRatio","target","clips","some","clip","left","x","top","y","right","bottom","Math","max","min","visibilityThreshold","value","Error"],"sourceRoot":"../../../src","sources":["viewport/geometry.ts"],"mappings":";;;;;;;;AACO,SAASA,mBAAmBA,CAACC,IAAoB,EAAW;EACjE,OAAOC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAACG,KAAK,CAACC,MAAM,CAACC,QAAQ,CAAC,IAAIL,IAAI,CAACM,KAAK,GAAG,CAAC,IAAIN,IAAI,CAACO,MAAM,GAAG,CAAC;AACxF;AACO,SAASC,iBAAiBA,CAACC,MAAsB,EAAEC,KAAgC,EAAU;EAClG,IAAI,CAACX,mBAAmB,CAACU,MAAM,CAAC,IAAIC,KAAK,CAACC,IAAI,CAAEC,IAAI,IAAK,CAACb,mBAAmB,CAACa,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC;EAC9F,IAAIC,IAAI,GAAGJ,MAAM,CAACK,CAAC;IAAEC,GAAG,GAAGN,MAAM,CAACO,CAAC;IAAEC,KAAK,GAAGJ,IAAI,GAAGJ,MAAM,CAACH,KAAK;IAAEY,MAAM,GAAGH,GAAG,GAAGN,MAAM,CAACF,MAAM;EAC9F,KAAK,MAAMK,IAAI,IAAIF,KAAK,EAAE;IACxBG,IAAI,GAAGM,IAAI,CAACC,GAAG,CAACP,IAAI,EAAED,IAAI,CAACE,CAAC,CAAC;IAAEC,GAAG,GAAGI,IAAI,CAACC,GAAG,CAACL,GAAG,EAAEH,IAAI,CAACI,CAAC,CAAC;IAC1DC,KAAK,GAAGE,IAAI,CAACE,GAAG,CAACJ,KAAK,EAAEL,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACN,KAAK,CAAC;IAAEY,MAAM,GAAGC,IAAI,CAACE,GAAG,CAACH,MAAM,EAAEN,IAAI,CAACI,CAAC,GAAGJ,IAAI,CAACL,MAAM,CAAC;EAC/F;EACA,IAAIM,IAAI,KAAKJ,MAAM,CAACK,CAAC,IAAIC,GAAG,KAAKN,MAAM,CAACO,CAAC,IAAIC,KAAK,KAAKR,MAAM,CAACK,CAAC,GAAGL,MAAM,CAACH,KAAK,IAAIY,MAAM,KAAKT,MAAM,CAACO,CAAC,GAAGP,MAAM,CAACF,MAAM,EAAE,OAAO,CAAC;EAC/H,OAAOY,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,KAAK,GAAGJ,IAAI,CAAC,GAAGM,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEF,MAAM,GAAGH,GAAG,CAAC,IAAIN,MAAM,CAACH,KAAK,GAAGG,MAAM,CAACF,MAAM,CAAC;AAC/F;AACO,SAASe,mBAAmBA,CAACC,KAAK,GAAG,CAAC,EAAU;EACrD,IAAI,CAACnB,MAAM,CAACC,QAAQ,CAACkB,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE,MAAM,IAAIC,KAAK,CAAC,qDAAqD,CAAC;EAC7H,OAAOD,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ViewportProvider", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ViewportProvider.ViewportProvider;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useInView", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _useInView.useInView;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useViewportBinding", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _useViewportBinding.useViewportBinding;
22
+ }
23
+ });
24
+ var _ViewportProvider = require("./ViewportProvider.js");
25
+ var _useViewportBinding = require("./use-viewport-binding.js");
26
+ var _useInView = require("./use-in-view");
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ViewportProvider","require","_useViewportBinding","_useInView"],"sourceRoot":"../../../src","sources":["viewport/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ViewportProvider", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ViewportProvider.ViewportProvider;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useInView", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _useInViewWeb.useInView;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useViewportBinding", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _useViewportBinding.useViewportBinding;
22
+ }
23
+ });
24
+ var _ViewportProvider = require("./ViewportProvider.js");
25
+ var _useViewportBinding = require("./use-viewport-binding.js");
26
+ var _useInViewWeb = require("./use-in-view.web.js");
27
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ViewportProvider","require","_useViewportBinding","_useInViewWeb"],"sourceRoot":"../../../src","sources":["viewport/index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["viewport/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useInView = useInView;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _context = require("./context.js");
10
+ var _geometry = require("./geometry.js");
11
+ /** Native visibility is measured against every bound ancestor viewport. */
12
+ function useInView({
13
+ threshold: requestedThreshold,
14
+ once = false
15
+ } = {}) {
16
+ const threshold = (0, _geometry.visibilityThreshold)(requestedThreshold);
17
+ const scope = (0, _react.useContext)(_context.ViewportContext);
18
+ if (!scope) throw new Error('Bloom useInView requires a bound ViewportProvider on native.');
19
+ const [node, setNode] = (0, _react.useState)(null);
20
+ const [inView, setInView] = (0, _react.useState)(false);
21
+ const entered = (0, _react.useRef)(false);
22
+ const scheduleRef = (0, _react.useRef)(() => {});
23
+ const ref = (0, _react.useCallback)(value => {
24
+ const target = value;
25
+ if (target && typeof target.measureInWindow !== 'function') throw new Error('Bloom useInView ref must point to a native View with measureInWindow.');
26
+ setNode(target);
27
+ }, []);
28
+ const onLayout = (0, _react.useCallback)(() => scheduleRef.current(), []);
29
+ (0, _react.useEffect)(() => {
30
+ if (!node || once && entered.current) return;
31
+ let disposed = false,
32
+ frame = null,
33
+ generation = 0;
34
+ const scopes = [];
35
+ for (let current = scope; current; current = current.parent) scopes.push(current);
36
+ const measure = (source, complete) => {
37
+ const handle = source && 'getNativeScrollRef' in source ? source.getNativeScrollRef() : source;
38
+ if (!handle) {
39
+ complete(null);
40
+ return;
41
+ }
42
+ handle.measureInWindow((x, y, width, height) => complete({
43
+ x,
44
+ y,
45
+ width,
46
+ height
47
+ }));
48
+ };
49
+ const read = () => {
50
+ frame = null;
51
+ const ticket = ++generation;
52
+ const window = _reactNative.Dimensions.get('window');
53
+ const clips = [{
54
+ x: 0,
55
+ y: 0,
56
+ width: window.width,
57
+ height: window.height
58
+ }];
59
+ let pending = scopes.length + 1,
60
+ target = null,
61
+ missing = false;
62
+ const finish = () => {
63
+ if (--pending || disposed || ticket !== generation) return;
64
+ const ratio = !missing && target ? (0, _geometry.intersectionRatio)(target, clips) : 0;
65
+ const visible = ratio > 0 && ratio >= threshold;
66
+ if (visible) entered.current = true;
67
+ setInView(visible);
68
+ };
69
+ measure(node, rect => {
70
+ target = rect;
71
+ finish();
72
+ });
73
+ scopes.forEach(owner => measure(owner.getNode?.() ?? null, rect => {
74
+ if (rect) clips.push(rect);else missing = true;
75
+ finish();
76
+ }));
77
+ };
78
+ const schedule = () => {
79
+ if (disposed || frame !== null) return;
80
+ // A newer event invalidates asynchronous native measurements immediately.
81
+ generation++;
82
+ frame = requestAnimationFrame(read);
83
+ };
84
+ scheduleRef.current = schedule;
85
+ scopes.forEach(owner => owner.listeners.add(schedule));
86
+ const subscription = _reactNative.Dimensions.addEventListener('change', schedule);
87
+ schedule();
88
+ return () => {
89
+ disposed = true;
90
+ generation++;
91
+ if (frame !== null) cancelAnimationFrame(frame);
92
+ scopes.forEach(owner => owner.listeners.delete(schedule));
93
+ subscription.remove();
94
+ scheduleRef.current = () => {};
95
+ };
96
+ }, [node, scope, threshold, once, inView]);
97
+ return {
98
+ inView,
99
+ targetProps: {
100
+ ref,
101
+ onLayout,
102
+ collapsable: false
103
+ }
104
+ };
105
+ }
106
+ //# sourceMappingURL=use-in-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_context","_geometry","useInView","threshold","requestedThreshold","once","visibilityThreshold","scope","useContext","ViewportContext","Error","node","setNode","useState","inView","setInView","entered","useRef","scheduleRef","ref","useCallback","value","target","measureInWindow","onLayout","current","useEffect","disposed","frame","generation","scopes","parent","push","measure","source","complete","handle","getNativeScrollRef","x","y","width","height","read","ticket","window","Dimensions","get","clips","pending","length","missing","finish","ratio","intersectionRatio","visible","rect","forEach","owner","getNode","schedule","requestAnimationFrame","listeners","add","subscription","addEventListener","cancelAnimationFrame","delete","remove","targetProps","collapsable"],"sourceRoot":"../../../src","sources":["viewport/use-in-view.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAGA;AACO,SAASI,SAASA,CAAC;EAAEC,SAAS,EAAEC,kBAAkB;EAAEC,IAAI,GAAG;AAAqB,CAAC,GAAG,CAAC,CAAC,EAAE;EAC7F,MAAMF,SAAS,GAAG,IAAAG,6BAAmB,EAACF,kBAAkB,CAAC;EACzD,MAAMG,KAAK,GAAG,IAAAC,iBAAU,EAACC,wBAAe,CAAC;EACzC,IAAI,CAACF,KAAK,EAAE,MAAM,IAAIG,KAAK,CAAC,8DAA8D,CAAC;EAC3F,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAC,eAAQ,EAA0B,IAAI,CAAC;EAC/D,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAC3C,MAAMG,OAAO,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAC7B,MAAMC,WAAW,GAAG,IAAAD,aAAM,EAAa,MAAM,CAAC,CAAC,CAAC;EAChD,MAAME,GAAG,GAAG,IAAAC,kBAAW,EAAEC,KAAc,IAAK;IAC1C,MAAMC,MAAM,GAAGD,KAAgC;IAC/C,IAAIC,MAAM,IAAI,OAAOA,MAAM,CAACC,eAAe,KAAK,UAAU,EAAE,MAAM,IAAIb,KAAK,CAAC,uEAAuE,CAAC;IACpJE,OAAO,CAACU,MAAM,CAAC;EACjB,CAAC,EAAE,EAAE,CAAC;EACN,MAAME,QAAQ,GAAG,IAAAJ,kBAA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AGlB,uBAAU,CAACmB,gBAAgB,CAAC,QAAQ,EAAEL,QAAQ,CAAC;IACpEA,QAAQ,CAAC,CAAC;IACV,OAAO,MAAM;MACXhC,QAAQ,GAAG,IAAI;MAAEE,UAAU,EAAE;MAC7B,IAAID,KAAK,KAAK,IAAI,EAAEqC,oBAAoB,CAACrC,KAAK,CAAC;MAC/CE,MAAM,CAAC0B,OAAO,CAAEC,KAAK,IAAKA,KAAK,CAACI,SAAS,CAACK,MAAM,CAACP,QAAQ,CAAC,CAAC;MAC3DI,YAAY,CAACI,MAAM,CAAC,CAAC;MAAEjD,WAAW,CAACO,OAAO,GAAG,MAAM,CAAC,CAAC;IACvD,CAAC;EACH,CAAC,EAAE,CAACd,IAAI,EAAEJ,KAAK,EAAEJ,SAAS,EAAEE,IAAI,EAAES,MAAM,CAAC,CAAC;EAC1C,OAAO;IAAEA,MAAM;IAAEsD,WAAW,EAAE;MAAEjD,GAAG;MAAEK,QAAQ;MAAE6C,WAAW,EAAE;IAAe;EAAE,CAAC;AAChF","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useInView = useInView;
7
+ var _react = require("react");
8
+ var _geometry = require("./geometry.js");
9
+ /** The browser owns ancestor clipping, scrolling and resize observation. */
10
+ function useInView({
11
+ threshold: requestedThreshold,
12
+ once = false
13
+ } = {}) {
14
+ const threshold = (0, _geometry.visibilityThreshold)(requestedThreshold);
15
+ const [node, setNode] = (0, _react.useState)(null);
16
+ const [inView, setInView] = (0, _react.useState)(false);
17
+ const entered = (0, _react.useRef)(false);
18
+ const ref = (0, _react.useCallback)(value => {
19
+ if (value != null && !(value instanceof Element)) throw new Error('Bloom useInView ref must point to a web host element.');
20
+ setNode(value);
21
+ }, []);
22
+ (0, _react.useEffect)(() => {
23
+ if (!node || once && entered.current) return;
24
+ // Unsupported environments remain unobserved, never pretend mount is visible.
25
+ if (typeof IntersectionObserver === 'undefined') return;
26
+ const observer = new IntersectionObserver(entries => {
27
+ for (const entry of entries) {
28
+ if (entry.target !== node || once && entered.current) continue;
29
+ const visible = entry.boundingClientRect.width > 0 && entry.boundingClientRect.height > 0 && entry.isIntersecting && entry.intersectionRatio > 0 && entry.intersectionRatio >= threshold;
30
+ if (visible) entered.current = true;
31
+ setInView(visible);
32
+ if (visible && once) observer.disconnect();
33
+ }
34
+ }, {
35
+ threshold
36
+ });
37
+ observer.observe(node);
38
+ return () => observer.disconnect();
39
+ }, [node, threshold, once]);
40
+ const onLayout = (0, _react.useCallback)(() => {}, []);
41
+ return {
42
+ inView,
43
+ targetProps: {
44
+ ref,
45
+ onLayout
46
+ }
47
+ };
48
+ }
49
+ //# sourceMappingURL=use-in-view.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_geometry","useInView","threshold","requestedThreshold","once","visibilityThreshold","node","setNode","useState","inView","setInView","entered","useRef","ref","useCallback","value","Element","Error","useEffect","current","IntersectionObserver","observer","entries","entry","target","visible","boundingClientRect","width","height","isIntersecting","intersectionRatio","disconnect","observe","onLayout","targetProps"],"sourceRoot":"../../../src","sources":["viewport/use-in-view.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAGA;AACO,SAASE,SAASA,CAAC;EAAEC,SAAS,EAAEC,kBAAkB;EAAEC,IAAI,GAAG;AAAqB,CAAC,GAAG,CAAC,CAAC,EAAE;EAC7F,MAAMF,SAAS,GAAG,IAAAG,6BAAmB,EAACF,kBAAkB,CAAC;EACzD,MAAM,CAACG,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAC,eAAQ,EAAiB,IAAI,CAAC;EACtD,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAC3C,MAAMG,OAAO,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAC7B,MAAMC,GAAG,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AAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;EAC1C,OAAO;IAAEL,MAAM;IAAEyB,WAAW,EAAE;MAAErB,GAAG;MAAEoB;IAAS;EAAE,CAAC;AACnD","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useViewportBinding = useViewportBinding;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _context = require("./context.js");
10
+ /** Compose with restoration/metrics callbacks; no React renders on scroll. */
11
+ function useViewportBinding({
12
+ viewportRef,
13
+ onScroll,
14
+ onLayout,
15
+ onContentSizeChange
16
+ }) {
17
+ const scope = (0, _react.useContext)(_context.ViewportContext);
18
+ if (_reactNative.Platform.OS !== 'web' && !scope) throw new Error('Bloom useViewportBinding requires ViewportProvider on native.');
19
+ if (onScroll != null && typeof onScroll !== 'function') {
20
+ throw new Error('Bloom useViewportBinding onScroll expects a plain RN callback; pass its returned onScroll through the observer slot of your animated binding.');
21
+ }
22
+ const notify = (0, _react.useCallback)(() => {
23
+ if (_reactNative.Platform.OS !== 'web') scope?.listeners.forEach(listener => listener());
24
+ }, [scope]);
25
+ (0, _react.useLayoutEffect)(() => {
26
+ if (!scope || _reactNative.Platform.OS === 'web') return;
27
+ if (scope.getNode) throw new Error('Each ViewportProvider supports one viewport binding. Nest another provider for a nested scroller.');
28
+ const getNode = () => viewportRef.current;
29
+ scope.getNode = getNode;
30
+ notify();
31
+ return () => {
32
+ if (scope.getNode === getNode) scope.getNode = null;
33
+ notify();
34
+ };
35
+ }, [scope, viewportRef, notify]);
36
+ const handleScroll = (0, _react.useCallback)(event => {
37
+ notify();
38
+ onScroll?.(event);
39
+ }, [notify, onScroll]);
40
+ const handleLayout = (0, _react.useCallback)(event => {
41
+ notify();
42
+ onLayout?.(event);
43
+ }, [notify, onLayout]);
44
+ const handleContentSizeChange = (0, _react.useCallback)((width, height) => {
45
+ notify();
46
+ onContentSizeChange?.(width, height);
47
+ }, [notify, onContentSizeChange]);
48
+ return {
49
+ onScroll: handleScroll,
50
+ onLayout: handleLayout,
51
+ onContentSizeChange: handleContentSizeChange,
52
+ scrollEventThrottle: 16
53
+ };
54
+ }
55
+ //# sourceMappingURL=use-viewport-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_context","useViewportBinding","viewportRef","onScroll","onLayout","onContentSizeChange","scope","useContext","ViewportContext","Platform","OS","Error","notify","useCallback","listeners","forEach","listener","useLayoutEffect","getNode","current","handleScroll","event","handleLayout","handleContentSizeChange","width","height","scrollEventThrottle"],"sourceRoot":"../../../src","sources":["viewport/use-viewport-binding.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAGA;AACO,SAASG,kBAAkBA,CAAC;EAAEC,WAAW;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC;AAA4C,CAAC,EAAE;EACnH,MAAMC,KAAK,GAAG,IAAAC,iBAAU,EAACC,wBAAe,CAAC;EACzC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,CAACJ,KAAK,EAAE,MAAM,IAAIK,KAAK,CAAC,+DAA+D,CAAC;EACrH,IAAIR,QAAQ,IAAI,IAAI,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAAE;IACtD,MAAM,IAAIQ,KAAK,CAAC,+IAA+I,CAAC;EAClK;EACA,MAAMC,MAAM,GAAG,IAAAC,kBAAW,EAAC,MAAM;IAC/B,IAAIJ,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAEJ,KAAK,EAAEQ,SAAS,CAACC,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,CAAC,CAAC;EAC/E,CAAC,EAAE,CAACV,KAAK,CAAC,CAAC;EACX,IAAAW,sBAAe,EAAC,MAAM;IACpB,IAAI,CAACX,KAAK,IAAIG,qB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"../motion/use-surface-transition.js";
3
4
  import { MOTION_RECIPES } from "../motion/recipes.js";
4
5
  import { surfaceStyle } from "../shapes/surface-style.js";
5
6
  import { SURFACE_SHAPES } from "../design-tokens/shapes.js";
@@ -53,6 +54,8 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
53
54
  backgroundComponent,
54
55
  backgroundFill,
55
56
  backdropComponent,
57
+ backdrop,
58
+ transition,
56
59
  style,
57
60
  enableHandlePanningGesture = true,
58
61
  onDismissAttempt,
@@ -68,6 +71,13 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
68
71
  headerOverlay,
69
72
  onLayout
70
73
  } = props;
74
+ const motion = useSurfaceTransition(transition);
75
+ const timed = transition !== undefined;
76
+ const timedConfig = useMemo(() => ({
77
+ ...MOTION_RECIPES.present,
78
+ duration: motion.duration ?? 250,
79
+ easing: motion.easing
80
+ }), [motion.duration, motion.easing]);
71
81
  const insets = useSafeAreaInsets();
72
82
  const theme = useTheme();
73
83
  const {
@@ -189,25 +199,25 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
189
199
  // it eventually fires, because its captured generation is stale.
190
200
  closeGenerationRef.current += 1;
191
201
  closeGeneration.value = closeGenerationRef.current;
192
- opacity.value = withTiming(1, {
202
+ opacity.value = withTiming(1, timed ? timedConfig : {
193
203
  ...MOTION_RECIPES.present,
194
- duration: 250
204
+ duration: motion.duration ?? 250
195
205
  });
196
- translateY.value = withSpring(0, SPRING_CONFIG);
206
+ translateY.value = motion.reducedMotion ? 0 : timed ? withTiming(0, timedConfig) : withSpring(0, SPRING_CONFIG);
197
207
  } else if (rendered) {
198
208
  // Capture the generation for THIS close cycle so the animation
199
209
  // callback (running on the UI thread, scheduled back to JS) and
200
210
  // the fallback timer agree on which cycle they belong to.
201
211
  const generation = closeGenerationRef.current;
202
- opacity.value = withTiming(0, {
212
+ opacity.value = withTiming(0, timed ? timedConfig : {
203
213
  ...MOTION_RECIPES.dismiss,
204
- duration: 250
214
+ duration: motion.duration ?? 250
205
215
  }, finished => {
206
216
  if (finished) {
207
217
  runOnJS(finishClose)(generation);
208
218
  }
209
219
  });
210
- translateY.value = withSpring(screenHeight, {
220
+ translateY.value = motion.reducedMotion ? screenHeight : timed ? withTiming(screenHeight, timedConfig) : withSpring(screenHeight, {
211
221
  ...SPRING_CONFIG,
212
222
  stiffness: 250
213
223
  });
@@ -220,9 +230,9 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
220
230
  closeTimeoutRef.current = setTimeout(() => {
221
231
  finishClose(generation);
222
232
  closeTimeoutRef.current = null;
223
- }, 300);
233
+ }, motion.reducedMotion ? 0 : timed ? timedConfig.duration + 50 : 300);
224
234
  }
225
- }, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY]);
235
+ }, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY, timed, timedConfig, motion.duration, motion.reducedMotion]);
226
236
 
227
237
  // On unmount: ensure pending close callbacks (e.g. consumer's `onDismiss`)
228
238
  // still fire if the BS is yanked mid-animation by a parent re-render while a
@@ -269,6 +279,12 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
269
279
  });
270
280
  return;
271
281
  }
282
+ // The timed presentation shares the imperative close lifecycle, so a live
283
+ // reduced-motion change can also settle a gesture-initiated dismissal.
284
+ if (timed || motion.reducedMotion) {
285
+ setVisible(false);
286
+ return;
287
+ }
272
288
  translateY.value = withSpring(screenHeightSV.value, {
273
289
  ...SPRING_CONFIG,
274
290
  velocity
@@ -279,7 +295,7 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
279
295
  }, finished => {
280
296
  if (finished) runOnJS(finishClose)(generation);
281
297
  });
282
- }, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose]);
298
+ }, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose, timed, timedConfig, motion.duration, motion.reducedMotion]);
283
299
  const present = useCallback(() => {
284
300
  setRendered(true);
285
301
  setVisible(true);
@@ -695,6 +711,7 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
695
711
  // `backdropOpacity`, so the shared component's own dim is
696
712
  // switched off here to keep a single source of dimming.
697
713
  _jsx(Backdrop, {
714
+ ...backdrop,
698
715
  onPress: handleBackdropPress
699
716
  // `progress` is the FADE (0 → 1, folding the drag);
700
717
  // how dark the backdrop gets is `backdropOpacity`,
@@ -704,7 +721,7 @@ export const BottomSheetBase = /*#__PURE__*/forwardRef((props, ref) => {
704
721
  // opacity on the root would sit above the blur layer
705
722
  // and neutralise it.
706
723
  ,
707
- dimOpacity: backdropOpacity,
724
+ dimOpacity: backdrop?.dimOpacity ?? backdropOpacity,
708
725
  progress: backdropProgress,
709
726
  style: styles.backdrop
710
727
  }), /*#__PURE__*/_jsx(GestureDetector, {