@jjlmoya/utils-science 1.35.0 → 1.36.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-science",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Naher Vorbeiflug',
73
73
  moonTrack: 'Mondspur',
74
74
  debrisTrack: 'Trümmerspur',
75
+ primaryEarth: 'Erde',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturn',
79
+ primaryNeptune: 'Neptun',
80
+ satelliteIcyMoon: 'Eismond',
81
+ satelliteRockyMoon: 'Gesteinsmond',
82
+ satelliteRubblePile: 'Trümmerhaufen',
83
+ satelliteIronCore: 'Eisenreicher Mond',
84
+ cohesionFluid: 'Fluid',
85
+ cohesionFractured: 'Gebrochen',
86
+ cohesionRigid: 'Starr',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Close pass',
73
73
  moonTrack: 'Moon track',
74
74
  debrisTrack: 'Debris track',
75
+ primaryEarth: 'Earth',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturn',
79
+ primaryNeptune: 'Neptune',
80
+ satelliteIcyMoon: 'Icy moon',
81
+ satelliteRockyMoon: 'Rocky moon',
82
+ satelliteRubblePile: 'Rubble pile',
83
+ satelliteIronCore: 'Iron-rich moon',
84
+ cohesionFluid: 'Fluid',
85
+ cohesionFractured: 'Fractured',
86
+ cohesionRigid: 'Rigid',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Paso cercano',
73
73
  moonTrack: 'Trayectoria de la luna',
74
74
  debrisTrack: 'Trayectoria de escombros',
75
+ primaryEarth: 'Tierra',
76
+ primaryMars: 'Marte',
77
+ primaryJupiter: 'Júpiter',
78
+ primarySaturn: 'Saturno',
79
+ primaryNeptune: 'Neptuno',
80
+ satelliteIcyMoon: 'Luna helada',
81
+ satelliteRockyMoon: 'Luna rocosa',
82
+ satelliteRubblePile: 'Pila de escombros',
83
+ satelliteIronCore: 'Luna rica en hierro',
84
+ cohesionFluid: 'Fluido',
85
+ cohesionFractured: 'Fracturado',
86
+ cohesionRigid: 'Rígido',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Passage rapproché',
73
73
  moonTrack: 'Trace lunaire',
74
74
  debrisTrack: 'Trace de débris',
75
+ primaryEarth: 'Terre',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturne',
79
+ primaryNeptune: 'Neptune',
80
+ satelliteIcyMoon: 'Lune glacée',
81
+ satelliteRockyMoon: 'Lune rocheuse',
82
+ satelliteRubblePile: 'Agrégat de débris',
83
+ satelliteIronCore: 'Lune riche en fer',
84
+ cohesionFluid: 'Fluide',
85
+ cohesionFractured: 'Fracturé',
86
+ cohesionRigid: 'Rigide',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Lintasan dekat',
73
73
  moonTrack: 'Jejak bulan',
74
74
  debrisTrack: 'Jejak puing',
75
+ primaryEarth: 'Bumi',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturnus',
79
+ primaryNeptune: 'Neptunus',
80
+ satelliteIcyMoon: 'Bulan es',
81
+ satelliteRockyMoon: 'Bulan berbatu',
82
+ satelliteRubblePile: 'Tumpukan puing',
83
+ satelliteIronCore: 'Bulan kaya besi',
84
+ cohesionFluid: 'Fluida',
85
+ cohesionFractured: 'Retak',
86
+ cohesionRigid: 'Kaku',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Passaggio ravvicinato',
73
73
  moonTrack: 'Traccia lunare',
74
74
  debrisTrack: 'Traccia di detriti',
75
+ primaryEarth: 'Terra',
76
+ primaryMars: 'Marte',
77
+ primaryJupiter: 'Giove',
78
+ primarySaturn: 'Saturno',
79
+ primaryNeptune: 'Nettuno',
80
+ satelliteIcyMoon: 'Luna ghiacciata',
81
+ satelliteRockyMoon: 'Luna rocciosa',
82
+ satelliteRubblePile: 'Cumulo di detriti',
83
+ satelliteIronCore: 'Luna ricca di ferro',
84
+ cohesionFluid: 'Fluido',
85
+ cohesionFractured: 'Fratturato',
86
+ cohesionRigid: 'Rigido',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: '接近通過',
73
73
  moonTrack: '月軌道',
74
74
  debrisTrack: 'デブリ軌道',
75
+ primaryEarth: '地球',
76
+ primaryMars: '火星',
77
+ primaryJupiter: '木星',
78
+ primarySaturn: '土星',
79
+ primaryNeptune: '海王星',
80
+ satelliteIcyMoon: '氷の月',
81
+ satelliteRockyMoon: '岩石の月',
82
+ satelliteRubblePile: '瓦礫の集合体',
83
+ satelliteIronCore: '鉄に富む月',
84
+ cohesionFluid: '流体',
85
+ cohesionFractured: '破砕',
86
+ cohesionRigid: '剛体',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: '근접 통과',
73
73
  moonTrack: '위성 궤적',
74
74
  debrisTrack: '잔해물 궤적',
75
+ primaryEarth: '지구',
76
+ primaryMars: '화성',
77
+ primaryJupiter: '목성',
78
+ primarySaturn: '토성',
79
+ primaryNeptune: '해왕성',
80
+ satelliteIcyMoon: '얼음 달',
81
+ satelliteRockyMoon: '암석 달',
82
+ satelliteRubblePile: '잔해 더미',
83
+ satelliteIronCore: '철이 풍부한 달',
84
+ cohesionFluid: '유체',
85
+ cohesionFractured: '균열',
86
+ cohesionRigid: '강체',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Nadering',
73
73
  moonTrack: 'Maanbaan',
74
74
  debrisTrack: 'Puinbaan',
75
+ primaryEarth: 'Aarde',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturnus',
79
+ primaryNeptune: 'Neptunus',
80
+ satelliteIcyMoon: 'IJzige maan',
81
+ satelliteRockyMoon: 'Rotsachtige maan',
82
+ satelliteRubblePile: 'Puinmassa',
83
+ satelliteIronCore: 'IJzerrijke maan',
84
+ cohesionFluid: 'Vloeibaar',
85
+ cohesionFractured: 'Gebarsten',
86
+ cohesionRigid: 'Rigide',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Bliski przelot',
73
73
  moonTrack: 'Tor ksiezyca',
74
74
  debrisTrack: 'Tor szczatkow',
75
+ primaryEarth: 'Ziemia',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jowisz',
78
+ primarySaturn: 'Saturn',
79
+ primaryNeptune: 'Neptun',
80
+ satelliteIcyMoon: 'Lodowy ksiezyc',
81
+ satelliteRockyMoon: 'Skalisty ksiezyc',
82
+ satelliteRubblePile: 'Stos gruzu',
83
+ satelliteIronCore: 'Ksiezyc bogaty w zelazo',
84
+ cohesionFluid: 'Plynny',
85
+ cohesionFractured: 'Spekany',
86
+ cohesionRigid: 'Sztywny',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Passagem próxima',
73
73
  moonTrack: 'Rastro da lua',
74
74
  debrisTrack: 'Rastro de detritos',
75
+ primaryEarth: 'Terra',
76
+ primaryMars: 'Marte',
77
+ primaryJupiter: 'Júpiter',
78
+ primarySaturn: 'Saturno',
79
+ primaryNeptune: 'Netuno',
80
+ satelliteIcyMoon: 'Lua gelada',
81
+ satelliteRockyMoon: 'Lua rochosa',
82
+ satelliteRubblePile: 'Agregado de detritos',
83
+ satelliteIronCore: 'Lua rica em ferro',
84
+ cohesionFluid: 'Fluido',
85
+ cohesionFractured: 'Fraturado',
86
+ cohesionRigid: 'Rígido',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Близкий проход',
73
73
  moonTrack: 'След луны',
74
74
  debrisTrack: 'След обломков',
75
+ primaryEarth: 'Земля',
76
+ primaryMars: 'Марс',
77
+ primaryJupiter: 'Юпитер',
78
+ primarySaturn: 'Сатурн',
79
+ primaryNeptune: 'Нептун',
80
+ satelliteIcyMoon: 'Ледяная луна',
81
+ satelliteRockyMoon: 'Каменистая луна',
82
+ satelliteRubblePile: 'Скопление обломков',
83
+ satelliteIronCore: 'Луна, богатая железом',
84
+ cohesionFluid: 'Жидкий',
85
+ cohesionFractured: 'Трещиноватый',
86
+ cohesionRigid: 'Жесткий',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Nära passage',
73
73
  moonTrack: 'Månspår',
74
74
  debrisTrack: 'Skräpspår',
75
+ primaryEarth: 'Jorden',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jupiter',
78
+ primarySaturn: 'Saturnus',
79
+ primaryNeptune: 'Neptunus',
80
+ satelliteIcyMoon: 'Ismåne',
81
+ satelliteRockyMoon: 'Sten måne',
82
+ satelliteRubblePile: 'Grushög',
83
+ satelliteIronCore: 'Järnrik måne',
84
+ cohesionFluid: 'Fluid',
85
+ cohesionFractured: 'Sprucken',
86
+ cohesionRigid: 'Styv',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: 'Yakin gecis',
73
73
  moonTrack: 'Ay izi',
74
74
  debrisTrack: 'Enkaz izi',
75
+ primaryEarth: 'Dünya',
76
+ primaryMars: 'Mars',
77
+ primaryJupiter: 'Jüpiter',
78
+ primarySaturn: 'Satürn',
79
+ primaryNeptune: 'Neptün',
80
+ satelliteIcyMoon: 'Buzlu ay',
81
+ satelliteRockyMoon: 'Kayalık ay',
82
+ satelliteRubblePile: 'Enkaz yığını',
83
+ satelliteIronCore: 'Demirce zengin ay',
84
+ cohesionFluid: 'Akışkan',
85
+ cohesionFractured: 'Çatlak',
86
+ cohesionRigid: 'Rijit',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -72,6 +72,18 @@ export const content: ToolLocaleContent = {
72
72
  closePass: '近距离飞越',
73
73
  moonTrack: '卫星轨迹',
74
74
  debrisTrack: '碎片轨迹',
75
+ primaryEarth: '地球',
76
+ primaryMars: '火星',
77
+ primaryJupiter: '木星',
78
+ primarySaturn: '土星',
79
+ primaryNeptune: '海王星',
80
+ satelliteIcyMoon: '冰质卫星',
81
+ satelliteRockyMoon: '岩质卫星',
82
+ satelliteRubblePile: '碎石堆',
83
+ satelliteIronCore: '富铁卫星',
84
+ cohesionFluid: '流体',
85
+ cohesionFractured: '破裂',
86
+ cohesionRigid: '刚性',
75
87
  },
76
88
  seo: [
77
89
  {
@@ -0,0 +1,11 @@
1
+ export function labelFor(ui: Record<string, string>, key: string, fallback: string): string {
2
+ return ui[key] ?? fallback;
3
+ }
4
+
5
+ export function capitalize(value: string): string {
6
+ return value.charAt(0).toUpperCase() + value.slice(1);
7
+ }
8
+
9
+ export function capitalizeId(value: string): string {
10
+ return value.split('-').map(capitalize).join('');
11
+ }
@@ -1,4 +1,5 @@
1
1
  import { PRIMARY_BODIES, SATELLITE_BODIES, calculateRocheLimit } from './logic';
2
+ import { capitalize, capitalizeId, labelFor } from './labels';
2
3
  import type { PrimaryId, RocheResult, SatelliteId } from './logic';
3
4
  import { animateParticles, resizeParticleCanvas } from './particle-system';
4
5
  import type { VisualState } from './particle-system';
@@ -151,7 +152,7 @@ function updateReadouts(result: RocheResult): void {
151
152
  refs.fluidLimit.textContent = formatKm(result.fluidLimitKm);
152
153
  refs.rigidLimit.textContent = formatKm(result.rigidLimitKm);
153
154
  refs.density.textContent = `${ui.density}: ${result.satellite.densityGcm3} g/cm3`;
154
- refs.cohesion.textContent = `${ui.cohesion}: ${result.satellite.cohesion}`;
155
+ refs.cohesion.textContent = `${ui.cohesion}: ${labelFor(ui, `cohesion${capitalize(result.satellite.cohesion)}`, result.satellite.cohesion)}`;
155
156
  refs.radius.textContent = `${ui.planetRadius}: ${formatKm(result.primary.radiusKm)}`;
156
157
  }
157
158
 
@@ -180,9 +181,9 @@ function update(persist = true): void {
180
181
  function syncPickers(): void {
181
182
  const primary = PRIMARY_BODIES.find((body) => body.id === selectedPrimary) ?? PRIMARY_BODIES[0];
182
183
  const satellite = SATELLITE_BODIES.find((body) => body.id === selectedSatellite) ?? SATELLITE_BODIES[0];
183
- refs.primaryName.textContent = primary.name;
184
+ refs.primaryName.textContent = labelFor(ui, `primary${capitalizeId(primary.id)}`, primary.name);
184
185
  refs.primaryDensity.textContent = `${primary.densityGcm3} g/cm3`;
185
- refs.satelliteName.textContent = satellite.name;
186
+ refs.satelliteName.textContent = labelFor(ui, `satellite${capitalizeId(satellite.id)}`, satellite.name);
186
187
  refs.satelliteDensity.textContent = `${satellite.densityGcm3} g/cm3`;
187
188
  refs.primaryMenu.querySelectorAll<HTMLButtonElement>('button').forEach((button) => button.classList.toggle('is-selected', button.dataset.value === selectedPrimary));
188
189
  refs.satelliteMenu.querySelectorAll<HTMLButtonElement>('button').forEach((button) => button.classList.toggle('is-selected', button.dataset.value === selectedSatellite));
@@ -199,10 +200,10 @@ function closePickers(): void {
199
200
  }
200
201
 
201
202
  function fillMenus(): void {
202
- PRIMARY_BODIES.forEach((body) => appendOption({ menu: refs.primaryMenu, value: body.id, name: body.name, meta: `${body.densityGcm3} g/cm3`, select: () => {
203
+ PRIMARY_BODIES.forEach((body) => appendOption({ menu: refs.primaryMenu, value: body.id, name: labelFor(ui, `primary${capitalizeId(body.id)}`, body.name), meta: `${body.densityGcm3} g/cm3`, select: () => {
203
204
  selectedPrimary = body.id;
204
205
  } }));
205
- SATELLITE_BODIES.forEach((body) => appendOption({ menu: refs.satelliteMenu, value: body.id, name: body.name, meta: `${body.densityGcm3} g/cm3`, select: () => {
206
+ SATELLITE_BODIES.forEach((body) => appendOption({ menu: refs.satelliteMenu, value: body.id, name: labelFor(ui, `satellite${capitalizeId(body.id)}`, body.name), meta: `${body.densityGcm3} g/cm3`, select: () => {
206
207
  selectedSatellite = body.id;
207
208
  } }));
208
209
  }
@@ -266,8 +267,7 @@ if (restoredState.primaryId) selectedPrimary = restoredState.primaryId;
266
267
  if (restoredState.satelliteId) selectedSatellite = restoredState.satelliteId;
267
268
  if (restoredState.orbitDistanceKm) refs.distanceInput.value = `${restoredState.orbitDistanceKm}`;
268
269
  setDistanceRange();
269
- bindEvents();
270
- syncPickers();
270
+ bindEvents(); syncPickers();
271
271
  resizeParticleCanvas(refs.particleCanvas);
272
272
  update();
273
273
  window.requestAnimationFrame(() => animateParticles(refs.particleCanvas, () => ({ moon: latestMoon, visualState })));