elements-kit 0.0.10 → 0.0.11

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 (310) hide show
  1. package/README.md +3 -4
  2. package/dist/builder/dom.d.mts +1 -1
  3. package/dist/builder/index.d.mts +87 -1
  4. package/dist/builder/index.mjs +1 -1
  5. package/dist/{element-Ddk9YaoE.mjs → element-MXzFk4G2.mjs} +1 -1
  6. package/dist/{index-BtqiEEfc.d.mts → index-Cvdhuy6Y.d.mts} +8 -4
  7. package/dist/index.d.mts +1 -1
  8. package/dist/index.mjs +3 -3
  9. package/dist/{signals/lib → integrations}/react.d.mts +2 -2
  10. package/dist/{signals/lib → integrations}/react.mjs +2 -2
  11. package/dist/jsx-runtime/index.d.mts +2 -2
  12. package/dist/jsx-runtime/index.mjs +3 -3
  13. package/dist/lib-BYJ5jPTG.d.mts +4 -0
  14. package/dist/polyfill-DR5XVnh_.d.mts +9 -0
  15. package/dist/signals/index.d.mts +2 -2
  16. package/dist/signals/index.mjs +2 -2
  17. package/dist/{signals-CLAPw8kk.mjs → signals-DcgXhkU2.mjs} +41 -9
  18. package/dist/slot.d.mts +1 -2
  19. package/dist/{test.BmQO5GaM-CR2qjV1t.mjs → test.BmQO5GaM-ANkhHvbr.mjs} +1 -1
  20. package/dist/utilities/active-element.d.mts +6 -0
  21. package/dist/utilities/active-element.mjs +13 -0
  22. package/dist/utilities/active-element.test.mjs +24 -0
  23. package/dist/{signals/lib → utilities}/debounced.d.mts +3 -3
  24. package/dist/{signals/lib → utilities}/debounced.mjs +7 -6
  25. package/dist/{signals/lib → utilities}/debounced.test.mjs +3 -3
  26. package/dist/{signals/lib → utilities}/element-rect.d.mts +3 -3
  27. package/dist/{signals/lib → utilities}/element-rect.mjs +7 -7
  28. package/dist/{signals/lib → utilities}/element-rect.test.mjs +3 -3
  29. package/dist/utilities/element-scroll.d.mts +16 -0
  30. package/dist/utilities/element-scroll.mjs +52 -0
  31. package/dist/utilities/element-scroll.test.mjs +25 -0
  32. package/dist/{signals/lib → utilities}/event-driven.d.mts +2 -2
  33. package/dist/{signals/lib → utilities}/event-driven.mjs +2 -2
  34. package/dist/utilities/event-listener.d.mts +16 -0
  35. package/dist/{signals/lib → utilities}/event-listener.mjs +4 -4
  36. package/dist/{signals/lib → utilities}/event-listener.test.mjs +8 -8
  37. package/dist/utilities/focus-within.d.mts +10 -0
  38. package/dist/utilities/focus-within.mjs +20 -0
  39. package/dist/{signals/lib/is-focus-within.test.mjs → utilities/focus-within.test.mjs} +10 -11
  40. package/dist/utilities/hover.d.mts +11 -0
  41. package/dist/utilities/hover.mjs +20 -0
  42. package/dist/{signals/lib → utilities}/hover.test.mjs +5 -16
  43. package/dist/utilities/intersection-observer.d.mts +8 -0
  44. package/dist/{signals/lib → utilities}/intersection-observer.mjs +3 -4
  45. package/dist/{signals/lib → utilities}/intersection-observer.test.mjs +3 -3
  46. package/dist/{signals/lib → utilities}/interval.d.mts +2 -2
  47. package/dist/{signals/lib → utilities}/interval.mjs +6 -5
  48. package/dist/{signals/lib → utilities}/interval.test.mjs +3 -3
  49. package/dist/utilities/location.d.mts +24 -0
  50. package/dist/utilities/location.mjs +54 -0
  51. package/dist/utilities/location.test.mjs +60 -0
  52. package/dist/utilities/long-press.d.mts +10 -0
  53. package/dist/utilities/long-press.mjs +27 -0
  54. package/dist/{signals/lib → utilities}/long-press.test.mjs +3 -3
  55. package/dist/{signals/lib → utilities}/media-devices.d.mts +3 -3
  56. package/dist/{signals/lib → utilities}/media-devices.mjs +5 -5
  57. package/dist/{signals/lib → utilities}/media-devices.test.mjs +6 -8
  58. package/dist/utilities/media-player.d.mts +22 -0
  59. package/dist/{signals/lib/video.mjs → utilities/media-player.mjs} +5 -4
  60. package/dist/utilities/media-player.test.mjs +100 -0
  61. package/dist/{signals/lib/media.d.mts → utilities/media-query.d.mts} +4 -4
  62. package/dist/{signals/lib/media.mjs → utilities/media-query.mjs} +6 -6
  63. package/dist/utilities/mutation-observer.d.mts +8 -0
  64. package/dist/{signals/lib → utilities}/mutation-observer.mjs +3 -3
  65. package/dist/{signals/lib → utilities}/mutation-observer.test.mjs +3 -3
  66. package/dist/{signals/lib → utilities}/on-click-outside.d.mts +3 -3
  67. package/dist/utilities/on-click-outside.mjs +17 -0
  68. package/dist/{signals/lib → utilities}/on-click-outside.test.mjs +7 -18
  69. package/dist/utilities/orientation.d.mts +10 -0
  70. package/dist/{signals/lib → utilities}/orientation.mjs +3 -2
  71. package/dist/utilities/previous.d.mts +12 -0
  72. package/dist/utilities/previous.mjs +24 -0
  73. package/dist/utilities/previous.test.mjs +88 -0
  74. package/dist/utilities/resize-observer.d.mts +8 -0
  75. package/dist/{signals/lib → utilities}/resize-observer.mjs +4 -5
  76. package/dist/utilities/routing.d.mts +59 -0
  77. package/dist/utilities/routing.mjs +89 -0
  78. package/dist/utilities/routing.test.mjs +128 -0
  79. package/dist/utilities/search-params.d.mts +13 -0
  80. package/dist/utilities/search-params.mjs +23 -0
  81. package/dist/utilities/search-params.test.mjs +35 -0
  82. package/dist/utilities/storage.d.mts +22 -0
  83. package/dist/utilities/storage.mjs +65 -0
  84. package/dist/utilities/storage.test.mjs +137 -0
  85. package/dist/{signals/lib → utilities}/throttled.d.mts +2 -2
  86. package/dist/utilities/throttled.mjs +36 -0
  87. package/dist/{signals/lib → utilities}/throttled.test.mjs +3 -3
  88. package/dist/{signals/lib → utilities}/timeout.d.mts +6 -5
  89. package/dist/utilities/timeout.mjs +42 -0
  90. package/dist/{signals/lib → utilities}/timeout.test.mjs +7 -7
  91. package/dist/utilities/window-size.d.mts +10 -0
  92. package/dist/utilities/window-size.mjs +22 -0
  93. package/dist/utilities/window-size.test.mjs +42 -0
  94. package/package.json +11 -6
  95. package/dist/index-CKjDUp1B.d.mts +0 -89
  96. package/dist/polyfill-AFIi9kAN.d.mts +0 -14
  97. package/dist/signals/lib/active-element.d.mts +0 -10
  98. package/dist/signals/lib/active-element.mjs +0 -12
  99. package/dist/signals/lib/active-element.test.mjs +0 -39
  100. package/dist/signals/lib/animation-frames.d.mts +0 -18
  101. package/dist/signals/lib/animation-frames.mjs +0 -48
  102. package/dist/signals/lib/animation-frames.test.mjs +0 -52
  103. package/dist/signals/lib/async-retry.d.mts +0 -21
  104. package/dist/signals/lib/async-retry.mjs +0 -57
  105. package/dist/signals/lib/async-retry.test.mjs +0 -57
  106. package/dist/signals/lib/audio.d.mts +0 -21
  107. package/dist/signals/lib/audio.mjs +0 -35
  108. package/dist/signals/lib/audio.test.mjs +0 -57
  109. package/dist/signals/lib/battery.d.mts +0 -17
  110. package/dist/signals/lib/battery.mjs +0 -45
  111. package/dist/signals/lib/battery.test.mjs +0 -38
  112. package/dist/signals/lib/before-unload.d.mts +0 -11
  113. package/dist/signals/lib/before-unload.mjs +0 -20
  114. package/dist/signals/lib/before-unload.test.mjs +0 -29
  115. package/dist/signals/lib/clipboard.d.mts +0 -15
  116. package/dist/signals/lib/clipboard.mjs +0 -25
  117. package/dist/signals/lib/clipboard.test.mjs +0 -53
  118. package/dist/signals/lib/counter.d.mts +0 -18
  119. package/dist/signals/lib/counter.mjs +0 -21
  120. package/dist/signals/lib/counter.test.d.mts +0 -1
  121. package/dist/signals/lib/counter.test.mjs +0 -74
  122. package/dist/signals/lib/document-title.d.mts +0 -10
  123. package/dist/signals/lib/document-title.mjs +0 -15
  124. package/dist/signals/lib/document-title.test.d.mts +0 -1
  125. package/dist/signals/lib/document-title.test.mjs +0 -33
  126. package/dist/signals/lib/element-size.d.mts +0 -16
  127. package/dist/signals/lib/element-size.mjs +0 -32
  128. package/dist/signals/lib/element-size.test.d.mts +0 -1
  129. package/dist/signals/lib/element-size.test.mjs +0 -86
  130. package/dist/signals/lib/event-listener.d.mts +0 -14
  131. package/dist/signals/lib/favicon.d.mts +0 -10
  132. package/dist/signals/lib/favicon.mjs +0 -24
  133. package/dist/signals/lib/favicon.test.d.mts +0 -1
  134. package/dist/signals/lib/favicon.test.mjs +0 -28
  135. package/dist/signals/lib/finite-state-machine.d.mts +0 -22
  136. package/dist/signals/lib/finite-state-machine.mjs +0 -26
  137. package/dist/signals/lib/finite-state-machine.test.d.mts +0 -1
  138. package/dist/signals/lib/finite-state-machine.test.mjs +0 -66
  139. package/dist/signals/lib/fullscreen.d.mts +0 -15
  140. package/dist/signals/lib/fullscreen.mjs +0 -24
  141. package/dist/signals/lib/fullscreen.test.d.mts +0 -1
  142. package/dist/signals/lib/fullscreen.test.mjs +0 -48
  143. package/dist/signals/lib/geolocation.d.mts +0 -15
  144. package/dist/signals/lib/geolocation.mjs +0 -30
  145. package/dist/signals/lib/geolocation.test.d.mts +0 -1
  146. package/dist/signals/lib/geolocation.test.mjs +0 -37
  147. package/dist/signals/lib/hash.d.mts +0 -10
  148. package/dist/signals/lib/hash.mjs +0 -14
  149. package/dist/signals/lib/hash.test.d.mts +0 -1
  150. package/dist/signals/lib/hash.test.mjs +0 -46
  151. package/dist/signals/lib/hover.d.mts +0 -11
  152. package/dist/signals/lib/hover.mjs +0 -23
  153. package/dist/signals/lib/intersection-observer.d.mts +0 -8
  154. package/dist/signals/lib/is-document-visible.d.mts +0 -11
  155. package/dist/signals/lib/is-document-visible.mjs +0 -13
  156. package/dist/signals/lib/is-document-visible.test.d.mts +0 -1
  157. package/dist/signals/lib/is-document-visible.test.mjs +0 -58
  158. package/dist/signals/lib/is-focus-within.d.mts +0 -10
  159. package/dist/signals/lib/is-focus-within.mjs +0 -28
  160. package/dist/signals/lib/is-focus-within.test.d.mts +0 -1
  161. package/dist/signals/lib/is-idle.d.mts +0 -10
  162. package/dist/signals/lib/is-idle.mjs +0 -37
  163. package/dist/signals/lib/is-idle.test.d.mts +0 -1
  164. package/dist/signals/lib/is-idle.test.mjs +0 -50
  165. package/dist/signals/lib/is-in-viewport.d.mts +0 -10
  166. package/dist/signals/lib/is-in-viewport.mjs +0 -16
  167. package/dist/signals/lib/is-in-viewport.test.d.mts +0 -1
  168. package/dist/signals/lib/is-in-viewport.test.mjs +0 -74
  169. package/dist/signals/lib/key-press.d.mts +0 -13
  170. package/dist/signals/lib/key-press.mjs +0 -25
  171. package/dist/signals/lib/key-press.test.d.mts +0 -1
  172. package/dist/signals/lib/key-press.test.mjs +0 -52
  173. package/dist/signals/lib/list.d.mts +0 -19
  174. package/dist/signals/lib/list.mjs +0 -36
  175. package/dist/signals/lib/list.test.d.mts +0 -1
  176. package/dist/signals/lib/list.test.mjs +0 -104
  177. package/dist/signals/lib/lock-body-scroll.d.mts +0 -8
  178. package/dist/signals/lib/lock-body-scroll.mjs +0 -17
  179. package/dist/signals/lib/lock-body-scroll.test.d.mts +0 -1
  180. package/dist/signals/lib/lock-body-scroll.test.mjs +0 -37
  181. package/dist/signals/lib/long-press.d.mts +0 -10
  182. package/dist/signals/lib/long-press.mjs +0 -29
  183. package/dist/signals/lib/map.d.mts +0 -18
  184. package/dist/signals/lib/map.mjs +0 -33
  185. package/dist/signals/lib/map.test.d.mts +0 -1
  186. package/dist/signals/lib/map.test.mjs +0 -60
  187. package/dist/signals/lib/motion.d.mts +0 -15
  188. package/dist/signals/lib/motion.mjs +0 -27
  189. package/dist/signals/lib/motion.test.d.mts +0 -1
  190. package/dist/signals/lib/motion.test.mjs +0 -51
  191. package/dist/signals/lib/mouse-position.d.mts +0 -14
  192. package/dist/signals/lib/mouse-position.mjs +0 -22
  193. package/dist/signals/lib/mouse-position.test.d.mts +0 -1
  194. package/dist/signals/lib/mouse-position.test.mjs +0 -44
  195. package/dist/signals/lib/mouse-wheel.d.mts +0 -10
  196. package/dist/signals/lib/mouse-wheel.mjs +0 -17
  197. package/dist/signals/lib/mouse-wheel.test.d.mts +0 -1
  198. package/dist/signals/lib/mouse-wheel.test.mjs +0 -38
  199. package/dist/signals/lib/mutation-observer.d.mts +0 -8
  200. package/dist/signals/lib/network-state.d.mts +0 -17
  201. package/dist/signals/lib/network-state.mjs +0 -34
  202. package/dist/signals/lib/network-state.test.d.mts +0 -1
  203. package/dist/signals/lib/network-state.test.mjs +0 -61
  204. package/dist/signals/lib/on-click-outside.mjs +0 -20
  205. package/dist/signals/lib/orientation.d.mts +0 -13
  206. package/dist/signals/lib/orientation.test.d.mts +0 -1
  207. package/dist/signals/lib/orientation.test.mjs +0 -43
  208. package/dist/signals/lib/page-leave.d.mts +0 -8
  209. package/dist/signals/lib/page-leave.mjs +0 -12
  210. package/dist/signals/lib/page-leave.test.d.mts +0 -1
  211. package/dist/signals/lib/page-leave.test.mjs +0 -29
  212. package/dist/signals/lib/permission.d.mts +0 -14
  213. package/dist/signals/lib/permission.mjs +0 -26
  214. package/dist/signals/lib/permission.test.d.mts +0 -1
  215. package/dist/signals/lib/permission.test.mjs +0 -50
  216. package/dist/signals/lib/persisted-state.d.mts +0 -11
  217. package/dist/signals/lib/persisted-state.mjs +0 -25
  218. package/dist/signals/lib/persisted-state.test.d.mts +0 -1
  219. package/dist/signals/lib/persisted-state.test.mjs +0 -70
  220. package/dist/signals/lib/pressed-keys.d.mts +0 -10
  221. package/dist/signals/lib/pressed-keys.mjs +0 -32
  222. package/dist/signals/lib/pressed-keys.test.d.mts +0 -1
  223. package/dist/signals/lib/pressed-keys.test.mjs +0 -54
  224. package/dist/signals/lib/previous-distinct.d.mts +0 -10
  225. package/dist/signals/lib/previous-distinct.mjs +0 -22
  226. package/dist/signals/lib/previous-distinct.test.d.mts +0 -1
  227. package/dist/signals/lib/previous-distinct.test.mjs +0 -50
  228. package/dist/signals/lib/previous.d.mts +0 -10
  229. package/dist/signals/lib/previous.mjs +0 -18
  230. package/dist/signals/lib/previous.test.mjs +0 -47
  231. package/dist/signals/lib/queue.d.mts +0 -17
  232. package/dist/signals/lib/queue.mjs +0 -28
  233. package/dist/signals/lib/queue.test.d.mts +0 -1
  234. package/dist/signals/lib/queue.test.mjs +0 -61
  235. package/dist/signals/lib/raf.d.mts +0 -17
  236. package/dist/signals/lib/raf.mjs +0 -38
  237. package/dist/signals/lib/raf.test.d.mts +0 -1
  238. package/dist/signals/lib/raf.test.mjs +0 -58
  239. package/dist/signals/lib/resize-observer.d.mts +0 -8
  240. package/dist/signals/lib/resize-observer.test.d.mts +0 -1
  241. package/dist/signals/lib/resize-observer.test.mjs +0 -44
  242. package/dist/signals/lib/resource.d.mts +0 -23
  243. package/dist/signals/lib/resource.mjs +0 -43
  244. package/dist/signals/lib/resource.test.d.mts +0 -1
  245. package/dist/signals/lib/resource.test.mjs +0 -56
  246. package/dist/signals/lib/scroll-state.d.mts +0 -19
  247. package/dist/signals/lib/scroll-state.mjs +0 -46
  248. package/dist/signals/lib/scroll-state.test.d.mts +0 -1
  249. package/dist/signals/lib/scroll-state.test.mjs +0 -94
  250. package/dist/signals/lib/scrolling.d.mts +0 -12
  251. package/dist/signals/lib/scrolling.mjs +0 -26
  252. package/dist/signals/lib/scrolling.test.d.mts +0 -1
  253. package/dist/signals/lib/scrolling.test.mjs +0 -57
  254. package/dist/signals/lib/search-params.d.mts +0 -16
  255. package/dist/signals/lib/search-params.mjs +0 -37
  256. package/dist/signals/lib/search-params.test.mjs +0 -56
  257. package/dist/signals/lib/set.d.mts +0 -18
  258. package/dist/signals/lib/set.mjs +0 -38
  259. package/dist/signals/lib/set.test.d.mts +0 -1
  260. package/dist/signals/lib/set.test.mjs +0 -70
  261. package/dist/signals/lib/start-typing.d.mts +0 -9
  262. package/dist/signals/lib/start-typing.mjs +0 -39
  263. package/dist/signals/lib/start-typing.test.d.mts +0 -1
  264. package/dist/signals/lib/start-typing.test.mjs +0 -64
  265. package/dist/signals/lib/state-history.d.mts +0 -21
  266. package/dist/signals/lib/state-history.mjs +0 -61
  267. package/dist/signals/lib/state-history.test.d.mts +0 -1
  268. package/dist/signals/lib/state-history.test.mjs +0 -106
  269. package/dist/signals/lib/state-validator.d.mts +0 -16
  270. package/dist/signals/lib/state-validator.mjs +0 -21
  271. package/dist/signals/lib/state-validator.test.d.mts +0 -1
  272. package/dist/signals/lib/state-validator.test.mjs +0 -41
  273. package/dist/signals/lib/throttled.mjs +0 -45
  274. package/dist/signals/lib/timeout.mjs +0 -39
  275. package/dist/signals/lib/toggle.d.mts +0 -12
  276. package/dist/signals/lib/toggle.mjs +0 -12
  277. package/dist/signals/lib/toggle.test.d.mts +0 -1
  278. package/dist/signals/lib/toggle.test.mjs +0 -43
  279. package/dist/signals/lib/video.d.mts +0 -21
  280. package/dist/signals/lib/video.test.d.mts +0 -1
  281. package/dist/signals/lib/video.test.mjs +0 -51
  282. package/dist/signals/lib/watch.d.mts +0 -16
  283. package/dist/signals/lib/watch.mjs +0 -31
  284. package/dist/signals/lib/watch.test.d.mts +0 -1
  285. package/dist/signals/lib/watch.test.mjs +0 -51
  286. package/dist/signals/lib/window-size.d.mts +0 -14
  287. package/dist/signals/lib/window-size.mjs +0 -21
  288. package/dist/signals/lib/window-size.test.mjs +0 -50
  289. /package/dist/{signals/lib → utilities}/active-element.test.d.mts +0 -0
  290. /package/dist/{signals/lib → utilities}/debounced.test.d.mts +0 -0
  291. /package/dist/{signals/lib → utilities}/element-rect.test.d.mts +0 -0
  292. /package/dist/{signals/lib/animation-frames.test.d.mts → utilities/element-scroll.test.d.mts} +0 -0
  293. /package/dist/{signals/lib → utilities}/event-listener.test.d.mts +0 -0
  294. /package/dist/{signals/lib/async-retry.test.d.mts → utilities/focus-within.test.d.mts} +0 -0
  295. /package/dist/{signals/lib → utilities}/hover.test.d.mts +0 -0
  296. /package/dist/{signals/lib → utilities}/intersection-observer.test.d.mts +0 -0
  297. /package/dist/{signals/lib → utilities}/interval.test.d.mts +0 -0
  298. /package/dist/{signals/lib/audio.test.d.mts → utilities/location.test.d.mts} +0 -0
  299. /package/dist/{signals/lib → utilities}/long-press.test.d.mts +0 -0
  300. /package/dist/{signals/lib → utilities}/media-devices.test.d.mts +0 -0
  301. /package/dist/{signals/lib/battery.test.d.mts → utilities/media-player.test.d.mts} +0 -0
  302. /package/dist/{signals/lib → utilities}/mutation-observer.test.d.mts +0 -0
  303. /package/dist/{signals/lib → utilities}/on-click-outside.test.d.mts +0 -0
  304. /package/dist/{signals/lib → utilities}/previous.test.d.mts +0 -0
  305. /package/dist/{signals/lib/before-unload.test.d.mts → utilities/routing.test.d.mts} +0 -0
  306. /package/dist/{signals/lib → utilities}/search-params.test.d.mts +0 -0
  307. /package/dist/{signals/lib/clipboard.test.d.mts → utilities/storage.test.d.mts} +0 -0
  308. /package/dist/{signals/lib → utilities}/throttled.test.d.mts +0 -0
  309. /package/dist/{signals/lib → utilities}/timeout.test.d.mts +0 -0
  310. /package/dist/{signals/lib → utilities}/window-size.test.d.mts +0 -0
@@ -0,0 +1,25 @@
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
+ import { createElementScroll } from "./element-scroll.mjs";
4
+ //#region src/utilities/element-scroll.test.ts
5
+ describe("createElementScroll", () => {
6
+ it("starts at 0,0 for a new element", () => {
7
+ const el = document.createElement("div");
8
+ let scroll;
9
+ effectScope(() => {
10
+ scroll = createElementScroll(el);
11
+ });
12
+ globalExpect(scroll.x()).toBe(0);
13
+ globalExpect(scroll.y()).toBe(0);
14
+ });
15
+ it("cleans up on dispose", () => {
16
+ const el = document.createElement("div");
17
+ let scroll;
18
+ effectScope(() => {
19
+ scroll = createElementScroll(el);
20
+ });
21
+ scroll[Symbol.dispose]();
22
+ });
23
+ });
24
+ //#endregion
25
+ export {};
@@ -1,6 +1,6 @@
1
- import { n as Signal, t as Computed } from "../../index-BtqiEEfc.mjs";
1
+ import { r as Signal, t as Computed } from "../index-Cvdhuy6Y.mjs";
2
2
 
3
- //#region src/signals/lib/event-driven.d.ts
3
+ //#region src/utilities/event-driven.d.ts
4
4
  /**
5
5
  * A subscribe function: registers a `notify` callback and returns an
6
6
  * unsubscribe cleanup. Same contract as `useSyncExternalStore`.
@@ -1,5 +1,5 @@
1
- import { d as onCleanup, f as signal, i as computed, p as trigger } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/event-driven.ts
1
+ import { a as computed, f as onCleanup, m as trigger, p as signal } from "../signals-DcgXhkU2.mjs";
2
+ //#region src/utilities/event-driven.ts
3
3
  /**
4
4
  * Returns a `Subscribe` for one or more DOM events on a target.
5
5
  *
@@ -0,0 +1,16 @@
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
+
3
+ //#region src/utilities/event-listener.d.ts
4
+ /**
5
+ * Attaches a type-safe event listener to a target, with automatic cleanup.
6
+ *
7
+ * When called inside an `effect` or `effectScope` the listener is removed
8
+ * when the scope is disposed. When the target is a reactive getter the
9
+ * listener is re-registered whenever the target changes.
10
+ */
11
+ declare function on<K extends keyof HTMLElementEventMap>(target: HTMLElement | Computed<HTMLElement | null>, type: K, handler: (e: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
12
+ declare function on<K extends keyof DocumentEventMap>(target: Document | Computed<Document | null>, type: K, handler: (e: DocumentEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
13
+ declare function on<K extends keyof WindowEventMap>(target: Window | Computed<Window | null>, type: K, handler: (e: WindowEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
14
+ declare function on(target: EventTarget | Computed<EventTarget | null>, type: string, handler: EventListener, options?: AddEventListenerOptions): () => void;
15
+ //#endregion
16
+ export { on };
@@ -1,6 +1,6 @@
1
- import { a as effect, d as onCleanup } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/event-listener.ts
3
- function createEventListener(target, type, handler, options) {
1
+ import { f as onCleanup, o as effect } from "../signals-DcgXhkU2.mjs";
2
+ //#region src/utilities/event-listener.ts
3
+ function on(target, type, handler, options) {
4
4
  const add = (t) => options !== void 0 ? t.addEventListener(type, handler, options) : t.addEventListener(type, handler);
5
5
  const del = (t) => options !== void 0 ? t.removeEventListener(type, handler, options) : t.removeEventListener(type, handler);
6
6
  if (typeof target === "function") {
@@ -25,4 +25,4 @@ function createEventListener(target, type, handler, options) {
25
25
  }
26
26
  }
27
27
  //#endregion
28
- export { createEventListener };
28
+ export { on };
@@ -1,7 +1,7 @@
1
- import { a as effect, f as signal, o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
3
- import { createEventListener } from "./event-listener.mjs";
4
- //#region src/signals/lib/event-listener.test.ts
1
+ import { o as effect, p as signal, s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
+ import { on } from "./event-listener.mjs";
4
+ //#region src/utilities/event-listener.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  });
@@ -11,7 +11,7 @@ describe("createEventListener", () => {
11
11
  document.body.appendChild(el);
12
12
  const handler = vi.fn();
13
13
  effect(() => {
14
- createEventListener(el, "click", handler);
14
+ on(el, "click", handler);
15
15
  });
16
16
  el.dispatchEvent(new MouseEvent("click", { bubbles: true }));
17
17
  globalExpect(handler).toHaveBeenCalledOnce();
@@ -21,7 +21,7 @@ describe("createEventListener", () => {
21
21
  document.body.appendChild(el);
22
22
  const handler = vi.fn();
23
23
  effect(() => {
24
- createEventListener(el, "click", handler);
24
+ on(el, "click", handler);
25
25
  })();
26
26
  el.dispatchEvent(new MouseEvent("click", { bubbles: true }));
27
27
  globalExpect(handler).not.toHaveBeenCalled();
@@ -31,7 +31,7 @@ describe("createEventListener", () => {
31
31
  document.body.appendChild(el);
32
32
  const handler = vi.fn();
33
33
  effectScope(() => {
34
- createEventListener(el, "click", handler);
34
+ on(el, "click", handler);
35
35
  })();
36
36
  el.dispatchEvent(new MouseEvent("click", { bubbles: true }));
37
37
  globalExpect(handler).not.toHaveBeenCalled();
@@ -43,7 +43,7 @@ describe("createEventListener", () => {
43
43
  const target = signal(el1);
44
44
  const handler = vi.fn();
45
45
  effectScope(() => {
46
- createEventListener(() => target(), "click", handler);
46
+ on(() => target(), "click", handler);
47
47
  });
48
48
  el1.dispatchEvent(new MouseEvent("click"));
49
49
  globalExpect(handler).toHaveBeenCalledTimes(1);
@@ -0,0 +1,10 @@
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
+
3
+ //#region src/utilities/focus-within.d.ts
4
+ /**
5
+ * Returns a `Computed<boolean>` that is `true` while focus is anywhere inside
6
+ * `target` (including `target` itself).
7
+ */
8
+ declare function createFocusWithin(target: Element): Computed<boolean>;
9
+ //#endregion
10
+ export { createFocusWithin };
@@ -0,0 +1,20 @@
1
+ import { p as signal } from "../signals-DcgXhkU2.mjs";
2
+ import { on } from "./event-listener.mjs";
3
+ //#region src/utilities/focus-within.ts
4
+ /**
5
+ * Returns a `Computed<boolean>` that is `true` while focus is anywhere inside
6
+ * `target` (including `target` itself).
7
+ */
8
+ function createFocusWithin(target) {
9
+ const focused = signal(false);
10
+ const el = target;
11
+ if (el) {
12
+ on(el, "focusin", () => focused(true));
13
+ on(el, "focusout", (e) => {
14
+ if (!el.contains(e.relatedTarget)) focused(false);
15
+ });
16
+ }
17
+ return focused;
18
+ }
19
+ //#endregion
20
+ export { createFocusWithin };
@@ -1,17 +1,17 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
3
- import { createIsFocusWithin } from "./is-focus-within.mjs";
4
- //#region src/signals/lib/is-focus-within.test.ts
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
+ import { createFocusWithin } from "./focus-within.mjs";
4
+ //#region src/utilities/focus-within.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  });
8
- describe("createIsFocusWithin", () => {
8
+ describe("createFocusWithin", () => {
9
9
  it("starts as false", () => {
10
10
  const el = document.createElement("div");
11
11
  document.body.appendChild(el);
12
12
  let focused;
13
13
  effectScope(() => {
14
- focused = createIsFocusWithin(el);
14
+ focused = createFocusWithin(el);
15
15
  });
16
16
  globalExpect(focused()).toBe(false);
17
17
  });
@@ -22,7 +22,7 @@ describe("createIsFocusWithin", () => {
22
22
  document.body.appendChild(outer);
23
23
  let focused;
24
24
  effectScope(() => {
25
- focused = createIsFocusWithin(outer);
25
+ focused = createFocusWithin(outer);
26
26
  });
27
27
  document.dispatchEvent(new FocusEvent("focusin", {
28
28
  bubbles: true,
@@ -35,14 +35,13 @@ describe("createIsFocusWithin", () => {
35
35
  outer.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
36
36
  globalExpect(typeof focused()).toBe("boolean");
37
37
  });
38
- it("stops reacting after Symbol.dispose", () => {
38
+ it("stops reacting after scope disposal", () => {
39
39
  const el = document.createElement("div");
40
40
  document.body.appendChild(el);
41
41
  let focused;
42
42
  effectScope(() => {
43
- focused = createIsFocusWithin(el);
44
- });
45
- focused[Symbol.dispose]();
43
+ focused = createFocusWithin(el);
44
+ })();
46
45
  globalExpect(focused()).toBe(false);
47
46
  });
48
47
  });
@@ -0,0 +1,11 @@
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
+
3
+ //#region src/utilities/hover.d.ts
4
+ /**
5
+ * Returns a `Computed<boolean>` that is `true` while the pointer is over
6
+ * `target`. Uses `pointerenter` / `pointerleave` so it works for both mouse
7
+ * and touch/stylus input.
8
+ */
9
+ declare function createHover(target: Element): Computed<boolean>;
10
+ //#endregion
11
+ export { createHover };
@@ -0,0 +1,20 @@
1
+ import { p as signal } from "../signals-DcgXhkU2.mjs";
2
+ import { on } from "./event-listener.mjs";
3
+ //#region src/utilities/hover.ts
4
+ /**
5
+ * Returns a `Computed<boolean>` that is `true` while the pointer is over
6
+ * `target`. Uses `pointerenter` / `pointerleave` so it works for both mouse
7
+ * and touch/stylus input.
8
+ */
9
+ function createHover(target) {
10
+ const hovered = signal(false);
11
+ const onEnter = () => hovered(true);
12
+ const onLeave = () => hovered(false);
13
+ if (target) {
14
+ on(target, "pointerenter", onEnter);
15
+ on(target, "pointerleave", onLeave);
16
+ }
17
+ return hovered;
18
+ }
19
+ //#endregion
20
+ export { createHover };
@@ -1,7 +1,7 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createHover } from "./hover.mjs";
4
- //#region src/signals/lib/hover.test.ts
4
+ //#region src/utilities/hover.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  vi.restoreAllMocks();
@@ -37,27 +37,16 @@ describe("createHover", () => {
37
37
  el.dispatchEvent(new PointerEvent("pointerleave"));
38
38
  globalExpect(hovered()).toBe(false);
39
39
  });
40
- it("removes listeners on Symbol.dispose", () => {
40
+ it("removes listeners on scope disposal", () => {
41
41
  const el = document.createElement("div");
42
42
  document.body.appendChild(el);
43
43
  let hovered;
44
44
  effectScope(() => {
45
45
  hovered = createHover(el);
46
- });
47
- hovered[Symbol.dispose]();
46
+ })();
48
47
  el.dispatchEvent(new PointerEvent("pointerenter"));
49
48
  globalExpect(hovered()).toBe(false);
50
49
  });
51
- it("works with a reactive getter target", () => {
52
- const el = document.createElement("div");
53
- document.body.appendChild(el);
54
- let hovered;
55
- effectScope(() => {
56
- hovered = createHover(() => el);
57
- });
58
- el.dispatchEvent(new PointerEvent("pointerenter"));
59
- globalExpect(hovered()).toBe(true);
60
- });
61
50
  });
62
51
  //#endregion
63
52
  export {};
@@ -0,0 +1,8 @@
1
+ //#region src/utilities/intersection-observer.d.ts
2
+ /**
3
+ * Raw `IntersectionObserver` wrapper with automatic cleanup.
4
+ * Use `createIsInViewport` for the common boolean case.
5
+ */
6
+ declare function createIntersectionObserver(target: Element, callback: IntersectionObserverCallback, options?: IntersectionObserverInit): Disposable;
7
+ //#endregion
8
+ export { createIntersectionObserver };
@@ -1,13 +1,12 @@
1
- import { d as onCleanup } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/intersection-observer.ts
1
+ import { f as onCleanup } from "../signals-DcgXhkU2.mjs";
2
+ //#region src/utilities/intersection-observer.ts
3
3
  /**
4
4
  * Raw `IntersectionObserver` wrapper with automatic cleanup.
5
5
  * Use `createIsInViewport` for the common boolean case.
6
6
  */
7
7
  function createIntersectionObserver(target, callback, options) {
8
8
  const observer = new IntersectionObserver(callback, options);
9
- const el = typeof target === "function" ? target() : target;
10
- if (el) observer.observe(el);
9
+ if (target) observer.observe(target);
11
10
  const cleanup = () => observer.disconnect();
12
11
  onCleanup(cleanup);
13
12
  return { [Symbol.dispose]: cleanup };
@@ -1,7 +1,7 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createIntersectionObserver } from "./intersection-observer.mjs";
4
- //#region src/signals/lib/intersection-observer.test.ts
4
+ //#region src/utilities/intersection-observer.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  vi.unstubAllGlobals();
@@ -1,6 +1,6 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
2
 
3
- //#region src/signals/lib/interval.d.ts
3
+ //#region src/utilities/interval.d.ts
4
4
  type IntervalResult = {
5
5
  isRunning: Computed<boolean>;
6
6
  start(): void;
@@ -1,5 +1,5 @@
1
- import { d as onCleanup, f as signal } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/interval.ts
1
+ import { f as onCleanup, p as signal } from "../signals-DcgXhkU2.mjs";
2
+ //#region src/utilities/interval.ts
3
3
  /**
4
4
  * Pausable `setInterval` wrapper. Starts running immediately on creation.
5
5
  *
@@ -27,12 +27,13 @@ function createInterval(callback, delay) {
27
27
  start();
28
28
  const cleanup = () => stop();
29
29
  onCleanup(cleanup);
30
- return Object.assign({
30
+ return {
31
31
  isRunning,
32
32
  start,
33
33
  stop,
34
- reset
35
- }, { [Symbol.dispose]: cleanup });
34
+ reset,
35
+ [Symbol.dispose]: cleanup
36
+ };
36
37
  }
37
38
  //#endregion
38
39
  export { createInterval };
@@ -1,7 +1,7 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createInterval } from "./interval.mjs";
4
- //#region src/signals/lib/interval.test.ts
4
+ //#region src/utilities/interval.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  vi.useRealTimers();
@@ -0,0 +1,24 @@
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
+
3
+ //#region src/utilities/location.d.ts
4
+ type LocationResult = {
5
+ hash: Computed<string>;
6
+ href: Computed<string>;
7
+ pathname: Computed<string>;
8
+ search: Computed<string>;
9
+ };
10
+ /**
11
+ * Returns reactive signals for the four commonly used `location` properties:
12
+ * `hash`, `href`, `pathname`, and `search`.
13
+ *
14
+ * All four share a single event listener set, so creating one `LocationResult`
15
+ * is cheaper than creating four separate signals.
16
+ *
17
+ * **Custom events note:** `pushstate` and `replacestate` are not native DOM
18
+ * events — they must be dispatched by your router or by patching `history`.
19
+ * Back/forward navigation via `popstate` always works without any setup.
20
+ */
21
+ declare function createLocation(): LocationResult;
22
+ declare const currentLocation: LocationResult;
23
+ //#endregion
24
+ export { createLocation, currentLocation };
@@ -0,0 +1,54 @@
1
+ import { a as computed, f as onCleanup, m as trigger, p as signal } from "../signals-DcgXhkU2.mjs";
2
+ import { fromEvent } from "./event-driven.mjs";
3
+ //#region src/utilities/location.ts
4
+ const EVENTS = [
5
+ "popstate",
6
+ "pushstate",
7
+ "replacestate",
8
+ "hashchange"
9
+ ];
10
+ const read = (prop) => typeof location !== "undefined" ? String(location[prop]) : "";
11
+ /**
12
+ * Returns reactive signals for the four commonly used `location` properties:
13
+ * `hash`, `href`, `pathname`, and `search`.
14
+ *
15
+ * All four share a single event listener set, so creating one `LocationResult`
16
+ * is cheaper than creating four separate signals.
17
+ *
18
+ * **Custom events note:** `pushstate` and `replacestate` are not native DOM
19
+ * events — they must be dispatched by your router or by patching `history`.
20
+ * Back/forward navigation via `popstate` always works without any setup.
21
+ */
22
+ function createLocation() {
23
+ const tick = signal(void 0);
24
+ onCleanup(fromEvent(window, EVENTS)(() => trigger(tick)));
25
+ const hash = computed(() => {
26
+ tick();
27
+ return read("hash");
28
+ });
29
+ const href = computed(() => {
30
+ tick();
31
+ return read("href");
32
+ });
33
+ const pathname = computed(() => {
34
+ tick();
35
+ return read("pathname");
36
+ });
37
+ const search = computed(() => {
38
+ tick();
39
+ return read("search");
40
+ });
41
+ hash();
42
+ href();
43
+ pathname();
44
+ search();
45
+ return {
46
+ hash,
47
+ href,
48
+ pathname,
49
+ search
50
+ };
51
+ }
52
+ const currentLocation = createLocation();
53
+ //#endregion
54
+ export { createLocation, currentLocation };
@@ -0,0 +1,60 @@
1
+ import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
2
+ import { createLocation, currentLocation } from "./location.mjs";
3
+ //#region src/utilities/location.test.ts
4
+ afterEach(() => {
5
+ location.hash = "";
6
+ history.replaceState(null, "", "/");
7
+ });
8
+ describe("currentLocation (singleton)", () => {
9
+ it("reads current hash", () => {
10
+ globalExpect(currentLocation.hash()).toBe(location.hash);
11
+ });
12
+ it("reads current href", () => {
13
+ globalExpect(typeof currentLocation.href()).toBe("string");
14
+ });
15
+ it("reads current pathname", () => {
16
+ globalExpect(typeof currentLocation.pathname()).toBe("string");
17
+ });
18
+ it("reads current search", () => {
19
+ globalExpect(typeof currentLocation.search()).toBe("string");
20
+ });
21
+ it("updates hash on hashchange", () => {
22
+ location.hash = "#foo";
23
+ window.dispatchEvent(new HashChangeEvent("hashchange"));
24
+ globalExpect(currentLocation.hash()).toBe("#foo");
25
+ });
26
+ it("updates href on popstate", () => {
27
+ history.replaceState(null, "", "/foo");
28
+ window.dispatchEvent(new PopStateEvent("popstate"));
29
+ globalExpect(currentLocation.href()).toMatch(/\/foo$/);
30
+ });
31
+ it("updates pathname on popstate", () => {
32
+ history.replaceState(null, "", "/new-page");
33
+ window.dispatchEvent(new PopStateEvent("popstate"));
34
+ globalExpect(currentLocation.pathname()).toBe("/new-page");
35
+ });
36
+ it("updates href on hashchange", () => {
37
+ history.replaceState(null, "", "/bar#baz");
38
+ window.dispatchEvent(new HashChangeEvent("hashchange"));
39
+ globalExpect(currentLocation.href()).toMatch(/#baz$/);
40
+ });
41
+ });
42
+ describe("createLocation (factory)", () => {
43
+ it("returns independent location signals", () => {
44
+ const loc = createLocation();
45
+ globalExpect(typeof loc.hash()).toBe("string");
46
+ globalExpect(typeof loc.href()).toBe("string");
47
+ globalExpect(typeof loc.pathname()).toBe("string");
48
+ globalExpect(typeof loc.search()).toBe("string");
49
+ });
50
+ it("all four properties update from a single event", () => {
51
+ const loc = createLocation();
52
+ history.replaceState(null, "", "/factory-test?q=1#section");
53
+ window.dispatchEvent(new PopStateEvent("popstate"));
54
+ globalExpect(loc.pathname()).toBe("/factory-test");
55
+ globalExpect(loc.search()).toBe("?q=1");
56
+ globalExpect(loc.hash()).toBe("#section");
57
+ });
58
+ });
59
+ //#endregion
60
+ export {};
@@ -0,0 +1,10 @@
1
+ //#region src/utilities/long-press.d.ts
2
+ /**
3
+ * Fires `handler` when a pointer is held over `target` for at least `delay`
4
+ * milliseconds (default: 500 ms).
5
+ */
6
+ declare function createLongPress(target: Element, handler: (e: PointerEvent) => void, options?: {
7
+ delay?: number;
8
+ }): () => void;
9
+ //#endregion
10
+ export { createLongPress };
@@ -0,0 +1,27 @@
1
+ import { createTimeout } from "./timeout.mjs";
2
+ import { on } from "./event-listener.mjs";
3
+ //#region src/utilities/long-press.ts
4
+ /**
5
+ * Fires `handler` when a pointer is held over `target` for at least `delay`
6
+ * milliseconds (default: 500 ms).
7
+ */
8
+ function createLongPress(target, handler, options = {}) {
9
+ const { delay = 500 } = options;
10
+ let lastEvent;
11
+ const { reset, stop } = createTimeout(() => handler(lastEvent), delay, false);
12
+ const cleanups = [
13
+ on(target, "pointerdown", (e) => {
14
+ lastEvent = e;
15
+ reset();
16
+ }),
17
+ on(target, "pointerup", stop),
18
+ on(target, "pointerleave", stop),
19
+ on(target, "pointermove", stop)
20
+ ];
21
+ return () => {
22
+ stop();
23
+ cleanups.forEach((fn) => fn());
24
+ };
25
+ }
26
+ //#endregion
27
+ export { createLongPress };
@@ -1,7 +1,7 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createLongPress } from "./long-press.mjs";
4
- //#region src/signals/lib/long-press.test.ts
4
+ //#region src/utilities/long-press.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  vi.useRealTimers();
@@ -1,10 +1,10 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
1
+ import { t as Computed } from "../index-Cvdhuy6Y.mjs";
2
2
 
3
- //#region src/signals/lib/media-devices.d.ts
3
+ //#region src/utilities/media-devices.d.ts
4
4
  /**
5
5
  * Returns a reactive list of available media devices, refreshed whenever
6
6
  * devices are added or removed.
7
7
  */
8
- declare function createMediaDevices(): Computed<MediaDeviceInfo[]> & Disposable;
8
+ declare function createMediaDevices(): Computed<MediaDeviceInfo[]>;
9
9
  //#endregion
10
10
  export { createMediaDevices };
@@ -1,6 +1,6 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/media-devices.ts
1
+ import { p as signal } from "../signals-DcgXhkU2.mjs";
2
+ import { on } from "./event-listener.mjs";
3
+ //#region src/utilities/media-devices.ts
4
4
  /**
5
5
  * Returns a reactive list of available media devices, refreshed whenever
6
6
  * devices are added or removed.
@@ -11,8 +11,8 @@ function createMediaDevices() {
11
11
  navigator.mediaDevices.enumerateDevices().then((list) => devices(list));
12
12
  };
13
13
  refresh();
14
- const cleanup = createEventListener(navigator.mediaDevices, "devicechange", refresh);
15
- return Object.assign(devices, { [Symbol.dispose]: cleanup });
14
+ on(navigator.mediaDevices, "devicechange", refresh);
15
+ return devices;
16
16
  }
17
17
  //#endregion
18
18
  export { createMediaDevices };
@@ -1,7 +1,7 @@
1
- import { o as effectScope } from "../../signals-CLAPw8kk.mjs";
2
- import { a as describe, n as vi, o as it, r as afterEach, t as globalExpect } from "../../test.BmQO5GaM-CR2qjV1t.mjs";
1
+ import { s as effectScope } from "../signals-DcgXhkU2.mjs";
2
+ import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createMediaDevices } from "./media-devices.mjs";
4
- //#region src/signals/lib/media-devices.test.ts
4
+ //#region src/utilities/media-devices.test.ts
5
5
  afterEach(() => {
6
6
  document.body.innerHTML = "";
7
7
  vi.unstubAllGlobals();
@@ -25,18 +25,16 @@ describe("createMediaDevices", () => {
25
25
  await new Promise((res) => setTimeout(res, 0));
26
26
  globalExpect(d()).toEqual(mockDevices);
27
27
  });
28
- it("removes devicechange listener on Symbol.dispose", () => {
28
+ it("removes devicechange listener on scope disposal", () => {
29
29
  const removeListener = vi.fn();
30
30
  vi.stubGlobal("navigator", { mediaDevices: {
31
31
  enumerateDevices: vi.fn().mockResolvedValue([]),
32
32
  addEventListener: vi.fn(),
33
33
  removeEventListener: removeListener
34
34
  } });
35
- let d;
36
35
  effectScope(() => {
37
- d = createMediaDevices();
38
- });
39
- d[Symbol.dispose]();
36
+ createMediaDevices();
37
+ })();
40
38
  globalExpect(removeListener).toHaveBeenCalledWith("devicechange", globalExpect.any(Function));
41
39
  });
42
40
  });