@sharadox/web-library 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/LICENSE.md +22 -22
  2. package/README.md +41 -29
  3. package/distribution/assert/never/index.d.ts +13 -0
  4. package/distribution/assert/never/index.d.ts.map +1 -0
  5. package/distribution/assert/never/index.js +15 -0
  6. package/distribution/assert/never/index.js.map +1 -0
  7. package/distribution/class-name/index.d.ts +6 -1
  8. package/distribution/class-name/index.d.ts.map +1 -1
  9. package/distribution/class-name/index.js +6 -1
  10. package/distribution/class-name/index.js.map +1 -1
  11. package/distribution/html/escape/index.d.ts +6 -1
  12. package/distribution/html/escape/index.d.ts.map +1 -1
  13. package/distribution/html/escape/index.js +7 -2
  14. package/distribution/html/escape/index.js.map +1 -1
  15. package/distribution/math/clamp/index.d.ts +6 -1
  16. package/distribution/math/clamp/index.d.ts.map +1 -1
  17. package/distribution/math/clamp/index.js +6 -1
  18. package/distribution/math/clamp/index.js.map +1 -1
  19. package/distribution/math/pseudo-random/index.d.ts +6 -1
  20. package/distribution/math/pseudo-random/index.d.ts.map +1 -1
  21. package/distribution/math/pseudo-random/index.js +6 -1
  22. package/distribution/math/pseudo-random/index.js.map +1 -1
  23. package/distribution/math/radians/index.d.ts +6 -1
  24. package/distribution/math/radians/index.d.ts.map +1 -1
  25. package/distribution/math/radians/index.js +6 -1
  26. package/distribution/math/radians/index.js.map +1 -1
  27. package/distribution/text/separate/index.d.ts +9 -0
  28. package/distribution/text/separate/index.d.ts.map +1 -0
  29. package/distribution/text/separate/index.js +11 -0
  30. package/distribution/text/separate/index.js.map +1 -0
  31. package/distribution/type-guard/is-boolean/index.d.ts +8 -0
  32. package/distribution/type-guard/is-boolean/index.d.ts.map +1 -0
  33. package/distribution/type-guard/is-boolean/index.js +10 -0
  34. package/distribution/type-guard/is-boolean/index.js.map +1 -0
  35. package/distribution/type-guard/is-defined/index.d.ts +8 -0
  36. package/distribution/type-guard/is-defined/index.d.ts.map +1 -0
  37. package/distribution/type-guard/is-defined/index.js +10 -0
  38. package/distribution/type-guard/is-defined/index.js.map +1 -0
  39. package/distribution/type-guard/is-non-empty-string/index.d.ts +8 -0
  40. package/distribution/type-guard/is-non-empty-string/index.d.ts.map +1 -0
  41. package/distribution/type-guard/is-non-empty-string/index.js +11 -0
  42. package/distribution/type-guard/is-non-empty-string/index.js.map +1 -0
  43. package/distribution/type-guard/is-number/index.d.ts +9 -0
  44. package/distribution/type-guard/is-number/index.d.ts.map +1 -0
  45. package/distribution/type-guard/is-number/index.js +11 -0
  46. package/distribution/type-guard/is-number/index.js.map +1 -0
  47. package/distribution/type-guard/is-record/index.d.ts +9 -0
  48. package/distribution/type-guard/is-record/index.d.ts.map +1 -0
  49. package/distribution/type-guard/is-record/index.js +14 -0
  50. package/distribution/type-guard/is-record/index.js.map +1 -0
  51. package/distribution/type-guard/is-string/index.d.ts +9 -0
  52. package/distribution/type-guard/is-string/index.d.ts.map +1 -0
  53. package/distribution/type-guard/is-string/index.js +11 -0
  54. package/distribution/type-guard/is-string/index.js.map +1 -0
  55. package/llms.txt +17 -0
  56. package/package.json +17 -45
  57. package/distribution/animation/count-up/index.d.ts +0 -6
  58. package/distribution/animation/count-up/index.d.ts.map +0 -1
  59. package/distribution/animation/count-up/index.js +0 -29
  60. package/distribution/animation/count-up/index.js.map +0 -1
  61. package/distribution/animation/in-view/index.d.ts +0 -3
  62. package/distribution/animation/in-view/index.d.ts.map +0 -1
  63. package/distribution/animation/in-view/index.js +0 -15
  64. package/distribution/animation/in-view/index.js.map +0 -1
  65. package/distribution/animation/marquee/index.d.ts +0 -9
  66. package/distribution/animation/marquee/index.d.ts.map +0 -1
  67. package/distribution/animation/marquee/index.js +0 -78
  68. package/distribution/animation/marquee/index.js.map +0 -1
  69. package/distribution/animation/marquee/type.d.ts +0 -5
  70. package/distribution/animation/marquee/type.d.ts.map +0 -1
  71. package/distribution/animation/marquee/type.js +0 -2
  72. package/distribution/animation/marquee/type.js.map +0 -1
  73. package/distribution/animation/reveal/index.d.ts +0 -4
  74. package/distribution/animation/reveal/index.d.ts.map +0 -1
  75. package/distribution/animation/reveal/index.js +0 -9
  76. package/distribution/animation/reveal/index.js.map +0 -1
  77. package/distribution/animation/reveal/type.d.ts +0 -14
  78. package/distribution/animation/reveal/type.d.ts.map +0 -1
  79. package/distribution/animation/reveal/type.js +0 -2
  80. package/distribution/animation/reveal/type.js.map +0 -1
  81. package/distribution/animation/scroll-word/index.d.ts +0 -4
  82. package/distribution/animation/scroll-word/index.d.ts.map +0 -1
  83. package/distribution/animation/scroll-word/index.js +0 -16
  84. package/distribution/animation/scroll-word/index.js.map +0 -1
  85. package/distribution/animation/scroll-word/type.d.ts +0 -11
  86. package/distribution/animation/scroll-word/type.d.ts.map +0 -1
  87. package/distribution/animation/scroll-word/type.js +0 -2
  88. package/distribution/animation/scroll-word/type.js.map +0 -1
  89. package/distribution/animation/scroll-word/word/index.d.ts +0 -4
  90. package/distribution/animation/scroll-word/word/index.d.ts.map +0 -1
  91. package/distribution/animation/scroll-word/word/index.js +0 -10
  92. package/distribution/animation/scroll-word/word/index.js.map +0 -1
  93. package/distribution/animation/scroll-word/word/type.d.ts +0 -14
  94. package/distribution/animation/scroll-word/word/type.d.ts.map +0 -1
  95. package/distribution/animation/scroll-word/word/type.js +0 -2
  96. package/distribution/animation/scroll-word/word/type.js.map +0 -1
  97. package/distribution/animation/smooth-scroll/index.d.ts +0 -4
  98. package/distribution/animation/smooth-scroll/index.d.ts.map +0 -1
  99. package/distribution/animation/smooth-scroll/index.js +0 -33
  100. package/distribution/animation/smooth-scroll/index.js.map +0 -1
  101. package/distribution/animation/smooth-scroll/type.d.ts +0 -7
  102. package/distribution/animation/smooth-scroll/type.d.ts.map +0 -1
  103. package/distribution/animation/smooth-scroll/type.js +0 -2
  104. package/distribution/animation/smooth-scroll/type.js.map +0 -1
  105. package/distribution/form/bot-check/index.d.ts +0 -4
  106. package/distribution/form/bot-check/index.d.ts.map +0 -1
  107. package/distribution/form/bot-check/index.js +0 -6
  108. package/distribution/form/bot-check/index.js.map +0 -1
  109. package/distribution/form/bot-check/type.d.ts +0 -11
  110. package/distribution/form/bot-check/type.d.ts.map +0 -1
  111. package/distribution/form/bot-check/type.js +0 -2
  112. package/distribution/form/bot-check/type.js.map +0 -1
  113. package/distribution/form/field/index.d.ts +0 -3
  114. package/distribution/form/field/index.d.ts.map +0 -1
  115. package/distribution/form/field/index.js +0 -7
  116. package/distribution/form/field/index.js.map +0 -1
  117. package/distribution/form/rate-limit/index.d.ts +0 -4
  118. package/distribution/form/rate-limit/index.d.ts.map +0 -1
  119. package/distribution/form/rate-limit/index.js +0 -14
  120. package/distribution/form/rate-limit/index.js.map +0 -1
  121. package/distribution/form/rate-limit/type.d.ts +0 -9
  122. package/distribution/form/rate-limit/type.d.ts.map +0 -1
  123. package/distribution/form/rate-limit/type.js +0 -2
  124. package/distribution/form/rate-limit/type.js.map +0 -1
  125. package/distribution/internationalization/locale/index.d.ts +0 -7
  126. package/distribution/internationalization/locale/index.d.ts.map +0 -1
  127. package/distribution/internationalization/locale/index.js +0 -17
  128. package/distribution/internationalization/locale/index.js.map +0 -1
  129. package/distribution/internationalization/locale/type.d.ts +0 -3
  130. package/distribution/internationalization/locale/type.d.ts.map +0 -1
  131. package/distribution/internationalization/locale/type.js +0 -2
  132. package/distribution/internationalization/locale/type.js.map +0 -1
  133. package/distribution/internationalization/locale-preference/index.d.ts +0 -5
  134. package/distribution/internationalization/locale-preference/index.d.ts.map +0 -1
  135. package/distribution/internationalization/locale-preference/index.js +0 -9
  136. package/distribution/internationalization/locale-preference/index.js.map +0 -1
  137. package/distribution/internationalization/locale-redirect/index.d.ts +0 -8
  138. package/distribution/internationalization/locale-redirect/index.d.ts.map +0 -1
  139. package/distribution/internationalization/locale-redirect/index.js +0 -24
  140. package/distribution/internationalization/locale-redirect/index.js.map +0 -1
  141. package/distribution/internationalization/locale-redirect/type.d.ts +0 -12
  142. package/distribution/internationalization/locale-redirect/type.d.ts.map +0 -1
  143. package/distribution/internationalization/locale-redirect/type.js +0 -2
  144. package/distribution/internationalization/locale-redirect/type.js.map +0 -1
  145. package/distribution/internationalization/translate/index.d.ts +0 -4
  146. package/distribution/internationalization/translate/index.d.ts.map +0 -1
  147. package/distribution/internationalization/translate/index.js +0 -5
  148. package/distribution/internationalization/translate/index.js.map +0 -1
  149. package/distribution/pointer/spotlight/index.d.ts +0 -3
  150. package/distribution/pointer/spotlight/index.d.ts.map +0 -1
  151. package/distribution/pointer/spotlight/index.js +0 -20
  152. package/distribution/pointer/spotlight/index.js.map +0 -1
  153. package/distribution/pointer/tilt/index.d.ts +0 -7
  154. package/distribution/pointer/tilt/index.d.ts.map +0 -1
  155. package/distribution/pointer/tilt/index.js +0 -34
  156. package/distribution/pointer/tilt/index.js.map +0 -1
  157. package/distribution/privacy/consent/index.d.ts +0 -22
  158. package/distribution/privacy/consent/index.d.ts.map +0 -1
  159. package/distribution/privacy/consent/index.js +0 -75
  160. package/distribution/privacy/consent/index.js.map +0 -1
  161. package/distribution/privacy/consent/type.d.ts +0 -35
  162. package/distribution/privacy/consent/type.d.ts.map +0 -1
  163. package/distribution/privacy/consent/type.js +0 -2
  164. package/distribution/privacy/consent/type.js.map +0 -1
  165. package/distribution/privacy/use-consent/index.d.ts +0 -5
  166. package/distribution/privacy/use-consent/index.d.ts.map +0 -1
  167. package/distribution/privacy/use-consent/index.js +0 -22
  168. package/distribution/privacy/use-consent/index.js.map +0 -1
  169. package/distribution/privacy/use-consent/type.d.ts +0 -10
  170. package/distribution/privacy/use-consent/type.d.ts.map +0 -1
  171. package/distribution/privacy/use-consent/type.js +0 -2
  172. package/distribution/privacy/use-consent/type.js.map +0 -1
  173. package/distribution/scroll/active-section/index.d.ts +0 -7
  174. package/distribution/scroll/active-section/index.d.ts.map +0 -1
  175. package/distribution/scroll/active-section/index.js +0 -49
  176. package/distribution/scroll/active-section/index.js.map +0 -1
  177. package/distribution/scroll/active-section/type.d.ts +0 -9
  178. package/distribution/scroll/active-section/type.d.ts.map +0 -1
  179. package/distribution/scroll/active-section/type.js +0 -2
  180. package/distribution/scroll/active-section/type.js.map +0 -1
  181. package/distribution/search-engine/robots/index.d.ts +0 -4
  182. package/distribution/search-engine/robots/index.d.ts.map +0 -1
  183. package/distribution/search-engine/robots/index.js +0 -7
  184. package/distribution/search-engine/robots/index.js.map +0 -1
  185. package/distribution/search-engine/robots/type.d.ts +0 -17
  186. package/distribution/search-engine/robots/type.d.ts.map +0 -1
  187. package/distribution/search-engine/robots/type.js +0 -2
  188. package/distribution/search-engine/robots/type.js.map +0 -1
  189. package/distribution/search-engine/sitemap/index.d.ts +0 -4
  190. package/distribution/search-engine/sitemap/index.d.ts.map +0 -1
  191. package/distribution/search-engine/sitemap/index.js +0 -12
  192. package/distribution/search-engine/sitemap/index.js.map +0 -1
  193. package/distribution/search-engine/sitemap/type.d.ts +0 -22
  194. package/distribution/search-engine/sitemap/type.d.ts.map +0 -1
  195. package/distribution/search-engine/sitemap/type.js +0 -2
  196. package/distribution/search-engine/sitemap/type.js.map +0 -1
  197. package/distribution/search-engine/structured-data/index.d.ts +0 -4
  198. package/distribution/search-engine/structured-data/index.d.ts.map +0 -1
  199. package/distribution/search-engine/structured-data/index.js +0 -6
  200. package/distribution/search-engine/structured-data/index.js.map +0 -1
  201. package/distribution/search-engine/structured-data/type.d.ts +0 -5
  202. package/distribution/search-engine/structured-data/type.d.ts.map +0 -1
  203. package/distribution/search-engine/structured-data/type.js +0 -2
  204. package/distribution/search-engine/structured-data/type.js.map +0 -1
  205. package/distribution/style/apply/index.d.ts +0 -11
  206. package/distribution/style/apply/index.d.ts.map +0 -1
  207. package/distribution/style/apply/index.js +0 -50
  208. package/distribution/style/apply/index.js.map +0 -1
  209. package/distribution/style/apply/type.d.ts +0 -12
  210. package/distribution/style/apply/type.d.ts.map +0 -1
  211. package/distribution/style/apply/type.js +0 -2
  212. package/distribution/style/apply/type.js.map +0 -1
  213. package/distribution/style/definition/index.d.ts +0 -14
  214. package/distribution/style/definition/index.d.ts.map +0 -1
  215. package/distribution/style/definition/index.js +0 -26
  216. package/distribution/style/definition/index.js.map +0 -1
  217. package/distribution/style/definition/type.d.ts +0 -29
  218. package/distribution/style/definition/type.d.ts.map +0 -1
  219. package/distribution/style/definition/type.js +0 -2
  220. package/distribution/style/definition/type.js.map +0 -1
  221. package/distribution/style/style-script/index.d.ts +0 -10
  222. package/distribution/style/style-script/index.d.ts.map +0 -1
  223. package/distribution/style/style-script/index.js +0 -16
  224. package/distribution/style/style-script/index.js.map +0 -1
  225. package/distribution/style/style-script/type.d.ts +0 -5
  226. package/distribution/style/style-script/type.d.ts.map +0 -1
  227. package/distribution/style/style-script/type.js +0 -2
  228. package/distribution/style/style-script/type.js.map +0 -1
  229. package/distribution/style/style-sheet/index.d.ts +0 -8
  230. package/distribution/style/style-sheet/index.d.ts.map +0 -1
  231. package/distribution/style/style-sheet/index.js +0 -25
  232. package/distribution/style/style-sheet/index.js.map +0 -1
  233. package/distribution/style/use-style/index.d.ts +0 -5
  234. package/distribution/style/use-style/index.d.ts.map +0 -1
  235. package/distribution/style/use-style/index.js +0 -37
  236. package/distribution/style/use-style/index.js.map +0 -1
  237. package/distribution/style/use-style/type.d.ts +0 -9
  238. package/distribution/style/use-style/type.d.ts.map +0 -1
  239. package/distribution/style/use-style/type.js +0 -2
  240. package/distribution/style/use-style/type.js.map +0 -1
  241. package/distribution/test/visual-snapshot/index.d.ts +0 -8
  242. package/distribution/test/visual-snapshot/index.d.ts.map +0 -1
  243. package/distribution/test/visual-snapshot/index.js +0 -20
  244. package/distribution/test/visual-snapshot/index.js.map +0 -1
  245. package/distribution/test/visual-snapshot/type.d.ts +0 -7
  246. package/distribution/test/visual-snapshot/type.d.ts.map +0 -1
  247. package/distribution/test/visual-snapshot/type.js +0 -2
  248. package/distribution/test/visual-snapshot/type.js.map +0 -1
  249. package/distribution/time/format-time/index.d.ts +0 -3
  250. package/distribution/time/format-time/index.d.ts.map +0 -1
  251. package/distribution/time/format-time/index.js +0 -5
  252. package/distribution/time/format-time/index.js.map +0 -1
  253. package/distribution/time/open-state/index.d.ts +0 -4
  254. package/distribution/time/open-state/index.d.ts.map +0 -1
  255. package/distribution/time/open-state/index.js +0 -11
  256. package/distribution/time/open-state/index.js.map +0 -1
  257. package/distribution/time/open-state/type.d.ts +0 -5
  258. package/distribution/time/open-state/type.d.ts.map +0 -1
  259. package/distribution/time/open-state/type.js +0 -2
  260. package/distribution/time/open-state/type.js.map +0 -1
  261. package/distribution/time/sun-time/index.d.ts +0 -4
  262. package/distribution/time/sun-time/index.d.ts.map +0 -1
  263. package/distribution/time/sun-time/index.js +0 -27
  264. package/distribution/time/sun-time/index.js.map +0 -1
  265. package/distribution/time/sun-time/type.d.ts +0 -6
  266. package/distribution/time/sun-time/type.d.ts.map +0 -1
  267. package/distribution/time/sun-time/type.js +0 -2
  268. package/distribution/time/sun-time/type.js.map +0 -1
  269. package/distribution/time/sun-today/index.d.ts +0 -4
  270. package/distribution/time/sun-today/index.d.ts.map +0 -1
  271. package/distribution/time/sun-today/index.js +0 -25
  272. package/distribution/time/sun-today/index.js.map +0 -1
  273. package/distribution/time/sun-today/type.d.ts +0 -9
  274. package/distribution/time/sun-today/type.d.ts.map +0 -1
  275. package/distribution/time/sun-today/type.js +0 -2
  276. package/distribution/time/sun-today/type.js.map +0 -1
  277. package/distribution/time/zone-minute/index.d.ts +0 -3
  278. package/distribution/time/zone-minute/index.d.ts.map +0 -1
  279. package/distribution/time/zone-minute/index.js +0 -13
  280. package/distribution/time/zone-minute/index.js.map +0 -1
@@ -1,9 +0,0 @@
1
- export interface StyleState {
2
- /** What the visitor picked: "system" or a style name. */
3
- choice: string;
4
- /** The style in use right now. Before hydration (and on the server) it is the fallback default. */
5
- style: string;
6
- /** Picks a style (or "system"), remembers it and applies it at once. */
7
- choose: (choice: string) => void;
8
- }
9
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/style/use-style/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/style/use-style/type.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import type { Page } from "@playwright/test";
2
- import type { VisualSnapshotOptions } from "@sharadox/web-library/test/visual-snapshot/type";
3
- /**
4
- * Prepares a page for a deterministic full-page screenshot: freezes the clock, opens the url, waits for fonts,
5
- * scrolls through so every reveal-on-scroll fires, then returns to the top and lets animations finish.
6
- */
7
- export declare function prepareVisualSnapshot(page: Page, url: string, { time, step }?: VisualSnapshotOptions): Promise<void>;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/test/visual-snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAE7F;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,EAAE,IAAuC,EAAE,IAAU,EAAE,GAAE,qBAA0B,GAClF,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Prepares a page for a deterministic full-page screenshot: freezes the clock, opens the url, waits for fonts,
3
- * scrolls through so every reveal-on-scroll fires, then returns to the top and lets animations finish.
4
- */
5
- export async function prepareVisualSnapshot(page, url, { time = new Date("2026-11-08T12:00:00Z"), step = 400 } = {}) {
6
- await page.clock.install({ time });
7
- await page.clock.pauseAt(new Date(time.getTime() + 1000));
8
- await page.goto(url);
9
- await page.evaluate(() => document.fonts.ready);
10
- const height = await page.evaluate(() => document.documentElement.scrollHeight);
11
- for (let y = 0; y <= height; y += step) {
12
- await page.evaluate((top) => window.scrollTo(0, top), y);
13
- await page.waitForTimeout(60);
14
- await page.clock.runFor(400);
15
- }
16
- await page.evaluate(() => window.scrollTo(0, 0));
17
- await page.waitForTimeout(60);
18
- await page.clock.runFor(4000);
19
- }
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/test/visual-snapshot/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAU,EACV,GAAW,EACX,EAAE,IAAI,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,EAAE,IAAI,GAAG,GAAG,KAA4B,EAAE;IAEnF,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAChF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QACvC,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
@@ -1,7 +0,0 @@
1
- export interface VisualSnapshotOptions {
2
- /** The moment the page believes it is; animations and timers only move when the test advances the clock. */
3
- time?: Date;
4
- /** Pixels per scroll step while settling. Defaults to 400. */
5
- step?: number;
6
- }
7
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/test/visual-snapshot/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,4GAA4G;IAC5G,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/test/visual-snapshot/type.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- /** "HH:MM" on a 24-hour clock in a time zone, for example "17:28". */
2
- export declare function formatTime(date: Date, timeZone: string): string;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/format-time/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI/D"}
@@ -1,5 +0,0 @@
1
- /** "HH:MM" on a 24-hour clock in a time zone, for example "17:28". */
2
- export function formatTime(date, timeZone) {
3
- return new Intl.DateTimeFormat("en-GB", { timeZone, hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).format(date);
4
- }
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/format-time/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,QAAgB;IACrD,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAChH,IAAI,CACL,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { OpenState, TimeOfDay } from "@sharadox/web-library/time/open-state/type";
2
- /** Whether a place with daily hours `from`–`to` is open at `now`, in the place's time zone. */
3
- export declare function openState(now: Date, from: TimeOfDay, to: TimeOfDay, timeZone: string): OpenState;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/open-state/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAGvF,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAKhG"}
@@ -1,11 +0,0 @@
1
- import { minutesInZone } from "@sharadox/web-library/time/zone-minute";
2
- /** Whether a place with daily hours `from`–`to` is open at `now`, in the place's time zone. */
3
- export function openState(now, from, to, timeZone) {
4
- const minutes = minutesInZone(now, timeZone);
5
- if (minutes < from[0] * 60 + from[1])
6
- return "before";
7
- if (minutes >= to[0] * 60 + to[1])
8
- return "after";
9
- return "open";
10
- }
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/open-state/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,GAAS,EAAE,IAAe,EAAE,EAAa,EAAE,QAAgB;IACnF,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7C,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACtD,IAAI,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,5 +0,0 @@
1
- /** Before opening, open, or after closing — today, in the place's time zone. */
2
- export type OpenState = "open" | "before" | "after";
3
- /** A time of day as [hours, minutes]. */
4
- export type TimeOfDay = readonly [number, number];
5
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/open-state/type.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,yCAAyC;AACzC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/open-state/type.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type { SunTimes } from "@sharadox/web-library/time/sun-time/type";
2
- /** Sunrise and sunset for a date and place (NOAA solar position approximation, ±1–2 minutes). */
3
- export declare function sunTimes(date: Date, latitude: number, longitude: number): SunTimes;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/sun-time/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAIzE,iGAAiG;AACjG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,CA4BlF"}
@@ -1,27 +0,0 @@
1
- const RADIANS_PER_DEGREE = Math.PI / 180;
2
- /** Sunrise and sunset for a date and place (NOAA solar position approximation, ±1–2 minutes). */
3
- export function sunTimes(date, latitude, longitude) {
4
- const year = date.getUTCFullYear();
5
- const midnight = Date.UTC(year, date.getUTCMonth(), date.getUTCDate());
6
- const day = Math.floor((midnight - Date.UTC(year, 0, 0)) / 864e5);
7
- const yearAngle = ((2 * Math.PI) / 365) * (day - 1 + 0.5);
8
- const equationOfTime = 229.18 *
9
- (0.000075 +
10
- 0.001868 * Math.cos(yearAngle) -
11
- 0.032077 * Math.sin(yearAngle) -
12
- 0.014615 * Math.cos(2 * yearAngle) -
13
- 0.040849 * Math.sin(2 * yearAngle));
14
- const declination = 0.006918 -
15
- 0.399912 * Math.cos(yearAngle) +
16
- 0.070257 * Math.sin(yearAngle) -
17
- 0.006758 * Math.cos(2 * yearAngle) +
18
- 0.000907 * Math.sin(2 * yearAngle) -
19
- 0.002697 * Math.cos(3 * yearAngle) +
20
- 0.00148 * Math.sin(3 * yearAngle);
21
- const hourAngle = Math.acos(Math.cos(90.833 * RADIANS_PER_DEGREE) / (Math.cos(latitude * RADIANS_PER_DEGREE) * Math.cos(declination)) -
22
- Math.tan(latitude * RADIANS_PER_DEGREE) * Math.tan(declination)) / RADIANS_PER_DEGREE;
23
- const riseMinutes = 720 - 4 * (longitude + hourAngle) - equationOfTime;
24
- const setMinutes = 720 - 4 * (longitude - hourAngle) - equationOfTime;
25
- return { rise: new Date(midnight + riseMinutes * 6e4), set: new Date(midnight + setMinutes * 6e4) };
26
- }
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/sun-time/index.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEzC,iGAAiG;AACjG,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,QAAgB,EAAE,SAAiB;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAC1D,MAAM,cAAc,GAClB,MAAM;QACN,CAAC,QAAQ;YACP,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAC9B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAC9B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;YAClC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IACxC,MAAM,WAAW,GACf,QAAQ;QACR,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;QAC9B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;QAC9B,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;QAClC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;QAClC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;QAClC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACpC,MAAM,SAAS,GACb,IAAI,CAAC,IAAI,CACP,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,kBAAkB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACvG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,kBAAkB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAClE,GAAG,kBAAkB,CAAC;IACzB,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACvE,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,cAAc,CAAC;IACtE,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,QAAQ,GAAG,WAAW,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,GAAG,CAAC,EAAE,CAAC;AACtG,CAAC"}
@@ -1,6 +0,0 @@
1
- /** Sunrise and sunset as real instants, so they can be formatted in any timezone. */
2
- export interface SunTimes {
3
- rise: Date;
4
- set: Date;
5
- }
6
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/sun-time/type.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,IAAI,CAAC;CACX"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/sun-time/type.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import type { SunToday } from "@sharadox/web-library/time/sun-today/type";
2
- /** Today's sunrise and sunset at a place (tomorrow's once the sun has set), refreshed every minute. Null until mounted. */
3
- export declare function useSunToday(latitude: number, longitude: number): SunToday | null;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/sun-today/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAE1E,2HAA2H;AAC3H,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAkB9D"}
@@ -1,25 +0,0 @@
1
- "use client";
2
- import { useEffect, useState } from "react";
3
- import { sunTimes } from "@sharadox/web-library/time/sun-time";
4
- /** Today's sunrise and sunset at a place (tomorrow's once the sun has set), refreshed every minute. Null until mounted. */
5
- export function useSunToday(latitude, longitude) {
6
- const [sun, setSun] = useState(null);
7
- useEffect(() => {
8
- const tick = () => {
9
- const now = new Date();
10
- let times = sunTimes(now, latitude, longitude);
11
- const tomorrow = now > times.set;
12
- if (tomorrow)
13
- times = sunTimes(new Date(now.getTime() + 864e5), latitude, longitude);
14
- setSun({ ...times, now, tomorrow });
15
- };
16
- const first = setTimeout(tick, 0);
17
- const timer = setInterval(tick, 60_000);
18
- return () => {
19
- clearTimeout(first);
20
- clearInterval(timer);
21
- };
22
- }, [latitude, longitude]);
23
- return sun;
24
- }
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/sun-today/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAG/D,2HAA2H;AAC3H,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,SAAiB;IAC7D,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;YACjC,IAAI,QAAQ;gBAAE,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YACrF,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,9 +0,0 @@
1
- /** Sun times for the relevant evening, plus the moment they were computed for. */
2
- export interface SunToday {
3
- rise: Date;
4
- set: Date;
5
- now: Date;
6
- /** After today's sunset these are tomorrow's times. */
7
- tomorrow: boolean;
8
- }
9
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/time/sun-today/type.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,IAAI,CAAC;IACV,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/sun-today/type.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- /** Minutes since midnight in a time zone for an instant, whatever the visitor's own time zone. */
2
- export declare function minutesInZone(date: Date, timeZone: string): number;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/time/zone-minute/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUlE"}
@@ -1,13 +0,0 @@
1
- /** Minutes since midnight in a time zone for an instant, whatever the visitor's own time zone. */
2
- export function minutesInZone(date, timeZone) {
3
- const parts = new Intl.DateTimeFormat("en-GB", {
4
- timeZone,
5
- hour: "2-digit",
6
- minute: "2-digit",
7
- hourCycle: "h23",
8
- }).formatToParts(date);
9
- const hours = Number(parts.find((part) => part.type === "hour")?.value ?? 0);
10
- const minutes = Number(parts.find((part) => part.type === "minute")?.value ?? 0);
11
- return hours * 60 + minutes;
12
- }
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/time/zone-minute/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,QAAgB;IACxD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC7C,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IACjF,OAAO,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC;AAC9B,CAAC"}