@sharadox/web-library 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/LICENCA.md +76 -0
  2. package/LICENSE.md +76 -0
  3. package/NOTICE.md +3 -0
  4. package/README.md +34 -2
  5. package/distribution/animation/in-view/index.d.ts +3 -0
  6. package/distribution/animation/in-view/index.d.ts.map +1 -0
  7. package/distribution/animation/in-view/index.js +15 -0
  8. package/distribution/animation/in-view/index.js.map +1 -0
  9. package/distribution/animation/reveal/index.d.ts +4 -0
  10. package/distribution/animation/reveal/index.d.ts.map +1 -0
  11. package/distribution/animation/reveal/index.js +9 -0
  12. package/distribution/animation/reveal/index.js.map +1 -0
  13. package/distribution/animation/reveal/type.d.ts +14 -0
  14. package/distribution/animation/reveal/type.d.ts.map +1 -0
  15. package/distribution/animation/reveal/type.js +2 -0
  16. package/distribution/animation/reveal/type.js.map +1 -0
  17. package/distribution/animation/scroll-word/index.d.ts +4 -0
  18. package/distribution/animation/scroll-word/index.d.ts.map +1 -0
  19. package/distribution/animation/scroll-word/index.js +16 -0
  20. package/distribution/animation/scroll-word/index.js.map +1 -0
  21. package/distribution/animation/scroll-word/type.d.ts +11 -0
  22. package/distribution/animation/scroll-word/type.d.ts.map +1 -0
  23. package/distribution/animation/scroll-word/type.js +2 -0
  24. package/distribution/animation/scroll-word/type.js.map +1 -0
  25. package/distribution/animation/scroll-word/word/index.d.ts +4 -0
  26. package/distribution/animation/scroll-word/word/index.d.ts.map +1 -0
  27. package/distribution/animation/scroll-word/word/index.js +10 -0
  28. package/distribution/animation/scroll-word/word/index.js.map +1 -0
  29. package/distribution/animation/scroll-word/word/type.d.ts +14 -0
  30. package/distribution/animation/scroll-word/word/type.d.ts.map +1 -0
  31. package/distribution/animation/scroll-word/word/type.js +2 -0
  32. package/distribution/animation/scroll-word/word/type.js.map +1 -0
  33. package/distribution/animation/smooth-scroll/index.d.ts +4 -0
  34. package/distribution/animation/smooth-scroll/index.d.ts.map +1 -0
  35. package/distribution/animation/smooth-scroll/index.js +33 -0
  36. package/distribution/animation/smooth-scroll/index.js.map +1 -0
  37. package/distribution/animation/smooth-scroll/type.d.ts +7 -0
  38. package/distribution/animation/smooth-scroll/type.d.ts.map +1 -0
  39. package/distribution/animation/smooth-scroll/type.js +2 -0
  40. package/distribution/animation/smooth-scroll/type.js.map +1 -0
  41. package/distribution/class-name/index.d.ts +3 -0
  42. package/distribution/class-name/index.d.ts.map +1 -0
  43. package/distribution/class-name/index.js +5 -0
  44. package/distribution/class-name/index.js.map +1 -0
  45. package/distribution/form/bot-check/index.d.ts +4 -0
  46. package/distribution/form/bot-check/index.d.ts.map +1 -0
  47. package/distribution/form/bot-check/index.js +6 -0
  48. package/distribution/form/bot-check/index.js.map +1 -0
  49. package/distribution/form/bot-check/type.d.ts +11 -0
  50. package/distribution/form/bot-check/type.d.ts.map +1 -0
  51. package/distribution/form/bot-check/type.js +2 -0
  52. package/distribution/form/bot-check/type.js.map +1 -0
  53. package/distribution/form/field/index.d.ts +3 -0
  54. package/distribution/form/field/index.d.ts.map +1 -0
  55. package/distribution/form/field/index.js +7 -0
  56. package/distribution/form/field/index.js.map +1 -0
  57. package/distribution/form/rate-limit/index.d.ts +4 -0
  58. package/distribution/form/rate-limit/index.d.ts.map +1 -0
  59. package/distribution/form/rate-limit/index.js +14 -0
  60. package/distribution/form/rate-limit/index.js.map +1 -0
  61. package/distribution/form/rate-limit/type.d.ts +9 -0
  62. package/distribution/form/rate-limit/type.d.ts.map +1 -0
  63. package/distribution/form/rate-limit/type.js +2 -0
  64. package/distribution/form/rate-limit/type.js.map +1 -0
  65. package/distribution/html/escape/index.d.ts +3 -0
  66. package/distribution/html/escape/index.d.ts.map +1 -0
  67. package/distribution/html/escape/index.js +6 -0
  68. package/distribution/html/escape/index.js.map +1 -0
  69. package/distribution/internationalization/locale/index.d.ts +7 -0
  70. package/distribution/internationalization/locale/index.d.ts.map +1 -0
  71. package/distribution/internationalization/locale/index.js +17 -0
  72. package/distribution/internationalization/locale/index.js.map +1 -0
  73. package/distribution/internationalization/locale/type.d.ts +3 -0
  74. package/distribution/internationalization/locale/type.d.ts.map +1 -0
  75. package/distribution/internationalization/locale/type.js +2 -0
  76. package/distribution/internationalization/locale/type.js.map +1 -0
  77. package/distribution/internationalization/locale-redirect/index.d.ts +7 -0
  78. package/distribution/internationalization/locale-redirect/index.d.ts.map +1 -0
  79. package/distribution/internationalization/locale-redirect/index.js +16 -0
  80. package/distribution/internationalization/locale-redirect/index.js.map +1 -0
  81. package/distribution/internationalization/locale-redirect/type.d.ts +12 -0
  82. package/distribution/internationalization/locale-redirect/type.d.ts.map +1 -0
  83. package/distribution/internationalization/locale-redirect/type.js +2 -0
  84. package/distribution/internationalization/locale-redirect/type.js.map +1 -0
  85. package/distribution/internationalization/translate/index.d.ts +4 -0
  86. package/distribution/internationalization/translate/index.d.ts.map +1 -0
  87. package/distribution/internationalization/translate/index.js +5 -0
  88. package/distribution/internationalization/translate/index.js.map +1 -0
  89. package/distribution/math/clamp/index.d.ts +3 -0
  90. package/distribution/math/clamp/index.d.ts.map +1 -0
  91. package/distribution/math/clamp/index.js +5 -0
  92. package/distribution/math/clamp/index.js.map +1 -0
  93. package/distribution/math/pseudo-random/index.d.ts +3 -0
  94. package/distribution/math/pseudo-random/index.d.ts.map +1 -0
  95. package/distribution/math/pseudo-random/index.js +6 -0
  96. package/distribution/math/pseudo-random/index.js.map +1 -0
  97. package/distribution/math/radians/index.d.ts +3 -0
  98. package/distribution/math/radians/index.d.ts.map +1 -0
  99. package/distribution/math/radians/index.js +5 -0
  100. package/distribution/math/radians/index.js.map +1 -0
  101. package/distribution/pointer/spotlight/index.d.ts +3 -0
  102. package/distribution/pointer/spotlight/index.d.ts.map +1 -0
  103. package/distribution/pointer/spotlight/index.js +20 -0
  104. package/distribution/pointer/spotlight/index.js.map +1 -0
  105. package/distribution/search-engine/robots/index.d.ts +4 -0
  106. package/distribution/search-engine/robots/index.d.ts.map +1 -0
  107. package/distribution/search-engine/robots/index.js +7 -0
  108. package/distribution/search-engine/robots/index.js.map +1 -0
  109. package/distribution/search-engine/robots/type.d.ts +17 -0
  110. package/distribution/search-engine/robots/type.d.ts.map +1 -0
  111. package/distribution/search-engine/robots/type.js +2 -0
  112. package/distribution/search-engine/robots/type.js.map +1 -0
  113. package/distribution/search-engine/sitemap/index.d.ts +4 -0
  114. package/distribution/search-engine/sitemap/index.d.ts.map +1 -0
  115. package/distribution/search-engine/sitemap/index.js +12 -0
  116. package/distribution/search-engine/sitemap/index.js.map +1 -0
  117. package/distribution/search-engine/sitemap/type.d.ts +22 -0
  118. package/distribution/search-engine/sitemap/type.d.ts.map +1 -0
  119. package/distribution/search-engine/sitemap/type.js +2 -0
  120. package/distribution/search-engine/sitemap/type.js.map +1 -0
  121. package/distribution/search-engine/structured-data/index.d.ts +4 -0
  122. package/distribution/search-engine/structured-data/index.d.ts.map +1 -0
  123. package/distribution/search-engine/structured-data/index.js +6 -0
  124. package/distribution/search-engine/structured-data/index.js.map +1 -0
  125. package/distribution/search-engine/structured-data/type.d.ts +5 -0
  126. package/distribution/search-engine/structured-data/type.d.ts.map +1 -0
  127. package/distribution/search-engine/structured-data/type.js +2 -0
  128. package/distribution/search-engine/structured-data/type.js.map +1 -0
  129. package/distribution/test/visual-snapshot/index.d.ts +8 -0
  130. package/distribution/test/visual-snapshot/index.d.ts.map +1 -0
  131. package/distribution/test/visual-snapshot/index.js +20 -0
  132. package/distribution/test/visual-snapshot/index.js.map +1 -0
  133. package/distribution/test/visual-snapshot/type.d.ts +7 -0
  134. package/distribution/test/visual-snapshot/type.d.ts.map +1 -0
  135. package/distribution/test/visual-snapshot/type.js +2 -0
  136. package/distribution/test/visual-snapshot/type.js.map +1 -0
  137. package/distribution/time/format-time/index.d.ts +3 -0
  138. package/distribution/time/format-time/index.d.ts.map +1 -0
  139. package/distribution/time/format-time/index.js +5 -0
  140. package/distribution/time/format-time/index.js.map +1 -0
  141. package/distribution/time/open-state/index.d.ts +4 -0
  142. package/distribution/time/open-state/index.d.ts.map +1 -0
  143. package/distribution/time/open-state/index.js +11 -0
  144. package/distribution/time/open-state/index.js.map +1 -0
  145. package/distribution/time/open-state/type.d.ts +5 -0
  146. package/distribution/time/open-state/type.d.ts.map +1 -0
  147. package/distribution/time/open-state/type.js +2 -0
  148. package/distribution/time/open-state/type.js.map +1 -0
  149. package/distribution/time/sun-time/index.d.ts +4 -0
  150. package/distribution/time/sun-time/index.d.ts.map +1 -0
  151. package/distribution/time/sun-time/index.js +27 -0
  152. package/distribution/time/sun-time/index.js.map +1 -0
  153. package/distribution/time/sun-time/type.d.ts +6 -0
  154. package/distribution/time/sun-time/type.d.ts.map +1 -0
  155. package/distribution/time/sun-time/type.js +2 -0
  156. package/distribution/time/sun-time/type.js.map +1 -0
  157. package/distribution/time/sun-today/index.d.ts +4 -0
  158. package/distribution/time/sun-today/index.d.ts.map +1 -0
  159. package/distribution/time/sun-today/index.js +25 -0
  160. package/distribution/time/sun-today/index.js.map +1 -0
  161. package/distribution/time/sun-today/type.d.ts +9 -0
  162. package/distribution/time/sun-today/type.d.ts.map +1 -0
  163. package/distribution/time/sun-today/type.js +2 -0
  164. package/distribution/time/sun-today/type.js.map +1 -0
  165. package/distribution/time/zone-minute/index.d.ts +3 -0
  166. package/distribution/time/zone-minute/index.d.ts.map +1 -0
  167. package/distribution/time/zone-minute/index.js +13 -0
  168. package/distribution/time/zone-minute/index.js.map +1 -0
  169. package/package.json +99 -3
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/form/rate-limit/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** Escapes text for safe use inside html (for example in email bodies). */
2
+ export declare function escapeHtml(text: string): string;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,6 @@
1
+ const ENTITIES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
2
+ /** Escapes text for safe use inside html (for example in email bodies). */
3
+ export function escapeHtml(text) {
4
+ return text.replace(/[&<>"']/g, (character) => ENTITIES[character] ?? character);
5
+ }
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAEjH,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Narrows an untrusted value (a route segment, a form field) to one of the published locales. */
2
+ export declare function isLocale<Locale extends string>(value: string, locales: readonly Locale[]): value is Locale;
3
+ /** The BCP 47 tag for `<html lang>`: European Portuguese is `pt-PT`; other languages keep their code. */
4
+ export declare function languageTag(locale: string): string;
5
+ /** The Open Graph locale (`og:locale`), for example `pt_PT` or `en_GB`. */
6
+ export declare function openGraphLocale(locale: string): string;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale/index.ts"],"names":[],"mappings":"AAKA,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,IAAI,MAAM,CAE1G;AAED,yGAAyG;AACzG,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -0,0 +1,17 @@
1
+ /** Language tags for `<html lang>` and structured data's `inLanguage`, where the region matters. */
2
+ const LANGUAGE_TAG = { pt: "pt-PT", en: "en" };
3
+ /** Open Graph locales (`og:locale`). */
4
+ const OPEN_GRAPH_LOCALE = { pt: "pt_PT", en: "en_GB", es: "es_ES", fr: "fr_FR", de: "de_DE" };
5
+ /** Narrows an untrusted value (a route segment, a form field) to one of the published locales. */
6
+ export function isLocale(value, locales) {
7
+ return locales.includes(value);
8
+ }
9
+ /** The BCP 47 tag for `<html lang>`: European Portuguese is `pt-PT`; other languages keep their code. */
10
+ export function languageTag(locale) {
11
+ return LANGUAGE_TAG[locale] ?? locale;
12
+ }
13
+ /** The Open Graph locale (`og:locale`), for example `pt_PT` or `en_GB`. */
14
+ export function openGraphLocale(locale) {
15
+ return OPEN_GRAPH_LOCALE[locale] ?? locale;
16
+ }
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/locale/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,YAAY,GAA2B,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACvE,wCAAwC;AACxC,MAAM,iBAAiB,GAA2B,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AAEtH,kGAAkG;AAClG,MAAM,UAAU,QAAQ,CAAwB,KAAa,EAAE,OAA0B;IACvF,OAAQ,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;AACxC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** A piece of copy written in every published language, for example `{ en: "Hello", pt: "Olá" }`. */
2
+ export type Translated<Locale extends string = string> = Record<Locale, string>;
3
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale/type.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/internationalization/locale/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { LocaleRedirect } from "@sharadox/web-library/internationalization/locale-redirect/type";
2
+ /**
3
+ * Redirects for next.config `redirects()`: `/` goes to the visitor's language when their browser asks for one of
4
+ * the published locales first (Accept-Language), otherwise to `/<defaultLocale>`.
5
+ */
6
+ export declare function localeRedirects(locales: readonly string[], defaultLocale: string): LocaleRedirect[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iEAAiE,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,cAAc,EAAE,CAUnG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Redirects for next.config `redirects()`: `/` goes to the visitor's language when their browser asks for one of
3
+ * the published locales first (Accept-Language), otherwise to `/<defaultLocale>`.
4
+ */
5
+ export function localeRedirects(locales, defaultLocale) {
6
+ const preferred = locales
7
+ .filter((locale) => locale !== defaultLocale)
8
+ .map((locale) => ({
9
+ source: "/",
10
+ has: [{ type: "header", key: "accept-language", value: `${locale}.*` }],
11
+ destination: `/${locale}`,
12
+ permanent: false,
13
+ }));
14
+ return [...preferred, { source: "/", destination: `/${defaultLocale}`, permanent: false }];
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAA0B,EAAE,aAAqB;IAC/E,MAAM,SAAS,GAAqB,OAAO;SACxC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC;SAC5C,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChB,MAAM,EAAE,GAAG;QACX,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACvE,WAAW,EAAE,IAAI,MAAM,EAAE;QACzB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,CAAC;IACN,OAAO,CAAC,GAAG,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,aAAa,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** One Next.js redirect, as returned from `redirects()` in next.config. */
2
+ export interface LocaleRedirect {
3
+ source: string;
4
+ destination: string;
5
+ permanent: false;
6
+ has?: {
7
+ type: "header";
8
+ key: string;
9
+ value: string;
10
+ }[];
11
+ }
12
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/type.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;IACjB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/internationalization/locale-redirect/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { Translated } from "@sharadox/web-library/internationalization/locale/type";
2
+ /** Picks the copy for a locale. */
3
+ export declare function translate<Locale extends string>(value: Translated<Locale>, locale: NoInfer<Locale>): string;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/internationalization/translate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;AAEzF,mCAAmC;AACnC,wBAAgB,SAAS,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAE3G"}
@@ -0,0 +1,5 @@
1
+ /** Picks the copy for a locale. */
2
+ export function translate(value, locale) {
3
+ return value[locale];
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/internationalization/translate/index.ts"],"names":[],"mappings":"AAEA,mCAAmC;AACnC,MAAM,UAAU,SAAS,CAAwB,KAAyB,EAAE,MAAuB;IACjG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Keeps a value between a minimum and a maximum. */
2
+ export declare function clamp(value: number, minimum: number, maximum: number): number;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7E"}
@@ -0,0 +1,5 @@
1
+ /** Keeps a value between a minimum and a maximum. */
2
+ export function clamp(value, minimum, maximum) {
3
+ return Math.min(maximum, Math.max(minimum, value));
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** A deterministic number in [0, 1) for a seed: the same seed always gives the same value (stable renders). */
2
+ export declare function pseudoRandom(seed: number): number;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"}
@@ -0,0 +1,6 @@
1
+ /** A deterministic number in [0, 1) for a seed: the same seed always gives the same value (stable renders). */
2
+ export function pseudoRandom(seed) {
3
+ const value = Math.sin(seed * 12.9898) * 43758.5453;
4
+ return value - Math.floor(value);
5
+ }
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,UAAU,CAAC;IACpD,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Degrees to radians. */
2
+ export declare function radians(degrees: number): number;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,5 @@
1
+ /** Degrees to radians. */
2
+ export function radians(degrees) {
3
+ return (degrees * Math.PI) / 180;
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Tracks the pointer inside an element as `--pointer-x`/`--pointer-y`, for lights that follow the cursor. */
2
+ export declare function useSpotlight<Target extends HTMLElement>(): import("react").RefObject<Target | null>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/pointer/spotlight/index.ts"],"names":[],"mappings":"AAGA,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,MAAM,SAAS,WAAW,8CActD"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ /** Tracks the pointer inside an element as `--pointer-x`/`--pointer-y`, for lights that follow the cursor. */
4
+ export function useSpotlight() {
5
+ const reference = useRef(null);
6
+ useEffect(() => {
7
+ const element = reference.current;
8
+ if (!element)
9
+ return;
10
+ const move = (event) => {
11
+ const bounds = element.getBoundingClientRect();
12
+ element.style.setProperty("--pointer-x", `${event.clientX - bounds.left}px`);
13
+ element.style.setProperty("--pointer-y", `${event.clientY - bounds.top}px`);
14
+ };
15
+ element.addEventListener("pointermove", move);
16
+ return () => element.removeEventListener("pointermove", move);
17
+ }, []);
18
+ return reference;
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/pointer/spotlight/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,8GAA8G;AAC9G,MAAM,UAAU,YAAY;IAC1B,MAAM,SAAS,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,MAAM,IAAI,GAAG,CAAC,KAAmB,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;YAC7E,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9E,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RobotsOptions, RobotsRules } from "@sharadox/web-library/search-engine/robots/type";
2
+ /** robots.txt rules: everything allowed with the sitemap and host, or everything disallowed while not indexable. */
3
+ export declare function robots({ url, indexable }: RobotsOptions): RobotsRules;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/robots/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAElG,oHAAoH;AACpH,wBAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAa,GAAG,WAAW,CAIrE"}
@@ -0,0 +1,7 @@
1
+ /** robots.txt rules: everything allowed with the sitemap and host, or everything disallowed while not indexable. */
2
+ export function robots({ url, indexable }) {
3
+ return indexable
4
+ ? { rules: { userAgent: "*", allow: "/" }, sitemap: `${url}/sitemap.xml`, host: url }
5
+ : { rules: { userAgent: "*", disallow: "/" } };
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/robots/index.ts"],"names":[],"mappings":"AAEA,oHAAoH;AACpH,MAAM,UAAU,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAiB;IACtD,OAAO,SAAS;QACd,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,GAAG,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;QACrF,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface RobotsOptions {
2
+ /** The site's public url without a trailing slash. */
3
+ url: string;
4
+ /** False keeps the whole site out of search engines (previews before a client launches). */
5
+ indexable: boolean;
6
+ }
7
+ /** The rules Next.js's `robots()` returns. */
8
+ export interface RobotsRules {
9
+ rules: {
10
+ userAgent: string;
11
+ allow?: string;
12
+ disallow?: string;
13
+ };
14
+ sitemap?: string;
15
+ host?: string;
16
+ }
17
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/robots/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,4FAA4F;IAC5F,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/robots/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { LocalizedSitemapOptions, SitemapEntry } from "@sharadox/web-library/search-engine/sitemap/type";
2
+ /** A sitemap with one entry per locale (`/<locale>`), each listing every language version as an alternate. */
3
+ export declare function localizedSitemap({ url, locales, primaryLocale, otherPriority, changeFrequency, lastModified, }: LocalizedSitemapOptions): SitemapEntry[];
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAE9G,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,aAA0B,EAC1B,aAAiB,EACjB,eAA2B,EAC3B,YAAyB,GAC1B,EAAE,uBAAuB,GAAG,YAAY,EAAE,CAS1C"}
@@ -0,0 +1,12 @@
1
+ /** A sitemap with one entry per locale (`/<locale>`), each listing every language version as an alternate. */
2
+ export function localizedSitemap({ url, locales, primaryLocale = locales[0], otherPriority = 1, changeFrequency = "monthly", lastModified = new Date(), }) {
3
+ const languages = Object.fromEntries(locales.map((locale) => [locale, `${url}/${locale}`]));
4
+ return locales.map((locale) => ({
5
+ url: `${url}/${locale}`,
6
+ lastModified,
7
+ changeFrequency,
8
+ priority: locale === primaryLocale ? 1 : otherPriority,
9
+ alternates: { languages },
10
+ }));
11
+ }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/sitemap/index.ts"],"names":[],"mappings":"AAEA,8GAA8G;AAC9G,MAAM,UAAU,gBAAgB,CAAC,EAC/B,GAAG,EACH,OAAO,EACP,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,EAC1B,aAAa,GAAG,CAAC,EACjB,eAAe,GAAG,SAAS,EAC3B,YAAY,GAAG,IAAI,IAAI,EAAE,GACD;IACxB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,GAAG,GAAG,IAAI,MAAM,EAAE;QACvB,YAAY;QACZ,eAAe;QACf,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;QACtD,UAAU,EAAE,EAAE,SAAS,EAAE;KAC1B,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,22 @@
1
+ export interface LocalizedSitemapOptions {
2
+ /** The site's public url without a trailing slash, for example "https://sharadox.com". */
3
+ url: string;
4
+ locales: readonly string[];
5
+ /** Gets priority 1; the other locales get `otherPriority`. Defaults to the first locale. */
6
+ primaryLocale?: string;
7
+ otherPriority?: number;
8
+ changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
9
+ /** Defaults to now. */
10
+ lastModified?: Date;
11
+ }
12
+ /** One sitemap entry, in the shape Next.js's `sitemap()` returns. */
13
+ export interface SitemapEntry {
14
+ url: string;
15
+ lastModified: Date;
16
+ changeFrequency: NonNullable<LocalizedSitemapOptions["changeFrequency"]>;
17
+ priority: number;
18
+ alternates: {
19
+ languages: Record<string, string>;
20
+ };
21
+ }
22
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/sitemap/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,0FAA0F;IAC1F,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5F,uBAAuB;IACvB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,IAAI,CAAC;IACnB,eAAe,EAAE,WAAW,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/sitemap/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { StructuredDataProperties } from "@sharadox/web-library/search-engine/structured-data/type";
2
+ /** Renders JSON-LD for search engines. `<` is escaped so the data can never close the script tag early. */
3
+ export declare function StructuredData({ data }: StructuredDataProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/search-engine/structured-data/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AAEzG,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,+BAOhE"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Renders JSON-LD for search engines. `<` is escaped so the data can never close the script tag early. */
3
+ export function StructuredData({ data }) {
4
+ return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(data).replace(/</g, "\\u003c") } }));
5
+ }
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/search-engine/structured-data/index.tsx"],"names":[],"mappings":";AAEA,2GAA2G;AAC3G,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAA4B;IAC/D,OAAO,CACL,iBACE,IAAI,EAAC,qBAAqB,EAC1B,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAClF,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface StructuredDataProperties {
2
+ /** A schema.org JSON-LD object, for example `{ "@context": "https://schema.org", "@type": "Restaurant", … }`. */
3
+ data: Record<string, unknown>;
4
+ }
5
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/search-engine/structured-data/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,iHAAiH;IACjH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/search-engine/structured-data/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,7 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/test/visual-snapshot/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,4 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/time/open-state/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,27 @@
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