@esmirnov.ai/sperm-lab 0.4.3 → 0.4.4
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/dist/core/factors.d.ts +16 -13
- package/dist/core/factors.js +14 -14
- package/dist/react/sperm-lab.js +37 -4
- package/dist/styles.css +3 -3
- package/docs/API.md +1 -0
- package/docs/MODEL.md +2 -1
- package/package.json +1 -1
package/dist/core/factors.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const FACTORS: readonly [{
|
|
|
18
18
|
readonly id: "exercise";
|
|
19
19
|
readonly title: "Regular exercise";
|
|
20
20
|
readonly evidence: "Human association";
|
|
21
|
-
readonly summary: "Compare
|
|
21
|
+
readonly summary: "Compare weekly minutes of regular physical activity in the example.";
|
|
22
22
|
readonly mechanism: "Physical activity can support metabolic health and hormone balance. Some studies report better semen measures in active men.";
|
|
23
23
|
readonly timescale: "Weeks to months. This example represents a new sample after development.";
|
|
24
24
|
readonly limits: "Exercise does not guarantee better semen or pregnancy. Studies differ, and this example has no prescribed exercise dose.";
|
|
@@ -36,7 +36,7 @@ export declare const FACTORS: readonly [{
|
|
|
36
36
|
readonly id: "endurance";
|
|
37
37
|
readonly title: "High-volume running";
|
|
38
38
|
readonly evidence: "Mixed evidence";
|
|
39
|
-
readonly summary: "
|
|
39
|
+
readonly summary: "Set weekly hours of hard running in a scenario with poor recovery.";
|
|
40
40
|
readonly mechanism: "Low energy availability, heat, and insufficient recovery can accompany heavy training. These conditions can affect reproductive hormone signals.";
|
|
41
41
|
readonly timescale: "Weeks to months. This example represents a later sample.";
|
|
42
42
|
readonly limits: "Running is not inherently harmful. Endurance studies report inconsistent results. The scene shows one possible pathway, without a mileage threshold.";
|
|
@@ -48,7 +48,7 @@ export declare const FACTORS: readonly [{
|
|
|
48
48
|
readonly id: "cycling";
|
|
49
49
|
readonly title: "Long cycling sessions";
|
|
50
50
|
readonly evidence: "Mixed evidence";
|
|
51
|
-
readonly summary: "
|
|
51
|
+
readonly summary: "Set weekly hours spent in long cycling sessions.";
|
|
52
52
|
readonly mechanism: "Long sessions can involve local heat and pressure. Some studies report differences in semen measures among cyclists.";
|
|
53
53
|
readonly timescale: "Repeated exposure over weeks. This example represents a later sample.";
|
|
54
54
|
readonly limits: "Studies do not establish a universal cycling threshold. The scene shows a possible adverse example, not an inevitable effect.";
|
|
@@ -63,7 +63,7 @@ export declare const FACTORS: readonly [{
|
|
|
63
63
|
readonly id: "smoking";
|
|
64
64
|
readonly title: "Smoking";
|
|
65
65
|
readonly evidence: "Human association";
|
|
66
|
-
readonly summary: "
|
|
66
|
+
readonly summary: "Set the usual number of cigarettes smoked per day in the example.";
|
|
67
67
|
readonly mechanism: "Smoke constituents can contribute to oxidative stress and DNA damage. Membrane damage can interfere with active movement.";
|
|
68
68
|
readonly timescale: "Repeated exposure and sperm development. A new cohort replaces the initial sample.";
|
|
69
69
|
readonly limits: "A cigarette does not instantly reshape a sperm. The scene does not predict the effect of a cigarette count.";
|
|
@@ -78,19 +78,22 @@ export declare const FACTORS: readonly [{
|
|
|
78
78
|
readonly id: "alcohol";
|
|
79
79
|
readonly title: "Heavy alcohol use";
|
|
80
80
|
readonly evidence: "Human association";
|
|
81
|
-
readonly summary: "
|
|
81
|
+
readonly summary: "Set weekly U.S. standard drinks. One standard drink contains 14 grams of pure alcohol.";
|
|
82
82
|
readonly mechanism: "Chronic heavy alcohol use can disrupt hormone balance and sperm production. Studies also report changes in movement and shape.";
|
|
83
83
|
readonly timescale: "Repeated exposure over weeks to months. This scene uses a new sample.";
|
|
84
84
|
readonly limits: "Heavy use differs from moderate consumption. No established dose-response curve converts drinks into the counts in this scene.";
|
|
85
85
|
readonly sources: readonly [{
|
|
86
86
|
readonly title: "ASRM: Optimizing natural fertility";
|
|
87
87
|
readonly url: "https://www.asrm.org/practice-guidance/practice-committee-documents/optimizing-natural-fertility-a-committee-opinion-2021/";
|
|
88
|
+
}, {
|
|
89
|
+
readonly title: "NIAAA: What is a standard drink?";
|
|
90
|
+
readonly url: "https://www.niaaa.nih.gov/alcohols-effects-health/what-standard-drink";
|
|
88
91
|
}];
|
|
89
92
|
}, {
|
|
90
93
|
readonly id: "stress";
|
|
91
94
|
readonly title: "Chronic stress";
|
|
92
95
|
readonly evidence: "Mixed evidence";
|
|
93
|
-
readonly summary: "
|
|
96
|
+
readonly summary: "Set the number of days with prolonged stress in a typical week in the example.";
|
|
94
97
|
readonly mechanism: "Stress-related hormone signals can affect reproductive pathways. Human studies report variable associations with semen measures.";
|
|
95
98
|
readonly timescale: "Prolonged exposure. This example represents a later sample.";
|
|
96
99
|
readonly limits: "Association does not prove cause. A stressful day does not determine sperm quality. This scene shows an uncertain pathway.";
|
|
@@ -105,7 +108,7 @@ export declare const FACTORS: readonly [{
|
|
|
105
108
|
readonly id: "sleep";
|
|
106
109
|
readonly title: "Disrupted sleep";
|
|
107
110
|
readonly evidence: "Human association";
|
|
108
|
-
readonly summary: "
|
|
111
|
+
readonly summary: "Set the number of nights with disrupted sleep in a typical week in the example.";
|
|
109
112
|
readonly mechanism: "Sleep patterns relate to daily hormone rhythms. Observational studies report associations between disturbed sleep and some semen measures.";
|
|
110
113
|
readonly timescale: "Habitual sleep patterns. This example represents a later sample.";
|
|
111
114
|
readonly limits: "These associations do not prove cause. The model does not prescribe sleep hours or predict damage after a poor night.";
|
|
@@ -120,10 +123,10 @@ export declare const FACTORS: readonly [{
|
|
|
120
123
|
readonly id: "heat";
|
|
121
124
|
readonly title: "Prolonged heat";
|
|
122
125
|
readonly evidence: "Established mechanism";
|
|
123
|
-
readonly summary: "
|
|
126
|
+
readonly summary: "Set weekly hours of extra heat exposure in a repeated exposure scenario.";
|
|
124
127
|
readonly mechanism: "Increased testicular temperature can disturb sperm production and function. This example changes the later cohort, not the current fluid temperature.";
|
|
125
128
|
readonly timescale: "Sustained exposure, followed by delayed sample changes.";
|
|
126
|
-
readonly limits: "The
|
|
129
|
+
readonly limits: "The model does not measure temperature. Heat sources and individual responses differ. Normal warmth does not imply damage.";
|
|
127
130
|
readonly sources: readonly [{
|
|
128
131
|
title: string;
|
|
129
132
|
url: string;
|
|
@@ -135,7 +138,7 @@ export declare const FACTORS: readonly [{
|
|
|
135
138
|
readonly id: "fever";
|
|
136
139
|
readonly title: "Fever";
|
|
137
140
|
readonly evidence: "Human association";
|
|
138
|
-
readonly summary: "
|
|
141
|
+
readonly summary: "Set how many days a single fever episode lasts in the example.";
|
|
139
142
|
readonly mechanism: "Fever can disrupt developing sperm. Changes in concentration, movement, and shape can appear after the illness.";
|
|
140
143
|
readonly timescale: "Delayed effects over subsequent weeks. Recovery also takes time.";
|
|
141
144
|
readonly limits: "Responses differ with the illness and its timing. This example does not set a recovery date or diagnose an infection.";
|
|
@@ -147,7 +150,7 @@ export declare const FACTORS: readonly [{
|
|
|
147
150
|
readonly id: "metabolic";
|
|
148
151
|
readonly title: "Obesity and metabolic health";
|
|
149
152
|
readonly evidence: "Human association";
|
|
150
|
-
readonly summary: "
|
|
153
|
+
readonly summary: "Choose a modeled level of metabolic stress during sperm development.";
|
|
151
154
|
readonly mechanism: "Hormone balance, inflammation, and heat can differ with metabolic conditions. Population studies associate obesity with poorer semen measures.";
|
|
152
155
|
readonly timescale: "Longer-term conditions. This example represents a later sample.";
|
|
153
156
|
readonly limits: "Body size does not diagnose fertility. Individuals differ, and the scene does not assign a target weight or a fertility score.";
|
|
@@ -162,7 +165,7 @@ export declare const FACTORS: readonly [{
|
|
|
162
165
|
readonly id: "androgens";
|
|
163
166
|
readonly title: "Testosterone and anabolic steroids";
|
|
164
167
|
readonly evidence: "Established mechanism";
|
|
165
|
-
readonly summary: "
|
|
168
|
+
readonly summary: "Choose a modeled level of exposure to external androgens.";
|
|
166
169
|
readonly mechanism: "External androgens suppress pituitary signals that support sperm production. A higher blood testosterone level does not guarantee more sperm.";
|
|
167
170
|
readonly timescale: "Suppression and recovery develop over months. Individual timing differs.";
|
|
168
171
|
readonly limits: "This scene does not give medication advice or a recovery schedule. Steroid-associated suppression differs from ordinary exercise.";
|
|
@@ -177,7 +180,7 @@ export declare const FACTORS: readonly [{
|
|
|
177
180
|
readonly id: "pesticides";
|
|
178
181
|
readonly title: "Certain pesticides";
|
|
179
182
|
readonly evidence: "Human association";
|
|
180
|
-
readonly summary: "
|
|
183
|
+
readonly summary: "Choose a modeled level of repeated exposure to one example class of chemicals.";
|
|
181
184
|
readonly mechanism: "Some chemicals can disturb hormone signals or contribute to cellular stress. Effects depend on the substance and exposure.";
|
|
182
185
|
readonly timescale: "Substance-specific exposure and sperm development. This example uses a later sample.";
|
|
183
186
|
readonly limits: "Pesticides are not one substance. This scene is not an exposure calculator and does not represent all products.";
|
package/dist/core/factors.js
CHANGED
|
@@ -12,7 +12,7 @@ export const ANATOMY_SOURCES = [
|
|
|
12
12
|
export const FACTORS = [
|
|
13
13
|
{
|
|
14
14
|
id: "exercise", title: "Regular exercise", evidence: "Human association",
|
|
15
|
-
summary: "Compare
|
|
15
|
+
summary: "Compare weekly minutes of regular physical activity in the example.",
|
|
16
16
|
mechanism: "Physical activity can support metabolic health and hormone balance. Some studies report better semen measures in active men.",
|
|
17
17
|
timescale: "Weeks to months. This example represents a new sample after development.",
|
|
18
18
|
limits: "Exercise does not guarantee better semen or pregnancy. Studies differ, and this example has no prescribed exercise dose.",
|
|
@@ -20,7 +20,7 @@ export const FACTORS = [
|
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
id: "endurance", title: "High-volume running", evidence: "Mixed evidence",
|
|
23
|
-
summary: "
|
|
23
|
+
summary: "Set weekly hours of hard running in a scenario with poor recovery.",
|
|
24
24
|
mechanism: "Low energy availability, heat, and insufficient recovery can accompany heavy training. These conditions can affect reproductive hormone signals.",
|
|
25
25
|
timescale: "Weeks to months. This example represents a later sample.",
|
|
26
26
|
limits: "Running is not inherently harmful. Endurance studies report inconsistent results. The scene shows one possible pathway, without a mileage threshold.",
|
|
@@ -28,7 +28,7 @@ export const FACTORS = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: "cycling", title: "Long cycling sessions", evidence: "Mixed evidence",
|
|
31
|
-
summary: "
|
|
31
|
+
summary: "Set weekly hours spent in long cycling sessions.",
|
|
32
32
|
mechanism: "Long sessions can involve local heat and pressure. Some studies report differences in semen measures among cyclists.",
|
|
33
33
|
timescale: "Repeated exposure over weeks. This example represents a later sample.",
|
|
34
34
|
limits: "Studies do not establish a universal cycling threshold. The scene shows a possible adverse example, not an inevitable effect.",
|
|
@@ -36,7 +36,7 @@ export const FACTORS = [
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
id: "smoking", title: "Smoking", evidence: "Human association",
|
|
39
|
-
summary: "
|
|
39
|
+
summary: "Set the usual number of cigarettes smoked per day in the example.",
|
|
40
40
|
mechanism: "Smoke constituents can contribute to oxidative stress and DNA damage. Membrane damage can interfere with active movement.",
|
|
41
41
|
timescale: "Repeated exposure and sperm development. A new cohort replaces the initial sample.",
|
|
42
42
|
limits: "A cigarette does not instantly reshape a sperm. The scene does not predict the effect of a cigarette count.",
|
|
@@ -44,15 +44,15 @@ export const FACTORS = [
|
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
id: "alcohol", title: "Heavy alcohol use", evidence: "Human association",
|
|
47
|
-
summary: "
|
|
47
|
+
summary: "Set weekly U.S. standard drinks. One standard drink contains 14 grams of pure alcohol.",
|
|
48
48
|
mechanism: "Chronic heavy alcohol use can disrupt hormone balance and sperm production. Studies also report changes in movement and shape.",
|
|
49
49
|
timescale: "Repeated exposure over weeks to months. This scene uses a new sample.",
|
|
50
50
|
limits: "Heavy use differs from moderate consumption. No established dose-response curve converts drinks into the counts in this scene.",
|
|
51
|
-
sources: [{ title: "ASRM: Optimizing natural fertility", url: "https://www.asrm.org/practice-guidance/practice-committee-documents/optimizing-natural-fertility-a-committee-opinion-2021/" }],
|
|
51
|
+
sources: [{ title: "ASRM: Optimizing natural fertility", url: "https://www.asrm.org/practice-guidance/practice-committee-documents/optimizing-natural-fertility-a-committee-opinion-2021/" }, { title: "NIAAA: What is a standard drink?", url: "https://www.niaaa.nih.gov/alcohols-effects-health/what-standard-drink" }],
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
id: "stress", title: "Chronic stress", evidence: "Mixed evidence",
|
|
55
|
-
summary: "
|
|
55
|
+
summary: "Set the number of days with prolonged stress in a typical week in the example.",
|
|
56
56
|
mechanism: "Stress-related hormone signals can affect reproductive pathways. Human studies report variable associations with semen measures.",
|
|
57
57
|
timescale: "Prolonged exposure. This example represents a later sample.",
|
|
58
58
|
limits: "Association does not prove cause. A stressful day does not determine sperm quality. This scene shows an uncertain pathway.",
|
|
@@ -60,7 +60,7 @@ export const FACTORS = [
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
id: "sleep", title: "Disrupted sleep", evidence: "Human association",
|
|
63
|
-
summary: "
|
|
63
|
+
summary: "Set the number of nights with disrupted sleep in a typical week in the example.",
|
|
64
64
|
mechanism: "Sleep patterns relate to daily hormone rhythms. Observational studies report associations between disturbed sleep and some semen measures.",
|
|
65
65
|
timescale: "Habitual sleep patterns. This example represents a later sample.",
|
|
66
66
|
limits: "These associations do not prove cause. The model does not prescribe sleep hours or predict damage after a poor night.",
|
|
@@ -68,15 +68,15 @@ export const FACTORS = [
|
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
id: "heat", title: "Prolonged heat", evidence: "Established mechanism",
|
|
71
|
-
summary: "
|
|
71
|
+
summary: "Set weekly hours of extra heat exposure in a repeated exposure scenario.",
|
|
72
72
|
mechanism: "Increased testicular temperature can disturb sperm production and function. This example changes the later cohort, not the current fluid temperature.",
|
|
73
73
|
timescale: "Sustained exposure, followed by delayed sample changes.",
|
|
74
|
-
limits: "The
|
|
74
|
+
limits: "The model does not measure temperature. Heat sources and individual responses differ. Normal warmth does not imply damage.",
|
|
75
75
|
sources: [eau, { title: "Scrotal heat stress and sperm chromatin damage in fertile men", url: "https://pmc.ncbi.nlm.nih.gov/articles/PMC4429437/" }],
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
id: "fever", title: "Fever", evidence: "Human association",
|
|
79
|
-
summary: "
|
|
79
|
+
summary: "Set how many days a single fever episode lasts in the example.",
|
|
80
80
|
mechanism: "Fever can disrupt developing sperm. Changes in concentration, movement, and shape can appear after the illness.",
|
|
81
81
|
timescale: "Delayed effects over subsequent weeks. Recovery also takes time.",
|
|
82
82
|
limits: "Responses differ with the illness and its timing. This example does not set a recovery date or diagnose an infection.",
|
|
@@ -84,7 +84,7 @@ export const FACTORS = [
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
id: "metabolic", title: "Obesity and metabolic health", evidence: "Human association",
|
|
87
|
-
summary: "
|
|
87
|
+
summary: "Choose a modeled level of metabolic stress during sperm development.",
|
|
88
88
|
mechanism: "Hormone balance, inflammation, and heat can differ with metabolic conditions. Population studies associate obesity with poorer semen measures.",
|
|
89
89
|
timescale: "Longer-term conditions. This example represents a later sample.",
|
|
90
90
|
limits: "Body size does not diagnose fertility. Individuals differ, and the scene does not assign a target weight or a fertility score.",
|
|
@@ -92,7 +92,7 @@ export const FACTORS = [
|
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
id: "androgens", title: "Testosterone and anabolic steroids", evidence: "Established mechanism",
|
|
95
|
-
summary: "
|
|
95
|
+
summary: "Choose a modeled level of exposure to external androgens.",
|
|
96
96
|
mechanism: "External androgens suppress pituitary signals that support sperm production. A higher blood testosterone level does not guarantee more sperm.",
|
|
97
97
|
timescale: "Suppression and recovery develop over months. Individual timing differs.",
|
|
98
98
|
limits: "This scene does not give medication advice or a recovery schedule. Steroid-associated suppression differs from ordinary exercise.",
|
|
@@ -100,7 +100,7 @@ export const FACTORS = [
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
id: "pesticides", title: "Certain pesticides", evidence: "Human association",
|
|
103
|
-
summary: "
|
|
103
|
+
summary: "Choose a modeled level of repeated exposure to one example class of chemicals.",
|
|
104
104
|
mechanism: "Some chemicals can disturb hormone signals or contribute to cellular stress. Effects depend on the substance and exposure.",
|
|
105
105
|
timescale: "Substance-specific exposure and sperm development. This example uses a later sample.",
|
|
106
106
|
limits: "Pesticides are not one substance. This scene is not an exposure calculator and does not represent all products.",
|
package/dist/react/sperm-lab.js
CHANGED
|
@@ -10,10 +10,42 @@ const groups = [
|
|
|
10
10
|
{ title: "Chemicals", ids: ["androgens", "pesticides"], side: "right" },
|
|
11
11
|
];
|
|
12
12
|
const shortLabels = {
|
|
13
|
-
exercise: "Regular exercise", endurance: "Heavy running", cycling: "Long cycling", smoking: "Smoking", alcohol: "
|
|
13
|
+
exercise: "Regular exercise", endurance: "Heavy running", cycling: "Long cycling", smoking: "Smoking", alcohol: "Alcohol use",
|
|
14
14
|
stress: "Chronic stress", sleep: "Poor sleep", heat: "Prolonged heat", fever: "Fever", metabolic: "Metabolic stress",
|
|
15
15
|
androgens: "External androgens", pesticides: "Certain pesticides",
|
|
16
16
|
};
|
|
17
|
+
const scenarioLevels = ["Off", "Low", "Moderate", "High"];
|
|
18
|
+
const factorControls = {
|
|
19
|
+
exercise: { max: 300, step: 15, unit: ["min/week", "min/week"] },
|
|
20
|
+
endurance: { max: 15, step: 1, unit: ["hour/week", "hours/week"] },
|
|
21
|
+
cycling: { max: 20, step: 1, unit: ["hour/week", "hours/week"] },
|
|
22
|
+
smoking: { max: 40, step: 1, unit: ["cigarette/day", "cigarettes/day"] },
|
|
23
|
+
alcohol: { max: 35, step: 1, unit: ["drink/week", "drinks/week"] },
|
|
24
|
+
stress: { max: 7, step: 1, unit: ["day/week", "days/week"] },
|
|
25
|
+
sleep: { max: 7, step: 1, unit: ["night/week", "nights/week"] },
|
|
26
|
+
heat: { max: 14, step: 1, unit: ["hour/week", "hours/week"] },
|
|
27
|
+
fever: { max: 7, step: 1, unit: ["day", "days"] },
|
|
28
|
+
metabolic: scenarioLevels,
|
|
29
|
+
androgens: scenarioLevels,
|
|
30
|
+
pesticides: scenarioLevels,
|
|
31
|
+
};
|
|
32
|
+
function factorSlider(id, strength) {
|
|
33
|
+
const control = factorControls[id];
|
|
34
|
+
if ("max" in control) {
|
|
35
|
+
const { max, step, unit } = control;
|
|
36
|
+
const value = Math.round(strength * max / step) * step;
|
|
37
|
+
if (strength > 0 && value === 0) {
|
|
38
|
+
const firstStep = `${step} ${unit[step === 1 ? 0 : 1]}`;
|
|
39
|
+
return { max, step, value, text: `<${firstStep}`, spokenText: `Less than ${firstStep}` };
|
|
40
|
+
}
|
|
41
|
+
const text = `${value} ${unit[value === 1 ? 0 : 1]}`;
|
|
42
|
+
return { max, step, value, text, spokenText: text };
|
|
43
|
+
}
|
|
44
|
+
const max = control.length - 1;
|
|
45
|
+
const value = strength > 0 ? Math.max(1, Math.round(strength * max)) : 0;
|
|
46
|
+
const text = control[value];
|
|
47
|
+
return { max, step: 1, value, text, spokenText: `${text} (illustrative scenario)` };
|
|
48
|
+
}
|
|
17
49
|
function finite(value, fallback, min, max) {
|
|
18
50
|
return Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback;
|
|
19
51
|
}
|
|
@@ -413,12 +445,13 @@ export function SpermLab({ seed = 42, count = 48, initialFactors, initialFactor,
|
|
|
413
445
|
}
|
|
414
446
|
function controlColumn(side) {
|
|
415
447
|
return _jsx("aside", { className: `sl-controls sl-controls-${side}`, "aria-label": `${side === "left" ? "Exercise and habits" : "Body and chemicals"} factors`, children: groups.filter(group => group.side === side).map(group => _jsxs("fieldset", { className: "sl-factor-group", children: [_jsx("legend", { children: group.title }), group.ids.map(id => {
|
|
416
|
-
const factor = FACTORS.find(item => item.id === id)
|
|
448
|
+
const factor = FACTORS.find(item => item.id === id);
|
|
449
|
+
const { max, step, value, text, spokenText } = factorSlider(id, factors[id] ?? 0);
|
|
417
450
|
const rangeId = `${prefix}-${id}`;
|
|
418
|
-
return _jsxs("div", { className: "sl-factor", children: [_jsxs("div", { className: "sl-factor-row", children: [_jsx("label", { htmlFor: rangeId, children: shortLabels[id] }), _jsx("input", { id: rangeId, "data-factor": id, type: "range", min:
|
|
451
|
+
return _jsxs("div", { className: "sl-factor", children: [_jsxs("div", { className: "sl-factor-row", children: [_jsx("label", { htmlFor: rangeId, children: shortLabels[id] }), _jsx("input", { id: rangeId, "data-factor": id, type: "range", min: 0, max: max, step: step, value: value, "aria-label": shortLabels[id] === factor.title ? factor.title : `${shortLabels[id]}: ${factor.title}`, "aria-valuetext": spokenText, style: { "--sl-progress": `${value / max * 100}%` }, onChange: event => changeFactor(id, Number(event.target.value) / max) }), _jsx("output", { htmlFor: rangeId, children: text })] }), _jsxs("details", { className: "sl-factor-help", children: [_jsxs("summary", { children: [_jsxs("span", { children: ["About ", shortLabels[id].toLowerCase()] }), _jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: _jsx("path", { d: "m5 6 3 3 3-3" }) })] }), _jsx("p", { children: factor.summary }), _jsx("p", { children: factor.mechanism }), _jsx("p", { className: "sl-evidence", children: factor.evidence }), _jsx("p", { children: factor.limits }), _jsx("p", { className: "sl-help-timescale", children: factor.timescale }), _jsx("ul", { children: factor.sources.map(source => _jsx("li", { children: _jsx("a", { href: source.url, target: "_blank", rel: "noopener noreferrer", children: source.title }) }, source.url)) })] })] }, id);
|
|
419
452
|
})] }, group.title)) });
|
|
420
453
|
}
|
|
421
|
-
return _jsxs("div", { ref: root, className: `sperm-lab sl-lab sl-lab-v3 ${className}`.trim(), style: style, children: [_jsxs("div", { className: "sl-intro-line", children: [_jsxs("p", { children: [_jsx("strong", { children: "Change the factors. Watch one sample." }), " Each slider acts independently."] }), _jsx("span", { children: "
|
|
454
|
+
return _jsxs("div", { ref: root, className: `sperm-lab sl-lab sl-lab-v3 ${className}`.trim(), style: style, children: [_jsxs("div", { className: "sl-intro-line", children: [_jsxs("p", { children: [_jsx("strong", { children: "Change the factors. Watch one sample." }), " Each slider acts independently."] }), _jsx("span", { children: "The settings describe example habits and exposures. The sample shows illustrative responses." })] }), _jsxs("div", { className: "sl-workbench", children: [_jsxs("section", { className: "sl-field", "aria-label": "Live sperm sample", children: [_jsxs("div", { className: "sl-sample-bar", children: [_jsxs("div", { children: [_jsx("h2", { children: prepared ? "Prepared defect examples" : defaults.teachingPopulation ? "Illustrative sample" : "Live sample" }), _jsxs("span", { children: [metrics.total, " fictional cells"] })] }), _jsxs("div", { className: "sl-actions", children: [_jsx("button", { className: "sl-explore", type: "button", "aria-pressed": popupOpen, "aria-controls": `${prefix}-sample`, onClick: explore, children: "Explore" }), _jsx("button", { type: "button", "aria-pressed": paused, onClick: () => setPaused(value => !value), children: paused ? "Resume" : "Pause" }), _jsx("button", { type: "button", onClick: reset, children: "Reset sample" })] })] }), _jsxs("div", { className: "sl-concentration", children: [_jsx("span", { id: `${prefix}-concentration`, children: "Concentration" }), _jsxs("output", { "data-concentration": metrics.total, "aria-labelledby": `${prefix}-concentration`, children: [metrics.total, " cells / model field"] }), _jsx("small", { children: "Synthetic model count. No clinical units." })] }), unavailable && _jsx("p", { role: "status", children: "Canvas is unavailable. The sample counts, cell inspector, and factor explanations remain available." }), _jsxs("div", { id: `${prefix}-sample`, className: "sl-canvas-wrap", "data-popup": popupOpen && Boolean(selected), style: { "--sl-popup-min-height": `${popupHeight}px` }, children: [_jsx("canvas", { ref: canvas, tabIndex: 0, role: "group", "aria-label": "Interactive sperm sample. Use Explore to follow a swimmer. Drag to stir. Click a cell for details. Arrow keys create currents. Enter selects the next cell and opens its details. Escape closes details. Space pauses.", "aria-describedby": `${prefix}-help`, onPointerDown: pointerDown, onPointerMove: pointerMove, onPointerUp: pointerUp, onPointerCancel: () => actions.current.release(), onLostPointerCapture: () => { pointer.current = null; }, onKeyDown: keyboard, onContextMenu: event => event.preventDefault(), children: "The sample needs canvas support. Use the cell inspector and model counts for a text alternative." }), popupOpen && selected && _jsxs(_Fragment, { children: [_jsx("svg", { className: "sl-popup-connector", "aria-hidden": "true", children: _jsx("line", { ref: popupConnector }) }), _jsxs("div", { ref: popup, className: "sl-cell-popup", role: "dialog", "aria-modal": "false", "aria-labelledby": `${prefix}-popup-title`, "data-cell-popup": "true", "data-cell-id": selected.id, children: [_jsxs("header", { children: [_jsxs("h3", { id: `${prefix}-popup-title`, children: ["Cell ", selected.id + 1] }), _jsx("button", { ref: popupClose, className: "sl-popup-close", type: "button", "aria-label": "Close cell details", onClick: () => { setPopupOpen(false); canvas.current?.focus({ preventScroll: true }); }, children: _jsx("svg", { viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { d: "m5 5 10 10M15 5 5 15" }) }) })] }), _jsx(CellPopupDetails, { cell: selected, dna: dna }), _jsx("button", { className: "sl-popup-anatomy", type: "button", onClick: () => { setPopupOpen(false); requestAnimationFrame(() => inspector.current?.scrollIntoView({ block: "start", behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth" })); }, children: "Full anatomy" })] })] })] }), _jsxs("div", { className: "sl-sample-tools", children: [_jsx("button", { type: "button", onClick: () => current(.3, .1), disabled: paused, children: "Create a current" }), _jsx("button", { type: "button", onClick: () => nextCell(), children: "Next swimmer" }), _jsx("button", { type: "button", onClick: prepareExamples, children: "Inspect defect examples" }), prepared && _jsx("button", { type: "button", onClick: restore, children: "Return to current settings" })] }), _jsxs("div", { className: "sl-display", children: [_jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: dna, onChange: event => setDna(event.target.checked) }), "DNA overlay"] }), _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: trails, onChange: event => setTrails(event.target.checked) }), "Trails"] }), _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: slowMotion, onChange: event => setSlowMotion(event.target.checked) }), "Slow motion"] })] })] }), controlColumn("left"), controlColumn("right"), _jsxs("div", { className: "sl-sample-notes", children: [_jsx("p", { id: `${prefix}-help`, className: "sl-canvas-help", children: "Use Explore to follow a swimmer. Click or tap another cell to switch. Drag to stir the sample." }), defaults.teachingPopulation && !prepared && _jsx("p", { className: "sl-teaching-population", children: "The teaching sample includes common defect examples. Counts do not show their frequency in people." }), _jsx("p", { className: "sl-overlay-note", children: "Red marks illustrated abnormalities. Disconnected red pieces inside the nucleus show schematic DNA fragmentation. The overlay is not ordinary microscopy." }), _jsx("p", { className: "sl-model-note", children: "Sliders prepare an illustrative later cohort. Counts do not predict personal fertility." }), prepared && _jsx("div", { className: "sl-prepared-note", children: _jsx("p", { children: "These examples contain head, tail, midpiece, and DNA traits. They do not show the effects of a specific exposure." }) })] }), _jsxs("section", { className: "sl-readouts", "aria-labelledby": `${prefix}-counts-title`, children: [_jsx("h2", { id: `${prefix}-counts-title`, children: "In this sample" }), _jsx("dl", { children: [
|
|
422
455
|
["Cells", metrics.total], ["Active motion", metrics.motile], ["Forward", metrics.progressive], ["Slow", metrics.slow],
|
|
423
456
|
["Nonprogressive", metrics.nonprogressive], ["Still", metrics.immotile], ["Alive", metrics.alive],
|
|
424
457
|
].map(([label, value]) => _jsxs("div", { children: [_jsx("dt", { children: label }), _jsx("dd", { children: value })] }, label)) })] }), _jsxs("section", { className: "sl-catalog", "aria-labelledby": `${prefix}-catalog-title`, children: [_jsxs("header", { children: [_jsx("h2", { id: `${prefix}-catalog-title`, children: "Common examples" }), _jsx("p", { children: "These curated examples explain separate traits. Their frequency is not clinical prevalence. Select an example to inspect its cell." })] }), _jsx("div", { className: "sl-defect-catalog", children: DEFECT_CATALOG.map(defect => {
|
package/dist/styles.css
CHANGED
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
.sl-factor-group + .sl-factor-group { padding-top: 16px; border-top: 1px solid var(--sl-rule); }
|
|
33
33
|
.sl-factor-group legend { width: 100%; padding: 0; margin-bottom: 8px; font-size: 13px; line-height: 1.5; font-weight: 600; }
|
|
34
34
|
.sl-factor + .sl-factor { margin-top: 12px; }
|
|
35
|
-
.sl-factor-row { display: grid; grid-template-columns: minmax(0, 1fr)
|
|
36
|
-
.sl-factor-row label { grid-column: 1; grid-row: 1; font-size: 13px; line-height: 18px;
|
|
35
|
+
.sl-factor-row { display: grid; grid-template-columns: minmax(0, 1fr) fit-content(55%); align-items: center; column-gap: 8px; }
|
|
36
|
+
.sl-factor-row label { grid-column: 1; grid-row: 1; font-size: 13px; line-height: 18px; }
|
|
37
37
|
.sl-factor-row input[type="range"] { grid-column: 1 / -1; grid-row: 2; appearance: none; -webkit-appearance: none; display: block; width: 100%; min-width: 0; height: 44px; padding: 0; margin: 0; border: 0; background: transparent; accent-color: var(--sl-accent); cursor: pointer; }
|
|
38
38
|
.sl-factor-row input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(to right, var(--sl-accent) 0 var(--sl-progress), var(--sl-track) var(--sl-progress) 100%); }
|
|
39
39
|
.sl-factor-row input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--sl-track); }
|
|
40
40
|
.sl-factor-row input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--sl-accent); }
|
|
41
41
|
.sl-factor-row input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin-top: -6px; border: 0; border-radius: 50%; background: var(--sl-accent); }
|
|
42
42
|
.sl-factor-row input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--sl-accent); }
|
|
43
|
-
.sl-factor-row output { grid-column: 2; grid-row: 1; font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; text-align: right; opacity: .8; }
|
|
43
|
+
.sl-factor-row output { grid-column: 2; grid-row: 1; font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; opacity: .8; }
|
|
44
44
|
.sl-factor-help { min-width: 0; }
|
|
45
45
|
.sl-factor-help summary { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 26px; width: 100%; cursor: pointer; font-size: 10px; color: var(--sl-accent); list-style: none; }
|
|
46
46
|
.sl-factor-help summary::-webkit-details-marker { display: none; }
|
package/docs/API.md
CHANGED
|
@@ -55,6 +55,7 @@ All factor strengths default to zero.
|
|
|
55
55
|
The older `initialFactor` option starts that factor at a strength of 0.65.
|
|
56
56
|
All 12 native factor sliders remain visible.
|
|
57
57
|
Each slider changes its own value in the combined sample.
|
|
58
|
+
The sliders show example quantities or scenario levels. The component converts slider changes to strengths from 0 to 1.
|
|
58
59
|
|
|
59
60
|
`onMetrics` receives one `Metrics` object after the initial mount and population changes.
|
|
60
61
|
It does not run for every animation frame.
|
package/docs/MODEL.md
CHANGED
|
@@ -49,7 +49,8 @@ The lab identifies uncertain scenarios as possible-pathway examples.
|
|
|
49
49
|
|
|
50
50
|
Every numerical parameter in a scenario is an authored teaching value.
|
|
51
51
|
The parameters do not fit clinical data.
|
|
52
|
-
|
|
52
|
+
The React controls use example quantities such as cigarettes per day and nights of disrupted sleep per week.
|
|
53
|
+
These quantities select relative strengths in the core. The model does not estimate a clinical response to an exposure.
|
|
53
54
|
The core progress option does not represent a clinical recovery period.
|
|
54
55
|
The React component applies the current factor settings at progress 1.
|
|
55
56
|
|
package/package.json
CHANGED