@siegesailor/terminal-sigma 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -40
- package/build/app.js +387 -0
- package/build/app.js.map +1 -0
- package/build/command-line-interface.js +41 -4
- package/build/command-line-interface.js.map +1 -1
- package/build/components/character.js +17 -293
- package/build/components/character.js.map +1 -1
- package/build/components/choice.js +32 -0
- package/build/components/choice.js.map +1 -0
- package/build/components/entry-form.js +54 -0
- package/build/components/entry-form.js.map +1 -0
- package/build/components/footer.js +27 -0
- package/build/components/footer.js.map +1 -0
- package/build/components/logs-view.js +102 -0
- package/build/components/logs-view.js.map +1 -0
- package/build/components/menu-grid.js +27 -45
- package/build/components/menu-grid.js.map +1 -1
- package/build/components/today-panel.js +30 -0
- package/build/components/today-panel.js.map +1 -0
- package/build/content.js +286 -0
- package/build/content.js.map +1 -0
- package/build/health.js +90 -0
- package/build/health.js.map +1 -0
- package/build/i18n.js +603 -0
- package/build/i18n.js.map +1 -0
- package/build/pixel-art.js +359 -0
- package/build/pixel-art.js.map +1 -0
- package/build/progress.js +72 -34
- package/build/progress.js.map +1 -1
- package/build/quotes.js +157 -5
- package/build/quotes.js.map +1 -1
- package/build/theme.js +137 -0
- package/build/theme.js.map +1 -0
- package/package.json +1 -3
- package/build/commands/index.js +0 -274
- package/build/commands/index.js.map +0 -1
- package/build/components/status-panel.js +0 -19
- package/build/components/status-panel.js.map +0 -1
package/build/health.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { formatNumber, } from "./i18n.js";
|
|
2
|
+
// Without a profile: the common 2,000 kcal reference, 50 g protein, and 30 active minutes.
|
|
3
|
+
const defaultTargets = {
|
|
4
|
+
calories: 2000,
|
|
5
|
+
protein: 50,
|
|
6
|
+
workoutMinutes: 30,
|
|
7
|
+
};
|
|
8
|
+
// Physical activity levels, from sedentary to very active.
|
|
9
|
+
const activityFactor = {
|
|
10
|
+
desk: 1.2,
|
|
11
|
+
standing: 1.375,
|
|
12
|
+
active: 1.55,
|
|
13
|
+
athlete: 1.725,
|
|
14
|
+
};
|
|
15
|
+
// Mifflin-St Jeor's constant, averaged when gender is not given.
|
|
16
|
+
const genderConstant = {
|
|
17
|
+
male: 5,
|
|
18
|
+
female: -161,
|
|
19
|
+
other: -78,
|
|
20
|
+
};
|
|
21
|
+
const calorieShift = {
|
|
22
|
+
loseFat: -500,
|
|
23
|
+
maintain: 0,
|
|
24
|
+
buildMuscle: 300,
|
|
25
|
+
endurance: 200,
|
|
26
|
+
};
|
|
27
|
+
// Grams of protein per kilogram of body weight, within the 0.8 to 2.2 g that
|
|
28
|
+
// sports nutrition guidance covers.
|
|
29
|
+
const proteinPerKilogram = {
|
|
30
|
+
loseFat: 1.8,
|
|
31
|
+
maintain: 1,
|
|
32
|
+
buildMuscle: 2,
|
|
33
|
+
endurance: 1.4,
|
|
34
|
+
};
|
|
35
|
+
const proteinForWork = {
|
|
36
|
+
desk: 0,
|
|
37
|
+
standing: 0.1,
|
|
38
|
+
active: 0.2,
|
|
39
|
+
athlete: 0.3,
|
|
40
|
+
};
|
|
41
|
+
const workoutMinutes = {
|
|
42
|
+
loseFat: 45,
|
|
43
|
+
maintain: 30,
|
|
44
|
+
buildMuscle: 45,
|
|
45
|
+
endurance: 60,
|
|
46
|
+
};
|
|
47
|
+
export function targetsOf(profile) {
|
|
48
|
+
if (!profile) {
|
|
49
|
+
return defaultTargets;
|
|
50
|
+
}
|
|
51
|
+
const { weight, height, age, gender, workStyle, goal } = profile;
|
|
52
|
+
const restingCalories = 10 * weight + 6.25 * height - 5 * age + genderConstant[gender];
|
|
53
|
+
const calories = restingCalories * activityFactor[workStyle] + calorieShift[goal];
|
|
54
|
+
const proteinRate = Math.min(proteinPerKilogram[goal] + proteinForWork[workStyle], 2.2);
|
|
55
|
+
return {
|
|
56
|
+
calories: Math.round(Math.max(calories, 1200) / 10) * 10,
|
|
57
|
+
protein: Math.round(weight * proteinRate),
|
|
58
|
+
workoutMinutes: workoutMinutes[goal],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// What is left of today, most pressing first.
|
|
62
|
+
export function adviceOf(profile, today, language, messages) {
|
|
63
|
+
const targets = targetsOf(profile);
|
|
64
|
+
const goal = profile?.goal ?? "maintain";
|
|
65
|
+
const protein = targets.protein - today.protein;
|
|
66
|
+
const minutes = targets.workoutMinutes - today.workoutMinutes;
|
|
67
|
+
const calories = targets.calories - today.calories;
|
|
68
|
+
const { health } = messages;
|
|
69
|
+
return [
|
|
70
|
+
minutes > 0
|
|
71
|
+
? {
|
|
72
|
+
text: health.workoutLeft(minutes, health.suggestion[goal]),
|
|
73
|
+
isDone: false,
|
|
74
|
+
}
|
|
75
|
+
: { text: health.workoutDone, isDone: true },
|
|
76
|
+
protein > 0
|
|
77
|
+
? { text: health.proteinLeft(protein), isDone: false }
|
|
78
|
+
: { text: health.proteinDone, isDone: true },
|
|
79
|
+
calories >= 0
|
|
80
|
+
? {
|
|
81
|
+
text: health.caloriesLeft(formatNumber(language, calories)),
|
|
82
|
+
isDone: false,
|
|
83
|
+
}
|
|
84
|
+
: {
|
|
85
|
+
text: health.caloriesOver(formatNumber(language, -calories)),
|
|
86
|
+
isDone: false,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../source/health.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,GAMZ,MAAM,WAAW,CAAC;AAWnB,2FAA2F;AAC3F,MAAM,cAAc,GAAY;IAC/B,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE;IACX,cAAc,EAAE,EAAE;CAClB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,cAAc,GAA8B;IACjD,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,IAAI;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