@jjlmoya/utils-science 1.50.0 → 1.52.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.
- package/package.json +2 -2
- package/src/category/i18n/es.ts +3 -4
- package/src/category/i18n/fr.ts +2 -2
- package/src/category/i18n/it.ts +2 -2
- package/src/category/i18n/pt.ts +2 -2
- package/src/category/index.ts +25 -25
- package/src/components/PreviewNavSidebar.astro +1 -1
- package/src/components/PreviewToolbar.astro +1 -1
- package/src/data.ts +1 -1
- package/src/env.d.ts +1 -1
- package/src/layouts/PreviewLayout.astro +1 -1
- package/src/pages/index.astro +1 -1
- package/src/tests/bibliography_wellformed_export.test.ts +46 -0
- package/src/tests/category_seo_quality.test.ts +76 -0
- package/src/tests/faq_count.test.ts +19 -19
- package/src/tests/i18n_coverage.test.ts +36 -36
- package/src/tests/mocks/astro_mock.js +1 -1
- package/src/tests/no_h1_in_components.test.ts +1 -1
- package/src/tests/script_density.test.ts +94 -94
- package/src/tests/seo_length.test.ts +24 -24
- package/src/tests/seo_parity.test.ts +5 -5
- package/src/tests/seo_translation_completeness.test.ts +76 -0
- package/src/tests/seo_wellformed_export.test.ts +65 -0
- package/src/tests/spanish_leakage.test.ts +175 -153
- package/src/tool/asteroid-impact/component.astro +251 -251
- package/src/tool/asteroid-impact/helpers.ts +17 -17
- package/src/tool/asteroid-impact/i18n/de.ts +2 -2
- package/src/tool/asteroid-impact/i18n/en.ts +2 -2
- package/src/tool/asteroid-impact/i18n/es.ts +2 -2
- package/src/tool/asteroid-impact/i18n/fr.ts +2 -2
- package/src/tool/asteroid-impact/i18n/id.ts +2 -2
- package/src/tool/asteroid-impact/i18n/it.ts +2 -2
- package/src/tool/asteroid-impact/i18n/ja.ts +2 -2
- package/src/tool/asteroid-impact/i18n/ko.ts +2 -2
- package/src/tool/asteroid-impact/i18n/nl.ts +2 -2
- package/src/tool/asteroid-impact/i18n/pl.ts +2 -2
- package/src/tool/asteroid-impact/i18n/pt.ts +2 -2
- package/src/tool/asteroid-impact/i18n/ru.ts +2 -2
- package/src/tool/asteroid-impact/i18n/sv.ts +2 -2
- package/src/tool/asteroid-impact/i18n/tr.ts +2 -2
- package/src/tool/asteroid-impact/i18n/zh.ts +2 -2
- package/src/tool/asteroid-impact/script.ts +262 -262
- package/src/tool/asteroid-impact/seo.astro +15 -15
- package/src/tool/asteroid-impact/ui.ts +69 -69
- package/src/tool/black-hole-event-horizon-simulator/i18n/de.ts +249 -241
- package/src/tool/black-hole-event-horizon-simulator/i18n/fr.ts +252 -247
- package/src/tool/black-hole-event-horizon-simulator/i18n/id.ts +259 -259
- package/src/tool/black-hole-event-horizon-simulator/i18n/it.ts +255 -252
- package/src/tool/black-hole-event-horizon-simulator/i18n/ja.ts +254 -252
- package/src/tool/black-hole-event-horizon-simulator/i18n/ko.ts +258 -258
- package/src/tool/black-hole-event-horizon-simulator/i18n/nl.ts +256 -252
- package/src/tool/black-hole-event-horizon-simulator/i18n/pl.ts +258 -258
- package/src/tool/black-hole-event-horizon-simulator/i18n/pt.ts +256 -252
- package/src/tool/black-hole-event-horizon-simulator/i18n/ru.ts +258 -258
- package/src/tool/black-hole-event-horizon-simulator/i18n/sv.ts +257 -252
- package/src/tool/black-hole-event-horizon-simulator/i18n/tr.ts +256 -251
- package/src/tool/black-hole-event-horizon-simulator/i18n/zh.ts +261 -252
- package/src/tool/cellular-renewal/component.astro +126 -126
- package/src/tool/cellular-renewal/i18n/de.ts +1 -1
- package/src/tool/cellular-renewal/i18n/en.ts +1 -1
- package/src/tool/cellular-renewal/i18n/es.ts +1 -1
- package/src/tool/cellular-renewal/i18n/fr.ts +1 -1
- package/src/tool/cellular-renewal/i18n/id.ts +1 -1
- package/src/tool/cellular-renewal/i18n/it.ts +1 -1
- package/src/tool/cellular-renewal/i18n/ja.ts +1 -1
- package/src/tool/cellular-renewal/i18n/ko.ts +1 -1
- package/src/tool/cellular-renewal/i18n/nl.ts +1 -1
- package/src/tool/cellular-renewal/i18n/pl.ts +1 -1
- package/src/tool/cellular-renewal/i18n/pt.ts +1 -1
- package/src/tool/cellular-renewal/i18n/ru.ts +1 -1
- package/src/tool/cellular-renewal/i18n/sv.ts +1 -1
- package/src/tool/cellular-renewal/i18n/tr.ts +1 -1
- package/src/tool/cellular-renewal/i18n/zh.ts +1 -1
- package/src/tool/cellular-renewal/seo.astro +15 -15
- package/src/tool/colony-counter/i18n/de.ts +1 -1
- package/src/tool/colony-counter/i18n/en.ts +1 -1
- package/src/tool/colony-counter/i18n/es.ts +1 -1
- package/src/tool/colony-counter/i18n/fr.ts +1 -1
- package/src/tool/colony-counter/i18n/id.ts +1 -1
- package/src/tool/colony-counter/i18n/it.ts +1 -1
- package/src/tool/colony-counter/i18n/ja.ts +1 -1
- package/src/tool/colony-counter/i18n/ko.ts +1 -1
- package/src/tool/colony-counter/i18n/nl.ts +1 -1
- package/src/tool/colony-counter/i18n/pl.ts +1 -1
- package/src/tool/colony-counter/i18n/pt.ts +1 -1
- package/src/tool/colony-counter/i18n/ru.ts +1 -1
- package/src/tool/colony-counter/i18n/sv.ts +1 -1
- package/src/tool/colony-counter/i18n/tr.ts +1 -1
- package/src/tool/colony-counter/i18n/zh.ts +1 -1
- package/src/tool/colony-counter/seo.astro +15 -15
- package/src/tool/conway-life-rule-lab/component.astro +1 -1
- package/src/tool/conway-life-rule-lab/i18n/de.ts +145 -141
- package/src/tool/conway-life-rule-lab/i18n/es.ts +146 -142
- package/src/tool/conway-life-rule-lab/i18n/fr.ts +146 -142
- package/src/tool/conway-life-rule-lab/i18n/id.ts +146 -145
- package/src/tool/conway-life-rule-lab/i18n/it.ts +146 -145
- package/src/tool/conway-life-rule-lab/i18n/ja.ts +146 -145
- package/src/tool/conway-life-rule-lab/i18n/ko.ts +146 -145
- package/src/tool/conway-life-rule-lab/i18n/nl.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/pl.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/pt.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/ru.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/sv.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/tr.ts +147 -145
- package/src/tool/conway-life-rule-lab/i18n/zh.ts +147 -145
- package/src/tool/conway-life-rule-lab/logic/LifeLabRuntime.ts +2 -2
- package/src/tool/cosmic-inflation/i18n/ru.ts +105 -105
- package/src/tool/crystal-lattice-structure-finder/i18n/de.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/en.ts +1 -1
- package/src/tool/crystal-lattice-structure-finder/i18n/es.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/fr.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/id.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/it.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/ja.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/ko.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/nl.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/pl.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/pt.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/ru.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/sv.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/tr.ts +217 -217
- package/src/tool/crystal-lattice-structure-finder/i18n/zh.ts +217 -217
- package/src/tool/double-slit-decoherence/i18n/de.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/fr.ts +180 -180
- package/src/tool/double-slit-decoherence/i18n/id.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/it.ts +180 -180
- package/src/tool/double-slit-decoherence/i18n/ja.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/ko.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/nl.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/pl.ts +181 -181
- package/src/tool/double-slit-decoherence/i18n/pt.ts +178 -174
- package/src/tool/double-slit-decoherence/i18n/ru.ts +180 -180
- package/src/tool/double-slit-decoherence/i18n/sv.ts +176 -172
- package/src/tool/double-slit-decoherence/i18n/tr.ts +180 -180
- package/src/tool/double-slit-decoherence/i18n/zh.ts +181 -181
- package/src/tool/dyson-sphere-energy-capture/component.astro +253 -253
- package/src/tool/dyson-sphere-energy-capture/i18n/de.ts +194 -194
- package/src/tool/dyson-sphere-energy-capture/i18n/en.ts +6 -6
- package/src/tool/dyson-sphere-energy-capture/i18n/es.ts +6 -6
- package/src/tool/dyson-sphere-energy-capture/i18n/fr.ts +194 -194
- package/src/tool/dyson-sphere-energy-capture/i18n/id.ts +195 -195
- package/src/tool/dyson-sphere-energy-capture/i18n/it.ts +194 -194
- package/src/tool/dyson-sphere-energy-capture/i18n/ja.ts +194 -190
- package/src/tool/dyson-sphere-energy-capture/i18n/ko.ts +194 -193
- package/src/tool/dyson-sphere-energy-capture/i18n/nl.ts +197 -197
- package/src/tool/dyson-sphere-energy-capture/i18n/pl.ts +168 -166
- package/src/tool/dyson-sphere-energy-capture/i18n/pt.ts +194 -193
- package/src/tool/dyson-sphere-energy-capture/i18n/ru.ts +195 -193
- package/src/tool/dyson-sphere-energy-capture/i18n/sv.ts +195 -193
- package/src/tool/dyson-sphere-energy-capture/i18n/tr.ts +168 -166
- package/src/tool/dyson-sphere-energy-capture/i18n/zh.ts +194 -193
- package/src/tool/epidemic-sir-simulator/i18n/de.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/es.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/fr.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/it.ts +346 -346
- package/src/tool/epidemic-sir-simulator/i18n/nl.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/ru.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/sv.ts +347 -347
- package/src/tool/epidemic-sir-simulator/i18n/zh.ts +347 -347
- package/src/tool/exoplanet-biosignature-detector/i18n/de.ts +186 -186
- package/src/tool/exoplanet-biosignature-detector/i18n/en.ts +195 -195
- package/src/tool/exoplanet-biosignature-detector/i18n/es.ts +194 -194
- package/src/tool/exoplanet-biosignature-detector/i18n/fr.ts +183 -183
- package/src/tool/exoplanet-biosignature-detector/i18n/id.ts +193 -193
- package/src/tool/exoplanet-biosignature-detector/i18n/it.ts +194 -194
- package/src/tool/exoplanet-biosignature-detector/i18n/ja.ts +194 -194
- package/src/tool/exoplanet-biosignature-detector/i18n/ko.ts +194 -194
- package/src/tool/exoplanet-biosignature-detector/i18n/nl.ts +194 -194
- package/src/tool/exoplanet-biosignature-detector/i18n/pl.ts +144 -144
- package/src/tool/exoplanet-biosignature-detector/i18n/pt.ts +146 -146
- package/src/tool/exoplanet-biosignature-detector/i18n/ru.ts +143 -143
- package/src/tool/exoplanet-biosignature-detector/i18n/sv.ts +144 -144
- package/src/tool/exoplanet-biosignature-detector/i18n/tr.ts +145 -145
- package/src/tool/exoplanet-biosignature-detector/i18n/zh.ts +194 -194
- package/src/tool/global-albedo-snowball-simulator/component.astro +1 -1
- package/src/tool/global-albedo-snowball-simulator/i18n/de.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/fr.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/id.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/it.ts +87 -87
- package/src/tool/global-albedo-snowball-simulator/i18n/ja.ts +87 -87
- package/src/tool/global-albedo-snowball-simulator/i18n/ko.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/nl.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/pl.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/pt.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/ru.ts +165 -161
- package/src/tool/global-albedo-snowball-simulator/i18n/sv.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/tr.ts +169 -169
- package/src/tool/global-albedo-snowball-simulator/i18n/zh.ts +169 -169
- package/src/tool/lorenz-attractor/i18n/de.ts +144 -143
- package/src/tool/lorenz-attractor/i18n/fr.ts +144 -144
- package/src/tool/lorenz-attractor/i18n/id.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/it.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/ja.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/ko.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/nl.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/pl.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/pt.ts +142 -141
- package/src/tool/lorenz-attractor/i18n/ru.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/sv.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/tr.ts +149 -149
- package/src/tool/lorenz-attractor/i18n/zh.ts +149 -149
- package/src/tool/mandelbrot-fractal/i18n/de.ts +158 -158
- package/src/tool/mandelbrot-fractal/i18n/fr.ts +158 -158
- package/src/tool/mandelbrot-fractal/i18n/id.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/it.ts +155 -151
- package/src/tool/mandelbrot-fractal/i18n/ja.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/ko.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/nl.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/pl.ts +157 -153
- package/src/tool/mandelbrot-fractal/i18n/pt.ts +158 -158
- package/src/tool/mandelbrot-fractal/i18n/ru.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/sv.ts +159 -150
- package/src/tool/mandelbrot-fractal/i18n/tr.ts +159 -159
- package/src/tool/mandelbrot-fractal/i18n/zh.ts +159 -159
- package/src/tool/microwave-detector/component.astro +238 -238
- package/src/tool/microwave-detector/i18n/de.ts +1 -1
- package/src/tool/microwave-detector/i18n/en.ts +1 -1
- package/src/tool/microwave-detector/i18n/es.ts +1 -1
- package/src/tool/microwave-detector/i18n/fr.ts +1 -1
- package/src/tool/microwave-detector/i18n/id.ts +1 -1
- package/src/tool/microwave-detector/i18n/it.ts +1 -1
- package/src/tool/microwave-detector/i18n/ja.ts +1 -1
- package/src/tool/microwave-detector/i18n/ko.ts +1 -1
- package/src/tool/microwave-detector/i18n/nl.ts +1 -1
- package/src/tool/microwave-detector/i18n/pl.ts +1 -1
- package/src/tool/microwave-detector/i18n/pt.ts +1 -1
- package/src/tool/microwave-detector/i18n/ru.ts +1 -1
- package/src/tool/microwave-detector/i18n/sv.ts +1 -1
- package/src/tool/microwave-detector/i18n/tr.ts +1 -1
- package/src/tool/microwave-detector/i18n/zh.ts +1 -1
- package/src/tool/microwave-detector/seo.astro +15 -15
- package/src/tool/natural-selection-drift/component.astro +135 -135
- package/src/tool/natural-selection-drift/i18n/de.ts +164 -160
- package/src/tool/natural-selection-drift/i18n/fr.ts +204 -204
- package/src/tool/natural-selection-drift/i18n/id.ts +156 -154
- package/src/tool/natural-selection-drift/i18n/it.ts +197 -193
- package/src/tool/natural-selection-drift/i18n/ja.ts +155 -154
- package/src/tool/natural-selection-drift/i18n/ko.ts +155 -154
- package/src/tool/natural-selection-drift/i18n/nl.ts +164 -163
- package/src/tool/natural-selection-drift/i18n/pl.ts +168 -166
- package/src/tool/natural-selection-drift/i18n/pt.ts +200 -195
- package/src/tool/natural-selection-drift/i18n/ru.ts +186 -184
- package/src/tool/natural-selection-drift/i18n/sv.ts +157 -154
- package/src/tool/natural-selection-drift/i18n/tr.ts +186 -184
- package/src/tool/natural-selection-drift/i18n/zh.ts +160 -154
- package/src/tool/natural-selection-drift/natural-selection-drift.css +563 -563
- package/src/tool/phase-diagram-critical-points/i18n/de.ts +178 -178
- package/src/tool/phase-diagram-critical-points/i18n/fr.ts +178 -178
- package/src/tool/phase-diagram-critical-points/i18n/id.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/it.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/ja.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/ko.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/nl.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/pl.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/pt.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/ru.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/sv.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/tr.ts +179 -179
- package/src/tool/phase-diagram-critical-points/i18n/zh.ts +179 -179
- package/src/tool/planet-atmosphere-survival/i18n/de.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/fr.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/id.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/it.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/ja.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/ko.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/nl.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/pl.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/pt.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/ru.ts +227 -223
- package/src/tool/planet-atmosphere-survival/i18n/sv.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/tr.ts +255 -255
- package/src/tool/planet-atmosphere-survival/i18n/zh.ts +255 -255
- package/src/tool/radioactive-decay/i18n/de.ts +168 -164
- package/src/tool/radioactive-decay/i18n/fr.ts +76 -75
- package/src/tool/radioactive-decay/i18n/id.ts +169 -165
- package/src/tool/radioactive-decay/i18n/it.ts +76 -74
- package/src/tool/radioactive-decay/i18n/ja.ts +168 -167
- package/src/tool/radioactive-decay/i18n/ko.ts +168 -167
- package/src/tool/radioactive-decay/i18n/nl.ts +170 -168
- package/src/tool/radioactive-decay/i18n/pl.ts +170 -168
- package/src/tool/radioactive-decay/i18n/pt.ts +169 -167
- package/src/tool/radioactive-decay/i18n/ru.ts +170 -168
- package/src/tool/radioactive-decay/i18n/sv.ts +170 -168
- package/src/tool/radioactive-decay/i18n/tr.ts +171 -168
- package/src/tool/radioactive-decay/i18n/zh.ts +171 -167
- package/src/tool/roche-limit-satellite-disruption/i18n/de.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/fr.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/id.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/it.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/ja.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/ko.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/nl.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/pl.ts +237 -229
- package/src/tool/roche-limit-satellite-disruption/i18n/pt.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/ru.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/sv.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/tr.ts +241 -241
- package/src/tool/roche-limit-satellite-disruption/i18n/zh.ts +241 -241
- package/src/tool/simulation-probability/component.astro +138 -138
- package/src/tool/simulation-probability/i18n/de.ts +1 -1
- package/src/tool/simulation-probability/i18n/en.ts +1 -1
- package/src/tool/simulation-probability/i18n/es.ts +1 -1
- package/src/tool/simulation-probability/i18n/fr.ts +1 -1
- package/src/tool/simulation-probability/i18n/id.ts +1 -1
- package/src/tool/simulation-probability/i18n/it.ts +1 -1
- package/src/tool/simulation-probability/i18n/ja.ts +1 -1
- package/src/tool/simulation-probability/i18n/ko.ts +1 -1
- package/src/tool/simulation-probability/i18n/nl.ts +1 -1
- package/src/tool/simulation-probability/i18n/pl.ts +1 -1
- package/src/tool/simulation-probability/i18n/pt.ts +1 -1
- package/src/tool/simulation-probability/i18n/ru.ts +1 -1
- package/src/tool/simulation-probability/i18n/sv.ts +1 -1
- package/src/tool/simulation-probability/i18n/tr.ts +1 -1
- package/src/tool/simulation-probability/i18n/zh.ts +1 -1
- package/src/tool/simulation-probability/seo.astro +15 -15
- package/src/tool/stellar-habitability-zone/i18n/ru.ts +189 -189
- package/src/tool/temperature-timeline/i18n/de.ts +2 -1
- package/src/tool/temperature-timeline/i18n/fr.ts +177 -177
- package/src/tool/temperature-timeline/i18n/it.ts +142 -141
- package/src/tool/temperature-timeline/i18n/pt.ts +3 -1
- package/src/tool/temperature-timeline/i18n/ru.ts +116 -114
- package/src/tool/three-body-problem/app.ts +4 -4
- package/src/tool/three-body-problem/component.astro +6 -6
- package/src/tool/twin-paradox-visualizer/i18n/de.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/es.ts +165 -165
- package/src/tool/twin-paradox-visualizer/i18n/fr.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/id.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/it.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/ja.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/ko.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/nl.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/pl.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/pt.ts +164 -160
- package/src/tool/twin-paradox-visualizer/i18n/ru.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/sv.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/tr.ts +168 -168
- package/src/tool/twin-paradox-visualizer/i18n/zh.ts +168 -168
- package/src/types.ts +1 -1
|
@@ -1,262 +1,262 @@
|
|
|
1
|
-
import L from "leaflet";
|
|
2
|
-
import { ImpactPhysics, type Composition, type ImpactResults } from "./logic/impactPhysics";
|
|
3
|
-
import { getCompositionColor } from "./helpers";
|
|
4
|
-
import { getConfig, updateUI } from "./ui";
|
|
5
|
-
import { VERDICT_CONFIGS, DEFAULT_LABELS, type Labels, type VerdictConfig } from "./constants";
|
|
6
|
-
|
|
7
|
-
let map: L.Map;
|
|
8
|
-
|
|
9
|
-
interface Impact {
|
|
10
|
-
id: string;
|
|
11
|
-
circles: L.LayerGroup;
|
|
12
|
-
marker: L.Marker;
|
|
13
|
-
data: ImpactResults;
|
|
14
|
-
config: typeof config;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const impacts: Impact[] = [];
|
|
18
|
-
const config = getConfig();
|
|
19
|
-
|
|
20
|
-
function setupControls() {
|
|
21
|
-
const sizeInput = document.getElementById("input-size") as HTMLInputElement;
|
|
22
|
-
const velInput = document.getElementById("input-velocity") as HTMLInputElement;
|
|
23
|
-
const matBtns = document.querySelectorAll(".asteroid-material-btn");
|
|
24
|
-
const presetBtns = document.querySelectorAll(".asteroid-preset-btn");
|
|
25
|
-
const clearBtn = document.getElementById("clear-btn");
|
|
26
|
-
|
|
27
|
-
sizeInput?.addEventListener("input", (e) => {
|
|
28
|
-
config.diameter = parseInt((e.target as HTMLInputElement).value);
|
|
29
|
-
updateUI();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
velInput?.addEventListener("input", (e) => {
|
|
33
|
-
config.velocity = parseInt((e.target as HTMLInputElement).value);
|
|
34
|
-
updateUI();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
matBtns.forEach((btn) => {
|
|
38
|
-
btn.addEventListener("click", () => {
|
|
39
|
-
config.composition = btn.getAttribute("data-type") as Composition;
|
|
40
|
-
updateUI();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
presetBtns.forEach((btn) => {
|
|
45
|
-
btn.addEventListener("click", () => {
|
|
46
|
-
config.diameter = parseInt(btn.getAttribute("data-dia")!);
|
|
47
|
-
config.velocity = parseInt(btn.getAttribute("data-vel")!);
|
|
48
|
-
config.composition = btn.getAttribute("data-comp") as Composition;
|
|
49
|
-
updateUI();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
clearBtn?.addEventListener("click", clearAll);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getEventCoordinates(e: MouseEvent | TouchEvent) {
|
|
57
|
-
const touch = (e as TouchEvent).changedTouches?.[0];
|
|
58
|
-
const clientX = (e as MouseEvent).clientX || touch?.clientX || 0;
|
|
59
|
-
const clientY = (e as MouseEvent).clientY || touch?.clientY || 0;
|
|
60
|
-
return { clientX, clientY };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function setupGhostDrag() {
|
|
64
|
-
const source = document.getElementById("drag-source-desktop");
|
|
65
|
-
if (!source) return;
|
|
66
|
-
|
|
67
|
-
const start = (e: MouseEvent | TouchEvent) => {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
const targetOverlay = document.getElementById("asteroid-map-target-overlay");
|
|
70
|
-
if (targetOverlay) targetOverlay.classList.add("active");
|
|
71
|
-
|
|
72
|
-
const onEnd = (endEvent: MouseEvent | TouchEvent) => {
|
|
73
|
-
if (targetOverlay) targetOverlay.classList.remove("active");
|
|
74
|
-
|
|
75
|
-
const coords = getEventCoordinates(endEvent);
|
|
76
|
-
const point = map.mouseEventToContainerPoint(coords as MouseEvent);
|
|
77
|
-
const latlng = map.containerPointToLatLng(point);
|
|
78
|
-
spawnImpact(latlng);
|
|
79
|
-
|
|
80
|
-
window.removeEventListener("mousemove", onEnd);
|
|
81
|
-
window.removeEventListener("mouseup", onEnd);
|
|
82
|
-
window.removeEventListener("touchmove", onEnd);
|
|
83
|
-
window.removeEventListener("touchend", onEnd);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
window.addEventListener("mousemove", onEnd);
|
|
87
|
-
window.addEventListener("mouseup", onEnd);
|
|
88
|
-
window.addEventListener("touchmove", onEnd, { passive: false });
|
|
89
|
-
window.addEventListener("touchend", onEnd);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
source.addEventListener("mousedown", start);
|
|
93
|
-
source.addEventListener("touchstart", start);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function renderCircles(latlng: L.LatLng, physics: ImpactResults, group: L.LayerGroup) {
|
|
97
|
-
L.circle(latlng, {
|
|
98
|
-
radius: physics.craterDiameter / 2,
|
|
99
|
-
color: "#ef4444",
|
|
100
|
-
fillColor: "#ef4444",
|
|
101
|
-
fillOpacity: 0.6,
|
|
102
|
-
weight: 0,
|
|
103
|
-
}).addTo(group);
|
|
104
|
-
|
|
105
|
-
L.circle(latlng, {
|
|
106
|
-
radius: physics.thermalRadius,
|
|
107
|
-
color: "#f97316",
|
|
108
|
-
fillColor: "#f97316",
|
|
109
|
-
fillOpacity: 0.15,
|
|
110
|
-
weight: 1,
|
|
111
|
-
dashArray: "5 5",
|
|
112
|
-
}).addTo(group);
|
|
113
|
-
|
|
114
|
-
L.circle(latlng, {
|
|
115
|
-
radius: physics.shockwave1psi,
|
|
116
|
-
color: "#3b82f6",
|
|
117
|
-
fillColor: "#3b82f6",
|
|
118
|
-
fillOpacity: 0.05,
|
|
119
|
-
weight: 1,
|
|
120
|
-
}).addTo(group);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function setupMarkerEvents(marker: L.Marker, group: L.LayerGroup, physics: ImpactResults) {
|
|
124
|
-
marker.on("dragstart", () => {
|
|
125
|
-
map.dragging.disable();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
marker.on("drag", (e: L.LeafletEvent) => {
|
|
129
|
-
const newPos = (e.target as L.Marker).getLatLng();
|
|
130
|
-
group.clearLayers();
|
|
131
|
-
renderCircles(newPos, physics, group);
|
|
132
|
-
updateVerdict();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
marker.on("dragend", (e: L.LeafletEvent) => {
|
|
136
|
-
map.dragging.enable();
|
|
137
|
-
const newPos = (e.target as L.Marker).getLatLng();
|
|
138
|
-
group.clearLayers();
|
|
139
|
-
renderCircles(newPos, physics, group);
|
|
140
|
-
updateVerdict();
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function spawnImpact(latlng: L.LatLng) {
|
|
145
|
-
const physics = ImpactPhysics.calculate({
|
|
146
|
-
diameter: config.diameter,
|
|
147
|
-
velocity: config.velocity * 1000,
|
|
148
|
-
composition: config.composition,
|
|
149
|
-
distance: 0,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const group = L.layerGroup();
|
|
153
|
-
renderCircles(latlng, physics, group);
|
|
154
|
-
group.addTo(map);
|
|
155
|
-
|
|
156
|
-
const color = getCompositionColor(config.composition);
|
|
157
|
-
const marker = L.marker(latlng, {
|
|
158
|
-
draggable: true,
|
|
159
|
-
icon: L.divIcon({
|
|
160
|
-
className: "asteroid-marker",
|
|
161
|
-
iconSize: [32, 32],
|
|
162
|
-
iconAnchor: [16, 16],
|
|
163
|
-
html: `<div style="width: 2rem; height: 2rem; border-radius: 50%; background-color: ${color}; border: 2px solid white; box-shadow: 0 4px 8px rgba(0,0,0,0.2);"></div>`,
|
|
164
|
-
}),
|
|
165
|
-
}).addTo(map);
|
|
166
|
-
|
|
167
|
-
impacts.push({ id: Date.now().toString(), circles: group, marker, data: physics, config });
|
|
168
|
-
setupMarkerEvents(marker, group, physics);
|
|
169
|
-
updateVerdict();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function setupGPS() {
|
|
173
|
-
const btn = document.getElementById("asteroid-gps-btn");
|
|
174
|
-
btn?.addEventListener("click", () => {
|
|
175
|
-
const gpsText = document.getElementById("asteroid-gps-text");
|
|
176
|
-
if (gpsText) gpsText.textContent = "Buscando...";
|
|
177
|
-
|
|
178
|
-
navigator.geolocation.getCurrentPosition(
|
|
179
|
-
(pos) => {
|
|
180
|
-
const ll = new L.LatLng(pos.coords.latitude, pos.coords.longitude);
|
|
181
|
-
if (gpsText) gpsText.textContent = "GPS Activo";
|
|
182
|
-
map.flyTo(ll, 9);
|
|
183
|
-
},
|
|
184
|
-
() => {
|
|
185
|
-
if (gpsText) gpsText.textContent = "Error GPS";
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function updateVerdictUI(verdictConfig: VerdictConfig) {
|
|
192
|
-
const label = document.getElementById("asteroid-verdict-label");
|
|
193
|
-
const value = document.getElementById("asteroid-verdict-value");
|
|
194
|
-
const icon = document.getElementById("asteroid-verdict-icon");
|
|
195
|
-
const container = document.getElementById("asteroid-verdict-container");
|
|
196
|
-
|
|
197
|
-
if (value) value.textContent = verdictConfig.text;
|
|
198
|
-
if (label) label.textContent = verdictConfig.label;
|
|
199
|
-
if (container) container.className = `asteroid-verdict-container ${verdictConfig.class}`;
|
|
200
|
-
|
|
201
|
-
const iconSource = document.getElementById(verdictConfig.iconId);
|
|
202
|
-
if (icon && iconSource) icon.innerHTML = iconSource.innerHTML;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function updateVerdict() {
|
|
206
|
-
const pill = document.getElementById("asteroid-verdict-pill");
|
|
207
|
-
if (impacts.length === 0) {
|
|
208
|
-
pill?.classList.remove("active");
|
|
209
|
-
} else {
|
|
210
|
-
if (VERDICT_CONFIGS.safe) {
|
|
211
|
-
updateVerdictUI(VERDICT_CONFIGS.safe);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function clearAll() {
|
|
217
|
-
impacts.forEach((i) => {
|
|
218
|
-
map.removeLayer(i.circles);
|
|
219
|
-
map.removeLayer(i.marker);
|
|
220
|
-
});
|
|
221
|
-
impacts.length = 0;
|
|
222
|
-
updateVerdict();
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function init() {
|
|
226
|
-
map = L.map("asteroid-game-map", {
|
|
227
|
-
zoomControl: false,
|
|
228
|
-
attributionControl: false,
|
|
229
|
-
dragging: true,
|
|
230
|
-
}).setView([40.4168, -3.7038], 6);
|
|
231
|
-
|
|
232
|
-
L.tileLayer("https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.webp", {
|
|
233
|
-
subdomains: "abcd",
|
|
234
|
-
maxZoom: 20,
|
|
235
|
-
attribution: "© OpenStreetMap © CARTO",
|
|
236
|
-
}).addTo(map);
|
|
237
|
-
|
|
238
|
-
setupControls();
|
|
239
|
-
setupGhostDrag();
|
|
240
|
-
setupGPS();
|
|
241
|
-
|
|
242
|
-
map.on("click", () => {
|
|
243
|
-
map.dragging.enable();
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export let labels: Labels = DEFAULT_LABELS;
|
|
248
|
-
|
|
249
|
-
export function setLabels(newLabels: Partial<Labels>) {
|
|
250
|
-
labels = { ...labels, ...newLabels };
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export function initAsteroid(customLabels?: Partial<Labels>) {
|
|
254
|
-
if (customLabels) {
|
|
255
|
-
setLabels(customLabels);
|
|
256
|
-
}
|
|
257
|
-
if (document.readyState === "loading") {
|
|
258
|
-
document.addEventListener("DOMContentLoaded", init);
|
|
259
|
-
} else {
|
|
260
|
-
init();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
1
|
+
import L from "leaflet";
|
|
2
|
+
import { ImpactPhysics, type Composition, type ImpactResults } from "./logic/impactPhysics";
|
|
3
|
+
import { getCompositionColor } from "./helpers";
|
|
4
|
+
import { getConfig, updateUI } from "./ui";
|
|
5
|
+
import { VERDICT_CONFIGS, DEFAULT_LABELS, type Labels, type VerdictConfig } from "./constants";
|
|
6
|
+
|
|
7
|
+
let map: L.Map;
|
|
8
|
+
|
|
9
|
+
interface Impact {
|
|
10
|
+
id: string;
|
|
11
|
+
circles: L.LayerGroup;
|
|
12
|
+
marker: L.Marker;
|
|
13
|
+
data: ImpactResults;
|
|
14
|
+
config: typeof config;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const impacts: Impact[] = [];
|
|
18
|
+
const config = getConfig();
|
|
19
|
+
|
|
20
|
+
function setupControls() {
|
|
21
|
+
const sizeInput = document.getElementById("input-size") as HTMLInputElement;
|
|
22
|
+
const velInput = document.getElementById("input-velocity") as HTMLInputElement;
|
|
23
|
+
const matBtns = document.querySelectorAll(".asteroid-material-btn");
|
|
24
|
+
const presetBtns = document.querySelectorAll(".asteroid-preset-btn");
|
|
25
|
+
const clearBtn = document.getElementById("clear-btn");
|
|
26
|
+
|
|
27
|
+
sizeInput?.addEventListener("input", (e) => {
|
|
28
|
+
config.diameter = parseInt((e.target as HTMLInputElement).value);
|
|
29
|
+
updateUI();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
velInput?.addEventListener("input", (e) => {
|
|
33
|
+
config.velocity = parseInt((e.target as HTMLInputElement).value);
|
|
34
|
+
updateUI();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
matBtns.forEach((btn) => {
|
|
38
|
+
btn.addEventListener("click", () => {
|
|
39
|
+
config.composition = btn.getAttribute("data-type") as Composition;
|
|
40
|
+
updateUI();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
presetBtns.forEach((btn) => {
|
|
45
|
+
btn.addEventListener("click", () => {
|
|
46
|
+
config.diameter = parseInt(btn.getAttribute("data-dia")!);
|
|
47
|
+
config.velocity = parseInt(btn.getAttribute("data-vel")!);
|
|
48
|
+
config.composition = btn.getAttribute("data-comp") as Composition;
|
|
49
|
+
updateUI();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
clearBtn?.addEventListener("click", clearAll);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getEventCoordinates(e: MouseEvent | TouchEvent) {
|
|
57
|
+
const touch = (e as TouchEvent).changedTouches?.[0];
|
|
58
|
+
const clientX = (e as MouseEvent).clientX || touch?.clientX || 0;
|
|
59
|
+
const clientY = (e as MouseEvent).clientY || touch?.clientY || 0;
|
|
60
|
+
return { clientX, clientY };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function setupGhostDrag() {
|
|
64
|
+
const source = document.getElementById("drag-source-desktop");
|
|
65
|
+
if (!source) return;
|
|
66
|
+
|
|
67
|
+
const start = (e: MouseEvent | TouchEvent) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
const targetOverlay = document.getElementById("asteroid-map-target-overlay");
|
|
70
|
+
if (targetOverlay) targetOverlay.classList.add("active");
|
|
71
|
+
|
|
72
|
+
const onEnd = (endEvent: MouseEvent | TouchEvent) => {
|
|
73
|
+
if (targetOverlay) targetOverlay.classList.remove("active");
|
|
74
|
+
|
|
75
|
+
const coords = getEventCoordinates(endEvent);
|
|
76
|
+
const point = map.mouseEventToContainerPoint(coords as MouseEvent);
|
|
77
|
+
const latlng = map.containerPointToLatLng(point);
|
|
78
|
+
spawnImpact(latlng);
|
|
79
|
+
|
|
80
|
+
window.removeEventListener("mousemove", onEnd);
|
|
81
|
+
window.removeEventListener("mouseup", onEnd);
|
|
82
|
+
window.removeEventListener("touchmove", onEnd);
|
|
83
|
+
window.removeEventListener("touchend", onEnd);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
window.addEventListener("mousemove", onEnd);
|
|
87
|
+
window.addEventListener("mouseup", onEnd);
|
|
88
|
+
window.addEventListener("touchmove", onEnd, { passive: false });
|
|
89
|
+
window.addEventListener("touchend", onEnd);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
source.addEventListener("mousedown", start);
|
|
93
|
+
source.addEventListener("touchstart", start);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function renderCircles(latlng: L.LatLng, physics: ImpactResults, group: L.LayerGroup) {
|
|
97
|
+
L.circle(latlng, {
|
|
98
|
+
radius: physics.craterDiameter / 2,
|
|
99
|
+
color: "#ef4444",
|
|
100
|
+
fillColor: "#ef4444",
|
|
101
|
+
fillOpacity: 0.6,
|
|
102
|
+
weight: 0,
|
|
103
|
+
}).addTo(group);
|
|
104
|
+
|
|
105
|
+
L.circle(latlng, {
|
|
106
|
+
radius: physics.thermalRadius,
|
|
107
|
+
color: "#f97316",
|
|
108
|
+
fillColor: "#f97316",
|
|
109
|
+
fillOpacity: 0.15,
|
|
110
|
+
weight: 1,
|
|
111
|
+
dashArray: "5 5",
|
|
112
|
+
}).addTo(group);
|
|
113
|
+
|
|
114
|
+
L.circle(latlng, {
|
|
115
|
+
radius: physics.shockwave1psi,
|
|
116
|
+
color: "#3b82f6",
|
|
117
|
+
fillColor: "#3b82f6",
|
|
118
|
+
fillOpacity: 0.05,
|
|
119
|
+
weight: 1,
|
|
120
|
+
}).addTo(group);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function setupMarkerEvents(marker: L.Marker, group: L.LayerGroup, physics: ImpactResults) {
|
|
124
|
+
marker.on("dragstart", () => {
|
|
125
|
+
map.dragging.disable();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
marker.on("drag", (e: L.LeafletEvent) => {
|
|
129
|
+
const newPos = (e.target as L.Marker).getLatLng();
|
|
130
|
+
group.clearLayers();
|
|
131
|
+
renderCircles(newPos, physics, group);
|
|
132
|
+
updateVerdict();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
marker.on("dragend", (e: L.LeafletEvent) => {
|
|
136
|
+
map.dragging.enable();
|
|
137
|
+
const newPos = (e.target as L.Marker).getLatLng();
|
|
138
|
+
group.clearLayers();
|
|
139
|
+
renderCircles(newPos, physics, group);
|
|
140
|
+
updateVerdict();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function spawnImpact(latlng: L.LatLng) {
|
|
145
|
+
const physics = ImpactPhysics.calculate({
|
|
146
|
+
diameter: config.diameter,
|
|
147
|
+
velocity: config.velocity * 1000,
|
|
148
|
+
composition: config.composition,
|
|
149
|
+
distance: 0,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const group = L.layerGroup();
|
|
153
|
+
renderCircles(latlng, physics, group);
|
|
154
|
+
group.addTo(map);
|
|
155
|
+
|
|
156
|
+
const color = getCompositionColor(config.composition);
|
|
157
|
+
const marker = L.marker(latlng, {
|
|
158
|
+
draggable: true,
|
|
159
|
+
icon: L.divIcon({
|
|
160
|
+
className: "asteroid-marker",
|
|
161
|
+
iconSize: [32, 32],
|
|
162
|
+
iconAnchor: [16, 16],
|
|
163
|
+
html: `<div style="width: 2rem; height: 2rem; border-radius: 50%; background-color: ${color}; border: 2px solid white; box-shadow: 0 4px 8px rgba(0,0,0,0.2);"></div>`,
|
|
164
|
+
}),
|
|
165
|
+
}).addTo(map);
|
|
166
|
+
|
|
167
|
+
impacts.push({ id: Date.now().toString(), circles: group, marker, data: physics, config });
|
|
168
|
+
setupMarkerEvents(marker, group, physics);
|
|
169
|
+
updateVerdict();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function setupGPS() {
|
|
173
|
+
const btn = document.getElementById("asteroid-gps-btn");
|
|
174
|
+
btn?.addEventListener("click", () => {
|
|
175
|
+
const gpsText = document.getElementById("asteroid-gps-text");
|
|
176
|
+
if (gpsText) gpsText.textContent = "Buscando...";
|
|
177
|
+
|
|
178
|
+
navigator.geolocation.getCurrentPosition(
|
|
179
|
+
(pos) => {
|
|
180
|
+
const ll = new L.LatLng(pos.coords.latitude, pos.coords.longitude);
|
|
181
|
+
if (gpsText) gpsText.textContent = "GPS Activo";
|
|
182
|
+
map.flyTo(ll, 9);
|
|
183
|
+
},
|
|
184
|
+
() => {
|
|
185
|
+
if (gpsText) gpsText.textContent = "Error GPS";
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function updateVerdictUI(verdictConfig: VerdictConfig) {
|
|
192
|
+
const label = document.getElementById("asteroid-verdict-label");
|
|
193
|
+
const value = document.getElementById("asteroid-verdict-value");
|
|
194
|
+
const icon = document.getElementById("asteroid-verdict-icon");
|
|
195
|
+
const container = document.getElementById("asteroid-verdict-container");
|
|
196
|
+
|
|
197
|
+
if (value) value.textContent = verdictConfig.text;
|
|
198
|
+
if (label) label.textContent = verdictConfig.label;
|
|
199
|
+
if (container) container.className = `asteroid-verdict-container ${verdictConfig.class}`;
|
|
200
|
+
|
|
201
|
+
const iconSource = document.getElementById(verdictConfig.iconId);
|
|
202
|
+
if (icon && iconSource) icon.innerHTML = iconSource.innerHTML;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function updateVerdict() {
|
|
206
|
+
const pill = document.getElementById("asteroid-verdict-pill");
|
|
207
|
+
if (impacts.length === 0) {
|
|
208
|
+
pill?.classList.remove("active");
|
|
209
|
+
} else {
|
|
210
|
+
if (VERDICT_CONFIGS.safe) {
|
|
211
|
+
updateVerdictUI(VERDICT_CONFIGS.safe);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function clearAll() {
|
|
217
|
+
impacts.forEach((i) => {
|
|
218
|
+
map.removeLayer(i.circles);
|
|
219
|
+
map.removeLayer(i.marker);
|
|
220
|
+
});
|
|
221
|
+
impacts.length = 0;
|
|
222
|
+
updateVerdict();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function init() {
|
|
226
|
+
map = L.map("asteroid-game-map", {
|
|
227
|
+
zoomControl: false,
|
|
228
|
+
attributionControl: false,
|
|
229
|
+
dragging: true,
|
|
230
|
+
}).setView([40.4168, -3.7038], 6);
|
|
231
|
+
|
|
232
|
+
L.tileLayer("https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.webp", {
|
|
233
|
+
subdomains: "abcd",
|
|
234
|
+
maxZoom: 20,
|
|
235
|
+
attribution: "© OpenStreetMap © CARTO",
|
|
236
|
+
}).addTo(map);
|
|
237
|
+
|
|
238
|
+
setupControls();
|
|
239
|
+
setupGhostDrag();
|
|
240
|
+
setupGPS();
|
|
241
|
+
|
|
242
|
+
map.on("click", () => {
|
|
243
|
+
map.dragging.enable();
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export let labels: Labels = DEFAULT_LABELS;
|
|
248
|
+
|
|
249
|
+
export function setLabels(newLabels: Partial<Labels>) {
|
|
250
|
+
labels = { ...labels, ...newLabels };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function initAsteroid(customLabels?: Partial<Labels>) {
|
|
254
|
+
if (customLabels) {
|
|
255
|
+
setLabels(customLabels);
|
|
256
|
+
}
|
|
257
|
+
if (document.readyState === "loading") {
|
|
258
|
+
document.addEventListener("DOMContentLoaded", init);
|
|
259
|
+
} else {
|
|
260
|
+
init();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { SEORenderer } from '@jjlmoya/utils-shared';
|
|
3
|
-
import { asteroidImpact } 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 asteroidImpact.i18n[locale]?.();
|
|
12
|
-
if (!content) return null;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
{content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}
|
|
1
|
+
---
|
|
2
|
+
import { SEORenderer } from '@jjlmoya/utils-shared';
|
|
3
|
+
import { asteroidImpact } 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 asteroidImpact.i18n[locale]?.();
|
|
12
|
+
if (!content) return null;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
{content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}
|