@jjlmoya/utils-science 1.32.0 → 1.34.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 (56) hide show
  1. package/package.json +1 -1
  2. package/src/category/index.ts +3 -1
  3. package/src/entries.ts +5 -1
  4. package/src/index.ts +2 -0
  5. package/src/tests/locale_completeness.test.ts +2 -2
  6. package/src/tests/tool_validation.test.ts +2 -2
  7. package/src/tool/natural-selection-drift/component.astro +37 -6
  8. package/src/tool/natural-selection-drift/natural-selection-drift.css +134 -0
  9. package/src/tool/planet-atmosphere-survival/bibliography.astro +14 -0
  10. package/src/tool/planet-atmosphere-survival/bibliography.ts +16 -0
  11. package/src/tool/planet-atmosphere-survival/component.astro +404 -0
  12. package/src/tool/planet-atmosphere-survival/entry.ts +26 -0
  13. package/src/tool/planet-atmosphere-survival/i18n/de.ts +255 -0
  14. package/src/tool/planet-atmosphere-survival/i18n/en.ts +255 -0
  15. package/src/tool/planet-atmosphere-survival/i18n/es.ts +255 -0
  16. package/src/tool/planet-atmosphere-survival/i18n/fr.ts +255 -0
  17. package/src/tool/planet-atmosphere-survival/i18n/id.ts +255 -0
  18. package/src/tool/planet-atmosphere-survival/i18n/it.ts +255 -0
  19. package/src/tool/planet-atmosphere-survival/i18n/ja.ts +255 -0
  20. package/src/tool/planet-atmosphere-survival/i18n/ko.ts +255 -0
  21. package/src/tool/planet-atmosphere-survival/i18n/nl.ts +255 -0
  22. package/src/tool/planet-atmosphere-survival/i18n/pl.ts +255 -0
  23. package/src/tool/planet-atmosphere-survival/i18n/pt.ts +255 -0
  24. package/src/tool/planet-atmosphere-survival/i18n/ru.ts +255 -0
  25. package/src/tool/planet-atmosphere-survival/i18n/sv.ts +255 -0
  26. package/src/tool/planet-atmosphere-survival/i18n/tr.ts +255 -0
  27. package/src/tool/planet-atmosphere-survival/i18n/zh.ts +255 -0
  28. package/src/tool/planet-atmosphere-survival/index.ts +11 -0
  29. package/src/tool/planet-atmosphere-survival/logic.ts +201 -0
  30. package/src/tool/planet-atmosphere-survival/planet-atmosphere-survival-calculator.css +494 -0
  31. package/src/tool/planet-atmosphere-survival/seo.astro +15 -0
  32. package/src/tool/three-body-problem/app.ts +274 -0
  33. package/src/tool/three-body-problem/bibliography.astro +14 -0
  34. package/src/tool/three-body-problem/bibliography.ts +16 -0
  35. package/src/tool/three-body-problem/component.astro +70 -0
  36. package/src/tool/three-body-problem/entry.ts +26 -0
  37. package/src/tool/three-body-problem/i18n/de.ts +162 -0
  38. package/src/tool/three-body-problem/i18n/en.ts +162 -0
  39. package/src/tool/three-body-problem/i18n/es.ts +162 -0
  40. package/src/tool/three-body-problem/i18n/fr.ts +162 -0
  41. package/src/tool/three-body-problem/i18n/id.ts +162 -0
  42. package/src/tool/three-body-problem/i18n/it.ts +162 -0
  43. package/src/tool/three-body-problem/i18n/ja.ts +162 -0
  44. package/src/tool/three-body-problem/i18n/ko.ts +162 -0
  45. package/src/tool/three-body-problem/i18n/nl.ts +162 -0
  46. package/src/tool/three-body-problem/i18n/pl.ts +162 -0
  47. package/src/tool/three-body-problem/i18n/pt.ts +162 -0
  48. package/src/tool/three-body-problem/i18n/ru.ts +162 -0
  49. package/src/tool/three-body-problem/i18n/sv.ts +162 -0
  50. package/src/tool/three-body-problem/i18n/tr.ts +162 -0
  51. package/src/tool/three-body-problem/i18n/zh.ts +162 -0
  52. package/src/tool/three-body-problem/index.ts +11 -0
  53. package/src/tool/three-body-problem/logic/ThreeBodyEngine.ts +179 -0
  54. package/src/tool/three-body-problem/seo.astro +15 -0
  55. package/src/tool/three-body-problem/three-body-problem-simulator.css +503 -0
  56. package/src/tools.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-science",
3
- "version": "1.32.0",
3
+ "version": "1.34.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -14,10 +14,12 @@ import { entropySecondLaw } from '../tool/entropy-second-law/index';
14
14
  import { phaseDiagramCriticalPoints } from '../tool/phase-diagram-critical-points/index';
15
15
  import { twinParadoxVisualizer } from '../tool/twin-paradox-visualizer/index';
16
16
  import { mandelbrotFractal } from '../tool/mandelbrot-fractal/index';
17
+ import { planetAtmosphereSurvival } from '../tool/planet-atmosphere-survival/index';
18
+ import { threeBodyProblem } from '../tool/three-body-problem/index';
17
19
 
18
20
  export const scienceCategory: ScienceCategoryEntry = {
19
21
  icon: 'mdi:flask',
20
- tools: [colonyCounter, asteroidImpact, microwaveDetector, simulationProbability, cellularRenewal, cosmicInflation, temperatureTimeline, lorenzAttractor, stellarHabitabilityZone, radioactiveDecay, naturalSelectionDrift, entropySecondLaw, phaseDiagramCriticalPoints, twinParadoxVisualizer, mandelbrotFractal],
22
+ tools: [colonyCounter, asteroidImpact, microwaveDetector, simulationProbability, cellularRenewal, cosmicInflation, temperatureTimeline, lorenzAttractor, stellarHabitabilityZone, radioactiveDecay, naturalSelectionDrift, entropySecondLaw, phaseDiagramCriticalPoints, twinParadoxVisualizer, mandelbrotFractal, planetAtmosphereSurvival, threeBodyProblem],
21
23
  i18n: {
22
24
  es: () => import('./i18n/es').then((m) => m.content),
23
25
  en: () => import('./i18n/en').then((m) => m.content),
package/src/entries.ts CHANGED
@@ -14,6 +14,8 @@ export { entropySecondLaw } from './tool/entropy-second-law/entry';
14
14
  export { phaseDiagramCriticalPoints } from './tool/phase-diagram-critical-points/entry';
15
15
  export { twinParadoxVisualizer } from './tool/twin-paradox-visualizer/entry';
16
16
  export { mandelbrotFractal } from './tool/mandelbrot-fractal/entry';
17
+ export { planetAtmosphereSurvival } from './tool/planet-atmosphere-survival/entry';
18
+ export { threeBodyProblem } from './tool/three-body-problem/entry';
17
19
  export { scienceCategory } from './category';
18
20
  import { asteroidImpact } from './tool/asteroid-impact/entry';
19
21
  import { cellularRenewal } from './tool/cellular-renewal/entry';
@@ -30,4 +32,6 @@ import { entropySecondLaw } from './tool/entropy-second-law/entry';
30
32
  import { phaseDiagramCriticalPoints } from './tool/phase-diagram-critical-points/entry';
31
33
  import { twinParadoxVisualizer } from './tool/twin-paradox-visualizer/entry';
32
34
  import { mandelbrotFractal } from './tool/mandelbrot-fractal/entry';
33
- export const ALL_ENTRIES = [asteroidImpact, cellularRenewal, colonyCounter, microwaveDetector, simulationProbability, cosmicInflation, temperatureTimeline, lorenzAttractor, stellarHabitabilityZone, radioactiveDecay, naturalSelectionDrift, entropySecondLaw, phaseDiagramCriticalPoints, twinParadoxVisualizer, mandelbrotFractal];
35
+ import { planetAtmosphereSurvival } from './tool/planet-atmosphere-survival/entry';
36
+ import { threeBodyProblem } from './tool/three-body-problem/entry';
37
+ export const ALL_ENTRIES = [asteroidImpact, cellularRenewal, colonyCounter, microwaveDetector, simulationProbability, cosmicInflation, temperatureTimeline, lorenzAttractor, stellarHabitabilityZone, radioactiveDecay, naturalSelectionDrift, entropySecondLaw, phaseDiagramCriticalPoints, twinParadoxVisualizer, mandelbrotFractal, planetAtmosphereSurvival, threeBodyProblem];
package/src/index.ts CHANGED
@@ -15,6 +15,8 @@ export { ENTROPY_SECOND_LAW_TOOL } from './tool/entropy-second-law/index';
15
15
  export { PHASE_DIAGRAM_CRITICAL_POINTS_TOOL } from './tool/phase-diagram-critical-points/index';
16
16
  export { TWIN_PARADOX_VISUALIZER_TOOL } from './tool/twin-paradox-visualizer/index';
17
17
  export { MANDELBROT_FRACTAL_TOOL } from './tool/mandelbrot-fractal/index';
18
+ export { PLANET_ATMOSPHERE_SURVIVAL_TOOL } from './tool/planet-atmosphere-survival/index';
19
+ export { THREE_BODY_PROBLEM_TOOL } from './tool/three-body-problem/index';
18
20
 
19
21
  export type {
20
22
  KnownLocale,
@@ -18,7 +18,7 @@ describe('Locale Completeness Validation', () => {
18
18
  });
19
19
  });
20
20
 
21
- it('all 15 tools registered', () => {
22
- expect(ALL_TOOLS.length).toBe(15);
21
+ it('all 17 tools registered', () => {
22
+ expect(ALL_TOOLS.length).toBe(17);
23
23
  });
24
24
  });
@@ -4,8 +4,8 @@ import { scienceCategory } from '../data';
4
4
 
5
5
  describe('Tool Validation Suite', () => {
6
6
  describe('Library Registration', () => {
7
- it('should have 15 tools in ALL_TOOLS', () => {
8
- expect(ALL_TOOLS.length).toBe(15);
7
+ it('should have 17 tools in ALL_TOOLS', () => {
8
+ expect(ALL_TOOLS.length).toBe(17);
9
9
  });
10
10
 
11
11
  it('scienceCategory should be defined', () => {
@@ -8,7 +8,7 @@ interface Props {
8
8
  const { ui } = Astro.props;
9
9
  ---
10
10
 
11
- <div class="ns-app">
11
+ <div class="ns-app" data-alive-label={ui.aliveLabel} data-allele-default={ui.alleleDefault}>
12
12
  <section class="ns-card">
13
13
  <canvas id="simulation-canvas" class="ns-canvas"></canvas>
14
14
  <div class="ns-canvas-badge" id="alive-badge">0 {ui.aliveLabel}</div>
@@ -25,9 +25,19 @@ const { ui } = Astro.props;
25
25
 
26
26
  <section class="ns-alleles" id="allele-ranking" aria-label={ui.alleleCountsLabel}></section>
27
27
 
28
- <aside class="ns-console" aria-label="Simulation controls">
28
+ <button class="ns-console-trigger" id="ns-console-trigger" aria-label={ui.controls} aria-expanded="false">
29
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M2 4h12M2 8h8M2 12h10" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
30
+ {ui.controls}
31
+ </button>
32
+
33
+ <aside class="ns-console" id="ns-console" aria-label="Simulation controls">
29
34
  <div class="ns-console-header">
30
- <span class="ns-console-kicker">{ui.evolutionConsole}</span>
35
+ <div class="ns-console-header-row">
36
+ <span class="ns-console-kicker">{ui.evolutionConsole}</span>
37
+ <button class="ns-console-close" id="ns-console-close" aria-label="Close controls">
38
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M1 1l12 12M13 1L1 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
39
+ </button>
40
+ </div>
31
41
  <h3>{ui.title}</h3>
32
42
  </div>
33
43
 
@@ -74,9 +84,10 @@ const { ui } = Astro.props;
74
84
  </section>
75
85
  </div>
76
86
 
77
- <script type="module" define:vars={{ ui }}>
78
- import { createNaturalSelectionRuntime } from '/src/tool/natural-selection-drift/runtime';
87
+ <script>
88
+ import { createNaturalSelectionRuntime } from './runtime';
79
89
 
90
+ const root = document.querySelector('.ns-app');
80
91
  createNaturalSelectionRuntime({
81
92
  populationInput: document.getElementById('population'),
82
93
  generationsInput: document.getElementById('generations'),
@@ -99,6 +110,26 @@ const { ui } = Astro.props;
99
110
  diversityScore: document.getElementById('diversity-score'),
100
111
  populationScore: document.getElementById('population-score'),
101
112
  alleleRanking: document.getElementById('allele-ranking'),
102
- ui: { ...ui },
113
+ ui: {
114
+ aliveLabel: root?.dataset.aliveLabel ?? '',
115
+ alleleDefault: root?.dataset.alleleDefault ?? '',
116
+ },
103
117
  });
118
+
119
+ const trigger = document.getElementById('ns-console-trigger');
120
+ const closeBtn = document.getElementById('ns-console-close');
121
+ const console = document.getElementById('ns-console');
122
+
123
+ function openConsole() {
124
+ console?.classList.add('is-open');
125
+ trigger?.setAttribute('aria-expanded', 'true');
126
+ }
127
+
128
+ function closeConsole() {
129
+ console?.classList.remove('is-open');
130
+ trigger?.setAttribute('aria-expanded', 'false');
131
+ }
132
+
133
+ trigger?.addEventListener('click', openConsole);
134
+ closeBtn?.addEventListener('click', closeConsole);
104
135
  </script>
@@ -427,3 +427,137 @@
427
427
  grid-template-columns: minmax(0, 1fr);
428
428
  }
429
429
  }
430
+
431
+ .ns-console-trigger {
432
+ display: none;
433
+ }
434
+
435
+ .ns-console-header-row {
436
+ display: flex;
437
+ align-items: center;
438
+ justify-content: space-between;
439
+ gap: 0.5rem;
440
+ }
441
+
442
+ .ns-console-close {
443
+ display: none;
444
+ align-items: center;
445
+ justify-content: center;
446
+ width: 28px;
447
+ height: 28px;
448
+ border-radius: 50%;
449
+ border: 1px solid var(--ns-border);
450
+ background: var(--ns-panel);
451
+ color: var(--ns-muted);
452
+ cursor: pointer;
453
+ flex-shrink: 0;
454
+ transition: background 0.18s ease, color 0.18s ease;
455
+ }
456
+
457
+ .ns-console-close:hover {
458
+ background: rgba(239, 68, 68, 0.12);
459
+ color: #ef4444;
460
+ }
461
+
462
+ @media (max-width: 640px) {
463
+ .ns-console-trigger {
464
+ display: inline-flex;
465
+ align-items: center;
466
+ gap: 0.5rem;
467
+ position: absolute;
468
+ left: clamp(16px, 4vw, 24px);
469
+ bottom: clamp(16px, 4vw, 24px);
470
+ z-index: 3;
471
+ padding: 0.6rem 1rem;
472
+ border-radius: 999px;
473
+ border: 1px solid rgba(255, 255, 255, 0.14);
474
+ background: rgba(2, 6, 23, 0.72);
475
+ backdrop-filter: blur(18px);
476
+ color: rgba(255, 255, 255, 0.9);
477
+ font-size: 0.78rem;
478
+ font-weight: 700;
479
+ letter-spacing: 0.06em;
480
+ text-transform: uppercase;
481
+ cursor: pointer;
482
+ transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
483
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
484
+ }
485
+
486
+ .theme-light .ns-console-trigger {
487
+ background: rgba(255, 255, 255, 0.88);
488
+ border-color: rgba(148, 163, 184, 0.22);
489
+ color: #0f172a;
490
+ box-shadow: 0 8px 24px rgba(148, 163, 184, 0.22);
491
+ }
492
+
493
+ .ns-console-trigger:hover {
494
+ transform: translateY(-1px);
495
+ }
496
+
497
+ .ns-console-trigger[aria-expanded="true"] {
498
+ opacity: 0;
499
+ pointer-events: none;
500
+ }
501
+
502
+ .ns-console {
503
+ left: 0;
504
+ right: 0;
505
+ top: auto;
506
+ bottom: 0;
507
+ width: 100%;
508
+ border-radius: 24px 24px 0 0;
509
+ border-bottom: none;
510
+ padding: 1.25rem clamp(16px, 4vw, 24px) calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-bottom, 0px));
511
+ transform: translateY(110%);
512
+ transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
513
+ background: rgba(7, 9, 13, 0.88);
514
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
515
+ backdrop-filter: blur(24px);
516
+ max-height: 80vh;
517
+ overflow-y: auto;
518
+ overscroll-behavior: contain;
519
+ }
520
+
521
+ .theme-light .ns-console {
522
+ background: rgba(255, 255, 255, 0.96);
523
+ border-top-color: rgba(148, 163, 184, 0.2);
524
+ }
525
+
526
+ .ns-console.is-open {
527
+ transform: translateY(0);
528
+ }
529
+
530
+ .ns-console-close {
531
+ display: inline-flex;
532
+ }
533
+
534
+ .ns-console::before {
535
+ content: "";
536
+ display: block;
537
+ width: 40px;
538
+ height: 4px;
539
+ border-radius: 999px;
540
+ background: rgba(255, 255, 255, 0.18);
541
+ margin: 0 auto 1rem;
542
+ }
543
+
544
+ .theme-light .ns-console::before {
545
+ background: rgba(15, 23, 42, 0.14);
546
+ }
547
+
548
+ .ns-alleles {
549
+ top: 72px;
550
+ right: clamp(12px, 3vw, 16px);
551
+ grid-template-columns: minmax(140px, 180px);
552
+ }
553
+
554
+ .ns-allele-chip {
555
+ padding: 0.28rem 0.4rem 0.28rem 0.6rem;
556
+ border-radius: 10px;
557
+ }
558
+
559
+ .ns-hud {
560
+ bottom: clamp(72px, 12vw, 96px);
561
+ }
562
+ }
563
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
+ import { planetAtmosphereSurvival } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'en' } = Astro.props;
11
+ const content = await planetAtmosphereSurvival.i18n[locale]?.();
12
+ ---
13
+
14
+ {content && <SharedBibliography links={content.bibliography} />}
@@ -0,0 +1,16 @@
1
+ import type { BibliographyEntry } from '../../types';
2
+
3
+ export const bibliography: BibliographyEntry[] = [
4
+ {
5
+ name: 'NASA Space Science Data Coordinated Archive, Planetary Fact Sheets',
6
+ url: 'https://science.gsfc.nasa.gov/solarsystem/dataarchives/projects/629/',
7
+ },
8
+ {
9
+ name: 'NASA, Human Integration Design Handbook',
10
+ url: 'https://www.nasa.gov/human-integration-design-handbook/',
11
+ },
12
+ {
13
+ name: 'NOAA National Weather Service, Wind Chill Temperature Index',
14
+ url: 'https://www.weather.gov/ddc/windchillddc',
15
+ },
16
+ ];