elements-kit 0.0.9 → 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 (313) 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/utilities/event-driven.d.mts +47 -0
  33. package/dist/utilities/event-driven.mjs +38 -0
  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/utilities/media-player.mjs +36 -0
  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/utilities/media-query.mjs +19 -0
  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/utilities/orientation.mjs +21 -0
  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 -20
  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 -26
  107. package/dist/signals/lib/audio.mjs +0 -60
  108. package/dist/signals/lib/audio.test.mjs +0 -54
  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 -26
  141. package/dist/signals/lib/fullscreen.test.d.mts +0 -1
  142. package/dist/signals/lib/fullscreen.test.mjs +0 -56
  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 -20
  149. package/dist/signals/lib/hash.test.d.mts +0 -1
  150. package/dist/signals/lib/hash.test.mjs +0 -47
  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 -19
  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/media.mjs +0 -26
  188. package/dist/signals/lib/motion.d.mts +0 -15
  189. package/dist/signals/lib/motion.mjs +0 -27
  190. package/dist/signals/lib/motion.test.d.mts +0 -1
  191. package/dist/signals/lib/motion.test.mjs +0 -51
  192. package/dist/signals/lib/mouse-position.d.mts +0 -14
  193. package/dist/signals/lib/mouse-position.mjs +0 -22
  194. package/dist/signals/lib/mouse-position.test.d.mts +0 -1
  195. package/dist/signals/lib/mouse-position.test.mjs +0 -44
  196. package/dist/signals/lib/mouse-wheel.d.mts +0 -10
  197. package/dist/signals/lib/mouse-wheel.mjs +0 -17
  198. package/dist/signals/lib/mouse-wheel.test.d.mts +0 -1
  199. package/dist/signals/lib/mouse-wheel.test.mjs +0 -38
  200. package/dist/signals/lib/mutation-observer.d.mts +0 -8
  201. package/dist/signals/lib/network-state.d.mts +0 -17
  202. package/dist/signals/lib/network-state.mjs +0 -34
  203. package/dist/signals/lib/network-state.test.d.mts +0 -1
  204. package/dist/signals/lib/network-state.test.mjs +0 -61
  205. package/dist/signals/lib/on-click-outside.mjs +0 -20
  206. package/dist/signals/lib/orientation.d.mts +0 -13
  207. package/dist/signals/lib/orientation.mjs +0 -21
  208. package/dist/signals/lib/orientation.test.d.mts +0 -1
  209. package/dist/signals/lib/orientation.test.mjs +0 -43
  210. package/dist/signals/lib/page-leave.d.mts +0 -8
  211. package/dist/signals/lib/page-leave.mjs +0 -12
  212. package/dist/signals/lib/page-leave.test.d.mts +0 -1
  213. package/dist/signals/lib/page-leave.test.mjs +0 -29
  214. package/dist/signals/lib/permission.d.mts +0 -14
  215. package/dist/signals/lib/permission.mjs +0 -26
  216. package/dist/signals/lib/permission.test.d.mts +0 -1
  217. package/dist/signals/lib/permission.test.mjs +0 -50
  218. package/dist/signals/lib/persisted-state.d.mts +0 -11
  219. package/dist/signals/lib/persisted-state.mjs +0 -25
  220. package/dist/signals/lib/persisted-state.test.d.mts +0 -1
  221. package/dist/signals/lib/persisted-state.test.mjs +0 -70
  222. package/dist/signals/lib/pressed-keys.d.mts +0 -10
  223. package/dist/signals/lib/pressed-keys.mjs +0 -32
  224. package/dist/signals/lib/pressed-keys.test.d.mts +0 -1
  225. package/dist/signals/lib/pressed-keys.test.mjs +0 -54
  226. package/dist/signals/lib/previous-distinct.d.mts +0 -10
  227. package/dist/signals/lib/previous-distinct.mjs +0 -22
  228. package/dist/signals/lib/previous-distinct.test.d.mts +0 -1
  229. package/dist/signals/lib/previous-distinct.test.mjs +0 -50
  230. package/dist/signals/lib/previous.d.mts +0 -10
  231. package/dist/signals/lib/previous.mjs +0 -18
  232. package/dist/signals/lib/previous.test.mjs +0 -47
  233. package/dist/signals/lib/queue.d.mts +0 -17
  234. package/dist/signals/lib/queue.mjs +0 -28
  235. package/dist/signals/lib/queue.test.d.mts +0 -1
  236. package/dist/signals/lib/queue.test.mjs +0 -61
  237. package/dist/signals/lib/raf.d.mts +0 -17
  238. package/dist/signals/lib/raf.mjs +0 -38
  239. package/dist/signals/lib/raf.test.d.mts +0 -1
  240. package/dist/signals/lib/raf.test.mjs +0 -58
  241. package/dist/signals/lib/resize-observer.d.mts +0 -8
  242. package/dist/signals/lib/resize-observer.test.d.mts +0 -1
  243. package/dist/signals/lib/resize-observer.test.mjs +0 -44
  244. package/dist/signals/lib/resource.d.mts +0 -23
  245. package/dist/signals/lib/resource.mjs +0 -43
  246. package/dist/signals/lib/resource.test.d.mts +0 -1
  247. package/dist/signals/lib/resource.test.mjs +0 -56
  248. package/dist/signals/lib/scroll-state.d.mts +0 -19
  249. package/dist/signals/lib/scroll-state.mjs +0 -46
  250. package/dist/signals/lib/scroll-state.test.d.mts +0 -1
  251. package/dist/signals/lib/scroll-state.test.mjs +0 -94
  252. package/dist/signals/lib/scrolling.d.mts +0 -12
  253. package/dist/signals/lib/scrolling.mjs +0 -26
  254. package/dist/signals/lib/scrolling.test.d.mts +0 -1
  255. package/dist/signals/lib/scrolling.test.mjs +0 -57
  256. package/dist/signals/lib/search-params.d.mts +0 -16
  257. package/dist/signals/lib/search-params.mjs +0 -37
  258. package/dist/signals/lib/search-params.test.mjs +0 -56
  259. package/dist/signals/lib/set.d.mts +0 -18
  260. package/dist/signals/lib/set.mjs +0 -38
  261. package/dist/signals/lib/set.test.d.mts +0 -1
  262. package/dist/signals/lib/set.test.mjs +0 -70
  263. package/dist/signals/lib/start-typing.d.mts +0 -9
  264. package/dist/signals/lib/start-typing.mjs +0 -39
  265. package/dist/signals/lib/start-typing.test.d.mts +0 -1
  266. package/dist/signals/lib/start-typing.test.mjs +0 -64
  267. package/dist/signals/lib/state-history.d.mts +0 -21
  268. package/dist/signals/lib/state-history.mjs +0 -61
  269. package/dist/signals/lib/state-history.test.d.mts +0 -1
  270. package/dist/signals/lib/state-history.test.mjs +0 -106
  271. package/dist/signals/lib/state-validator.d.mts +0 -16
  272. package/dist/signals/lib/state-validator.mjs +0 -21
  273. package/dist/signals/lib/state-validator.test.d.mts +0 -1
  274. package/dist/signals/lib/state-validator.test.mjs +0 -41
  275. package/dist/signals/lib/throttled.mjs +0 -45
  276. package/dist/signals/lib/timeout.mjs +0 -39
  277. package/dist/signals/lib/toggle.d.mts +0 -12
  278. package/dist/signals/lib/toggle.mjs +0 -12
  279. package/dist/signals/lib/toggle.test.d.mts +0 -1
  280. package/dist/signals/lib/toggle.test.mjs +0 -43
  281. package/dist/signals/lib/video.d.mts +0 -25
  282. package/dist/signals/lib/video.mjs +0 -59
  283. package/dist/signals/lib/video.test.d.mts +0 -1
  284. package/dist/signals/lib/video.test.mjs +0 -51
  285. package/dist/signals/lib/watch.d.mts +0 -16
  286. package/dist/signals/lib/watch.mjs +0 -31
  287. package/dist/signals/lib/watch.test.d.mts +0 -1
  288. package/dist/signals/lib/watch.test.mjs +0 -51
  289. package/dist/signals/lib/window-size.d.mts +0 -14
  290. package/dist/signals/lib/window-size.mjs +0 -22
  291. package/dist/signals/lib/window-size.test.mjs +0 -50
  292. /package/dist/{signals/lib → utilities}/active-element.test.d.mts +0 -0
  293. /package/dist/{signals/lib → utilities}/debounced.test.d.mts +0 -0
  294. /package/dist/{signals/lib → utilities}/element-rect.test.d.mts +0 -0
  295. /package/dist/{signals/lib/animation-frames.test.d.mts → utilities/element-scroll.test.d.mts} +0 -0
  296. /package/dist/{signals/lib → utilities}/event-listener.test.d.mts +0 -0
  297. /package/dist/{signals/lib/async-retry.test.d.mts → utilities/focus-within.test.d.mts} +0 -0
  298. /package/dist/{signals/lib → utilities}/hover.test.d.mts +0 -0
  299. /package/dist/{signals/lib → utilities}/intersection-observer.test.d.mts +0 -0
  300. /package/dist/{signals/lib → utilities}/interval.test.d.mts +0 -0
  301. /package/dist/{signals/lib/audio.test.d.mts → utilities/location.test.d.mts} +0 -0
  302. /package/dist/{signals/lib → utilities}/long-press.test.d.mts +0 -0
  303. /package/dist/{signals/lib → utilities}/media-devices.test.d.mts +0 -0
  304. /package/dist/{signals/lib/battery.test.d.mts → utilities/media-player.test.d.mts} +0 -0
  305. /package/dist/{signals/lib → utilities}/mutation-observer.test.d.mts +0 -0
  306. /package/dist/{signals/lib → utilities}/on-click-outside.test.d.mts +0 -0
  307. /package/dist/{signals/lib → utilities}/previous.test.d.mts +0 -0
  308. /package/dist/{signals/lib/before-unload.test.d.mts → utilities/routing.test.d.mts} +0 -0
  309. /package/dist/{signals/lib → utilities}/search-params.test.d.mts +0 -0
  310. /package/dist/{signals/lib/clipboard.test.d.mts → utilities/storage.test.d.mts} +0 -0
  311. /package/dist/{signals/lib → utilities}/throttled.test.d.mts +0 -0
  312. /package/dist/{signals/lib → utilities}/timeout.test.d.mts +0 -0
  313. /package/dist/{signals/lib → utilities}/window-size.test.d.mts +0 -0
@@ -1,29 +0,0 @@
1
- import { createEventListener } from "./event-listener.mjs";
2
- //#region src/signals/lib/long-press.ts
3
- /**
4
- * Fires `handler` when a pointer is held over `target` for at least `delay`
5
- * milliseconds (default: 500 ms).
6
- */
7
- function createLongPress(target, handler, options = {}) {
8
- const { delay = 500 } = options;
9
- const el = typeof target === "function" ? target() : target;
10
- let timer;
11
- const onPointerDown = (e) => {
12
- timer = setTimeout(() => handler(e), delay);
13
- };
14
- const cancel = () => clearTimeout(timer);
15
- const cleanups = [];
16
- if (el) {
17
- cleanups.push(createEventListener(el, "pointerdown", onPointerDown));
18
- cleanups.push(createEventListener(el, "pointerup", cancel));
19
- cleanups.push(createEventListener(el, "pointerleave", cancel));
20
- cleanups.push(createEventListener(el, "pointermove", cancel));
21
- }
22
- const cleanup = () => {
23
- clearTimeout(timer);
24
- cleanups.forEach((fn) => fn());
25
- };
26
- return { [Symbol.dispose]: cleanup };
27
- }
28
- //#endregion
29
- export { createLongPress };
@@ -1,18 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/map.d.ts
4
- type ReactiveMapResult<K, V> = {
5
- entries: Computed<ReadonlyMap<K, V>>;
6
- get(key: K): V | undefined;
7
- set(key: K, value: V): void;
8
- delete(key: K): void;
9
- has(key: K): boolean;
10
- clear(): void;
11
- size: Computed<number>;
12
- };
13
- /**
14
- * Reactive `Map` with mutation helpers.
15
- */
16
- declare function createMap<K, V>(initial?: Map<K, V>): ReactiveMapResult<K, V>;
17
- //#endregion
18
- export { createMap };
@@ -1,33 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/map.ts
3
- /**
4
- * Reactive `Map` with mutation helpers.
5
- */
6
- function createMap(initial) {
7
- const s = signal(new Map(initial));
8
- const get = (key) => s().get(key);
9
- const set = (key, value) => {
10
- const next = new Map(s());
11
- next.set(key, value);
12
- s(next);
13
- };
14
- const del = (key) => {
15
- const next = new Map(s());
16
- next.delete(key);
17
- s(next);
18
- };
19
- const has = (key) => s().has(key);
20
- const clear = () => s(/* @__PURE__ */ new Map());
21
- const size = () => s().size;
22
- return {
23
- entries: s,
24
- get,
25
- set,
26
- delete: del,
27
- has,
28
- clear,
29
- size
30
- };
31
- }
32
- //#endregion
33
- export { createMap };
@@ -1 +0,0 @@
1
- export { };
@@ -1,60 +0,0 @@
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 { createMap } from "./map.mjs";
4
- //#region src/signals/lib/map.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- });
8
- describe("createMap", () => {
9
- it("starts empty by default", () => {
10
- let m;
11
- effectScope(() => {
12
- m = createMap();
13
- });
14
- globalExpect(m.entries().size).toBe(0);
15
- globalExpect(m.size()).toBe(0);
16
- });
17
- it("initializes from a Map", () => {
18
- let m;
19
- effectScope(() => {
20
- m = createMap(new Map([["a", 1]]));
21
- });
22
- globalExpect(m.get("a")).toBe(1);
23
- });
24
- it("set adds an entry", () => {
25
- let m;
26
- effectScope(() => {
27
- m = createMap();
28
- });
29
- m.set("x", 42);
30
- globalExpect(m.get("x")).toBe(42);
31
- globalExpect(m.size()).toBe(1);
32
- });
33
- it("delete removes an entry", () => {
34
- let m;
35
- effectScope(() => {
36
- m = createMap(new Map([["a", 1], ["b", 2]]));
37
- });
38
- m.delete("a");
39
- globalExpect(m.has("a")).toBe(false);
40
- globalExpect(m.size()).toBe(1);
41
- });
42
- it("has returns correct boolean", () => {
43
- let m;
44
- effectScope(() => {
45
- m = createMap(new Map([["a", 1]]));
46
- });
47
- globalExpect(m.has("a")).toBe(true);
48
- globalExpect(m.has("z")).toBe(false);
49
- });
50
- it("clear empties the map", () => {
51
- let m;
52
- effectScope(() => {
53
- m = createMap(new Map([["a", 1], ["b", 2]]));
54
- });
55
- m.clear();
56
- globalExpect(m.size()).toBe(0);
57
- });
58
- });
59
- //#endregion
60
- export {};
@@ -1,26 +0,0 @@
1
- import { d as onCleanup, f as signal } from "../../signals-CLAPw8kk.mjs";
2
- //#region src/signals/lib/media.ts
3
- const isBrowser = typeof window !== "undefined";
4
- /**
5
- * Creates a signal that tracks a CSS media query.
6
- *
7
- * @param query The media query string (e.g. '(max-width: 600px)')
8
- * @param defaultState The default value (for SSR/hydration)
9
- * @returns Computed<boolean> that is true if the query matches
10
- */
11
- function createMediaSignal(query, defaultState) {
12
- if (!isBrowser) return signal(defaultState ?? false);
13
- const mql = window.matchMedia(query);
14
- const state = signal(mql.matches);
15
- const handler = () => {
16
- state(mql.matches);
17
- };
18
- mql.addEventListener("change", handler);
19
- const cleanup = () => {
20
- mql.removeEventListener("change", handler);
21
- };
22
- onCleanup(cleanup);
23
- return Object.assign(state, { [Symbol.dispose]: cleanup });
24
- }
25
- //#endregion
26
- export { createMediaSignal, isBrowser };
@@ -1,15 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/motion.d.ts
4
- type MotionResult = {
5
- acceleration: Computed<DeviceMotionEventAcceleration | null>;
6
- accelerationIncludingGravity: Computed<DeviceMotionEventAcceleration | null>;
7
- rotationRate: Computed<DeviceMotionEventRotationRate | null>;
8
- interval: Computed<number | null>;
9
- } & Disposable;
10
- /**
11
- * Returns reactive signals driven by the `devicemotion` event.
12
- */
13
- declare function createMotion(): MotionResult;
14
- //#endregion
15
- export { createMotion };
@@ -1,27 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/motion.ts
4
- /**
5
- * Returns reactive signals driven by the `devicemotion` event.
6
- */
7
- function createMotion() {
8
- const acceleration = signal(null);
9
- const accelerationIncludingGravity = signal(null);
10
- const rotationRate = signal(null);
11
- const interval = signal(null);
12
- const onMotion = (e) => {
13
- acceleration(e.acceleration);
14
- accelerationIncludingGravity(e.accelerationIncludingGravity);
15
- rotationRate(e.rotationRate);
16
- interval(e.interval);
17
- };
18
- const cleanup = createEventListener(window, "devicemotion", onMotion);
19
- return Object.assign({
20
- acceleration,
21
- accelerationIncludingGravity,
22
- rotationRate,
23
- interval
24
- }, { [Symbol.dispose]: cleanup });
25
- }
26
- //#endregion
27
- export { createMotion };
@@ -1 +0,0 @@
1
- export { };
@@ -1,51 +0,0 @@
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 { createMotion } from "./motion.mjs";
4
- //#region src/signals/lib/motion.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- });
8
- describe("createMotion", () => {
9
- it("starts with null values", () => {
10
- let m;
11
- effectScope(() => {
12
- m = createMotion();
13
- });
14
- globalExpect(m.acceleration()).toBeNull();
15
- globalExpect(m.rotationRate()).toBeNull();
16
- globalExpect(m.interval()).toBeNull();
17
- });
18
- it("updates on devicemotion event", () => {
19
- let m;
20
- effectScope(() => {
21
- m = createMotion();
22
- });
23
- const accel = {
24
- x: 1,
25
- y: 2,
26
- z: 3
27
- };
28
- window.dispatchEvent(Object.assign(new Event("devicemotion"), {
29
- acceleration: accel,
30
- accelerationIncludingGravity: accel,
31
- rotationRate: {
32
- alpha: 0,
33
- beta: 90,
34
- gamma: -45
35
- },
36
- interval: 16
37
- }));
38
- globalExpect(m.interval()).toBe(16);
39
- });
40
- it("stops reacting after Symbol.dispose", () => {
41
- let m;
42
- effectScope(() => {
43
- m = createMotion();
44
- });
45
- m[Symbol.dispose]();
46
- window.dispatchEvent(Object.assign(new Event("devicemotion"), { interval: 100 }));
47
- globalExpect(m.interval()).toBeNull();
48
- });
49
- });
50
- //#endregion
51
- export {};
@@ -1,14 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/mouse-position.d.ts
4
- type MousePositionResult = {
5
- x: Computed<number>;
6
- y: Computed<number>;
7
- } & Disposable;
8
- /**
9
- * Returns reactive `x` / `y` signals that track the mouse pointer position on
10
- * the document.
11
- */
12
- declare function createMousePosition(): MousePositionResult;
13
- //#endregion
14
- export { createMousePosition };
@@ -1,22 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/mouse-position.ts
4
- /**
5
- * Returns reactive `x` / `y` signals that track the mouse pointer position on
6
- * the document.
7
- */
8
- function createMousePosition() {
9
- const x = signal(0);
10
- const y = signal(0);
11
- const handler = (e) => {
12
- x(e.clientX);
13
- y(e.clientY);
14
- };
15
- const cleanup = createEventListener(document, "mousemove", handler);
16
- return Object.assign({
17
- x,
18
- y
19
- }, { [Symbol.dispose]: cleanup });
20
- }
21
- //#endregion
22
- export { createMousePosition };
@@ -1 +0,0 @@
1
- export { };
@@ -1,44 +0,0 @@
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 { createMousePosition } from "./mouse-position.mjs";
4
- //#region src/signals/lib/mouse-position.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- });
8
- describe("createMousePosition", () => {
9
- it("starts at (0, 0)", () => {
10
- let pos;
11
- effectScope(() => {
12
- pos = createMousePosition();
13
- });
14
- globalExpect(pos.x()).toBe(0);
15
- globalExpect(pos.y()).toBe(0);
16
- });
17
- it("updates on mousemove", () => {
18
- let pos;
19
- effectScope(() => {
20
- pos = createMousePosition();
21
- });
22
- document.dispatchEvent(new MouseEvent("mousemove", {
23
- clientX: 100,
24
- clientY: 200
25
- }));
26
- globalExpect(pos.x()).toBe(100);
27
- globalExpect(pos.y()).toBe(200);
28
- });
29
- it("stops updating after Symbol.dispose", () => {
30
- let pos;
31
- effectScope(() => {
32
- pos = createMousePosition();
33
- });
34
- pos[Symbol.dispose]();
35
- document.dispatchEvent(new MouseEvent("mousemove", {
36
- clientX: 99,
37
- clientY: 77
38
- }));
39
- globalExpect(pos.x()).toBe(0);
40
- globalExpect(pos.y()).toBe(0);
41
- });
42
- });
43
- //#endregion
44
- export {};
@@ -1,10 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/mouse-wheel.d.ts
4
- /**
5
- * Returns a `Computed<number>` tracking the cumulative vertical mouse-wheel
6
- * delta (positive = scrolled down).
7
- */
8
- declare function createMouseWheel(): Computed<number> & Disposable;
9
- //#endregion
10
- export { createMouseWheel };
@@ -1,17 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/mouse-wheel.ts
4
- /**
5
- * Returns a `Computed<number>` tracking the cumulative vertical mouse-wheel
6
- * delta (positive = scrolled down).
7
- */
8
- function createMouseWheel() {
9
- const delta = signal(0);
10
- const handler = (e) => {
11
- delta(delta() + e.deltaY);
12
- };
13
- const cleanup = createEventListener(window, "wheel", handler, { passive: true });
14
- return Object.assign(delta, { [Symbol.dispose]: cleanup });
15
- }
16
- //#endregion
17
- export { createMouseWheel };
@@ -1 +0,0 @@
1
- export { };
@@ -1,38 +0,0 @@
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";
3
- import { createMouseWheel } from "./mouse-wheel.mjs";
4
- //#region src/signals/lib/mouse-wheel.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- vi.useRealTimers();
8
- });
9
- describe("createMouseWheel", () => {
10
- it("starts at 0", () => {
11
- let w;
12
- effectScope(() => {
13
- w = createMouseWheel();
14
- });
15
- globalExpect(w()).toBe(0);
16
- });
17
- it("accumulates deltaY on wheel events", () => {
18
- let w;
19
- effectScope(() => {
20
- w = createMouseWheel();
21
- });
22
- window.dispatchEvent(new WheelEvent("wheel", { deltaY: 100 }));
23
- globalExpect(w()).toBe(100);
24
- window.dispatchEvent(new WheelEvent("wheel", { deltaY: -50 }));
25
- globalExpect(w()).toBe(50);
26
- });
27
- it("stops updating after Symbol.dispose", () => {
28
- let w;
29
- effectScope(() => {
30
- w = createMouseWheel();
31
- });
32
- w[Symbol.dispose]();
33
- window.dispatchEvent(new WheelEvent("wheel", { deltaY: 200 }));
34
- globalExpect(w()).toBe(0);
35
- });
36
- });
37
- //#endregion
38
- export {};
@@ -1,8 +0,0 @@
1
- //#region src/signals/lib/mutation-observer.d.ts
2
- /**
3
- * Watches `target` for DOM mutations and calls `callback` with each batch of
4
- * `MutationRecord`s.
5
- */
6
- declare function createMutationObserver(target: Element | (() => Element | null), options: MutationObserverInit, callback: (records: MutationRecord[]) => void): Disposable;
7
- //#endregion
8
- export { createMutationObserver };
@@ -1,17 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/network-state.d.ts
4
- type NetworkStateResult = {
5
- online: Computed<boolean>;
6
- downlink: Computed<number | undefined>;
7
- effectiveType: Computed<string | undefined>;
8
- rtt: Computed<number | undefined>;
9
- saveData: Computed<boolean | undefined>;
10
- } & Disposable;
11
- /**
12
- * Returns reactive signals reflecting `navigator.onLine` and the Network
13
- * Information API (`navigator.connection`) when available.
14
- */
15
- declare function createNetworkState(): NetworkStateResult;
16
- //#endregion
17
- export { createNetworkState };
@@ -1,34 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/network-state.ts
4
- /**
5
- * Returns reactive signals reflecting `navigator.onLine` and the Network
6
- * Information API (`navigator.connection`) when available.
7
- */
8
- function createNetworkState() {
9
- const connection = navigator.connection;
10
- const online = signal(typeof navigator !== "undefined" ? navigator.onLine : true);
11
- const downlink = signal(connection?.downlink);
12
- const effectiveType = signal(connection?.effectiveType);
13
- const rtt = signal(connection?.rtt);
14
- const saveData = signal(connection?.saveData);
15
- const updateOnline = () => online(navigator.onLine);
16
- const updateConnection = () => {
17
- downlink(connection?.downlink);
18
- effectiveType(connection?.effectiveType);
19
- rtt(connection?.rtt);
20
- saveData(connection?.saveData);
21
- };
22
- const cleanups = [createEventListener(window, "online", updateOnline), createEventListener(window, "offline", updateOnline)];
23
- if (connection) cleanups.push(createEventListener(connection, "change", updateConnection));
24
- const cleanup = () => cleanups.forEach((fn) => fn());
25
- return Object.assign({
26
- online,
27
- downlink,
28
- effectiveType,
29
- rtt,
30
- saveData
31
- }, { [Symbol.dispose]: cleanup });
32
- }
33
- //#endregion
34
- export { createNetworkState };
@@ -1 +0,0 @@
1
- export { };
@@ -1,61 +0,0 @@
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";
3
- import { createNetworkState } from "./network-state.mjs";
4
- //#region src/signals/lib/network-state.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- vi.restoreAllMocks();
8
- });
9
- describe("createNetworkState", () => {
10
- it("reads navigator.onLine initially", () => {
11
- let n;
12
- effectScope(() => {
13
- n = createNetworkState();
14
- });
15
- globalExpect(n.online()).toBe(navigator.onLine);
16
- });
17
- it("becomes false on offline event", () => {
18
- let n;
19
- effectScope(() => {
20
- n = createNetworkState();
21
- });
22
- Object.defineProperty(navigator, "onLine", {
23
- configurable: true,
24
- get: () => false
25
- });
26
- window.dispatchEvent(new Event("offline"));
27
- globalExpect(n.online()).toBe(false);
28
- });
29
- it("becomes true on online event", () => {
30
- Object.defineProperty(navigator, "onLine", {
31
- configurable: true,
32
- get: () => false
33
- });
34
- let n;
35
- effectScope(() => {
36
- n = createNetworkState();
37
- });
38
- Object.defineProperty(navigator, "onLine", {
39
- configurable: true,
40
- get: () => true
41
- });
42
- window.dispatchEvent(new Event("online"));
43
- globalExpect(n.online()).toBe(true);
44
- });
45
- it("stops reacting after Symbol.dispose", () => {
46
- let n;
47
- effectScope(() => {
48
- n = createNetworkState();
49
- });
50
- const initial = n.online();
51
- n[Symbol.dispose]();
52
- Object.defineProperty(navigator, "onLine", {
53
- configurable: true,
54
- get: () => !initial
55
- });
56
- window.dispatchEvent(new Event("offline"));
57
- globalExpect(n.online()).toBe(initial);
58
- });
59
- });
60
- //#endregion
61
- export {};
@@ -1,20 +0,0 @@
1
- import { createEventListener } from "./event-listener.mjs";
2
- //#region src/signals/lib/on-click-outside.ts
3
- /**
4
- * Fires `handler` whenever a pointer-down event occurs outside `target`.
5
- *
6
- * Built on a `document` `pointerdown` listener so it works for both mouse and
7
- * touch input. Cleanup is registered automatically when called inside an
8
- * effect or scope.
9
- */
10
- function createOnClickOutside(target, handler) {
11
- const getTarget = typeof target === "function" ? target : () => target;
12
- const listener = (e) => {
13
- const el = getTarget();
14
- if (!el) return;
15
- if (!el.contains(e.target)) handler(e);
16
- };
17
- createEventListener(document, "pointerdown", listener);
18
- }
19
- //#endregion
20
- export { createOnClickOutside };
@@ -1,13 +0,0 @@
1
- import { t as Computed } from "../../index-BtqiEEfc.mjs";
2
-
3
- //#region src/signals/lib/orientation.d.ts
4
- type OrientationResult = {
5
- angle: Computed<number>;
6
- type: Computed<OrientationType>;
7
- } & Disposable;
8
- /**
9
- * Returns reactive signals for the screen orientation.
10
- */
11
- declare function createOrientation(): OrientationResult;
12
- //#endregion
13
- export { createOrientation };
@@ -1,21 +0,0 @@
1
- import { f as signal } from "../../signals-CLAPw8kk.mjs";
2
- import { createEventListener } from "./event-listener.mjs";
3
- //#region src/signals/lib/orientation.ts
4
- /**
5
- * Returns reactive signals for the screen orientation.
6
- */
7
- function createOrientation() {
8
- const angle = signal(screen.orientation?.angle ?? 0);
9
- const type = signal(screen.orientation?.type ?? "portrait-primary");
10
- const onChange = () => {
11
- angle(screen.orientation.angle);
12
- type(screen.orientation.type);
13
- };
14
- const cleanup = createEventListener(screen.orientation, "change", onChange);
15
- return Object.assign({
16
- angle,
17
- type
18
- }, { [Symbol.dispose]: cleanup });
19
- }
20
- //#endregion
21
- export { createOrientation };
@@ -1 +0,0 @@
1
- export { };
@@ -1,43 +0,0 @@
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";
3
- import { createOrientation } from "./orientation.mjs";
4
- //#region src/signals/lib/orientation.test.ts
5
- afterEach(() => {
6
- document.body.innerHTML = "";
7
- vi.unstubAllGlobals();
8
- });
9
- describe("createOrientation", () => {
10
- it("reads initial screen orientation", () => {
11
- const mockOrientation = {
12
- angle: 0,
13
- type: "portrait-primary",
14
- addEventListener: vi.fn(),
15
- removeEventListener: vi.fn()
16
- };
17
- vi.stubGlobal("screen", { orientation: mockOrientation });
18
- let o;
19
- effectScope(() => {
20
- o = createOrientation();
21
- });
22
- globalExpect(o.angle()).toBe(0);
23
- globalExpect(o.type()).toBe("portrait-primary");
24
- });
25
- it("removes event listener on Symbol.dispose", () => {
26
- const removeListener = vi.fn();
27
- const mockOrientation = {
28
- angle: 0,
29
- type: "portrait-primary",
30
- addEventListener: vi.fn(),
31
- removeEventListener: removeListener
32
- };
33
- vi.stubGlobal("screen", { orientation: mockOrientation });
34
- let o;
35
- effectScope(() => {
36
- o = createOrientation();
37
- });
38
- o[Symbol.dispose]();
39
- globalExpect(removeListener).toHaveBeenCalledWith("change", globalExpect.any(Function));
40
- });
41
- });
42
- //#endregion
43
- export {};