@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
package/LICENCA.md ADDED
@@ -0,0 +1,76 @@
1
+ # Licença Sharadox de Código Aberto
2
+
3
+ Versão 0.1.0
4
+
5
+ O texto em língua portuguesa é o único texto original e vinculativo desta licença. A tradução para inglês (`LICENSE.md`) é meramente informativa; em caso de divergência prevalece o texto em português.
6
+
7
+ ## 1. Definições
8
+
9
+ Para efeitos desta licença:
10
+
11
+ 1. **«Obra»** — o programa de computador, a sua documentação e quaisquer outros conteúdos disponibilizados pelo Licenciante ao abrigo desta licença, em código-fonte ou em qualquer outra forma.
12
+ 2. **«Licenciante»** — o titular dos direitos de autor identificado no aviso de direitos de autor que acompanha a Obra.
13
+ 3. **«Licenciado»** — qualquer pessoa, singular ou coletiva, que exerça os direitos concedidos por esta licença.
14
+ 4. **«Obra Derivada»** — qualquer obra baseada na Obra ou que a incorpore, total ou parcialmente, com ou sem modificações, incluindo traduções, adaptações e programas que a integrem.
15
+ 5. **«Aviso»** — o aviso de direitos de autor do Licenciante e a indicação de que a Obra está licenciada ao abrigo desta licença, incluindo a respetiva versão.
16
+
17
+ ## 2. Concessão de direitos
18
+
19
+ 1. Nos termos desta licença, o Licenciante concede ao Licenciado uma licença mundial, gratuita, não exclusiva e por todo o prazo de proteção dos direitos de autor para:
20
+ 1. utilizar a Obra para qualquer finalidade, incluindo finalidades comerciais;
21
+ 2. reproduzir a Obra, total ou parcialmente, por qualquer meio e sob qualquer forma;
22
+ 3. modificar, traduzir, adaptar e transformar a Obra e criar Obras Derivadas;
23
+ 4. distribuir, publicar, comunicar ao público, colocar à disposição, vender e sublicenciar a Obra e as Obras Derivadas.
24
+ 2. Na medida em que o Licenciante seja titular de patentes necessariamente infringidas pela Obra tal como por si disponibilizada, concede igualmente ao Licenciado, nos mesmos termos, uma licença para utilizar essas patentes no exercício dos direitos previstos no número anterior.
25
+ 3. Esta licença não transmite a titularidade de quaisquer direitos, que permanecem do Licenciante.
26
+
27
+ ## 3. Condições
28
+
29
+ O exercício dos direitos concedidos fica sujeito às seguintes condições:
30
+
31
+ 1. Todas as cópias da Obra, ou de partes substanciais da mesma, e todas as Obras Derivadas distribuídas devem incluir o Aviso e uma cópia desta licença ou uma ligação estável para o seu texto.
32
+ 2. Quem distribuir uma versão modificada da Obra deve indicar de forma visível que a mesma foi modificada, não podendo apresentá-la como versão original do Licenciante.
33
+ 3. O Licenciado pode licenciar as suas próprias modificações ao abrigo de outros termos, desde que a parte da Obra que delas faça parte continue sujeita às condições desta licença.
34
+
35
+ ## 4. Nomes e marcas
36
+
37
+ Esta licença não concede qualquer direito sobre o nome, as marcas, os logótipos ou outros sinais distintivos do Licenciante, incluindo a designação «Sharadox», salvo na medida estritamente necessária para cumprir o dever de incluir o Aviso. É proibido utilizá-los para promover ou sugerir o apoio do Licenciante a Obras Derivadas ou a quaisquer produtos ou serviços sem autorização prévia e escrita.
38
+
39
+ ## 5. Exclusão de garantias
40
+
41
+ A Obra é disponibilizada «tal como está» e «conforme disponível», sem qualquer garantia, expressa ou tácita, incluindo, designadamente, garantias de comerciabilidade, de adequação a um fim específico, de ausência de erros ou de não violação de direitos de terceiros, na medida máxima permitida pela lei aplicável.
42
+
43
+ ## 6. Limitação de responsabilidade
44
+
45
+ 1. Na medida máxima permitida pela lei aplicável, o Licenciante não é responsável por quaisquer danos, diretos ou indiretos, incluindo lucros cessantes, perda de dados ou interrupção de atividade, resultantes da utilização ou da impossibilidade de utilização da Obra, ainda que tenha sido avisado da possibilidade da sua ocorrência.
46
+ 2. Nada nesta licença exclui ou limita a responsabilidade do Licenciante nos casos em que tal exclusão ou limitação não seja permitida por lei, designadamente por atos praticados com dolo ou culpa grave, nos termos do artigo 809.º e do n.º 2 do artigo 800.º do Código Civil, nem afeta os direitos que a lei imperativamente reconheça aos consumidores.
47
+
48
+ ## 7. Cessação
49
+
50
+ 1. Os direitos concedidos por esta licença cessam automaticamente se o Licenciado violar qualquer das suas condições.
51
+ 2. Os direitos são repostos se a violação for sanada no prazo de 30 dias a contar do momento em que o Licenciado dela tome conhecimento, salvo se o Licenciante tiver entretanto comunicado por escrito a sua oposição.
52
+ 3. A cessação não afeta as licenças validamente concedidas pelo Licenciado a terceiros que cumpram esta licença.
53
+
54
+ ## 8. Lei aplicável e foro
55
+
56
+ 1. Esta licença rege-se pela lei portuguesa, designadamente pelo Código do Direito de Autor e dos Direitos Conexos, aprovado pelo Decreto-Lei n.º 63/85, de 14 de março, e pelo Decreto-Lei n.º 252/94, de 20 de outubro, relativo à proteção jurídica dos programas de computador.
57
+ 2. Para a resolução de quaisquer litígios emergentes desta licença é competente o Tribunal Judicial da Comarca de Faro, sem prejuízo das normas imperativas de competência aplicáveis, nomeadamente as que protegem os consumidores.
58
+
59
+ ## 9. Versões da licença
60
+
61
+ O Licenciante pode publicar novas versões desta licença, identificadas por um número de versão. A Obra fica sujeita à versão indicada no Aviso. O Licenciado pode, se o Aviso o permitir, optar por qualquer versão posterior.
62
+
63
+ ## 10. Disposições finais
64
+
65
+ 1. Se alguma disposição desta licença for considerada inválida ou ineficaz, as restantes mantêm-se em vigor, devendo a disposição afetada ser interpretada de forma a aproximar-se, tanto quanto possível, da intenção original.
66
+ 2. A não exigência, em qualquer momento, do cumprimento de uma disposição desta licença não constitui renúncia ao direito de o exigir posteriormente.
67
+
68
+ ## Como aplicar esta licença
69
+
70
+ Inclua na Obra um ficheiro `LICENCA.md` com este texto, a tradução `LICENSE.md` e o seguinte aviso, preenchendo o ano e o titular:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/LICENSE.md ADDED
@@ -0,0 +1,76 @@
1
+ # Sharadox Open Source Licence
2
+
3
+ Version 0.1.0
4
+
5
+ This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this licence; if the two differ, the Portuguese text prevails.
6
+
7
+ ## 1. Definitions
8
+
9
+ For the purposes of this licence:
10
+
11
+ 1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this licence, in source code or in any other form.
12
+ 2. **"Licensor"** — the copyright holder identified in the copyright notice that accompanies the Work.
13
+ 3. **"Licensee"** — any natural or legal person exercising the rights granted by this licence.
14
+ 4. **"Derivative Work"** — any work based on or incorporating the Work, in whole or in part, with or without modifications, including translations, adaptations and programs that integrate it.
15
+ 5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this licence, including its version.
16
+
17
+ ## 2. Grant of rights
18
+
19
+ 1. Under this licence, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive licence, for the whole term of copyright protection, to:
20
+ 1. use the Work for any purpose, including commercial purposes;
21
+ 2. reproduce the Work, in whole or in part, by any means and in any form;
22
+ 3. modify, translate, adapt and transform the Work and create Derivative Works;
23
+ 4. distribute, publish, communicate to the public, make available, sell and sublicense the Work and Derivative Works.
24
+ 2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a licence to use those patents in exercising the rights in the previous paragraph.
25
+ 3. This licence does not transfer ownership of any rights, which remain with the Licensor.
26
+
27
+ ## 3. Conditions
28
+
29
+ The exercise of the rights granted is subject to the following conditions:
30
+
31
+ 1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this licence or a stable link to its text.
32
+ 2. Anyone distributing a modified version of the Work must state visibly that it has been modified and may not present it as the Licensor's original version.
33
+ 3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this licence.
34
+
35
+ ## 4. Names and trademarks
36
+
37
+ This licence grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
38
+
39
+ ## 5. Disclaimer of warranties
40
+
41
+ The Work is provided "as is" and "as available", without any warranty, express or implied, including in particular warranties of merchantability, fitness for a particular purpose, absence of errors or non-infringement of third-party rights, to the maximum extent permitted by applicable law.
42
+
43
+ ## 6. Limitation of liability
44
+
45
+ 1. To the maximum extent permitted by applicable law, the Licensor is not liable for any damages, direct or indirect, including loss of profits, loss of data or business interruption, arising from the use of or inability to use the Work, even if advised of the possibility of such damages.
46
+ 2. Nothing in this licence excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
47
+
48
+ ## 7. Termination
49
+
50
+ 1. The rights granted by this licence terminate automatically if the Licensee breaches any of its conditions.
51
+ 2. The rights are reinstated if the breach is remedied within 30 days of the Licensee becoming aware of it, unless the Licensor has meanwhile objected in writing.
52
+ 3. Termination does not affect licences validly granted by the Licensee to third parties who comply with this licence.
53
+
54
+ ## 8. Governing law and jurisdiction
55
+
56
+ 1. This licence is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
57
+ 2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this licence, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
58
+
59
+ ## 9. Licence versions
60
+
61
+ The Licensor may publish new versions of this licence, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
62
+
63
+ ## 10. Final provisions
64
+
65
+ 1. If any provision of this licence is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
66
+ 2. Failure to enforce any provision of this licence at any time does not waive the right to enforce it later.
67
+
68
+ ## How to apply this licence
69
+
70
+ Include in the Work a `LICENCA.md` file with the Portuguese text, this translation as `LICENSE.md`, and the following notice, filling in the year and holder:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/NOTICE.md ADDED
@@ -0,0 +1,3 @@
1
+ Direitos de autor © 2026 Micael Pires (Sharadox).
2
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
3
+ https://github.com/Sharadox/sharadox-open-source-license
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @sharadox/web-library
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Generic building blocks for web applications, arranged by topic. When a topic grows big enough it moves into its own library (for example `internationalization-web-library`).
4
+
5
+ ```sh
6
+ pnpm add @sharadox/web-library
7
+ ```
8
+
9
+ Import each piece by its path:
10
+
11
+ | Topic | Pieces |
12
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
13
+ | `internationalization/` | `locale` (`isLocale`, `languageTag`, `openGraphLocale`, `Translated`), `translate`, `locale-redirect` (Accept-Language redirects for next.config) |
14
+ | `search-engine/` | `sitemap` (`localizedSitemap`), `robots`, `structured-data` (JSON-LD component) |
15
+ | `animation/` | `reveal`, `scroll-word` (text that lights up word by word), `in-view`, `smooth-scroll` |
16
+ | `pointer/` | `spotlight` (pointer position as CSS variables) |
17
+ | `time/` | `zone-minute`, `format-time`, `sun-time` (sunrise and sunset), `sun-today` (React hook), `open-state` |
18
+ | `form/` | `rate-limit`, `bot-check` (honeypot and fill time), `field` |
19
+ | `html/` | `escape` |
20
+ | `math/` | `radians`, `clamp`, `pseudo-random` |
21
+ | `test/` | `visual-snapshot` (Playwright: frozen clock, settled reveals) |
22
+ | — | `class-name` |
23
+
24
+ ```tsx
25
+ import { Reveal } from "@sharadox/web-library/animation/reveal";
26
+ import { translate } from "@sharadox/web-library/internationalization/translate";
27
+
28
+ <Reveal delay={0.1}>{translate({ en: "Hello", pt: "Olá" }, locale)}</Reveal>;
29
+ ```
30
+
31
+ React components are client components (`"use client"`), accept `className`, and can be restyled per site. React (and, for `test/`, Playwright) are optional peer dependencies.
32
+
33
+ ## Licence
34
+
35
+ Licença Sharadox de Código Aberto, versão 0.1.0 — [português](LICENCA.md) (the binding text) · [English translation](LICENSE.md).
@@ -0,0 +1,3 @@
1
+ /** True once the element has been at least `threshold` visible. Stays true. */
2
+ export declare function useInView<Target extends HTMLElement>(threshold?: number): readonly [import("react").RefObject<Target | null>, boolean];
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/in-view/index.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,MAAM,SAAS,WAAW,EAAE,SAAS,SAAO,gEASrE"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ /** True once the element has been at least `threshold` visible. Stays true. */
4
+ export function useInView(threshold = 0.35) {
5
+ const element = useRef(null);
6
+ const [inView, setInView] = useState(false);
7
+ useEffect(() => {
8
+ const observer = new IntersectionObserver(([entry]) => entry?.isIntersecting && setInView(true), { threshold });
9
+ if (element.current)
10
+ observer.observe(element.current);
11
+ return () => observer.disconnect();
12
+ }, [threshold]);
13
+ return [element, inView];
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/in-view/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAA6B,SAAS,GAAG,IAAI;IACpE,MAAM,OAAO,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,cAAc,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAChH,IAAI,OAAO,CAAC,OAAO;YAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAChB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AACpC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RevealProperties } from "@sharadox/web-library/animation/reveal/type";
2
+ /** Fades, lifts and (optionally) unblurs its children into place the first time they scroll into view. */
3
+ export declare function Reveal({ children, delay, y, blur, margin, className }: RevealProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/reveal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAIpF,0GAA0G;AAC1G,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAS,EAAE,CAAM,EAAE,IAAQ,EAAE,MAAmB,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAYjH"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { motion } from "motion/react";
4
+ const EASE = [0.22, 1, 0.36, 1];
5
+ /** Fades, lifts and (optionally) unblurs its children into place the first time they scroll into view. */
6
+ export function Reveal({ children, delay = 0, y = 24, blur = 6, margin = "-12% 0px", className }) {
7
+ return (_jsx(motion.div, { className: className, initial: blur ? { opacity: 0, y, filter: `blur(${blur}px)` } : { opacity: 0, y }, whileInView: blur ? { opacity: 1, y: 0, filter: "blur(0px)" } : { opacity: 1, y: 0 }, viewport: { once: true, margin: margin }, transition: { duration: 0.9, delay, ease: EASE }, children: children }));
8
+ }
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/reveal/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAU,CAAC;AAEzC,0GAA0G;AAC1G,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,SAAS,EAAoB;IAChH,OAAO,CACL,KAAC,MAAM,CAAC,GAAG,IACT,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAChF,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EACpF,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAuB,EAAE,EACzD,UAAU,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAE/C,QAAQ,GACE,CACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from "react";
2
+ export interface RevealProperties {
3
+ children: ReactNode;
4
+ /** Seconds to wait before animating in. */
5
+ delay?: number;
6
+ /** Starting vertical offset in pixels. Defaults to 24. */
7
+ y?: number;
8
+ /** Starting blur in pixels; 0 turns the blur off. Defaults to 6. */
9
+ blur?: number;
10
+ /** How far inside the viewport the element must be before it reveals (a CSS margin). Defaults to "-12% 0px". */
11
+ margin?: string;
12
+ className?: string;
13
+ }
14
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/reveal/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/reveal/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { ScrollWordsProperties } from "@sharadox/web-library/animation/scroll-word/type";
2
+ /** A paragraph that lights up word by word as it scrolls through the viewport. */
3
+ export declare function ScrollWords({ text, className, offset, opacity, span, }: ScrollWordsProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/scroll-word/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AAE9F,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAS,EACT,MAAiC,EACjC,OAAmB,EACnB,IAAU,GACX,EAAE,qBAAqB,+BAsBvB"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useScroll } from "motion/react";
4
+ import { useRef } from "react";
5
+ import { ScrollWord } from "@sharadox/web-library/animation/scroll-word/word";
6
+ /** A paragraph that lights up word by word as it scrolls through the viewport. */
7
+ export function ScrollWords({ text, className, offset = ["start 80%", "end 40%"], opacity = [0.12, 1], span = 1.5, }) {
8
+ const paragraph = useRef(null);
9
+ const { scrollYProgress } = useScroll({
10
+ target: paragraph,
11
+ offset: offset,
12
+ });
13
+ const words = text.split(" ");
14
+ return (_jsx("p", { ref: paragraph, className: className, children: words.map((word, index) => (_jsx(ScrollWord, { word: word, index: index, count: words.length, progress: scrollYProgress, opacity: opacity, span: span }, index))) }));
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/scroll-word/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAG9E,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAS,EACT,MAAM,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,EACjC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EACnB,IAAI,GAAG,GAAG,GACY;IACtB,MAAM,SAAS,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;QACpC,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,MAA2E;KACpF,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,CACL,YAAG,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,YACpC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,KAAC,UAAU,IAET,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,CAAC,MAAM,EACnB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,IANL,KAAK,CAOV,CACH,CAAC,GACA,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface ScrollWordsProperties {
2
+ text: string;
3
+ className?: string;
4
+ /** When lighting starts and ends, as Motion scroll offsets. Defaults to ["start 80%", "end 40%"]. */
5
+ offset?: readonly [string, string];
6
+ /** Opacity before and after each word lights up. Defaults to [0.12, 1]. */
7
+ opacity?: readonly [number, number];
8
+ /** How many words' worth of scroll each word takes to light up. Defaults to 1.5. */
9
+ span?: number;
10
+ }
11
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/scroll-word/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oFAAoF;IACpF,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/animation/scroll-word/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { ScrollWordProperties } from "@sharadox/web-library/animation/scroll-word/word/type";
2
+ /** One word that brightens when scroll progress reaches its place in the sentence. */
3
+ export declare function ScrollWord({ word, index, count, progress, opacity, span }: ScrollWordProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAElG,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,oBAAoB,+BAI/F"}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { motion, useTransform } from "motion/react";
4
+ /** One word that brightens when scroll progress reaches its place in the sentence. */
5
+ export function ScrollWord({ word, index, count, progress, opacity, span }) {
6
+ const start = index / count;
7
+ const value = useTransform(progress, [start, start + span / count], [...opacity]);
8
+ return _jsxs(motion.span, { style: { opacity: value }, children: [word, " "] });
9
+ }
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGpD,sFAAsF;AACtF,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAwB;IAC9F,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAClF,OAAO,MAAC,MAAM,CAAC,IAAI,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,aAAG,IAAI,SAAgB,CAAC;AACvE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { MotionValue } from "motion/react";
2
+ export interface ScrollWordProperties {
3
+ word: string;
4
+ /** Position of the word in the sentence. */
5
+ index: number;
6
+ /** Number of words in the sentence. */
7
+ count: number;
8
+ progress: MotionValue<number>;
9
+ /** Opacity before and after the word lights up. */
10
+ opacity: readonly [number, number];
11
+ /** How many words' worth of scroll each word takes to light up. */
12
+ span: number;
13
+ }
14
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,mDAAmD;IACnD,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../source/animation/scroll-word/word/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { SmoothScrollProperties } from "@sharadox/web-library/animation/smooth-scroll/type";
2
+ /** Smooth, inertial page scrolling, including in-page anchor links. Off when the visitor prefers reduced motion. */
3
+ export declare function SmoothScroll({ duration, anchorOffset }: SmoothScrollProperties): null;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAEjG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,EAAE,QAAe,EAAE,YAAkB,EAAE,EAAE,sBAAsB,QA0B3F"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import Lenis from "lenis";
3
+ import { useEffect } from "react";
4
+ /** Smooth, inertial page scrolling, including in-page anchor links. Off when the visitor prefers reduced motion. */
5
+ export function SmoothScroll({ duration = 1.15, anchorOffset = -60 }) {
6
+ useEffect(() => {
7
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches)
8
+ return;
9
+ const lenis = new Lenis({ duration, smoothWheel: true });
10
+ let frame = 0;
11
+ const animate = (time) => {
12
+ lenis.raf(time);
13
+ frame = requestAnimationFrame(animate);
14
+ };
15
+ frame = requestAnimationFrame(animate);
16
+ const onClick = (event) => {
17
+ const link = event.target.closest('a[href^="#"]');
18
+ const target = link && document.querySelector(link.getAttribute("href"));
19
+ if (target) {
20
+ event.preventDefault();
21
+ lenis.scrollTo(target, { offset: anchorOffset });
22
+ }
23
+ };
24
+ document.addEventListener("click", onClick);
25
+ return () => {
26
+ cancelAnimationFrame(frame);
27
+ document.removeEventListener("click", onClick);
28
+ lenis.destroy();
29
+ };
30
+ }, [duration, anchorOffset]);
31
+ return null;
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,oHAAoH;AACpH,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,EAA0B;IAC1F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO;YAAE,OAAO;QAC1E,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;YAC/B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChB,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC;QACF,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;YACpC,MAAM,IAAI,GAAI,KAAK,CAAC,MAAsB,CAAC,OAAO,CAAoB,cAAc,CAAC,CAAC;YACtF,MAAM,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,aAAa,CAAc,IAAI,CAAC,YAAY,CAAC,MAAM,CAAE,CAAC,CAAC;YACvF,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC5B,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface SmoothScrollProperties {
2
+ /** Seconds a scroll gesture takes to settle. Defaults to 1.15. */
3
+ duration?: number;
4
+ /** Pixels to stop above an in-page anchor target (for a fixed header). Defaults to -60. */
5
+ anchorOffset?: number;
6
+ }
7
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/animation/smooth-scroll/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** Joins the class names that are set, skipping false, null, undefined and empty strings. */
2
+ export declare function classNames(...names: (string | false | null | undefined)[]): string;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAElF"}
@@ -0,0 +1,5 @@
1
+ /** Joins the class names that are set, skipping false, null, undefined and empty strings. */
2
+ export function classNames(...names) {
3
+ return names.filter(Boolean).join(" ");
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,UAAU,UAAU,CAAC,GAAG,KAA4C;IACxE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BotCheckOptions } from "@sharadox/web-library/form/bot-check/type";
2
+ /** Whether a form submission looks automated: the honeypot is filled, or it was submitted faster than people can. */
3
+ export declare function isLikelyBot(form: FormData, { honeypotField, startedAtField, minimumFillTime, now, }?: BotCheckOptions): boolean;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/form/bot-check/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjF,qHAAqH;AACrH,wBAAgB,WAAW,CACzB,IAAI,EAAE,QAAQ,EACd,EACE,aAAyB,EACzB,cAA6B,EAC7B,eAAsB,EACtB,GAAgB,GACjB,GAAE,eAAoB,GACtB,OAAO,CAGT"}
@@ -0,0 +1,6 @@
1
+ /** Whether a form submission looks automated: the honeypot is filled, or it was submitted faster than people can. */
2
+ export function isLikelyBot(form, { honeypotField = "website", startedAtField = "started-at", minimumFillTime = 2500, now = Date.now(), } = {}) {
3
+ const started = Number(form.get(startedAtField) ?? 0);
4
+ return Boolean(form.get(honeypotField)) || Boolean(started && now - started < minimumFillTime);
5
+ }
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/bot-check/index.ts"],"names":[],"mappings":"AAEA,qHAAqH;AACrH,MAAM,UAAU,WAAW,CACzB,IAAc,EACd,EACE,aAAa,GAAG,SAAS,EACzB,cAAc,GAAG,YAAY,EAC7B,eAAe,GAAG,IAAI,EACtB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,MACG,EAAE;IAEvB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,IAAI,GAAG,GAAG,OAAO,GAAG,eAAe,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface BotCheckOptions {
2
+ /** A field hidden from people; anything typed in it was typed by a bot. Defaults to "website". */
3
+ honeypotField?: string;
4
+ /** A hidden field holding when the visitor started filling the form (milliseconds). Defaults to "started-at". */
5
+ startedAtField?: string;
6
+ /** People take longer than this to fill a form, in milliseconds. Defaults to 2500. */
7
+ minimumFillTime?: number;
8
+ /** Defaults to now. */
9
+ now?: number;
10
+ }
11
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/form/bot-check/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iHAAiH;IACjH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../source/form/bot-check/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** A text field from submitted form data, trimmed and cut to `maximumLength` characters ("" when missing). */
2
+ export declare function readField(form: FormData, name: string, maximumLength: number): string;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/form/field/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAIrF"}
@@ -0,0 +1,7 @@
1
+ /** A text field from submitted form data, trimmed and cut to `maximumLength` characters ("" when missing). */
2
+ export function readField(form, name, maximumLength) {
3
+ return String(form.get(name) ?? "")
4
+ .trim()
5
+ .slice(0, maximumLength);
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/field/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,IAAY,EAAE,aAAqB;IAC3E,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAChC,IAAI,EAAE;SACN,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RateLimiter, RateLimitOptions } from "@sharadox/web-library/form/rate-limit/type";
2
+ /** In-memory sliding-window rate limiter. Best effort: each server instance keeps its own memory. */
3
+ export declare function createRateLimiter({ window, maximum }: RateLimitOptions): RateLimiter;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/form/rate-limit/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAEhG,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,gBAAgB,GAAG,WAAW,CAWpF"}
@@ -0,0 +1,14 @@
1
+ /** In-memory sliding-window rate limiter. Best effort: each server instance keeps its own memory. */
2
+ export function createRateLimiter({ window, maximum }) {
3
+ const hits = new Map();
4
+ return (key, now = Date.now()) => {
5
+ const recent = (hits.get(key) ?? []).filter((time) => now - time < window);
6
+ if (recent.length >= maximum) {
7
+ hits.set(key, recent);
8
+ return false;
9
+ }
10
+ hits.set(key, [...recent, now]);
11
+ return true;
12
+ };
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/form/rate-limit/index.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,UAAU,iBAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAoB;IACrE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;QAC3E,IAAI,MAAM,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACtB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface RateLimitOptions {
2
+ /** Window length in milliseconds. */
3
+ window: number;
4
+ /** Allowed hits per key inside the window. */
5
+ maximum: number;
6
+ }
7
+ /** Records a hit for a key; returns false when the key is over its limit. */
8
+ export type RateLimiter = (key: string, now?: number) => boolean;
9
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../source/form/rate-limit/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC"}