@esmirnov.ai/sperm-lab 0.4.4 → 0.4.5

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.
@@ -41,7 +41,7 @@ function paintCell(context, cell, time, width, height, palette, display) {
41
41
  const selected = cell.id === display.selected;
42
42
  const color = selected ? palette.accent : palette.ink;
43
43
  const damage = palette.damage ?? "#b82735";
44
- const paper = palette.paper ?? "#eff2ed";
44
+ const paper = palette.paper ?? "#fbfdff";
45
45
  const geometry = getCellGeometry(cell, time, width, height);
46
46
  const { anchor, scale, headRx: rx, headRy: ry } = geometry;
47
47
  const opacity = cell.alive ? .97 : .66;
@@ -133,7 +133,7 @@ export function SpermLab({ seed = 42, count = 48, initialFactors, initialFactor,
133
133
  setPaused(true);
134
134
  }
135
135
  let frame = 0, idleFrame = 0, last = 0, visible = true, destroyed = false, width = 0, height = 0;
136
- let palette = { ink: "#303832", sage: "#6f897c", clay: "#a67769", accent: "#785448", paper: "#eff2ed", damage: "#b82735" };
136
+ let palette = { ink: "#17243a", sage: "#337e90", clay: "#a15570", accent: "#1557df", paper: "#fbfdff", damage: "#b82735" };
137
137
  function draw() {
138
138
  if (!world.current)
139
139
  return;
@@ -229,7 +229,7 @@ export function SpermLab({ seed = 42, count = 48, initialFactors, initialFactor,
229
229
  return;
230
230
  const computed = getComputedStyle(root.current);
231
231
  const token = (name, fallback) => computed.getPropertyValue(name).trim() || fallback;
232
- palette = { ink: computed.color, sage: token("--sl-sage", "#6f897c"), clay: token("--sl-clay", "#a67769"), accent: token("--sl-accent", "#785448"), paper: token("--sl-paper", "#eff2ed"), damage: token("--sl-damage", "#b82735") };
232
+ palette = { ink: computed.color, sage: token("--sl-sage", "#337e90"), clay: token("--sl-clay", "#a15570"), accent: token("--sl-accent", "#1557df"), paper: token("--sl-paper", "#fbfdff"), damage: token("--sl-damage", "#b82735") };
233
233
  width = surface.clientWidth;
234
234
  height = surface.clientHeight;
235
235
  if (!width || !height)
package/dist/styles.css CHANGED
@@ -1,36 +1,36 @@
1
1
  .sl-lab {
2
- --sl-surface: #dfe5dc;
3
- --sl-ink: #303832;
4
- --sl-accent: #785448;
5
- --sl-paper: #eff2ed;
2
+ --sl-surface: #edf3fb;
3
+ --sl-ink: #17243a;
4
+ --sl-accent: #1557df;
5
+ --sl-paper: #fbfdff;
6
6
  --sl-rule: color-mix(in oklch, var(--sl-ink) 22%, transparent);
7
- --sl-track: color-mix(in oklch, var(--sl-ink) 28%, var(--sl-surface));
8
- --sl-sage: #6f897c;
9
- --sl-clay: #a67769;
7
+ --sl-track: color-mix(in srgb, var(--sl-ink) 17%, var(--sl-surface));
8
+ --sl-sage: #337e90;
9
+ --sl-clay: #a15570;
10
10
  --sl-damage: #b82735;
11
11
  container: sperm-lab / inline-size;
12
12
  width: 100%; min-width: 0; color: var(--sl-ink);
13
- font: 14px/1.55 Arial, Helvetica, sans-serif; color-scheme: light;
13
+ font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: light;
14
14
  }
15
15
  .sl-lab, .sl-lab * { box-sizing: border-box; }
16
16
  .sl-lab :is(button, input, select) { color: inherit; font: inherit; }
17
17
  .sl-lab :is(button, input, canvas, a, summary):focus-visible { outline: 2px solid var(--sl-accent); outline-offset: 3px; }
18
- .sl-lab button { min-height: 44px; padding: 8px 10px; border: 1px solid var(--sl-rule); border-radius: 4px; background: transparent; cursor: pointer; font-size: 12px; }
19
- .sl-lab button:hover { background: color-mix(in oklch, var(--sl-ink) 6%, transparent); }
18
+ .sl-lab button { min-height: 44px; padding: 8px 10px; border: 0; border-radius: 999px; background: var(--sl-paper); cursor: pointer; font-size: 12px; }
19
+ .sl-lab button:hover { color: var(--sl-accent); background: color-mix(in srgb, var(--sl-accent) 7%, var(--sl-paper)); }
20
20
  .sl-lab button:disabled { opacity: .4; cursor: default; }
21
21
  .sl-lab p { max-width: 72ch; }
22
22
  .sl-lab h2, .sl-lab h3 { color: inherit; letter-spacing: normal; }
23
- .sl-intro-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--sl-rule); }
23
+ .sl-intro-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; margin-bottom: 22px; }
24
24
  .sl-intro-line p { margin: 0; font-size: 13px; }
25
25
  .sl-intro-line strong { font-weight: 600; }
26
26
  .sl-intro-line > span { font-size: 11px; opacity: .75; }
27
27
  .sl-workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr) minmax(0, 1fr); grid-template-areas: "left field right" "left notes right" "left readouts right" "catalog catalog catalog" "inspector inspector inspector"; align-items: start; gap: 20px 24px; }
28
- .sl-controls { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
28
+ .sl-controls { min-width: 0; display: flex; flex-direction: column; gap: 26px; padding: 12px 4px; }
29
29
  .sl-controls-left { grid-area: left; }
30
30
  .sl-controls-right { grid-area: right; }
31
31
  .sl-factor-group { min-width: 0; border: 0; padding: 0; margin: 0; }
32
- .sl-factor-group + .sl-factor-group { padding-top: 16px; border-top: 1px solid var(--sl-rule); }
33
- .sl-factor-group legend { width: 100%; padding: 0; margin-bottom: 8px; font-size: 13px; line-height: 1.5; font-weight: 600; }
32
+ .sl-factor-group + .sl-factor-group { padding-top: 4px; }
33
+ .sl-factor-group legend { width: 100%; padding: 0; margin-bottom: 8px; font-size: 16px; line-height: 1.5; font-weight: 600; }
34
34
  .sl-factor + .sl-factor { margin-top: 12px; }
35
35
  .sl-factor-row { display: grid; grid-template-columns: minmax(0, 1fr) fit-content(55%); align-items: center; column-gap: 8px; }
36
36
  .sl-factor-row label { grid-column: 1; grid-row: 1; font-size: 13px; line-height: 18px; }
@@ -52,30 +52,30 @@
52
52
  .sl-help-timescale { opacity: .8; }
53
53
  .sl-factor-help ul { margin: 8px 0 0; padding: 0; list-style: none; }
54
54
  .sl-factor-help a { display: inline-flex; align-items: center; min-height: 32px; font-size: 10px; line-height: 1.5; color: var(--sl-accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
55
- .sl-field { grid-area: field; min-width: 0; }
55
+ .sl-field { grid-area: field; min-width: 0; padding: clamp(14px, 1.5cqi, 22px); background: radial-gradient(ellipse at 4% 45%, #eaf6f9, transparent 62%), linear-gradient(140deg, var(--sl-paper), #f2f0fa); border-radius: 24px; }
56
56
  .sl-sample-notes { grid-area: notes; min-width: 0; }
57
57
  .sl-sample-notes > :first-child { margin-top: 0; }
58
- .sl-sample-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding-bottom: 9px; border-bottom: 1px solid var(--sl-rule); }
58
+ .sl-sample-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding-bottom: 9px; }
59
59
  .sl-sample-bar > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
60
- .sl-sample-bar h2 { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; }
60
+ .sl-sample-bar h2 { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 600; }
61
61
  .sl-sample-bar span { font-size: 10px; opacity: .75; }
62
62
  .sl-concentration { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; margin-top: 10px; }
63
63
  .sl-concentration > span { font-size: 11px; }
64
- .sl-concentration output { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
64
+ .sl-concentration output { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--sl-accent); }
65
65
  .sl-concentration small { flex-basis: 100%; font-size: 10px; line-height: 1.5; opacity: .75; }
66
66
  .sl-teaching-population { margin: 7px 0 0; font-size: 10px; line-height: 1.6; opacity: .8; }
67
67
  .sl-actions { display: flex; gap: 4px; }
68
- .sl-actions button { border: 0; padding-inline: 8px; }
69
- .sl-actions .sl-explore { border: 1px solid var(--sl-rule); }
70
- .sl-actions .sl-explore[aria-pressed="true"] { color: var(--sl-accent); background: color-mix(in oklch, var(--sl-clay) 14%, transparent); }
71
- .sl-canvas-wrap { position: relative; width: 100%; aspect-ratio: 1.35; min-height: 300px; max-height: 480px; }
68
+ .sl-actions button { padding-inline: 12px; background: transparent; }
69
+ .sl-actions .sl-explore { background: color-mix(in srgb, var(--sl-accent) 9%, var(--sl-paper)); color: var(--sl-accent); }
70
+ .sl-actions .sl-explore[aria-pressed="true"] { color: white; border-color: var(--sl-accent); background: var(--sl-accent); }
71
+ .sl-canvas-wrap { position: relative; width: 100%; aspect-ratio: 1.35; min-height: 300px; max-height: 480px; margin-top: 12px; background: transparent; }
72
72
  .sl-canvas-wrap canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: pan-y pinch-zoom; }
73
73
  .sl-canvas-wrap canvas:active { cursor: grabbing; }
74
74
  .sl-canvas-wrap canvas:focus-visible { outline-offset: -4px; }
75
75
  .sl-canvas-wrap[data-popup="true"] { min-height: max(300px, var(--sl-popup-min-height, 0px)); max-height: none; }
76
76
  .sl-popup-connector { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
77
77
  .sl-popup-connector line { stroke: var(--sl-accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: .65; }
78
- .sl-cell-popup { position: absolute; top: 0; left: 0; z-index: 3; width: 260px; max-width: calc(100% - 16px); padding: 0 12px 8px; border: 1px solid var(--sl-rule); border-radius: 4px; background: var(--sl-paper); color: var(--sl-ink); visibility: hidden; }
78
+ .sl-cell-popup { position: absolute; top: 0; left: 0; z-index: 3; width: 260px; max-width: calc(100% - 16px); padding: 0 12px 8px; border: 0; border-radius: 18px; box-shadow: 0 3px 18px rgb(23 36 58 / 11%); background: var(--sl-paper); color: var(--sl-ink); visibility: hidden; }
79
79
  .sl-cell-popup > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
80
80
  .sl-cell-popup h3 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
81
81
  .sl-cell-popup .sl-popup-close { display: grid; place-items: center; min-width: 44px; min-height: 44px; margin-right: -8px; padding: 8px; border: 0; }
@@ -83,7 +83,7 @@
83
83
  .sl-popup-details dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
84
84
  .sl-popup-details dt { font-size: 9px; line-height: 1.4; opacity: .75; }
85
85
  .sl-popup-details dd { margin: 2px 0 0; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
86
- .sl-popup-traits { display: grid; gap: 8px; padding: 10px 0 0; margin: 10px 0 0; border-top: 1px solid var(--sl-rule); list-style: none; }
86
+ .sl-popup-traits { display: grid; gap: 8px; padding: 10px 0 0; margin: 10px 0 0; list-style: none; }
87
87
  .sl-popup-traits strong, .sl-popup-traits span { display: block; }
88
88
  .sl-popup-traits strong { font-size: 10px; font-weight: 600; line-height: 1.4; }
89
89
  .sl-popup-traits span { margin-top: 2px; font-size: 10px; line-height: 1.5; }
@@ -91,23 +91,23 @@
91
91
  .sl-cell-popup .sl-popup-anatomy { min-height: 44px; margin-top: 7px; padding: 7px 0; border: 0; color: var(--sl-accent); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
92
92
  .sl-canvas-help { margin: 6px 0 0; font-size: 11px; line-height: 1.6; }
93
93
  .sl-sample-tools { display: flex; flex-wrap: wrap; gap: 5px 7px; margin-top: 10px; }
94
- .sl-sample-tools button { flex: 1 1 auto; padding-inline: 8px; font-size: 11px; }
94
+ .sl-sample-tools button { flex: 1 1 auto; background: var(--sl-paper); color: var(--sl-accent); padding-inline: 8px; font-size: 11px; }
95
95
  .sl-display { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 7px; }
96
96
  .sl-display label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 11px; cursor: pointer; }
97
97
  .sl-display input { width: 15px; height: 15px; margin: 0; accent-color: var(--sl-accent); }
98
98
  .sl-overlay-note, .sl-model-note { margin: 2px 0 0; font-size: 10px; line-height: 1.6; opacity: .8; }
99
- .sl-readouts { grid-area: readouts; min-width: 0; padding-top: 16px; border-top: 1px solid var(--sl-rule); }
99
+ .sl-readouts { grid-area: readouts; min-width: 0; padding: 6px 4px; }
100
100
  .sl-readouts h2, .sl-inspector h2, .sl-mechanisms h2 { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; }
101
101
  .sl-readouts dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 10px 0 0; }
102
102
  .sl-readouts dt { font-size: 10px; opacity: .75; overflow-wrap: anywhere; }
103
- .sl-readouts dd { margin: 3px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
103
+ .sl-readouts dd { margin: 3px 0 0; font-size: 18px; font-variant-numeric: tabular-nums; }
104
104
  .sl-readouts h3 { margin: 17px 0 0; font-size: 12px; line-height: 1.5; font-weight: 600; }
105
105
  .sl-legend-help { margin: 5px 0 0; font-size: 10px; opacity: .8; }
106
- .sl-catalog { grid-area: catalog; min-width: 0; padding-top: 17px; border-top: 1px solid var(--sl-rule); }
106
+ .sl-catalog { grid-area: catalog; min-width: 0; padding: 18px 0 0; }
107
107
  .sl-catalog h2 { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; }
108
108
  .sl-catalog header > p { margin: 7px 0 0; font-size: 11px; line-height: 1.6; }
109
109
  .sl-defect-catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; margin-top: 12px; }
110
- .sl-defect-catalog button { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 82px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--sl-rule); border-radius: 0; text-align: left; }
110
+ .sl-defect-catalog button { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 82px; padding: 10px 6px; border: 0; border-radius: 12px; text-align: left; background: transparent; }
111
111
  .sl-specimen-thumbnail { flex: 0 0 96px; width: 96px; height: 42px; overflow: visible; }
112
112
  .sl-specimen-thumbnail :is(path, ellipse) { vector-effect: non-scaling-stroke; }
113
113
  .sl-specimen-thumbnail .sl-anatomy-tail { stroke-width: .85; }
@@ -123,15 +123,15 @@
123
123
  .sl-catalog-copy > span { display: block; margin-top: 4px; font-size: 10px; line-height: 1.5; opacity: .8; }
124
124
  .sl-defect-catalog button > b { align-self: start; margin-top: 2px; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 400; }
125
125
  .sl-defect-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; margin-top: 8px; }
126
- .sl-defect-legend button { display: flex; align-items: center; gap: 5px; border: 0; border-bottom: 1px solid var(--sl-rule); border-radius: 0; padding: 7px 0; text-align: left; font-size: 10px; }
126
+ .sl-defect-legend button { display: flex; align-items: center; gap: 5px; border: 0; border-radius: 8px; padding: 7px 4px; text-align: left; font-size: 10px; background: transparent; }
127
127
  .sl-defect-legend svg { flex-shrink: 0; width: 25px; height: 22px; fill: none; stroke: var(--sl-clay); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
128
128
  .sl-defect-legend b { margin-left: auto; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }
129
- .sl-inspector { grid-area: inspector; min-width: 0; padding-top: 18px; border-top: 1px solid var(--sl-rule); }
129
+ .sl-inspector { grid-area: inspector; min-width: 0; padding-top: 18px; }
130
130
  .sl-inspector > header { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
131
131
  .sl-inspector > header p { margin: 0; font-size: 12px; opacity: .8; }
132
132
  .sl-inspector-content { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center; margin-top: 10px; }
133
133
  .sl-anatomy { display: block; width: 100%; max-width: 650px; color: var(--sl-ink); overflow: visible; }
134
- .sl-anatomy text { fill: currentColor; font: 12px Arial, Helvetica, sans-serif; }
134
+ .sl-anatomy text { fill: currentColor; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
135
135
  .sl-anatomy .sl-diagram-caption { font-size: 9px; opacity: .7; }
136
136
  .sl-anatomy-lines { fill: none; stroke: var(--sl-rule); stroke-width: 1; }
137
137
  .sl-anatomy-tail { fill: none; stroke: var(--sl-ink); stroke-width: 1.6; stroke-linecap: round; }
@@ -168,7 +168,7 @@
168
168
  .sl-mechanisms li strong { font-size: 12px; font-weight: 600; }
169
169
  .sl-mechanisms li span { margin-top: 4px; }
170
170
  .sl-mechanisms li small { margin-top: 5px; color: var(--sl-accent); font-size: 10px; }
171
- .sl-prepared-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sl-rule); }
171
+ .sl-prepared-note { margin-top: 12px; padding-top: 10px; }
172
172
  .sl-prepared-note p { margin: 0; font-size: 11px; }
173
173
  @container sperm-lab (max-width: 1000px) {
174
174
  .sl-workbench { grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr) minmax(0, 1fr); gap: 18px 18px; }
@@ -178,7 +178,6 @@
178
178
  @container sperm-lab (max-width: 800px) {
179
179
  .sl-workbench { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "field field" "left right" "readouts readouts" "notes notes" "catalog catalog" "inspector inspector"; gap: 22px; }
180
180
  .sl-defect-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
181
- .sl-controls { padding-top: 18px; border-top: 1px solid var(--sl-rule); }
182
181
  .sl-factor-row input[type="range"] { min-height: 44px; }
183
182
  .sl-factor-help summary { min-height: 36px; }
184
183
  .sl-canvas-wrap { min-height: 300px; max-height: 450px; aspect-ratio: 1.6; }
@@ -204,6 +203,8 @@
204
203
  .sl-sample-tools button { font-size: 10px; }
205
204
  }
206
205
  @media (pointer: coarse) { .sl-factor-row input[type="range"], .sl-factor-help summary { min-height: 44px; } }
206
+ @media (prefers-reduced-motion: no-preference) { .sl-lab button { transition: background-color 140ms ease-out, color 140ms ease-out; } }
207
+ @media (forced-colors: active) { .sl-lab button[aria-pressed="true"], .sl-cell-popup { outline: 1px solid Highlight; } }
207
208
  @media (forced-colors: active) {
208
209
  .sl-lab { --sl-ink: CanvasText; --sl-accent: LinkText; --sl-rule: CanvasText; }
209
210
  .sl-canvas-wrap { border: 1px solid CanvasText; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esmirnov.ai/sperm-lab",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "An interactive sperm education lab with 12 factors, a headless TypeScript simulation, and an embeddable React component.",
5
5
  "type": "module",
6
6
  "license": "MIT",