@jjlmoya/utils-chrono 1.2.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 (277) hide show
  1. package/package.json +65 -0
  2. package/scripts/postinstall.mjs +27 -0
  3. package/src/category/ChronoCategorySEO.astro +8 -0
  4. package/src/category/i18n/de.ts +23 -0
  5. package/src/category/i18n/en.ts +23 -0
  6. package/src/category/i18n/es.ts +23 -0
  7. package/src/category/i18n/fr.ts +23 -0
  8. package/src/category/i18n/id.ts +23 -0
  9. package/src/category/i18n/it.ts +23 -0
  10. package/src/category/i18n/ja.ts +23 -0
  11. package/src/category/i18n/ko.ts +23 -0
  12. package/src/category/i18n/nl.ts +23 -0
  13. package/src/category/i18n/pl.ts +23 -0
  14. package/src/category/i18n/pt.ts +23 -0
  15. package/src/category/i18n/ru.ts +23 -0
  16. package/src/category/i18n/sv.ts +23 -0
  17. package/src/category/i18n/tr.ts +23 -0
  18. package/src/category/i18n/zh.ts +23 -0
  19. package/src/category/index.ts +42 -0
  20. package/src/components/PreviewNavSidebar.astro +116 -0
  21. package/src/components/PreviewToolbar.astro +143 -0
  22. package/src/data.ts +11 -0
  23. package/src/entries.ts +32 -0
  24. package/src/env.d.ts +5 -0
  25. package/src/index.ts +28 -0
  26. package/src/layouts/PreviewLayout.astro +117 -0
  27. package/src/pages/[locale]/[slug].astro +161 -0
  28. package/src/pages/[locale].astro +251 -0
  29. package/src/pages/index.astro +4 -0
  30. package/src/tests/faq_count.test.ts +19 -0
  31. package/src/tests/i18n_coverage.test.ts +36 -0
  32. package/src/tests/locale_completeness.test.ts +29 -0
  33. package/src/tests/mocks/astro_mock.js +2 -0
  34. package/src/tests/no_h1_in_components.test.ts +48 -0
  35. package/src/tests/schemas_fulfillment.test.ts +23 -0
  36. package/src/tests/seo_length.test.ts +22 -0
  37. package/src/tests/shared-test-helpers.ts +56 -0
  38. package/src/tests/slug_language_code_format.test.ts +23 -0
  39. package/src/tests/slug_uniqueness.test.ts +81 -0
  40. package/src/tests/title_quality.test.ts +55 -0
  41. package/src/tests/tool_exports.test.ts +34 -0
  42. package/src/tests/tool_validation.test.ts +18 -0
  43. package/src/tool/beat-rate-converter/beat-rate-converter.css +301 -0
  44. package/src/tool/beat-rate-converter/bibliography.astro +16 -0
  45. package/src/tool/beat-rate-converter/bibliography.ts +12 -0
  46. package/src/tool/beat-rate-converter/client.ts +46 -0
  47. package/src/tool/beat-rate-converter/component.astro +15 -0
  48. package/src/tool/beat-rate-converter/components/ConverterPanel.astro +87 -0
  49. package/src/tool/beat-rate-converter/entry.ts +42 -0
  50. package/src/tool/beat-rate-converter/i18n/de.ts +138 -0
  51. package/src/tool/beat-rate-converter/i18n/en.ts +138 -0
  52. package/src/tool/beat-rate-converter/i18n/es.ts +138 -0
  53. package/src/tool/beat-rate-converter/i18n/fr.ts +138 -0
  54. package/src/tool/beat-rate-converter/i18n/id.ts +138 -0
  55. package/src/tool/beat-rate-converter/i18n/it.ts +138 -0
  56. package/src/tool/beat-rate-converter/i18n/ja.ts +138 -0
  57. package/src/tool/beat-rate-converter/i18n/ko.ts +138 -0
  58. package/src/tool/beat-rate-converter/i18n/nl.ts +138 -0
  59. package/src/tool/beat-rate-converter/i18n/pl.ts +138 -0
  60. package/src/tool/beat-rate-converter/i18n/pt.ts +138 -0
  61. package/src/tool/beat-rate-converter/i18n/ru.ts +138 -0
  62. package/src/tool/beat-rate-converter/i18n/sv.ts +138 -0
  63. package/src/tool/beat-rate-converter/i18n/tr.ts +138 -0
  64. package/src/tool/beat-rate-converter/i18n/zh.ts +138 -0
  65. package/src/tool/beat-rate-converter/index.ts +11 -0
  66. package/src/tool/beat-rate-converter/seo.astro +16 -0
  67. package/src/tool/crown-reference-guide/bibliography.astro +16 -0
  68. package/src/tool/crown-reference-guide/bibliography.ts +20 -0
  69. package/src/tool/crown-reference-guide/client.ts +193 -0
  70. package/src/tool/crown-reference-guide/component.astro +69 -0
  71. package/src/tool/crown-reference-guide/components/CrownView.astro +40 -0
  72. package/src/tool/crown-reference-guide/components/MovementSelector.astro +26 -0
  73. package/src/tool/crown-reference-guide/components/PositionPanel.astro +59 -0
  74. package/src/tool/crown-reference-guide/crown-reference-guide.css +383 -0
  75. package/src/tool/crown-reference-guide/entry.ts +60 -0
  76. package/src/tool/crown-reference-guide/i18n/de.ts +207 -0
  77. package/src/tool/crown-reference-guide/i18n/en.ts +207 -0
  78. package/src/tool/crown-reference-guide/i18n/es.ts +207 -0
  79. package/src/tool/crown-reference-guide/i18n/fr.ts +207 -0
  80. package/src/tool/crown-reference-guide/i18n/id.ts +207 -0
  81. package/src/tool/crown-reference-guide/i18n/it.ts +207 -0
  82. package/src/tool/crown-reference-guide/i18n/ja.ts +207 -0
  83. package/src/tool/crown-reference-guide/i18n/ko.ts +207 -0
  84. package/src/tool/crown-reference-guide/i18n/nl.ts +207 -0
  85. package/src/tool/crown-reference-guide/i18n/pl.ts +207 -0
  86. package/src/tool/crown-reference-guide/i18n/pt.ts +207 -0
  87. package/src/tool/crown-reference-guide/i18n/ru.ts +207 -0
  88. package/src/tool/crown-reference-guide/i18n/sv.ts +207 -0
  89. package/src/tool/crown-reference-guide/i18n/tr.ts +207 -0
  90. package/src/tool/crown-reference-guide/i18n/zh.ts +207 -0
  91. package/src/tool/crown-reference-guide/index.ts +11 -0
  92. package/src/tool/crown-reference-guide/seo.astro +16 -0
  93. package/src/tool/crown-reference-guide/utils.ts +0 -0
  94. package/src/tool/demagnetizing-timer/bibliography.astro +16 -0
  95. package/src/tool/demagnetizing-timer/bibliography.ts +12 -0
  96. package/src/tool/demagnetizing-timer/client.ts +221 -0
  97. package/src/tool/demagnetizing-timer/component.astro +15 -0
  98. package/src/tool/demagnetizing-timer/components/TimerPanel.astro +92 -0
  99. package/src/tool/demagnetizing-timer/demagnetizing-timer.css +389 -0
  100. package/src/tool/demagnetizing-timer/entry.ts +50 -0
  101. package/src/tool/demagnetizing-timer/helpers/field.ts +134 -0
  102. package/src/tool/demagnetizing-timer/i18n/de.ts +143 -0
  103. package/src/tool/demagnetizing-timer/i18n/en.ts +143 -0
  104. package/src/tool/demagnetizing-timer/i18n/es.ts +143 -0
  105. package/src/tool/demagnetizing-timer/i18n/fr.ts +143 -0
  106. package/src/tool/demagnetizing-timer/i18n/id.ts +143 -0
  107. package/src/tool/demagnetizing-timer/i18n/it.ts +143 -0
  108. package/src/tool/demagnetizing-timer/i18n/ja.ts +143 -0
  109. package/src/tool/demagnetizing-timer/i18n/ko.ts +143 -0
  110. package/src/tool/demagnetizing-timer/i18n/nl.ts +143 -0
  111. package/src/tool/demagnetizing-timer/i18n/pl.ts +143 -0
  112. package/src/tool/demagnetizing-timer/i18n/pt.ts +143 -0
  113. package/src/tool/demagnetizing-timer/i18n/ru.ts +143 -0
  114. package/src/tool/demagnetizing-timer/i18n/sv.ts +143 -0
  115. package/src/tool/demagnetizing-timer/i18n/tr.ts +143 -0
  116. package/src/tool/demagnetizing-timer/i18n/zh.ts +143 -0
  117. package/src/tool/demagnetizing-timer/index.ts +11 -0
  118. package/src/tool/demagnetizing-timer/seo.astro +16 -0
  119. package/src/tool/demagnetizing-timer/utils.ts +0 -0
  120. package/src/tool/power-reserve-estimator/bibliography.astro +16 -0
  121. package/src/tool/power-reserve-estimator/bibliography.ts +16 -0
  122. package/src/tool/power-reserve-estimator/client.ts +139 -0
  123. package/src/tool/power-reserve-estimator/component.astro +15 -0
  124. package/src/tool/power-reserve-estimator/components/EstimatorPanel.astro +150 -0
  125. package/src/tool/power-reserve-estimator/entry.ts +51 -0
  126. package/src/tool/power-reserve-estimator/i18n/de.ts +158 -0
  127. package/src/tool/power-reserve-estimator/i18n/en.ts +158 -0
  128. package/src/tool/power-reserve-estimator/i18n/es.ts +158 -0
  129. package/src/tool/power-reserve-estimator/i18n/fr.ts +158 -0
  130. package/src/tool/power-reserve-estimator/i18n/id.ts +158 -0
  131. package/src/tool/power-reserve-estimator/i18n/it.ts +158 -0
  132. package/src/tool/power-reserve-estimator/i18n/ja.ts +158 -0
  133. package/src/tool/power-reserve-estimator/i18n/ko.ts +158 -0
  134. package/src/tool/power-reserve-estimator/i18n/nl.ts +158 -0
  135. package/src/tool/power-reserve-estimator/i18n/pl.ts +158 -0
  136. package/src/tool/power-reserve-estimator/i18n/pt.ts +158 -0
  137. package/src/tool/power-reserve-estimator/i18n/ru.ts +158 -0
  138. package/src/tool/power-reserve-estimator/i18n/sv.ts +158 -0
  139. package/src/tool/power-reserve-estimator/i18n/tr.ts +158 -0
  140. package/src/tool/power-reserve-estimator/i18n/zh.ts +158 -0
  141. package/src/tool/power-reserve-estimator/index.ts +11 -0
  142. package/src/tool/power-reserve-estimator/power-reserve-estimator.css +402 -0
  143. package/src/tool/power-reserve-estimator/seo.astro +16 -0
  144. package/src/tool/strap-taper-calculator/bibliography.astro +16 -0
  145. package/src/tool/strap-taper-calculator/bibliography.ts +12 -0
  146. package/src/tool/strap-taper-calculator/client.ts +129 -0
  147. package/src/tool/strap-taper-calculator/component.astro +15 -0
  148. package/src/tool/strap-taper-calculator/components/CalculatorPanel.astro +114 -0
  149. package/src/tool/strap-taper-calculator/entry.ts +56 -0
  150. package/src/tool/strap-taper-calculator/i18n/de.ts +152 -0
  151. package/src/tool/strap-taper-calculator/i18n/en.ts +152 -0
  152. package/src/tool/strap-taper-calculator/i18n/es.ts +152 -0
  153. package/src/tool/strap-taper-calculator/i18n/fr.ts +152 -0
  154. package/src/tool/strap-taper-calculator/i18n/id.ts +152 -0
  155. package/src/tool/strap-taper-calculator/i18n/it.ts +152 -0
  156. package/src/tool/strap-taper-calculator/i18n/ja.ts +152 -0
  157. package/src/tool/strap-taper-calculator/i18n/ko.ts +152 -0
  158. package/src/tool/strap-taper-calculator/i18n/nl.ts +152 -0
  159. package/src/tool/strap-taper-calculator/i18n/pl.ts +152 -0
  160. package/src/tool/strap-taper-calculator/i18n/pt.ts +152 -0
  161. package/src/tool/strap-taper-calculator/i18n/ru.ts +152 -0
  162. package/src/tool/strap-taper-calculator/i18n/sv.ts +152 -0
  163. package/src/tool/strap-taper-calculator/i18n/tr.ts +152 -0
  164. package/src/tool/strap-taper-calculator/i18n/zh.ts +152 -0
  165. package/src/tool/strap-taper-calculator/index.ts +11 -0
  166. package/src/tool/strap-taper-calculator/seo.astro +16 -0
  167. package/src/tool/strap-taper-calculator/strap-taper-calculator.css +320 -0
  168. package/src/tool/watch-accuracy-tracker/bibliography.astro +16 -0
  169. package/src/tool/watch-accuracy-tracker/bibliography.ts +12 -0
  170. package/src/tool/watch-accuracy-tracker/chart.ts +126 -0
  171. package/src/tool/watch-accuracy-tracker/client.ts +287 -0
  172. package/src/tool/watch-accuracy-tracker/component.astro +35 -0
  173. package/src/tool/watch-accuracy-tracker/components/AccuracyTracker.astro +96 -0
  174. package/src/tool/watch-accuracy-tracker/components/DriftPredictor.astro +126 -0
  175. package/src/tool/watch-accuracy-tracker/components/LogHistory.astro +66 -0
  176. package/src/tool/watch-accuracy-tracker/entry.ts +94 -0
  177. package/src/tool/watch-accuracy-tracker/i18n/de.ts +167 -0
  178. package/src/tool/watch-accuracy-tracker/i18n/en.ts +167 -0
  179. package/src/tool/watch-accuracy-tracker/i18n/es.ts +167 -0
  180. package/src/tool/watch-accuracy-tracker/i18n/fr.ts +167 -0
  181. package/src/tool/watch-accuracy-tracker/i18n/id.ts +167 -0
  182. package/src/tool/watch-accuracy-tracker/i18n/it.ts +167 -0
  183. package/src/tool/watch-accuracy-tracker/i18n/ja.ts +167 -0
  184. package/src/tool/watch-accuracy-tracker/i18n/ko.ts +167 -0
  185. package/src/tool/watch-accuracy-tracker/i18n/nl.ts +167 -0
  186. package/src/tool/watch-accuracy-tracker/i18n/pl.ts +167 -0
  187. package/src/tool/watch-accuracy-tracker/i18n/pt.ts +167 -0
  188. package/src/tool/watch-accuracy-tracker/i18n/ru.ts +167 -0
  189. package/src/tool/watch-accuracy-tracker/i18n/sv.ts +167 -0
  190. package/src/tool/watch-accuracy-tracker/i18n/tr.ts +167 -0
  191. package/src/tool/watch-accuracy-tracker/i18n/zh.ts +167 -0
  192. package/src/tool/watch-accuracy-tracker/index.ts +9 -0
  193. package/src/tool/watch-accuracy-tracker/logger.ts +105 -0
  194. package/src/tool/watch-accuracy-tracker/seo.astro +16 -0
  195. package/src/tool/watch-accuracy-tracker/utils.ts +99 -0
  196. package/src/tool/watch-accuracy-tracker/watch-accuracy-tracker.css +564 -0
  197. package/src/tool/watch-savings-planner/bibliography.astro +16 -0
  198. package/src/tool/watch-savings-planner/bibliography.ts +8 -0
  199. package/src/tool/watch-savings-planner/client.ts +271 -0
  200. package/src/tool/watch-savings-planner/component.astro +33 -0
  201. package/src/tool/watch-savings-planner/components/AddGoalForm.astro +49 -0
  202. package/src/tool/watch-savings-planner/components/GoalCard.astro +58 -0
  203. package/src/tool/watch-savings-planner/entry.ts +62 -0
  204. package/src/tool/watch-savings-planner/i18n/de.ts +153 -0
  205. package/src/tool/watch-savings-planner/i18n/en.ts +155 -0
  206. package/src/tool/watch-savings-planner/i18n/es.ts +153 -0
  207. package/src/tool/watch-savings-planner/i18n/fr.ts +153 -0
  208. package/src/tool/watch-savings-planner/i18n/id.ts +153 -0
  209. package/src/tool/watch-savings-planner/i18n/it.ts +153 -0
  210. package/src/tool/watch-savings-planner/i18n/ja.ts +153 -0
  211. package/src/tool/watch-savings-planner/i18n/ko.ts +153 -0
  212. package/src/tool/watch-savings-planner/i18n/nl.ts +153 -0
  213. package/src/tool/watch-savings-planner/i18n/pl.ts +153 -0
  214. package/src/tool/watch-savings-planner/i18n/pt.ts +153 -0
  215. package/src/tool/watch-savings-planner/i18n/ru.ts +153 -0
  216. package/src/tool/watch-savings-planner/i18n/sv.ts +153 -0
  217. package/src/tool/watch-savings-planner/i18n/tr.ts +153 -0
  218. package/src/tool/watch-savings-planner/i18n/zh.ts +153 -0
  219. package/src/tool/watch-savings-planner/index.ts +11 -0
  220. package/src/tool/watch-savings-planner/seo.astro +16 -0
  221. package/src/tool/watch-savings-planner/utils.ts +0 -0
  222. package/src/tool/watch-savings-planner/watch-savings-planner.css +460 -0
  223. package/src/tool/water-resistance-converter/bibliography.astro +16 -0
  224. package/src/tool/water-resistance-converter/bibliography.ts +16 -0
  225. package/src/tool/water-resistance-converter/client.ts +56 -0
  226. package/src/tool/water-resistance-converter/component.astro +15 -0
  227. package/src/tool/water-resistance-converter/components/ConverterPanel.astro +113 -0
  228. package/src/tool/water-resistance-converter/entry.ts +52 -0
  229. package/src/tool/water-resistance-converter/i18n/de.ts +148 -0
  230. package/src/tool/water-resistance-converter/i18n/en.ts +148 -0
  231. package/src/tool/water-resistance-converter/i18n/es.ts +148 -0
  232. package/src/tool/water-resistance-converter/i18n/fr.ts +148 -0
  233. package/src/tool/water-resistance-converter/i18n/id.ts +148 -0
  234. package/src/tool/water-resistance-converter/i18n/it.ts +148 -0
  235. package/src/tool/water-resistance-converter/i18n/ja.ts +148 -0
  236. package/src/tool/water-resistance-converter/i18n/ko.ts +148 -0
  237. package/src/tool/water-resistance-converter/i18n/nl.ts +148 -0
  238. package/src/tool/water-resistance-converter/i18n/pl.ts +148 -0
  239. package/src/tool/water-resistance-converter/i18n/pt.ts +148 -0
  240. package/src/tool/water-resistance-converter/i18n/ru.ts +148 -0
  241. package/src/tool/water-resistance-converter/i18n/sv.ts +148 -0
  242. package/src/tool/water-resistance-converter/i18n/tr.ts +148 -0
  243. package/src/tool/water-resistance-converter/i18n/zh.ts +148 -0
  244. package/src/tool/water-resistance-converter/index.ts +11 -0
  245. package/src/tool/water-resistance-converter/seo.astro +16 -0
  246. package/src/tool/water-resistance-converter/water-resistance-converter.css +254 -0
  247. package/src/tool/wrist-presence-calculator/bibliography.astro +16 -0
  248. package/src/tool/wrist-presence-calculator/bibliography.ts +12 -0
  249. package/src/tool/wrist-presence-calculator/client.ts +180 -0
  250. package/src/tool/wrist-presence-calculator/component.astro +23 -0
  251. package/src/tool/wrist-presence-calculator/components/CalculatorInputs.astro +97 -0
  252. package/src/tool/wrist-presence-calculator/components/FitResult.astro +68 -0
  253. package/src/tool/wrist-presence-calculator/components/Visualizer.astro +16 -0
  254. package/src/tool/wrist-presence-calculator/entry.ts +59 -0
  255. package/src/tool/wrist-presence-calculator/helpers/canvas.ts +189 -0
  256. package/src/tool/wrist-presence-calculator/helpers/results.ts +78 -0
  257. package/src/tool/wrist-presence-calculator/i18n/de.ts +139 -0
  258. package/src/tool/wrist-presence-calculator/i18n/en.ts +155 -0
  259. package/src/tool/wrist-presence-calculator/i18n/es.ts +139 -0
  260. package/src/tool/wrist-presence-calculator/i18n/fr.ts +139 -0
  261. package/src/tool/wrist-presence-calculator/i18n/id.ts +139 -0
  262. package/src/tool/wrist-presence-calculator/i18n/it.ts +139 -0
  263. package/src/tool/wrist-presence-calculator/i18n/ja.ts +139 -0
  264. package/src/tool/wrist-presence-calculator/i18n/ko.ts +139 -0
  265. package/src/tool/wrist-presence-calculator/i18n/nl.ts +139 -0
  266. package/src/tool/wrist-presence-calculator/i18n/pl.ts +139 -0
  267. package/src/tool/wrist-presence-calculator/i18n/pt.ts +139 -0
  268. package/src/tool/wrist-presence-calculator/i18n/ru.ts +139 -0
  269. package/src/tool/wrist-presence-calculator/i18n/sv.ts +139 -0
  270. package/src/tool/wrist-presence-calculator/i18n/tr.ts +139 -0
  271. package/src/tool/wrist-presence-calculator/i18n/zh.ts +155 -0
  272. package/src/tool/wrist-presence-calculator/index.ts +11 -0
  273. package/src/tool/wrist-presence-calculator/seo.astro +16 -0
  274. package/src/tool/wrist-presence-calculator/utils.ts +30 -0
  275. package/src/tool/wrist-presence-calculator/wrist-presence-calculator.css +372 -0
  276. package/src/tools.ts +26 -0
  277. package/src/types.ts +70 -0
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ALL_TOOLS } from '../tools';
3
+ import { validateToolExports } from './shared-test-helpers';
4
+
5
+ describe('Tool Exports Pattern Validation', () => {
6
+ describe('Component Exports Format', () => {
7
+ ALL_TOOLS.forEach((tool) => {
8
+ it(`${tool.entry.id}: Component should be a lazy-loaded function`, () => {
9
+ expect(typeof tool.Component).toBe('function');
10
+ expect(tool.Component).toBeInstanceOf(Function);
11
+ });
12
+
13
+ it(`${tool.entry.id}: SEOComponent should be a lazy-loaded function`, () => {
14
+ expect(typeof tool.SEOComponent).toBe('function');
15
+ expect(tool.SEOComponent).toBeInstanceOf(Function);
16
+ });
17
+
18
+ it(`${tool.entry.id}: BibliographyComponent should be a lazy-loaded function`, () => {
19
+ expect(typeof tool.BibliographyComponent).toBe('function');
20
+ expect(tool.BibliographyComponent).toBeInstanceOf(Function);
21
+ });
22
+ });
23
+ });
24
+
25
+ describe('Dynamic Import Validation', () => {
26
+ it('all tools must have functional dynamic imports', async () => {
27
+ const result = await validateToolExports(ALL_TOOLS);
28
+ if (!result.passed) {
29
+ throw new Error(`Tool export validation failed:\n${result.failures.join('\n')}`);
30
+ }
31
+ expect(result.passed).toBe(true);
32
+ });
33
+ });
34
+ });
@@ -0,0 +1,18 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { ALL_TOOLS } from '../tools';
3
+ import { chronoCategory } from '../data';
4
+
5
+ describe('Tool Validation Suite', () => {
6
+ describe('Library Registration', () => {
7
+ it('should have tools in ALL_TOOLS', () => {
8
+ expect(ALL_TOOLS.length).toBe(9);
9
+ });
10
+
11
+
12
+ it('chronoCategory should be defined', () => {
13
+ expect(chronoCategory).toBeDefined();
14
+ expect(chronoCategory.i18n).toBeDefined();
15
+ });
16
+ });
17
+ });
18
+
@@ -0,0 +1,301 @@
1
+ .tool-main-card {
2
+ background: var(--bg-surface);
3
+ border: 1px solid var(--border-color);
4
+ border-radius: 1.25rem;
5
+ max-width: 400px;
6
+ margin: 0 auto;
7
+ padding: 1.75rem;
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 1.75rem;
11
+ box-shadow: var(--shadow-base);
12
+ position: relative;
13
+ overflow: hidden;
14
+ }
15
+
16
+ .converter-panel {
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 1.25rem;
20
+ position: relative;
21
+ z-index: 1;
22
+ }
23
+
24
+ .panel-section {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 0.5rem;
28
+ }
29
+
30
+ .section-label {
31
+ font-size: 0.75rem;
32
+ font-weight: 600;
33
+ color: var(--text-base);
34
+ opacity: 0.7;
35
+ text-transform: uppercase;
36
+ letter-spacing: 0.06em;
37
+ }
38
+
39
+ .movement-select {
40
+ width: 100%;
41
+ padding: 0.65rem 0.75rem;
42
+ background: var(--bg-page);
43
+ border: 1px solid var(--border-base);
44
+ border-radius: 0.75rem;
45
+ color: var(--text-base);
46
+ font-size: 0.875rem;
47
+ cursor: pointer;
48
+ transition: border-color 0.2s;
49
+ appearance: none;
50
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23888' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
51
+ background-repeat: no-repeat;
52
+ background-position: right 0.75rem center;
53
+ padding-right: 2rem;
54
+ }
55
+
56
+ .movement-select:focus {
57
+ outline: none;
58
+ border-color: var(--accent);
59
+ }
60
+
61
+ .stepper-wrap {
62
+ display: flex;
63
+ align-items: center;
64
+ background: var(--bg-page);
65
+ border: 1px solid var(--border-base);
66
+ border-radius: 0.75rem;
67
+ overflow: hidden;
68
+ transition: border-color 0.2s;
69
+ }
70
+
71
+ .stepper-wrap:focus-within {
72
+ border-color: var(--accent);
73
+ }
74
+
75
+ .stepper-input {
76
+ width: 100%;
77
+ padding: 0.6rem 0.25rem;
78
+ border: none;
79
+ background: transparent;
80
+ color: var(--text-base);
81
+ font-size: 0.875rem;
82
+ text-align: center;
83
+ font-variant-numeric: tabular-nums;
84
+ box-sizing: border-box;
85
+ -moz-appearance: textfield;
86
+ }
87
+
88
+ .stepper-input::-webkit-inner-spin-button,
89
+ .stepper-input::-webkit-outer-spin-button {
90
+ -webkit-appearance: none;
91
+ margin: 0;
92
+ }
93
+
94
+ .stepper-input:focus {
95
+ outline: none;
96
+ }
97
+
98
+ .stepper-btn {
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ min-width: 3rem;
103
+ padding: 0.5rem;
104
+ border: none;
105
+ background: transparent;
106
+ color: var(--text-base);
107
+ opacity: 0.5;
108
+ font-size: 0.75rem;
109
+ font-weight: 700;
110
+ cursor: pointer;
111
+ transition: all 0.15s ease;
112
+ user-select: none;
113
+ }
114
+
115
+ .stepper-btn:hover {
116
+ background: var(--bg-page);
117
+ color: var(--accent);
118
+ opacity: 1;
119
+ }
120
+
121
+ .stepper-btn:active {
122
+ background: var(--border-base);
123
+ transform: scale(0.95);
124
+ }
125
+
126
+ .result-card {
127
+ background: var(--bg-page);
128
+ border: 1px solid var(--border-base);
129
+ border-radius: 1rem;
130
+ padding: 1.25rem;
131
+ display: flex;
132
+ flex-direction: column;
133
+ gap: 1rem;
134
+ }
135
+
136
+ .result-grid {
137
+ display: flex;
138
+ align-items: center;
139
+ gap: 0.75rem;
140
+ }
141
+
142
+ .result-item {
143
+ flex: 1;
144
+ display: flex;
145
+ flex-direction: column;
146
+ align-items: center;
147
+ gap: 0.1rem;
148
+ }
149
+
150
+ .result-value {
151
+ font-size: 2.25rem;
152
+ font-weight: 800;
153
+ color: var(--accent);
154
+ letter-spacing: -0.03em;
155
+ line-height: 1;
156
+ font-variant-numeric: tabular-nums;
157
+ }
158
+
159
+ .result-unit {
160
+ font-size: 0.75rem;
161
+ font-weight: 600;
162
+ color: var(--text-base);
163
+ opacity: 0.6;
164
+ text-transform: uppercase;
165
+ }
166
+
167
+ .result-label {
168
+ font-size: 0.65rem;
169
+ font-weight: 600;
170
+ color: var(--text-base);
171
+ opacity: 0.5;
172
+ text-transform: uppercase;
173
+ letter-spacing: 0.04em;
174
+ margin-top: 0.2rem;
175
+ }
176
+
177
+ .result-divider {
178
+ width: 1px;
179
+ height: 4rem;
180
+ background: var(--border-base);
181
+ flex-shrink: 0;
182
+ }
183
+
184
+ .impact-card {
185
+ background: var(--bg-surface);
186
+ border: 1px solid var(--border-base);
187
+ border-radius: 0.875rem;
188
+ padding: 1rem;
189
+ display: flex;
190
+ flex-direction: column;
191
+ gap: 0.5rem;
192
+ }
193
+
194
+ .impact-header {
195
+ display: flex;
196
+ align-items: center;
197
+ gap: 0.4rem;
198
+ font-size: 0.75rem;
199
+ font-weight: 600;
200
+ color: var(--text-base);
201
+ opacity: 0.7;
202
+ }
203
+
204
+ .impact-result {
205
+ display: flex;
206
+ align-items: baseline;
207
+ gap: 0.3rem;
208
+ }
209
+
210
+ .impact-value {
211
+ font-size: 2rem;
212
+ font-weight: 800;
213
+ color: var(--color-warning, #f59e0b);
214
+ letter-spacing: -0.02em;
215
+ line-height: 1;
216
+ }
217
+
218
+ .impact-unit {
219
+ font-size: 0.875rem;
220
+ font-weight: 700;
221
+ color: var(--text-base);
222
+ opacity: 0.6;
223
+ }
224
+
225
+ .impact-note {
226
+ font-size: 0.75rem;
227
+ color: var(--text-base);
228
+ opacity: 0.6;
229
+ line-height: 1.4;
230
+ margin: 0;
231
+ }
232
+
233
+ .steps-section {
234
+ display: flex;
235
+ flex-direction: column;
236
+ gap: 0.625rem;
237
+ padding: 1rem 1.125rem;
238
+ background: var(--bg-page);
239
+ border-radius: 0.875rem;
240
+ border: 1px solid var(--border-base);
241
+ }
242
+
243
+ .step-row {
244
+ display: flex;
245
+ align-items: center;
246
+ gap: 0.75rem;
247
+ }
248
+
249
+ .step-marker {
250
+ width: 1.375rem;
251
+ height: 1.375rem;
252
+ border-radius: 50%;
253
+ background: var(--accent);
254
+ color: var(--text-on-primary, #fff);
255
+ font-size: 0.6875rem;
256
+ font-weight: 700;
257
+ display: flex;
258
+ align-items: center;
259
+ justify-content: center;
260
+ flex-shrink: 0;
261
+ }
262
+
263
+ .step-text {
264
+ font-size: 0.8125rem;
265
+ color: var(--text-base);
266
+ opacity: 0.85;
267
+ line-height: 1.4;
268
+ }
269
+
270
+ .tip-row {
271
+ display: flex;
272
+ gap: 0.5rem;
273
+ padding: 0.75rem 1rem;
274
+ background: var(--bg-page);
275
+ border-radius: 0.75rem;
276
+ border: 1px solid var(--border-base);
277
+ }
278
+
279
+ .tip-icon {
280
+ flex-shrink: 0;
281
+ margin-top: 0.1rem;
282
+ color: var(--accent);
283
+ }
284
+
285
+ .tip-text {
286
+ font-size: 0.8rem;
287
+ color: var(--text-base);
288
+ opacity: 0.85;
289
+ line-height: 1.5;
290
+ }
291
+
292
+ @media (max-width: 520px) {
293
+ .tool-main-card {
294
+ padding: 1rem;
295
+ gap: 1.25rem;
296
+ }
297
+
298
+ .result-value {
299
+ font-size: 1.75rem;
300
+ }
301
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
+ import { beatRateConverter } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'en' } = Astro.props as Props;
11
+ const loader = beatRateConverter.i18n[locale] || beatRateConverter.i18n.en;
12
+ const content = await loader?.();
13
+ if (!content) return null;
14
+ ---
15
+
16
+ {content && <SharedBibliography links={content.bibliography} />}
@@ -0,0 +1,12 @@
1
+ import type { BibliographyEntry } from '../../types';
2
+
3
+ export const bibliography: BibliographyEntry[] = [
4
+ {
5
+ name: 'What Is a Beat Rate? — Crown & Caliber',
6
+ url: 'https://henryarcher.com/en-eu/blogs/blog/beat-rates',
7
+ },
8
+ {
9
+ name: 'Oscillations, Vibrations and Hertz in Watchmaking',
10
+ url: 'https://monochrome-watches.com/glossary/oscillation/',
11
+ },
12
+ ];
@@ -0,0 +1,46 @@
1
+ const movementSelect = document.getElementById('movement-select') as HTMLSelectElement;
2
+ const vphInput = document.getElementById('vph-input') as HTMLInputElement;
3
+ const customSection = document.getElementById('custom-section') as HTMLElement;
4
+ const freqValue = document.getElementById('freq-value') as HTMLElement;
5
+ const tpsValue = document.getElementById('tps-value') as HTMLElement;
6
+ const impactValue = document.getElementById('impact-value') as HTMLElement;
7
+ function getVph(): number {
8
+ if (movementSelect.value === 'custom') {
9
+ return parseInt(vphInput.value, 10) || 28800;
10
+ }
11
+ return parseInt(movementSelect.value, 10) || 28800;
12
+ }
13
+
14
+ function update() {
15
+ const vph = getVph();
16
+ const hz = vph / 7200;
17
+ const tps = vph / 3600;
18
+ const sPerDay = 86400 / vph;
19
+
20
+ freqValue.textContent = hz.toFixed(3);
21
+ tpsValue.textContent = String(tps);
22
+ impactValue.textContent = sPerDay < 1 ? sPerDay.toFixed(1) : String(Math.round(sPerDay));
23
+ }
24
+
25
+ function toggleCustom() {
26
+ const show = movementSelect.value === 'custom';
27
+ customSection.style.display = show ? 'flex' : 'none';
28
+ if (!show) update();
29
+ }
30
+
31
+ movementSelect.addEventListener('change', () => { toggleCustom(); update(); });
32
+ vphInput.addEventListener('input', update);
33
+
34
+ document.querySelectorAll('.stepper-btn').forEach((btn) => {
35
+ btn.addEventListener('click', () => {
36
+ const step = parseInt(btn.getAttribute('data-step') || '1200', 10);
37
+ const dir = btn.textContent?.includes('+') ? 1 : -1;
38
+ const val = parseInt(vphInput.value, 10) || 28800;
39
+ const next = val + dir * step;
40
+ vphInput.value = String(Math.max(3600, Math.min(360000, next)));
41
+ update();
42
+ });
43
+ });
44
+
45
+ toggleCustom();
46
+ update();
@@ -0,0 +1,15 @@
1
+ ---
2
+ import ConverterPanel from './components/ConverterPanel.astro';
3
+
4
+ interface Props {
5
+ ui: Record<string, string>;
6
+ }
7
+
8
+ const { ui } = Astro.props;
9
+ ---
10
+
11
+ <div class="tool-main-card" data-ui={JSON.stringify(ui)}>
12
+ <ConverterPanel labels={ui} />
13
+ </div>
14
+
15
+ <script src="./client.ts"></script>
@@ -0,0 +1,87 @@
1
+ ---
2
+ interface Props {
3
+ labels: Record<string, string>;
4
+ }
5
+
6
+ const { labels } = Astro.props;
7
+ ---
8
+
9
+ <div class="converter-panel">
10
+ <div class="panel-section">
11
+ <div class="section-label">{labels.vphLabel || "Movement"}</div>
12
+ <select class="movement-select" id="movement-select">
13
+ <option value="28800" data-vph="28800">ETA 2824-2 / SW200 — 28,800 vph</option>
14
+ <option value="28800" data-vph="28800">ETA 2892-A2 / SW300 — 28,800 vph</option>
15
+ <option value="28800" data-vph="28800">Valjoux 7750 / SW500 — 28,800 vph</option>
16
+ <option value="21600" data-vph="21600">Miyota 8215 / 8315 — 21,600 vph</option>
17
+ <option value="28800" data-vph="28800">Miyota 9015 — 28,800 vph</option>
18
+ <option value="21600" data-vph="21600">Seiko NH35 / 4R35 — 21,600 vph</option>
19
+ <option value="21600" data-vph="21600">Seiko 6R35 — 21,600 vph</option>
20
+ <option value="18000" data-vph="18000">Unitas 6497 / 6498 — 18,000 vph</option>
21
+ <option value="28800" data-vph="28800">Rolex 3135 — 28,800 vph</option>
22
+ <option value="28800" data-vph="28800">Rolex 3235 — 28,800 vph</option>
23
+ <option value="25200" data-vph="25200">Omega 8500 / 8900 — 25,200 vph</option>
24
+ <option value="36000" data-vph="36000">Zenith El Primero 400 — 36,000 vph</option>
25
+ <option value="custom">{labels.customMovement || "Custom"}</option>
26
+ </select>
27
+ </div>
28
+
29
+ <div class="panel-section" id="custom-section" style="display: none;">
30
+ <div class="section-label">{labels.customVph || "Vibrations per hour"}</div>
31
+ <div class="stepper-wrap">
32
+ <button type="button" class="stepper-btn" data-step="1200">−1200</button>
33
+ <input type="number" class="stepper-input" id="vph-input" min="3600" max="360000" value="28800" />
34
+ <button type="button" class="stepper-btn" data-step="1200">+1200</button>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="result-card" id="result-card">
39
+ <div class="result-grid">
40
+ <div class="result-item">
41
+ <span class="result-value" id="freq-value">4.000</span>
42
+ <span class="result-unit">Hz</span>
43
+ <span class="result-label">{labels.frequency || "Frequency"}</span>
44
+ </div>
45
+ <div class="result-divider"></div>
46
+ <div class="result-item">
47
+ <span class="result-value" id="tps-value">8</span>
48
+ <span class="result-unit">/s</span>
49
+ <span class="result-label">{labels.ticksPerSec || "Ticks per second"}</span>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="impact-card">
54
+ <div class="impact-header">
55
+ <svg viewBox="0 0 24 24" width="16" height="16">
56
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" fill="currentColor" />
57
+ </svg>
58
+ <span>{labels.lostTickImpact || "If it loses 1 tick per hour"}</span>
59
+ </div>
60
+ <div class="impact-result">
61
+ <span class="impact-value" id="impact-value">3</span>
62
+ <span class="impact-unit">s/d</span>
63
+ </div>
64
+ <p class="impact-note" id="impact-note">
65
+ {labels.lostTickExplainer || "One missed tick per hour means ~3 seconds lost per day at 28,800 vph."}
66
+ </p>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="steps-section">
71
+ <div class="step-row">
72
+ <div class="step-marker">1</div>
73
+ <span class="step-text">{labels.step1 || "Select your movement or enter a custom VPH."}</span>
74
+ </div>
75
+ <div class="step-row">
76
+ <div class="step-marker">2</div>
77
+ <span class="step-text">{labels.step2 || "Read the Hz frequency, ticks per second, and the impact of a lost tick."}</span>
78
+ </div>
79
+ </div>
80
+
81
+ <div class="tip-row">
82
+ <svg class="tip-icon" viewBox="0 0 24 24" width="16" height="16">
83
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" fill="currentColor" />
84
+ </svg>
85
+ <span class="tip-text">{labels.tipContent || "Higher beat rates (36,000 vph) give smoother hand sweep and better precision, but also more wear on the escapement."}</span>
86
+ </div>
87
+ </div>
@@ -0,0 +1,42 @@
1
+ import type { ChronoToolEntry, ToolLocaleContent } from '../../types';
2
+
3
+ export type BeatRateConverterUI = {
4
+ title: string;
5
+ vphLabel: string;
6
+ selectMovement: string;
7
+ customMovement: string;
8
+ customVph: string;
9
+ resultsTitle: string;
10
+ frequency: string;
11
+ ticksPerSec: string;
12
+ lostTickImpact: string;
13
+ lostTickExplainer: string;
14
+ step1: string;
15
+ step2: string;
16
+ tipTitle: string;
17
+ tipContent: string;
18
+ };
19
+
20
+ export type BeatRateConverterLocaleContent = ToolLocaleContent<BeatRateConverterUI>;
21
+
22
+ export const beatRateConverter: ChronoToolEntry<BeatRateConverterUI> = {
23
+ id: 'beat-rate-converter',
24
+ icons: { bg: 'mdi:tune-variant', fg: 'mdi:sine-wave' },
25
+ i18n: {
26
+ de: () => import('./i18n/de').then((m) => m.content),
27
+ en: () => import('./i18n/en').then((m) => m.content),
28
+ es: () => import('./i18n/es').then((m) => m.content),
29
+ fr: () => import('./i18n/fr').then((m) => m.content),
30
+ id: () => import('./i18n/id').then((m) => m.content),
31
+ it: () => import('./i18n/it').then((m) => m.content),
32
+ ja: () => import('./i18n/ja').then((m) => m.content),
33
+ ko: () => import('./i18n/ko').then((m) => m.content),
34
+ nl: () => import('./i18n/nl').then((m) => m.content),
35
+ pl: () => import('./i18n/pl').then((m) => m.content),
36
+ pt: () => import('./i18n/pt').then((m) => m.content),
37
+ ru: () => import('./i18n/ru').then((m) => m.content),
38
+ sv: () => import('./i18n/sv').then((m) => m.content),
39
+ tr: () => import('./i18n/tr').then((m) => m.content),
40
+ zh: () => import('./i18n/zh').then((m) => m.content),
41
+ },
42
+ };