@jjlmoya/utils-science 1.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 (73) hide show
  1. package/package.json +64 -0
  2. package/src/category/i18n/en.ts +97 -0
  3. package/src/category/i18n/es.ts +97 -0
  4. package/src/category/i18n/fr.ts +96 -0
  5. package/src/category/index.ts +17 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +24 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +146 -0
  14. package/src/pages/[locale].astro +251 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/faq_count.test.ts +19 -0
  17. package/src/tests/locale_completeness.test.ts +42 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/no_h1_in_components.test.ts +48 -0
  20. package/src/tests/seo_length.test.ts +22 -0
  21. package/src/tests/tool_validation.test.ts +17 -0
  22. package/src/tool/asteroid-impact/AsteroidImpact.css +799 -0
  23. package/src/tool/asteroid-impact/bibliography.astro +14 -0
  24. package/src/tool/asteroid-impact/component.astro +436 -0
  25. package/src/tool/asteroid-impact/constants.ts +67 -0
  26. package/src/tool/asteroid-impact/helpers.ts +17 -0
  27. package/src/tool/asteroid-impact/i18n/en.ts +153 -0
  28. package/src/tool/asteroid-impact/i18n/es.ts +153 -0
  29. package/src/tool/asteroid-impact/i18n/fr.ts +153 -0
  30. package/src/tool/asteroid-impact/index.ts +24 -0
  31. package/src/tool/asteroid-impact/logic/impactPhysics.ts +86 -0
  32. package/src/tool/asteroid-impact/script.ts +256 -0
  33. package/src/tool/asteroid-impact/seo.astro +15 -0
  34. package/src/tool/asteroid-impact/ui-helpers.ts +56 -0
  35. package/src/tool/asteroid-impact/ui.ts +69 -0
  36. package/src/tool/asteroid-impact/utils.ts +17 -0
  37. package/src/tool/cellular-renewal/CellularRenewal.css +1 -0
  38. package/src/tool/cellular-renewal/bibliography.astro +14 -0
  39. package/src/tool/cellular-renewal/component.astro +387 -0
  40. package/src/tool/cellular-renewal/i18n/en.ts +170 -0
  41. package/src/tool/cellular-renewal/i18n/es.ts +170 -0
  42. package/src/tool/cellular-renewal/i18n/fr.ts +170 -0
  43. package/src/tool/cellular-renewal/index.ts +24 -0
  44. package/src/tool/cellular-renewal/logic/CellularRenewalEngine.ts +50 -0
  45. package/src/tool/cellular-renewal/seo.astro +14 -0
  46. package/src/tool/colony-counter/ColonyCounter.css +473 -0
  47. package/src/tool/colony-counter/bibliography.astro +14 -0
  48. package/src/tool/colony-counter/component.astro +358 -0
  49. package/src/tool/colony-counter/i18n/en.ts +151 -0
  50. package/src/tool/colony-counter/i18n/es.ts +151 -0
  51. package/src/tool/colony-counter/i18n/fr.ts +151 -0
  52. package/src/tool/colony-counter/index.ts +27 -0
  53. package/src/tool/colony-counter/seo.astro +15 -0
  54. package/src/tool/microwave-detector/MicrowaveDetector.css +122 -0
  55. package/src/tool/microwave-detector/bibliography.astro +14 -0
  56. package/src/tool/microwave-detector/component.astro +650 -0
  57. package/src/tool/microwave-detector/i18n/en.ts +155 -0
  58. package/src/tool/microwave-detector/i18n/es.ts +155 -0
  59. package/src/tool/microwave-detector/i18n/fr.ts +155 -0
  60. package/src/tool/microwave-detector/index.ts +24 -0
  61. package/src/tool/microwave-detector/logic/MicrowaveEngine.ts +89 -0
  62. package/src/tool/microwave-detector/seo.astro +14 -0
  63. package/src/tool/simulation-probability/SimulationProbability.css +1 -0
  64. package/src/tool/simulation-probability/bibliography.astro +14 -0
  65. package/src/tool/simulation-probability/component.astro +348 -0
  66. package/src/tool/simulation-probability/i18n/en.ts +184 -0
  67. package/src/tool/simulation-probability/i18n/es.ts +184 -0
  68. package/src/tool/simulation-probability/i18n/fr.ts +184 -0
  69. package/src/tool/simulation-probability/index.ts +24 -0
  70. package/src/tool/simulation-probability/logic/SimulationEngine.ts +42 -0
  71. package/src/tool/simulation-probability/seo.astro +14 -0
  72. package/src/tools.ts +15 -0
  73. package/src/types.ts +72 -0
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@jjlmoya/utils-science",
3
+ "version": "1.1.0",
4
+ "type": "module",
5
+ "main": "./src/index.ts",
6
+ "types": "./src/index.ts",
7
+ "exports": {
8
+ ".": "./src/index.ts",
9
+ "./data": "./src/data.ts"
10
+ },
11
+ "files": [
12
+ "src"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "dev": "astro dev",
19
+ "start": "astro dev",
20
+ "build": "astro build",
21
+ "preview": "astro preview",
22
+ "astro": "astro",
23
+ "lint": "eslint src/ --max-warnings 0 && stylelint \"src/**/*.{css,astro}\"",
24
+ "check": "astro check",
25
+ "type-check": "astro check",
26
+ "test": "vitest run",
27
+ "preversion": "npm run lint && npm run test",
28
+ "postversion": "git push && git push --tags",
29
+ "patch": "npm version patch",
30
+ "minor": "npm version minor",
31
+ "major": "npm version major"
32
+ },
33
+ "lint-staged": {
34
+ "*.{ts,tsx,astro}": [
35
+ "eslint --fix"
36
+ ]
37
+ },
38
+ "dependencies": {
39
+ "@iconify-json/mdi": "^1.2.3",
40
+ "@jjlmoya/utils-shared": "1.0.2",
41
+ "astro": "^6.1.2",
42
+ "astro-icon": "^1.1.0"
43
+ },
44
+ "peerDependencies": {
45
+ "leaflet": "^1.9.4"
46
+ },
47
+ "devDependencies": {
48
+ "@astrojs/check": "^0.9.8",
49
+ "eslint": "^9.39.4",
50
+ "eslint-plugin-astro": "^1.6.0",
51
+ "eslint-plugin-no-comments": "^1.1.10",
52
+ "husky": "^9.1.7",
53
+ "leaflet": "^1.9.4",
54
+ "lint-staged": "^16.4.0",
55
+ "postcss-html": "^1.8.1",
56
+ "schema-dts": "^1.1.2",
57
+ "stylelint": "^17.6.0",
58
+ "stylelint-config-standard": "^40.0.0",
59
+ "stylelint-declaration-strict-value": "^1.11.1",
60
+ "typescript": "^5.4.0",
61
+ "typescript-eslint": "^8.58.0",
62
+ "vitest": "^4.1.2"
63
+ }
64
+ }
@@ -0,0 +1,97 @@
1
+ import type { CategoryLocaleContent } from '../../types';
2
+
3
+ export const content: CategoryLocaleContent = {
4
+ slug: 'science',
5
+ title: 'Interactive Scientific Tools and Simulators',
6
+ description: 'Explore science with free online tools. Asteroid impact simulators, bacterial colony counting, simulation probability, and cellular renewal calculators.',
7
+ seo: [
8
+ {
9
+ type: 'title',
10
+ text: 'Scientific Exploration and Simulation: Science in Your Hands',
11
+ level: 2,
12
+ },
13
+ {
14
+ type: 'paragraph',
15
+ html: '<p>Science is not merely a static body of knowledge, but a dynamic process of exploration and experimentation. In this section, we offer free online tools designed to bring complex scientific concepts to any user through simulation and data analysis. From microbiology to astrophysics, our utilities apply mathematical models and physical theories to offer you an interactive perspective of the universe.</p><p>Whether you need to count colony-forming units in a laboratory or want to estimate the probability that we live in a virtual environment, our calculators provide technical rigor with an interface designed for curiosity.</p>',
16
+ },
17
+ {
18
+ type: 'title',
19
+ text: 'Astrophysics and Cosmic Risk: The Impact of Asteroids',
20
+ level: 2,
21
+ },
22
+ {
23
+ type: 'paragraph',
24
+ html: '<p>The cosmos is vast and, at times, violent. Our asteroid impact simulator uses terminal ballistics and atmospheric physics equations to calculate the effects of a cosmic collision on Earth. It analyzes crater size, shockwave, and thermal radiation emitted to understand the real risks posed by near-Earth objects (NEOs).</p>',
25
+ },
26
+ {
27
+ type: 'title',
28
+ text: 'Microbiology and Digital Laboratory Analysis',
29
+ level: 2,
30
+ },
31
+ {
32
+ type: 'paragraph',
33
+ html: '<p>Laboratory work requires precision and efficiency. The digital colony counter facilitates counting CFU (Colony-Forming Units) on Petri dishes, helping to minimize human error and accelerate bacterial analysis processes through a touch-based marking interface.</p>',
34
+ },
35
+ {
36
+ type: 'title',
37
+ text: 'Human Biology and Atomic Renewal',
38
+ level: 2,
39
+ },
40
+ {
41
+ type: 'paragraph',
42
+ html: '<p>You are not the same as you were seven years ago. The cellular renewal calculator estimates the rate of atom and cell turnover in your body based on the latest research in molecular biology. It\'s a fascinating tool for understanding the fluid nature of our biological identity.</p>',
43
+ },
44
+ {
45
+ type: 'title',
46
+ text: 'Analytical Philosophy and Simulation Probability',
47
+ level: 2,
48
+ },
49
+ {
50
+ type: 'paragraph',
51
+ html: '<p>Are there boundaries between reality and computation? Based on Nick Bostrom\'s trilemma, our simulation probability calculator allows you to adjust computing capacity and civilization survival variables to estimate the statistical likelihood that our reality is artificial.</p>',
52
+ },
53
+ {
54
+ type: 'title',
55
+ text: 'Domestic Physics and Interference Detection',
56
+ level: 2,
57
+ },
58
+ {
59
+ type: 'paragraph',
60
+ html: '<p>Science is also in your kitchen. The microwave detector uses WiFi signal intensity to monitor potential radiofrequency (RF) leaks from appliances, applying electromagnetic wave interference principles.</p>',
61
+ },
62
+ {
63
+ type: 'title',
64
+ text: 'Key Features',
65
+ level: 2,
66
+ },
67
+ {
68
+ type: 'summary',
69
+ title: 'What defines us:',
70
+ items: [
71
+ 'Mathematical Modeling: Simulations based on real physical laws (gravitation, thermodynamics, ballistics).',
72
+ 'Interactive Education: Tools designed for students and enthusiasts to experiment with scientific variables.',
73
+ 'Technical Rigor: Data and formulas extracted from scientific publications and academic databases.',
74
+ 'Scientific Data Privacy: All calculation and simulation processes run locally to ensure your research security.',
75
+ ],
76
+ },
77
+ {
78
+ type: 'title',
79
+ text: 'Note on Scientific Simulation',
80
+ level: 3,
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: '<p><strong>Theoretical Foundation:</strong> Although our simulators (such as the asteroid impact one) use precise physical equations, results should be taken as educational estimates. Real systems are chaotic and can be influenced by atmospheric and geological variables not modeled in this simplified version.</p>',
85
+ },
86
+ {
87
+ type: 'title',
88
+ text: 'Towards the Democratization of Science',
89
+ level: 2,
90
+ },
91
+ {
92
+ type: 'paragraph',
93
+ html: '<p>Citizen Science is stronger than ever. Having access to professional-level simulation tools allows anyone to validate theories or conduct their own thought experiments. These utilities break down the walls of the traditional laboratory and bring the scientific method directly to your screen. Scientific education shifts from passive (reading a book) to active (digitally experimenting with the forces of the universe).</p>',
94
+ },
95
+ ],
96
+ };
97
+
@@ -0,0 +1,97 @@
1
+ import type { CategoryLocaleContent } from '../../types';
2
+
3
+ export const content: CategoryLocaleContent = {
4
+ slug: 'ciencia',
5
+ title: 'Herramientas y Simuladores Científicos Interactivos',
6
+ description: 'Explora la ciencia con herramientas gratuitas online. Simuladores de impacto de asteroides, conteo de colonias bacterianas, probabilidad de simulación y renovación celular.',
7
+ seo: [
8
+ {
9
+ type: 'title',
10
+ text: 'Exploración Científica y Simulación: La Ciencia en tus Manos',
11
+ level: 2,
12
+ },
13
+ {
14
+ type: 'paragraph',
15
+ html: '<p>La ciencia no es solo un conjunto de conocimientos estáticos, sino un proceso dinámico de exploración y experimentación. En esta sección, ofrecemos herramientas gratuitas online diseñadas para acercar conceptos científicos complejos a cualquier usuario mediante la simulación y el análisis de datos. Desde la microbiología hasta la astrofísica, nuestras utilidades aplican modelos matemáticos y teorías físicas para ofrecerte una perspectiva interactiva del universo.</p><p>Ya sea que necesites contar unidades formadoras de colonias en un laboratorio o quieras estimar las probabilidades de que vivamos en un entorno virtual, nuestras calculadoras proporcionan rigor técnico con una interfaz diseñada para la curiosidad.</p>',
16
+ },
17
+ {
18
+ type: 'title',
19
+ text: 'Astrofísica y Riesgo Cósmico: El Impacto de Asteroides',
20
+ level: 2,
21
+ },
22
+ {
23
+ type: 'paragraph',
24
+ html: '<p>El cosmos es vasto y, en ocasiones, violento. Nuestro simulador de impacto de asteroides utiliza ecuaciones de balística terminal y física atmosférica para calcular los efectos de una colisión cósmica sobre la Tierra. Analiza el tamaño del cráter, la onda de choque y la radiación térmica emitida para entender los riesgos reales representados por los objetos cercanos a la Tierra (NEOs).</p>',
25
+ },
26
+ {
27
+ type: 'title',
28
+ text: 'Microbiología y Análisis de Laboratorio Digital',
29
+ level: 2,
30
+ },
31
+ {
32
+ type: 'paragraph',
33
+ html: '<p>El trabajo de laboratorio requiere precisión y eficiencia. El contador de colonias digital facilita el conteo de UFC (Unidades Formadoras de Colonias) en placas de Petri, ayudando a minimizar el error humano y acelerar los procesos de análisis bacteriológico mediante una interfaz de marcaje táctil.</p>',
34
+ },
35
+ {
36
+ type: 'title',
37
+ text: 'Biología Humana y Renovación Atómica',
38
+ level: 2,
39
+ },
40
+ {
41
+ type: 'paragraph',
42
+ html: '<p>Tu cuerpo no es el mismo que hace siete años. La calculadora de renovación celular estima la tasa de recambio de tus átomos y células según las investigaciones más recientes en biología molecular. Es una herramienta fascinante para entender la naturaleza fluida de nuestra identidad biológica.</p>',
43
+ },
44
+ {
45
+ type: 'title',
46
+ text: 'Filosofía Analítica y Probabilidad de Simulación',
47
+ level: 2,
48
+ },
49
+ {
50
+ type: 'paragraph',
51
+ html: '<p>¿Existen límites entre la realidad y la computación? Basándonos en el trilema de Nick Bostrom, nuestra calculadora de probabilidad de simulación permite ajustar las variables de capacidad de computación y supervivencia de civilizaciones para estimar las posibilidades estadísticas de que nuestra realidad sea artificial.</p>',
52
+ },
53
+ {
54
+ type: 'title',
55
+ text: 'Física Doméstica y Detección de Interferencias',
56
+ level: 2,
57
+ },
58
+ {
59
+ type: 'paragraph',
60
+ html: '<p>La ciencia también está en tu cocina. El detector de microondas utiliza la intensidad de la señal WiFi para monitorizar posibles fugas de radiofrecuencia (RF) de electrodomésticos, aplicando principios de interferencia de ondas electromagnéticas.</p>',
61
+ },
62
+ {
63
+ type: 'title',
64
+ text: 'Características Clave',
65
+ level: 2,
66
+ },
67
+ {
68
+ type: 'summary',
69
+ title: 'Lo que nos define:',
70
+ items: [
71
+ 'Modelado Matemático: Simulaciones basadas en leyes físicas reales (gravitación, termodinámica, balística).',
72
+ 'Educación Interactiva: Herramientas diseñadas para que estudiantes y entusiastas experimenten con variables científicas.',
73
+ 'Rigor Técnico: Datos y fórmulas extraídos de publicaciones científicas y bases de datos académicas.',
74
+ 'Privacidad de Datos Científicos: Todos los procesos de cálculo y simulación se ejecutan en local para garantizar la seguridad de tu investigación.',
75
+ ],
76
+ },
77
+ {
78
+ type: 'title',
79
+ text: 'Nota sobre la Simulación Científica',
80
+ level: 3,
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: '<p><strong>Fundamento Teórico:</strong> Aunque nuestros simuladores (como el de impacto de asteroides) utilizan ecuaciones físicas precisas, los resultados deben tomarse como estimaciones educativas. Los sistemas reales son caóticos y pueden verse influenciados por variables atmosféricas y geológicas no modeladas en esta versión simplificada.</p>',
85
+ },
86
+ {
87
+ type: 'title',
88
+ text: 'Hacia la democratización de la ciencia',
89
+ level: 2,
90
+ },
91
+ {
92
+ type: 'paragraph',
93
+ html: '<p>La Ciencia Ciudadana es más fuerte que nunca. Tener acceso a herramientas de simulación de nivel profesional permite que cualquier persona pueda validar teorías o realizar sus propios experimentos mentales. Estas utilidades rompen las paredes del laboratorio tradicional y llevan el método científico directamente a tu pantalla. La educación científica deja de ser pasiva (leer un libro) y se convierte en activa (experimentar digitalmente con las fuerzas del universo).</p>',
94
+ },
95
+ ],
96
+ };
97
+
@@ -0,0 +1,96 @@
1
+ import type { CategoryLocaleContent } from '../../types';
2
+
3
+ export const content: CategoryLocaleContent = {
4
+ slug: 'science',
5
+ title: 'Outils et Simulateurs Scientifiques Interactifs',
6
+ description: 'Explorez la science avec des outils gratuits en ligne. Simulateurs d\'impacts d\'astéroïdes, comptage de colonies bactériennes, probabilité de simulation et calculatrices de renouvellement cellulaire.',
7
+ seo: [
8
+ {
9
+ type: 'title',
10
+ text: 'Exploration Scientifique et Simulation : La Science Entre vos Mains',
11
+ level: 2,
12
+ },
13
+ {
14
+ type: 'paragraph',
15
+ html: '<p>La science n\'est pas simplement un ensemble statique de connaissances, mais un processus dynamique d\'exploration et d\'expérimentation. Dans cette section, nous offrons des outils gratuits en ligne conçus pour rendre les concepts scientifiques complexes accessibles à tous grâce à la simulation et l\'analyse de données. De la microbiologie à l\'astrophysique, nos utilitaires appliquent des modèles mathématiques et des théories physiques pour vous offrir une perspective interactive de l\'univers.</p><p>Que vous ayez besoin de compter les unités formant colonies dans un laboratoire ou que vous souhaitiez estimer les probabilités que nous vivions dans un environnement virtuel, nos calculatrices fournissent une rigueur technique avec une interface conçue pour la curiosité.</p>',
16
+ },
17
+ {
18
+ type: 'title',
19
+ text: 'Astrophysique et Risque Cosmique : L\'Impact des Astéroïdes',
20
+ level: 2,
21
+ },
22
+ {
23
+ type: 'paragraph',
24
+ html: '<p>Le cosmos est vaste et, parfois, violent. Notre simulateur d\'impact d\'astéroïde utilise les équations de balistique terminale et de physique atmosphérique pour calculer les effets d\'une collision cosmique sur la Terre. Il analyse la taille du cratère, l\'onde de choc et le rayonnement thermique émis pour comprendre les risques réels représentés par les objets géocroiseurs (NEO).</p>',
25
+ },
26
+ {
27
+ type: 'title',
28
+ text: 'Microbiologie et Analyse de Laboratoire Numérique',
29
+ level: 2,
30
+ },
31
+ {
32
+ type: 'paragraph',
33
+ html: '<p>Le travail de laboratoire exige précision et efficacité. Le compteur de colonies numérique facilite le comptage des UFC (Unités Formant Colonies) sur les boîtes de Pétri, contribuant à minimiser l\'erreur humaine et à accélérer les processus d\'analyse bactériologique par une interface de marquage tactile.</p>',
34
+ },
35
+ {
36
+ type: 'title',
37
+ text: 'Biologie Humaine et Renouvellement Atomique',
38
+ level: 2,
39
+ },
40
+ {
41
+ type: 'paragraph',
42
+ html: '<p>Vous n\'êtes pas le même qu\'il y a sept ans. La calculatrice de renouvellement cellulaire estime le taux de renouvellement des atomes et des cellules de votre corps selon les dernières recherches en biologie moléculaire. C\'est un outil fascinant pour comprendre la nature fluide de notre identité biologique.</p>',
43
+ },
44
+ {
45
+ type: 'title',
46
+ text: 'Philosophie Analytique et Probabilité de Simulation',
47
+ level: 2,
48
+ },
49
+ {
50
+ type: 'paragraph',
51
+ html: '<p>Y a-t-il des frontières entre la réalité et le calcul ? Sur la base du trilemme de Nick Bostrom, notre calculatrice de probabilité de simulation vous permet d\'ajuster les variables de capacité informatique et de survie des civilisations pour estimer les probabilités statistiques que notre réalité soit artificielle.</p>',
52
+ },
53
+ {
54
+ type: 'title',
55
+ text: 'Physique Domestique et Détection d\'Interférences',
56
+ level: 2,
57
+ },
58
+ {
59
+ type: 'paragraph',
60
+ html: '<p>La science est aussi dans votre cuisine. Le détecteur de micro-ondes utilise l\'intensité du signal WiFi pour surveiller les fuites possibles de radiofréquence (RF) des appareils électroménagers, en appliquant les principes d\'interférence des ondes électromagnétiques.</p>',
61
+ },
62
+ {
63
+ type: 'title',
64
+ text: 'Caractéristiques Clés',
65
+ level: 2,
66
+ },
67
+ {
68
+ type: 'summary',
69
+ title: 'Ce qui nous définit :',
70
+ items: [
71
+ 'Modélisation Mathématique : Simulations basées sur des lois physiques réelles (gravitation, thermodynamique, balistique).',
72
+ 'Éducation Interactif : Outils conçus pour que les étudiants et les passionnés expérimentent avec des variables scientifiques.',
73
+ 'Rigueur Technique : Données et formules extraites de publications scientifiques et de bases de données académiques.',
74
+ 'Confidentialité des Données Scientifiques : Tous les processus de calcul et de simulation s\'exécutent localement pour garantir la sécurité de votre recherche.',
75
+ ],
76
+ },
77
+ {
78
+ type: 'title',
79
+ text: 'Remarque sur la Simulation Scientifique',
80
+ level: 3,
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: '<p><strong>Fondement Théorique :</strong> Bien que nos simulateurs (comme celui d\'impact d\'astéroïde) utilisent des équations physiques précises, les résultats doivent être considérés comme des estimations éducatives. Les systèmes réels sont chaotiques et peuvent être influencés par des variables atmosphériques et géologiques non modélisées dans cette version simplifiée.</p>',
85
+ },
86
+ {
87
+ type: 'title',
88
+ text: 'Vers la Démocratisation de la Science',
89
+ level: 2,
90
+ },
91
+ {
92
+ type: 'paragraph',
93
+ html: '<p>La Science Citoyenne est plus forte que jamais. Avoir accès à des outils de simulation de niveau professionnel permet à chacun de valider des théories ou de mener ses propres expériences mentales. Ces utilitaires abattent les murs du laboratoire traditionnel et apportent la méthode scientifique directement à votre écran. L\'éducation scientifique passe de passive (lire un livre) à active (expérimenter numériquement avec les forces de l\'univers).</p>',
94
+ },
95
+ ],
96
+ };
@@ -0,0 +1,17 @@
1
+ import type { ScienceCategoryEntry } from '../types';
2
+ import { colonyCounter } from '../tool/colony-counter/index';
3
+ import { asteroidImpact } from '../tool/asteroid-impact/index';
4
+ import { microwaveDetector } from '../tool/microwave-detector/index';
5
+ import { simulationProbability } from '../tool/simulation-probability/index';
6
+ import { cellularRenewal } from '../tool/cellular-renewal/index';
7
+
8
+ export const scienceCategory: ScienceCategoryEntry = {
9
+ icon: 'mdi:flask',
10
+ tools: [colonyCounter, asteroidImpact, microwaveDetector, simulationProbability, cellularRenewal],
11
+ i18n: {
12
+ es: () => import('./i18n/es').then((m) => m.content),
13
+ en: () => import('./i18n/en').then((m) => m.content),
14
+ fr: () => import('./i18n/fr').then((m) => m.content),
15
+ },
16
+ };
17
+
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { scienceCategory } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await scienceCategory.i18n[locale]?.();
12
+ if (!content) return null;
13
+ ---
14
+
15
+ <SEORenderer content={{ sections: content.seo, locale }} />
@@ -0,0 +1,116 @@
1
+ ---
2
+ interface NavItem {
3
+ id: string;
4
+ title: string;
5
+ href: string;
6
+ isActive?: boolean;
7
+ }
8
+
9
+ interface Props {
10
+ categoryTitle: string;
11
+ tools?: NavItem[];
12
+ }
13
+
14
+ const { categoryTitle, tools = [] } = Astro.props;
15
+ ---
16
+
17
+ <nav class="preview-nav-sidebar">
18
+ <div class="sidebar-header">
19
+ <h3>{categoryTitle}</h3>
20
+ </div>
21
+
22
+ <ul class="tools-list">
23
+ {tools.map((tool) => (
24
+ <li>
25
+ <a
26
+ href={tool.href}
27
+ class:list={['tool-link', { active: tool.isActive }]}
28
+ >
29
+ <span class="tool-title">{tool.title}</span>
30
+ </a>
31
+ </li>
32
+ ))}
33
+ </ul>
34
+ </nav>
35
+
36
+ <style>
37
+ .preview-nav-sidebar {
38
+ display: flex;
39
+ flex-direction: column;
40
+ height: 100%;
41
+ background: var(--bg-surface, #0f172a);
42
+ }
43
+
44
+ .sidebar-header {
45
+ padding: 2rem 1.5rem 1.5rem;
46
+ border-bottom: 1px solid var(--border-color, #1e293b);
47
+ }
48
+
49
+ .sidebar-header h3 {
50
+ margin: 0;
51
+ font-size: 0.75rem;
52
+ font-weight: 900;
53
+ text-transform: uppercase;
54
+ letter-spacing: 0.1em;
55
+ color: var(--text-muted, #94a3b8);
56
+ }
57
+
58
+ .tools-list {
59
+ list-style: none;
60
+ margin: 0;
61
+ padding: 0.5rem 0;
62
+ display: flex;
63
+ flex-direction: column;
64
+ gap: 0.25rem;
65
+ }
66
+
67
+ .tools-list li {
68
+ margin: 0;
69
+ }
70
+
71
+ .tool-link {
72
+ display: flex;
73
+ align-items: center;
74
+ padding: 0.75rem 1.5rem;
75
+ color: var(--text-muted, #94a3b8);
76
+ text-decoration: none;
77
+ font-size: 0.9375rem;
78
+ font-weight: 500;
79
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
80
+ border-left: 3px solid transparent;
81
+ position: relative;
82
+ }
83
+
84
+ .tool-link:hover {
85
+ color: var(--text-base, #f1f5f9);
86
+ background: rgba(255, 255, 255, 0.08);
87
+ padding-left: 1.75rem;
88
+ }
89
+
90
+ .tool-link.active {
91
+ color: var(--accent, #f43f5e);
92
+ background: rgba(244, 63, 94, 0.15);
93
+ border-left-color: var(--accent, #f43f5e);
94
+ font-weight: 600;
95
+ }
96
+
97
+ .tool-link.active::before {
98
+ content: '';
99
+ position: absolute;
100
+ left: 0;
101
+ top: 50%;
102
+ transform: translateY(-50%);
103
+ width: 3px;
104
+ height: 24px;
105
+ background: var(--accent, #f43f5e);
106
+ border-radius: 0 2px 2px 0;
107
+ }
108
+
109
+ .tool-title {
110
+ display: block;
111
+ overflow: hidden;
112
+ text-overflow: ellipsis;
113
+ white-space: nowrap;
114
+ }
115
+ </style>
116
+
@@ -0,0 +1,143 @@
1
+ ---
2
+ import type { KnownLocale } from '../types';
3
+
4
+ interface Props {
5
+ currentLocale: KnownLocale;
6
+ localeUrls?: Partial<Record<KnownLocale, string>>;
7
+ }
8
+
9
+ const { currentLocale, localeUrls = {} } = Astro.props;
10
+
11
+ const otherLocales = Object.entries(localeUrls).filter(([l]) => l !== currentLocale) as [
12
+ KnownLocale,
13
+ string,
14
+ ][];
15
+ ---
16
+
17
+ <nav class="preview-toolbar">
18
+ {
19
+ otherLocales.length > 0 && (
20
+ <div class="locale-group">
21
+ <span class="locale-current">{currentLocale.toUpperCase()}</span>
22
+ {otherLocales.map(([locale, url]) => (
23
+ <a href={url} class="btn-locale">
24
+ {locale.toUpperCase()}
25
+ </a>
26
+ ))}
27
+ </div>
28
+ )
29
+ }
30
+
31
+ <button id="theme-toggle" class="btn-theme" aria-label="Toggle theme" title="Toggle theme">
32
+ <span class="theme-icon"></span>
33
+ </button>
34
+ </nav>
35
+
36
+ <script>
37
+ function initToolbar() {
38
+ const btn = document.getElementById('theme-toggle');
39
+ if (!btn) return;
40
+
41
+ const applyTheme = (theme: string) => {
42
+ document.documentElement.classList.remove('theme-light', 'theme-dark');
43
+ document.documentElement.classList.add(theme);
44
+ localStorage.setItem('theme', theme);
45
+ };
46
+
47
+ btn.addEventListener('click', () => {
48
+ const next = document.documentElement.classList.contains('theme-dark')
49
+ ? 'theme-light'
50
+ : 'theme-dark';
51
+ applyTheme(next);
52
+ });
53
+ }
54
+
55
+ initToolbar();
56
+ document.addEventListener('astro:after-swap', initToolbar);
57
+ </script>
58
+
59
+ <style>
60
+ .preview-toolbar {
61
+ position: fixed;
62
+ top: 1rem;
63
+ right: 1.5rem;
64
+ display: flex;
65
+ align-items: center;
66
+ gap: 0.5rem;
67
+ z-index: 1000;
68
+ background: var(--bg-surface);
69
+ padding: 0.4rem;
70
+ border-radius: 1rem;
71
+ border: 1px solid var(--border-color);
72
+ backdrop-filter: blur(12px);
73
+ }
74
+
75
+ .locale-group {
76
+ display: flex;
77
+ align-items: center;
78
+ gap: 0.25rem;
79
+ padding-right: 0.5rem;
80
+ border-right: 1px solid var(--border-color);
81
+ }
82
+
83
+ .locale-current {
84
+ font-size: 0.7rem;
85
+ font-weight: 900;
86
+ color: var(--text-muted);
87
+ padding: 0.4rem 0.6rem;
88
+ letter-spacing: 0.08em;
89
+ }
90
+
91
+ .btn-locale {
92
+ background: transparent;
93
+ border: 1px solid var(--border-color);
94
+ color: var(--text-main);
95
+ cursor: pointer;
96
+ padding: 0.4rem 0.7rem;
97
+ border-radius: 0.5rem;
98
+ font-weight: 700;
99
+ font-size: 0.7rem;
100
+ text-decoration: none;
101
+ letter-spacing: 0.08em;
102
+ transition: all 0.2s ease;
103
+ }
104
+
105
+ .btn-locale:hover {
106
+ border-color: var(--accent);
107
+ color: var(--accent);
108
+ }
109
+
110
+ .btn-theme {
111
+ background: transparent;
112
+ border: none;
113
+ cursor: pointer;
114
+ padding: 0.5rem;
115
+ border-radius: 0.6rem;
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: center;
119
+ transition: background 0.2s ease;
120
+ }
121
+
122
+ .btn-theme:hover {
123
+ background: rgba(255, 255, 255, 0.08);
124
+ }
125
+
126
+ .theme-icon {
127
+ display: block;
128
+ width: 16px;
129
+ height: 16px;
130
+ border-radius: 50%;
131
+ }
132
+
133
+ :global(.theme-light) .theme-icon {
134
+ background: #f59e0b;
135
+ box-shadow: 0 0 8px #fbbf24;
136
+ }
137
+
138
+ :global(.theme-dark) .theme-icon {
139
+ background: #94a3b8;
140
+ box-shadow: inset -4px -2px 0 #1e293b;
141
+ }
142
+ </style>
143
+
package/src/data.ts ADDED
@@ -0,0 +1,11 @@
1
+ export { scienceCategory } from './category';
2
+
3
+ export type {
4
+ KnownLocale,
5
+ ToolLocaleContent,
6
+ CategoryLocaleContent,
7
+ LocaleMap,
8
+ ScienceToolEntry,
9
+ ScienceCategoryEntry,
10
+ } from './types';
11
+
package/src/env.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ declare module '*.astro' {
2
+ const Component: (_props: Record<string, unknown>) => unknown;
3
+ export default Component;
4
+ }
5
+