@classytic/labs 0.1.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 (547) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/dist/biology/enzyme-rate/index.d.mts +1 -0
  4. package/dist/biology/enzyme-rate/preset.d.mts +25 -0
  5. package/dist/biology/enzyme-rate/preset.mjs +256 -0
  6. package/dist/biology/genetic-cross/core.d.mts +64 -0
  7. package/dist/biology/genetic-cross/core.mjs +147 -0
  8. package/dist/biology/genetic-cross/grid.mjs +239 -0
  9. package/dist/biology/genetic-cross/index.d.mts +3 -0
  10. package/dist/biology/genetic-cross/preset.d.mts +26 -0
  11. package/dist/biology/genetic-cross/preset.mjs +184 -0
  12. package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
  13. package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
  14. package/dist/biology/index.d.mts +11 -0
  15. package/dist/biology/index.mjs +12 -0
  16. package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
  17. package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
  18. package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
  19. package/dist/biology/punnett-cross/index.d.mts +1 -0
  20. package/dist/biology/punnett-cross/preset.d.mts +27 -0
  21. package/dist/biology/punnett-cross/preset.mjs +21 -0
  22. package/dist/biology/respiration/index.d.mts +1 -0
  23. package/dist/biology/respiration/preset.d.mts +17 -0
  24. package/dist/biology/respiration/preset.mjs +179 -0
  25. package/dist/biology/sequence/central-dogma.d.mts +17 -0
  26. package/dist/biology/sequence/central-dogma.mjs +339 -0
  27. package/dist/biology/sequence/core.d.mts +38 -0
  28. package/dist/biology/sequence/core.mjs +178 -0
  29. package/dist/biology/sequence/index.d.mts +3 -0
  30. package/dist/biology/sequence/preset.d.mts +20 -0
  31. package/dist/biology/sequence/preset.mjs +235 -0
  32. package/dist/blocks/accounting.d.mts +142 -0
  33. package/dist/blocks/accounting.mjs +446 -0
  34. package/dist/blocks/authoring.d.mts +12 -0
  35. package/dist/blocks/authoring.mjs +705 -0
  36. package/dist/blocks/biology.d.mts +197 -0
  37. package/dist/blocks/biology.mjs +513 -0
  38. package/dist/blocks/chem.d.mts +128 -0
  39. package/dist/blocks/chem.mjs +486 -0
  40. package/dist/blocks/circuits.d.mts +86 -0
  41. package/dist/blocks/circuits.mjs +348 -0
  42. package/dist/blocks/discrete.d.mts +62 -0
  43. package/dist/blocks/discrete.mjs +314 -0
  44. package/dist/blocks/economics.d.mts +56 -0
  45. package/dist/blocks/economics.mjs +203 -0
  46. package/dist/blocks/geography.d.mts +58 -0
  47. package/dist/blocks/geography.mjs +115 -0
  48. package/dist/blocks/geometry.d.mts +28 -0
  49. package/dist/blocks/geometry.mjs +160 -0
  50. package/dist/blocks/ict.d.mts +65 -0
  51. package/dist/blocks/ict.mjs +197 -0
  52. package/dist/blocks/index.d.mts +4555 -0
  53. package/dist/blocks/index.mjs +120 -0
  54. package/dist/blocks/lab-block.d.mts +16 -0
  55. package/dist/blocks/lab-block.mjs +74 -0
  56. package/dist/blocks/lab-config.d.mts +23 -0
  57. package/dist/blocks/lab-config.mjs +200 -0
  58. package/dist/blocks/lab-gallery.d.mts +30 -0
  59. package/dist/blocks/lab-gallery.mjs +208 -0
  60. package/dist/blocks/language.d.mts +349 -0
  61. package/dist/blocks/language.mjs +750 -0
  62. package/dist/blocks/lesson.d.mts +43 -0
  63. package/dist/blocks/lesson.mjs +140 -0
  64. package/dist/blocks/math.d.mts +411 -0
  65. package/dist/blocks/math.mjs +1536 -0
  66. package/dist/blocks/ml.d.mts +84 -0
  67. package/dist/blocks/ml.mjs +146 -0
  68. package/dist/blocks/physics.d.mts +259 -0
  69. package/dist/blocks/physics.mjs +868 -0
  70. package/dist/blocks/statistics.d.mts +29 -0
  71. package/dist/blocks/statistics.mjs +123 -0
  72. package/dist/catalog/index.d.mts +3 -0
  73. package/dist/catalog/index.mjs +8 -0
  74. package/dist/catalog/registry.d.mts +46 -0
  75. package/dist/catalog/registry.mjs +56 -0
  76. package/dist/catalog/templates.d.mts +11 -0
  77. package/dist/catalog/templates.mjs +141 -0
  78. package/dist/chem/battery.d.mts +16 -0
  79. package/dist/chem/battery.mjs +311 -0
  80. package/dist/chem/bohr-atom.d.mts +16 -0
  81. package/dist/chem/bohr-atom.mjs +212 -0
  82. package/dist/chem/diffusion/asset.mjs +76 -0
  83. package/dist/chem/diffusion/index.d.mts +1 -0
  84. package/dist/chem/diffusion/preset.d.mts +15 -0
  85. package/dist/chem/diffusion/preset.mjs +188 -0
  86. package/dist/chem/electrochem/index.d.mts +1 -0
  87. package/dist/chem/electrochem/preset.d.mts +23 -0
  88. package/dist/chem/electrochem/preset.mjs +402 -0
  89. package/dist/chem/equilibrium/index.d.mts +1 -0
  90. package/dist/chem/equilibrium/preset.d.mts +36 -0
  91. package/dist/chem/equilibrium/preset.mjs +416 -0
  92. package/dist/chem/gas-box/index.d.mts +1 -0
  93. package/dist/chem/gas-box/preset.d.mts +27 -0
  94. package/dist/chem/gas-box/preset.mjs +395 -0
  95. package/dist/chem/index.d.mts +16 -0
  96. package/dist/chem/index.mjs +17 -0
  97. package/dist/chem/kinetics/index.d.mts +1 -0
  98. package/dist/chem/kinetics/preset.d.mts +31 -0
  99. package/dist/chem/kinetics/preset.mjs +478 -0
  100. package/dist/chem/periodic-trends/index.d.mts +1 -0
  101. package/dist/chem/periodic-trends/preset.d.mts +21 -0
  102. package/dist/chem/periodic-trends/preset.mjs +831 -0
  103. package/dist/chem/reaction-lab.d.mts +18 -0
  104. package/dist/chem/reaction-lab.mjs +165 -0
  105. package/dist/chem/reaction-profile.d.mts +21 -0
  106. package/dist/chem/reaction-profile.mjs +287 -0
  107. package/dist/chem/solution/dilution.d.mts +27 -0
  108. package/dist/chem/solution/dilution.mjs +199 -0
  109. package/dist/chem/solution/field.d.mts +30 -0
  110. package/dist/chem/solution/field.mjs +145 -0
  111. package/dist/chem/solution/index.d.mts +3 -0
  112. package/dist/chem/solution/solution-box.d.mts +28 -0
  113. package/dist/chem/solution/solution-box.mjs +140 -0
  114. package/dist/chem/stoichiometry/index.d.mts +1 -0
  115. package/dist/chem/stoichiometry/preset.d.mts +29 -0
  116. package/dist/chem/stoichiometry/preset.mjs +392 -0
  117. package/dist/chem/titration/index.d.mts +1 -0
  118. package/dist/chem/titration/preset.d.mts +29 -0
  119. package/dist/chem/titration/preset.mjs +436 -0
  120. package/dist/circuits/ac-dc/asset.mjs +295 -0
  121. package/dist/circuits/ac-dc/index.d.mts +1 -0
  122. package/dist/circuits/ac-dc/preset.d.mts +16 -0
  123. package/dist/circuits/ac-dc/preset.mjs +134 -0
  124. package/dist/circuits/capacitor-leak/index.d.mts +1 -0
  125. package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
  126. package/dist/circuits/capacitor-leak/preset.mjs +271 -0
  127. package/dist/circuits/circuit/asset.d.mts +6 -0
  128. package/dist/circuits/circuit/asset.mjs +367 -0
  129. package/dist/circuits/circuit/index.d.mts +2 -0
  130. package/dist/circuits/circuit/preset.d.mts +46 -0
  131. package/dist/circuits/circuit/preset.mjs +235 -0
  132. package/dist/circuits/circuit-builder.d.mts +30 -0
  133. package/dist/circuits/circuit-builder.mjs +412 -0
  134. package/dist/circuits/circuit-lab.d.mts +20 -0
  135. package/dist/circuits/circuit-lab.mjs +400 -0
  136. package/dist/circuits/index.d.mts +7 -0
  137. package/dist/circuits/index.mjs +8 -0
  138. package/dist/commerce/accounting/core.d.mts +48 -0
  139. package/dist/commerce/accounting/core.mjs +57 -0
  140. package/dist/commerce/accounting/equation-balance.d.mts +35 -0
  141. package/dist/commerce/accounting/equation-balance.mjs +292 -0
  142. package/dist/commerce/accounting/index.d.mts +4 -0
  143. package/dist/commerce/accounting/journal-poster.d.mts +29 -0
  144. package/dist/commerce/accounting/journal-poster.mjs +472 -0
  145. package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
  146. package/dist/commerce/accounting/statement-sorter.mjs +304 -0
  147. package/dist/commerce/economics/core.d.mts +33 -0
  148. package/dist/commerce/economics/core.mjs +26 -0
  149. package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
  150. package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
  151. package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
  152. package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
  153. package/dist/commerce/economics/index.d.mts +4 -0
  154. package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
  155. package/dist/commerce/economics/market-equilibrium.mjs +340 -0
  156. package/dist/commerce/index.d.mts +9 -0
  157. package/dist/commerce/index.mjs +10 -0
  158. package/dist/core/easing.d.mts +28 -0
  159. package/dist/core/easing.mjs +66 -0
  160. package/dist/core/index.d.mts +10 -0
  161. package/dist/core/index.mjs +11 -0
  162. package/dist/core/numeric.d.mts +37 -0
  163. package/dist/core/numeric.mjs +75 -0
  164. package/dist/core/reactive.d.mts +24 -0
  165. package/dist/core/reactive.mjs +51 -0
  166. package/dist/core/rng.d.mts +21 -0
  167. package/dist/core/rng.mjs +39 -0
  168. package/dist/core/tex.d.mts +14 -0
  169. package/dist/core/tex.mjs +44 -0
  170. package/dist/core/timeline.d.mts +34 -0
  171. package/dist/core/timeline.mjs +77 -0
  172. package/dist/core/util.d.mts +19 -0
  173. package/dist/core/util.mjs +31 -0
  174. package/dist/discrete/arrangements/preset.d.mts +28 -0
  175. package/dist/discrete/arrangements/preset.mjs +304 -0
  176. package/dist/discrete/bayes/preset.d.mts +33 -0
  177. package/dist/discrete/bayes/preset.mjs +476 -0
  178. package/dist/discrete/binomial/preset.d.mts +25 -0
  179. package/dist/discrete/binomial/preset.mjs +333 -0
  180. package/dist/discrete/core/combinatorics.d.mts +23 -0
  181. package/dist/discrete/core/combinatorics.mjs +57 -0
  182. package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
  183. package/dist/discrete/core/inclusionExclusion.mjs +30 -0
  184. package/dist/discrete/core/pigeonhole.d.mts +15 -0
  185. package/dist/discrete/core/pigeonhole.mjs +24 -0
  186. package/dist/discrete/core/probability.d.mts +29 -0
  187. package/dist/discrete/core/probability.mjs +43 -0
  188. package/dist/discrete/core/sets.d.mts +21 -0
  189. package/dist/discrete/core/sets.mjs +45 -0
  190. package/dist/discrete/counting-slots/preset.d.mts +30 -0
  191. package/dist/discrete/counting-slots/preset.mjs +553 -0
  192. package/dist/discrete/counting-tree/index.d.mts +1 -0
  193. package/dist/discrete/counting-tree/preset.d.mts +44 -0
  194. package/dist/discrete/counting-tree/preset.mjs +364 -0
  195. package/dist/discrete/expected-value/preset.d.mts +28 -0
  196. package/dist/discrete/expected-value/preset.mjs +352 -0
  197. package/dist/discrete/hypergeometric/preset.d.mts +25 -0
  198. package/dist/discrete/hypergeometric/preset.mjs +330 -0
  199. package/dist/discrete/index.d.mts +26 -0
  200. package/dist/discrete/index.mjs +27 -0
  201. package/dist/discrete/karnaugh/index.d.mts +1 -0
  202. package/dist/discrete/karnaugh/preset.d.mts +30 -0
  203. package/dist/discrete/karnaugh/preset.mjs +452 -0
  204. package/dist/discrete/lln/asset.mjs +206 -0
  205. package/dist/discrete/lln/index.d.mts +1 -0
  206. package/dist/discrete/lln/preset.d.mts +17 -0
  207. package/dist/discrete/lln/preset.mjs +152 -0
  208. package/dist/discrete/logic-circuit/index.d.mts +1 -0
  209. package/dist/discrete/logic-circuit/preset.d.mts +47 -0
  210. package/dist/discrete/logic-circuit/preset.mjs +307 -0
  211. package/dist/discrete/monte-carlo/index.d.mts +1 -0
  212. package/dist/discrete/monte-carlo/preset.d.mts +64 -0
  213. package/dist/discrete/monte-carlo/preset.mjs +446 -0
  214. package/dist/discrete/monty-hall/index.d.mts +1 -0
  215. package/dist/discrete/monty-hall/preset.d.mts +23 -0
  216. package/dist/discrete/monty-hall/preset.mjs +491 -0
  217. package/dist/discrete/outcome-builder/preset.d.mts +24 -0
  218. package/dist/discrete/outcome-builder/preset.mjs +283 -0
  219. package/dist/discrete/pascal/preset.d.mts +24 -0
  220. package/dist/discrete/pascal/preset.mjs +372 -0
  221. package/dist/discrete/sample-space/index.d.mts +1 -0
  222. package/dist/discrete/sample-space/preset.d.mts +42 -0
  223. package/dist/discrete/sample-space/preset.mjs +395 -0
  224. package/dist/discrete/selection/preset.d.mts +33 -0
  225. package/dist/discrete/selection/preset.mjs +406 -0
  226. package/dist/discrete/truth-table/index.d.mts +1 -0
  227. package/dist/discrete/truth-table/preset.d.mts +30 -0
  228. package/dist/discrete/truth-table/preset.mjs +456 -0
  229. package/dist/discrete/venn/index.d.mts +1 -0
  230. package/dist/discrete/venn/preset.d.mts +32 -0
  231. package/dist/discrete/venn/preset.mjs +461 -0
  232. package/dist/geography/cycle-lab/index.d.mts +1 -0
  233. package/dist/geography/cycle-lab/preset.d.mts +25 -0
  234. package/dist/geography/cycle-lab/preset.mjs +254 -0
  235. package/dist/geography/cycles.d.mts +21 -0
  236. package/dist/geography/cycles.mjs +205 -0
  237. package/dist/geography/index.d.mts +4 -0
  238. package/dist/geography/index.mjs +5 -0
  239. package/dist/geometry/board/index.d.mts +1 -0
  240. package/dist/geometry/board/preset.d.mts +71 -0
  241. package/dist/geometry/board/preset.mjs +148 -0
  242. package/dist/geometry/builder.d.mts +18 -0
  243. package/dist/geometry/builder.mjs +332 -0
  244. package/dist/geometry/index.d.mts +4 -0
  245. package/dist/geometry/index.mjs +5 -0
  246. package/dist/geometry/intersecting-circles.d.mts +17 -0
  247. package/dist/geometry/intersecting-circles.mjs +104 -0
  248. package/dist/ict/index.d.mts +5 -0
  249. package/dist/ict/index.mjs +6 -0
  250. package/dist/ict/number-systems/base-odometer.d.mts +34 -0
  251. package/dist/ict/number-systems/base-odometer.mjs +160 -0
  252. package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
  253. package/dist/ict/number-systems/bit-grouper.mjs +190 -0
  254. package/dist/ict/number-systems/index.d.mts +4 -0
  255. package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
  256. package/dist/ict/number-systems/place-value-dial.mjs +153 -0
  257. package/dist/ict/number-systems/wheel.d.mts +73 -0
  258. package/dist/ict/number-systems/wheel.mjs +279 -0
  259. package/dist/index.d.mts +10 -0
  260. package/dist/index.mjs +11 -0
  261. package/dist/kit/anim.mjs +52 -0
  262. package/dist/kit/annotate.mjs +116 -0
  263. package/dist/kit/answer-check.d.mts +38 -0
  264. package/dist/kit/answer-check.mjs +65 -0
  265. package/dist/kit/asset-util.mjs +15 -0
  266. package/dist/kit/controls.mjs +77 -0
  267. package/dist/kit/cycle.d.mts +44 -0
  268. package/dist/kit/cycle.mjs +188 -0
  269. package/dist/kit/diagram.mjs +176 -0
  270. package/dist/kit/electronics.mjs +357 -0
  271. package/dist/kit/expr-analysis.d.mts +37 -0
  272. package/dist/kit/expr-analysis.mjs +111 -0
  273. package/dist/kit/frame.d.mts +70 -0
  274. package/dist/kit/frame.mjs +205 -0
  275. package/dist/kit/freq-tree.mjs +99 -0
  276. package/dist/kit/gameshow.mjs +315 -0
  277. package/dist/kit/index.d.mts +5 -0
  278. package/dist/kit/index.mjs +6 -0
  279. package/dist/kit/logic-gates.d.mts +6 -0
  280. package/dist/kit/logic-gates.mjs +210 -0
  281. package/dist/kit/molecules.mjs +178 -0
  282. package/dist/kit/pedagogy.d.mts +126 -0
  283. package/dist/kit/pedagogy.mjs +331 -0
  284. package/dist/kit/play.d.mts +21 -0
  285. package/dist/kit/play.mjs +52 -0
  286. package/dist/kit/probability.mjs +141 -0
  287. package/dist/kit/proportion.mjs +112 -0
  288. package/dist/kit/reaction.mjs +102 -0
  289. package/dist/kit/rich.d.mts +10 -0
  290. package/dist/kit/rich.mjs +21 -0
  291. package/dist/kit/scale.mjs +230 -0
  292. package/dist/kit/space.mjs +326 -0
  293. package/dist/kit/steps.d.mts +24 -0
  294. package/dist/kit/steps.mjs +57 -0
  295. package/dist/kit/thermal.mjs +289 -0
  296. package/dist/language/agreement/index.d.mts +1 -0
  297. package/dist/language/agreement/preset.d.mts +27 -0
  298. package/dist/language/agreement/preset.mjs +113 -0
  299. package/dist/language/article-lens/index.d.mts +1 -0
  300. package/dist/language/article-lens/preset.d.mts +31 -0
  301. package/dist/language/article-lens/preset.mjs +125 -0
  302. package/dist/language/deck.d.mts +45 -0
  303. package/dist/language/deck.mjs +61 -0
  304. package/dist/language/icon.d.mts +40 -0
  305. package/dist/language/icon.mjs +73 -0
  306. package/dist/language/index.d.mts +10 -0
  307. package/dist/language/index.mjs +11 -0
  308. package/dist/language/preposition-scene/index.d.mts +1 -0
  309. package/dist/language/preposition-scene/preset.d.mts +34 -0
  310. package/dist/language/preposition-scene/preset.mjs +234 -0
  311. package/dist/language/sentence-builder/index.d.mts +1 -0
  312. package/dist/language/sentence-builder/preset.d.mts +32 -0
  313. package/dist/language/sentence-builder/preset.mjs +122 -0
  314. package/dist/language/transform/index.d.mts +1 -0
  315. package/dist/language/transform/preset.d.mts +31 -0
  316. package/dist/language/transform/preset.mjs +137 -0
  317. package/dist/language/ui.d.mts +53 -0
  318. package/dist/language/ui.mjs +88 -0
  319. package/dist/language/word-match/index.d.mts +1 -0
  320. package/dist/language/word-match/preset.d.mts +22 -0
  321. package/dist/language/word-match/preset.mjs +148 -0
  322. package/dist/math/area-model/asset.d.mts +6 -0
  323. package/dist/math/area-model/asset.mjs +270 -0
  324. package/dist/math/area-model/index.d.mts +2 -0
  325. package/dist/math/area-model/preset.d.mts +29 -0
  326. package/dist/math/area-model/preset.mjs +243 -0
  327. package/dist/math/balance-algebra/asset.d.mts +6 -0
  328. package/dist/math/balance-algebra/asset.mjs +150 -0
  329. package/dist/math/balance-algebra/index.d.mts +2 -0
  330. package/dist/math/balance-algebra/preset.d.mts +30 -0
  331. package/dist/math/balance-algebra/preset.mjs +228 -0
  332. package/dist/math/derivation.d.mts +22 -0
  333. package/dist/math/derivation.mjs +113 -0
  334. package/dist/math/derivative-explorer/index.d.mts +1 -0
  335. package/dist/math/derivative-explorer/preset.d.mts +19 -0
  336. package/dist/math/derivative-explorer/preset.mjs +227 -0
  337. package/dist/math/function-machine/index.d.mts +1 -0
  338. package/dist/math/function-machine/preset.d.mts +21 -0
  339. package/dist/math/function-machine/preset.mjs +177 -0
  340. package/dist/math/gradient-descent.d.mts +23 -0
  341. package/dist/math/gradient-descent.mjs +473 -0
  342. package/dist/math/grapher/index.d.mts +1 -0
  343. package/dist/math/grapher/preset.d.mts +40 -0
  344. package/dist/math/grapher/preset.mjs +313 -0
  345. package/dist/math/harmonic-form/index.d.mts +1 -0
  346. package/dist/math/harmonic-form/preset.d.mts +21 -0
  347. package/dist/math/harmonic-form/preset.mjs +387 -0
  348. package/dist/math/index.d.mts +25 -0
  349. package/dist/math/index.mjs +26 -0
  350. package/dist/math/integral-explorer/index.d.mts +1 -0
  351. package/dist/math/integral-explorer/preset.d.mts +23 -0
  352. package/dist/math/integral-explorer/preset.mjs +217 -0
  353. package/dist/math/interactive/index.d.mts +1 -0
  354. package/dist/math/interactive/preset.d.mts +72 -0
  355. package/dist/math/interactive/preset.mjs +202 -0
  356. package/dist/math/limit-explorer/index.d.mts +1 -0
  357. package/dist/math/limit-explorer/preset.d.mts +19 -0
  358. package/dist/math/limit-explorer/preset.mjs +216 -0
  359. package/dist/math/linear-system/index.d.mts +1 -0
  360. package/dist/math/linear-system/preset.d.mts +28 -0
  361. package/dist/math/linear-system/preset.mjs +164 -0
  362. package/dist/math/mystery-bucket/asset.d.mts +6 -0
  363. package/dist/math/mystery-bucket/asset.mjs +145 -0
  364. package/dist/math/mystery-bucket/index.d.mts +2 -0
  365. package/dist/math/mystery-bucket/preset.d.mts +36 -0
  366. package/dist/math/mystery-bucket/preset.mjs +116 -0
  367. package/dist/math/number-line/index.d.mts +1 -0
  368. package/dist/math/number-line/preset.d.mts +24 -0
  369. package/dist/math/number-line/preset.mjs +142 -0
  370. package/dist/math/parabola/index.d.mts +1 -0
  371. package/dist/math/parabola/preset.d.mts +13 -0
  372. package/dist/math/parabola/preset.mjs +79 -0
  373. package/dist/math/pattern/asset.d.mts +6 -0
  374. package/dist/math/pattern/asset.mjs +102 -0
  375. package/dist/math/pattern/index.d.mts +2 -0
  376. package/dist/math/pattern/preset.d.mts +32 -0
  377. package/dist/math/pattern/preset.mjs +294 -0
  378. package/dist/math/triangle-trig/index.d.mts +1 -0
  379. package/dist/math/triangle-trig/preset.d.mts +47 -0
  380. package/dist/math/triangle-trig/preset.mjs +245 -0
  381. package/dist/math/trig-explorer.d.mts +18 -0
  382. package/dist/math/trig-explorer.mjs +209 -0
  383. package/dist/ml/boundary/index.d.mts +1 -0
  384. package/dist/ml/boundary/preset.d.mts +24 -0
  385. package/dist/ml/boundary/preset.mjs +385 -0
  386. package/dist/ml/classifier/index.d.mts +1 -0
  387. package/dist/ml/classifier/preset.d.mts +25 -0
  388. package/dist/ml/classifier/preset.mjs +315 -0
  389. package/dist/ml/index.d.mts +6 -0
  390. package/dist/ml/index.mjs +7 -0
  391. package/dist/ml/kmeans/index.d.mts +1 -0
  392. package/dist/ml/kmeans/preset.d.mts +33 -0
  393. package/dist/ml/kmeans/preset.mjs +236 -0
  394. package/dist/ml/knn/index.d.mts +1 -0
  395. package/dist/ml/knn/preset.d.mts +28 -0
  396. package/dist/ml/knn/preset.mjs +279 -0
  397. package/dist/ml/regression/index.d.mts +1 -0
  398. package/dist/ml/regression/preset.d.mts +32 -0
  399. package/dist/ml/regression/preset.mjs +394 -0
  400. package/dist/physics/atwood/index.d.mts +1 -0
  401. package/dist/physics/atwood/preset.d.mts +23 -0
  402. package/dist/physics/atwood/preset.mjs +312 -0
  403. package/dist/physics/bullet-walls/index.d.mts +1 -0
  404. package/dist/physics/bullet-walls/preset.d.mts +28 -0
  405. package/dist/physics/bullet-walls/preset.mjs +373 -0
  406. package/dist/physics/carnot/index.d.mts +1 -0
  407. package/dist/physics/carnot/preset.d.mts +27 -0
  408. package/dist/physics/carnot/preset.mjs +427 -0
  409. package/dist/physics/circular-motion/index.d.mts +1 -0
  410. package/dist/physics/circular-motion/preset.d.mts +25 -0
  411. package/dist/physics/circular-motion/preset.mjs +293 -0
  412. package/dist/physics/collision-track/index.d.mts +1 -0
  413. package/dist/physics/collision-track/preset.d.mts +27 -0
  414. package/dist/physics/collision-track/preset.mjs +352 -0
  415. package/dist/physics/efficiency/index.d.mts +1 -0
  416. package/dist/physics/efficiency/preset.d.mts +33 -0
  417. package/dist/physics/efficiency/preset.mjs +343 -0
  418. package/dist/physics/electric-field/index.d.mts +1 -0
  419. package/dist/physics/electric-field/preset.d.mts +15 -0
  420. package/dist/physics/electric-field/preset.mjs +306 -0
  421. package/dist/physics/energy-skate/index.d.mts +1 -0
  422. package/dist/physics/energy-skate/preset.d.mts +25 -0
  423. package/dist/physics/energy-skate/preset.mjs +254 -0
  424. package/dist/physics/entropy/index.d.mts +1 -0
  425. package/dist/physics/entropy/preset.d.mts +18 -0
  426. package/dist/physics/entropy/preset.mjs +416 -0
  427. package/dist/physics/expansion/index.d.mts +1 -0
  428. package/dist/physics/expansion/preset.d.mts +26 -0
  429. package/dist/physics/expansion/preset.mjs +609 -0
  430. package/dist/physics/exponential/asset.mjs +221 -0
  431. package/dist/physics/exponential/index.d.mts +1 -0
  432. package/dist/physics/exponential/preset.d.mts +17 -0
  433. package/dist/physics/exponential/preset.mjs +182 -0
  434. package/dist/physics/gas-process/index.d.mts +1 -0
  435. package/dist/physics/gas-process/preset.d.mts +30 -0
  436. package/dist/physics/gas-process/preset.mjs +384 -0
  437. package/dist/physics/gravitation/index.d.mts +1 -0
  438. package/dist/physics/gravitation/preset.d.mts +24 -0
  439. package/dist/physics/gravitation/preset.mjs +345 -0
  440. package/dist/physics/gravity-drop.d.mts +9 -0
  441. package/dist/physics/gravity-drop.mjs +187 -0
  442. package/dist/physics/heat-transfer/index.d.mts +1 -0
  443. package/dist/physics/heat-transfer/preset.d.mts +27 -0
  444. package/dist/physics/heat-transfer/preset.mjs +626 -0
  445. package/dist/physics/impulse/index.d.mts +1 -0
  446. package/dist/physics/impulse/preset.d.mts +29 -0
  447. package/dist/physics/impulse/preset.mjs +453 -0
  448. package/dist/physics/index.d.mts +43 -0
  449. package/dist/physics/index.mjs +44 -0
  450. package/dist/physics/kepler/index.d.mts +1 -0
  451. package/dist/physics/kepler/preset.d.mts +27 -0
  452. package/dist/physics/kepler/preset.mjs +257 -0
  453. package/dist/physics/lever/asset.d.mts +6 -0
  454. package/dist/physics/lever/asset.mjs +220 -0
  455. package/dist/physics/lever/index.d.mts +2 -0
  456. package/dist/physics/lever/preset.d.mts +31 -0
  457. package/dist/physics/lever/preset.mjs +261 -0
  458. package/dist/physics/lorentz/index.d.mts +1 -0
  459. package/dist/physics/lorentz/preset.d.mts +29 -0
  460. package/dist/physics/lorentz/preset.mjs +367 -0
  461. package/dist/physics/magnetism/index.d.mts +1 -0
  462. package/dist/physics/magnetism/preset.d.mts +15 -0
  463. package/dist/physics/magnetism/preset.mjs +334 -0
  464. package/dist/physics/optics/asset.d.mts +6 -0
  465. package/dist/physics/optics/asset.mjs +234 -0
  466. package/dist/physics/optics/index.d.mts +2 -0
  467. package/dist/physics/optics/preset.d.mts +14 -0
  468. package/dist/physics/optics/preset.mjs +202 -0
  469. package/dist/physics/orbit-lab.d.mts +6 -0
  470. package/dist/physics/orbit-lab.mjs +222 -0
  471. package/dist/physics/projectile-lab.d.mts +10 -0
  472. package/dist/physics/projectile-lab.mjs +354 -0
  473. package/dist/physics/rain-relative/index.d.mts +1 -0
  474. package/dist/physics/rain-relative/preset.d.mts +19 -0
  475. package/dist/physics/rain-relative/preset.mjs +358 -0
  476. package/dist/physics/ramp-forces/index.d.mts +1 -0
  477. package/dist/physics/ramp-forces/preset.d.mts +36 -0
  478. package/dist/physics/ramp-forces/preset.mjs +550 -0
  479. package/dist/physics/river-boat.d.mts +22 -0
  480. package/dist/physics/river-boat.mjs +498 -0
  481. package/dist/physics/shm/index.d.mts +1 -0
  482. package/dist/physics/shm/preset.d.mts +33 -0
  483. package/dist/physics/shm/preset.mjs +554 -0
  484. package/dist/physics/stopping-distance/index.d.mts +1 -0
  485. package/dist/physics/stopping-distance/preset.d.mts +29 -0
  486. package/dist/physics/stopping-distance/preset.mjs +662 -0
  487. package/dist/physics/temperature-scales/index.d.mts +1 -0
  488. package/dist/physics/temperature-scales/preset.d.mts +15 -0
  489. package/dist/physics/temperature-scales/preset.mjs +353 -0
  490. package/dist/physics/terminal-velocity/index.d.mts +1 -0
  491. package/dist/physics/terminal-velocity/preset.d.mts +26 -0
  492. package/dist/physics/terminal-velocity/preset.mjs +404 -0
  493. package/dist/physics/thermal/index.d.mts +1 -0
  494. package/dist/physics/thermal/preset.d.mts +44 -0
  495. package/dist/physics/thermal/preset.mjs +373 -0
  496. package/dist/physics/vector-board/index.d.mts +1 -0
  497. package/dist/physics/vector-board/preset.d.mts +65 -0
  498. package/dist/physics/vector-board/preset.mjs +273 -0
  499. package/dist/physics/vector-board/view.d.mts +49 -0
  500. package/dist/physics/vector-board/view.mjs +58 -0
  501. package/dist/physics/vector-scene.d.mts +41 -0
  502. package/dist/physics/vector-scene.mjs +211 -0
  503. package/dist/physics/vector-types/index.d.mts +1 -0
  504. package/dist/physics/vector-types/preset.d.mts +27 -0
  505. package/dist/physics/vector-types/preset.mjs +192 -0
  506. package/dist/physics/water-density/index.d.mts +1 -0
  507. package/dist/physics/water-density/preset.d.mts +18 -0
  508. package/dist/physics/water-density/preset.mjs +439 -0
  509. package/dist/physics/waves/core.mjs +33 -0
  510. package/dist/physics/waves/doppler.d.mts +23 -0
  511. package/dist/physics/waves/doppler.mjs +260 -0
  512. package/dist/physics/waves/index.d.mts +4 -0
  513. package/dist/physics/waves/preset.d.mts +30 -0
  514. package/dist/physics/waves/preset.mjs +488 -0
  515. package/dist/physics/waves/ripple.d.mts +26 -0
  516. package/dist/physics/waves/ripple.mjs +234 -0
  517. package/dist/physics/waves/string.d.mts +29 -0
  518. package/dist/physics/waves/string.mjs +289 -0
  519. package/dist/physics/work-energy/index.d.mts +1 -0
  520. package/dist/physics/work-energy/preset.d.mts +17 -0
  521. package/dist/physics/work-energy/preset.mjs +341 -0
  522. package/dist/schemas/index.d.mts +235 -0
  523. package/dist/schemas/index.mjs +145 -0
  524. package/dist/statistics/center-spread/preset.d.mts +34 -0
  525. package/dist/statistics/center-spread/preset.mjs +323 -0
  526. package/dist/statistics/core/descriptive.d.mts +35 -0
  527. package/dist/statistics/core/descriptive.mjs +64 -0
  528. package/dist/statistics/core/normal.d.mts +21 -0
  529. package/dist/statistics/core/normal.mjs +37 -0
  530. package/dist/statistics/core/sequences.d.mts +27 -0
  531. package/dist/statistics/core/sequences.mjs +35 -0
  532. package/dist/statistics/galton/preset.d.mts +27 -0
  533. package/dist/statistics/galton/preset.mjs +331 -0
  534. package/dist/statistics/histogram/preset.d.mts +27 -0
  535. package/dist/statistics/histogram/preset.mjs +385 -0
  536. package/dist/statistics/index.d.mts +11 -0
  537. package/dist/statistics/index.mjs +12 -0
  538. package/dist/statistics/normal/preset.d.mts +30 -0
  539. package/dist/statistics/normal/preset.mjs +400 -0
  540. package/dist/statistics/sampling/preset.d.mts +32 -0
  541. package/dist/statistics/sampling/preset.mjs +406 -0
  542. package/dist/statistics/sequence/preset.d.mts +28 -0
  543. package/dist/statistics/sequence/preset.mjs +302 -0
  544. package/dist/statistics/z-table/preset.d.mts +28 -0
  545. package/dist/statistics/z-table/preset.mjs +348 -0
  546. package/package.json +266 -0
  547. package/styles.css +267 -0
@@ -0,0 +1,239 @@
1
+ 'use client';
2
+
3
+ import { CheckButton, StatusPill } from "../../kit/controls.mjs";
4
+ import { LabFrame, LiveRegion } from "../../kit/frame.mjs";
5
+ import { useEffect, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/biology/genetic-cross/grid.tsx
9
+ /**
10
+ * CrossGrid — the shared Punnett-grid UI (single source of truth for every cross
11
+ * lab: monohybrid, dihybrid, sex-linked). It is PRESENTATIONAL: the parent labs
12
+ * compute the gametes + the combine rule and hand them in; this draws the gametes
13
+ * on the edges, fills the N×N grid, runs predict-before-reveal, and reads off the
14
+ * genotype + phenotype tally bars. No genetics logic lives here.
15
+ */
16
+ function CrossGrid({ gametes1, gametes2, gameteLabel, combine, traitLabel, resetKey, predictFirst, header, legend, title, prompt, objectives, showGenotypeTally = true, onReveal }) {
17
+ const [revealed, setRevealed] = useState(!predictFirst);
18
+ const [highlight, setHighlight] = useState(null);
19
+ useEffect(() => {
20
+ setRevealed(!predictFirst);
21
+ setHighlight(null);
22
+ }, [resetKey, predictFirst]);
23
+ const cells = gametes1.map((g1) => gametes2.map((g2) => combine(g1, g2)));
24
+ const flat = cells.flat();
25
+ const n = Math.max(gametes1.length, gametes2.length);
26
+ const cellSize = n <= 2 ? 54 : n === 3 ? 46 : 40;
27
+ const fontSize = n <= 2 ? 17 : 13;
28
+ const genoCount = (g) => flat.filter((c) => c.genotype === g).length;
29
+ const genotypes = [...new Set(flat.map((c) => c.genotype))];
30
+ const phenoTally = (() => {
31
+ const m = /* @__PURE__ */ new Map();
32
+ for (const c of flat) {
33
+ const e = m.get(c.phenotype.label) ?? {
34
+ n: 0,
35
+ color: c.phenotype.color
36
+ };
37
+ e.n += 1;
38
+ m.set(c.phenotype.label, e);
39
+ }
40
+ return [...m.entries()].map(([label, v]) => ({
41
+ label,
42
+ ...v
43
+ }));
44
+ })();
45
+ const genoColor = (g) => flat.find((c) => c.genotype === g).phenotype.color;
46
+ const reveal = () => {
47
+ setRevealed(true);
48
+ onReveal?.();
49
+ };
50
+ const Bar = ({ label, parts }) => {
51
+ const total = parts.reduce((s, p) => s + p.n, 0) || 1;
52
+ return /* @__PURE__ */ jsxs("div", {
53
+ style: {
54
+ flex: 1,
55
+ minWidth: 200
56
+ },
57
+ children: [/* @__PURE__ */ jsxs("div", {
58
+ style: {
59
+ fontSize: 11,
60
+ fontWeight: 700,
61
+ color: "var(--stage-muted)",
62
+ marginBottom: 3
63
+ },
64
+ children: [
65
+ label,
66
+ ": ",
67
+ parts.filter((p) => p.n).map((p) => `${p.n} ${p.tag}`).join(" : ")
68
+ ]
69
+ }), /* @__PURE__ */ jsx("div", {
70
+ style: {
71
+ display: "flex",
72
+ height: 16,
73
+ borderRadius: 6,
74
+ overflow: "hidden",
75
+ border: "1px solid var(--stage-grid)"
76
+ },
77
+ children: parts.filter((p) => p.n).map((p, i) => /* @__PURE__ */ jsx("div", {
78
+ style: {
79
+ flex: p.n / total,
80
+ background: p.color,
81
+ display: "flex",
82
+ alignItems: "center",
83
+ justifyContent: "center",
84
+ fontSize: 10,
85
+ fontWeight: 800,
86
+ color: "var(--stage-bg)"
87
+ },
88
+ children: p.n
89
+ }, i))
90
+ })]
91
+ });
92
+ };
93
+ const cellBg = (c) => highlight === c.genotype ? `color-mix(in oklab, ${c.phenotype.color} 34%, var(--stage-bg))` : `color-mix(in oklab, ${c.phenotype.color} 13%, var(--stage-bg))`;
94
+ const figure = /* @__PURE__ */ jsxs(Fragment$1, { children: [legend, /* @__PURE__ */ jsxs("div", {
95
+ style: {
96
+ borderRadius: 14,
97
+ background: "var(--stage-bg)",
98
+ border: "1px solid var(--stage-grid)",
99
+ padding: 16,
100
+ overflowX: "auto"
101
+ },
102
+ children: [
103
+ header,
104
+ /* @__PURE__ */ jsxs("div", {
105
+ style: {
106
+ display: "inline-grid",
107
+ gridTemplateColumns: `${cellSize}px repeat(${gametes2.length}, ${cellSize}px)`,
108
+ gap: 4
109
+ },
110
+ children: [
111
+ /* @__PURE__ */ jsx("div", {}),
112
+ gametes2.map((g, i) => /* @__PURE__ */ jsx("div", {
113
+ style: {
114
+ textAlign: "center",
115
+ fontSize,
116
+ fontWeight: 800,
117
+ color: "var(--stage-fg)"
118
+ },
119
+ children: gameteLabel(g)
120
+ }, i)),
121
+ cells.map((row, r) => /* @__PURE__ */ jsxs(Frag, { children: [/* @__PURE__ */ jsx("div", {
122
+ style: {
123
+ display: "flex",
124
+ alignItems: "center",
125
+ justifyContent: "center",
126
+ fontSize,
127
+ fontWeight: 800,
128
+ color: "var(--stage-fg)"
129
+ },
130
+ children: gameteLabel(gametes1[r])
131
+ }), row.map((c, ci) => /* @__PURE__ */ jsx("button", {
132
+ type: "button",
133
+ onClick: () => revealed && setHighlight((h) => h === c.genotype ? null : c.genotype),
134
+ title: revealed ? `${c.genotype} → ${c.phenotype.label}` : void 0,
135
+ style: {
136
+ width: cellSize,
137
+ height: cellSize,
138
+ borderRadius: 6,
139
+ border: "1px solid var(--stage-grid)",
140
+ background: revealed ? cellBg(c) : "var(--stage-bg)",
141
+ cursor: revealed ? "pointer" : "default",
142
+ fontSize,
143
+ fontWeight: 700,
144
+ color: "var(--stage-fg)",
145
+ padding: 0
146
+ },
147
+ children: revealed ? c.genotype : "?"
148
+ }, ci))] }, r))
149
+ ]
150
+ }),
151
+ !revealed ? /* @__PURE__ */ jsxs("div", {
152
+ className: "lab-bar",
153
+ style: { marginTop: 12 },
154
+ children: [/* @__PURE__ */ jsxs("span", {
155
+ style: { fontWeight: 600 },
156
+ children: [
157
+ "Predict the ",
158
+ traitLabel,
159
+ " ratio, then…"
160
+ ]
161
+ }), /* @__PURE__ */ jsx(CheckButton, {
162
+ onClick: reveal,
163
+ children: "Reveal the cross"
164
+ })]
165
+ }) : /* @__PURE__ */ jsxs("div", {
166
+ className: "lab-bar",
167
+ style: {
168
+ marginTop: 14,
169
+ gap: 16,
170
+ flexWrap: "wrap"
171
+ },
172
+ children: [
173
+ showGenotypeTally && /* @__PURE__ */ jsx(Bar, {
174
+ label: "Genotype",
175
+ parts: genotypes.map((g) => ({
176
+ n: genoCount(g),
177
+ color: genoColor(g),
178
+ tag: g
179
+ }))
180
+ }),
181
+ /* @__PURE__ */ jsx(Bar, {
182
+ label: traitLabel,
183
+ parts: phenoTally.map((p) => ({
184
+ n: p.n,
185
+ color: p.color,
186
+ tag: p.label
187
+ }))
188
+ }),
189
+ /* @__PURE__ */ jsxs(StatusPill, {
190
+ ok: true,
191
+ children: [
192
+ phenoTally.map((p) => p.n).join(":"),
193
+ " ",
194
+ phenoTally.map((p) => p.label).join(" : ")
195
+ ]
196
+ })
197
+ ]
198
+ }),
199
+ revealed && highlight && (() => {
200
+ const c = flat.find((x) => x.genotype === highlight);
201
+ return /* @__PURE__ */ jsxs("p", {
202
+ style: {
203
+ fontSize: 12,
204
+ color: "var(--stage-muted)",
205
+ margin: "8px 0 0"
206
+ },
207
+ children: [
208
+ highlight,
209
+ ": ",
210
+ genoCount(highlight),
211
+ " of ",
212
+ flat.length,
213
+ " (",
214
+ (genoCount(highlight) / flat.length * 100).toFixed(0),
215
+ "%) → ",
216
+ /* @__PURE__ */ jsx("b", {
217
+ style: { color: c.phenotype.color },
218
+ children: c.phenotype.label
219
+ }),
220
+ c.note ?? ""
221
+ ]
222
+ });
223
+ })()
224
+ ]
225
+ })] });
226
+ return /* @__PURE__ */ jsx(LabFrame, {
227
+ title,
228
+ prompt,
229
+ objectives,
230
+ footer: /* @__PURE__ */ jsx(LiveRegion, { children: revealed ? `${traitLabel} ratio ${phenoTally.map((p) => `${p.n} ${p.label}`).join(", ")}.` : "Predict, then reveal." }),
231
+ children: figure
232
+ });
233
+ }
234
+ function Frag({ children }) {
235
+ return /* @__PURE__ */ jsx(Fragment$1, { children });
236
+ }
237
+
238
+ //#endregion
239
+ export { CrossGrid };
@@ -0,0 +1,3 @@
1
+ import { AlleleSpec, BLOOD_TYPE_SPEC, BlendSpec, CROSS_PRESETS, CrossModelSpec, CrossPresetKey, DIHYBRID_LOCI, INCOMPLETE_SPEC, Phenotype, ResolvedModel, monohybridSpec, resolveModel } from "./core.mjs";
2
+ import { GeneticCrossLab, GeneticCrossProps } from "./preset.mjs";
3
+ import { SexLinkedCrossLab, SexLinkedCrossProps } from "./sex-linked.mjs";
@@ -0,0 +1,26 @@
1
+ import { CrossModelSpec } from "./core.mjs";
2
+ import { ReactNode } from "react";
3
+
4
+ //#region src/biology/genetic-cross/preset.d.ts
5
+ interface GeneticCrossProps {
6
+ spec?: CrossModelSpec;
7
+ loci?: CrossModelSpec[];
8
+ parent1?: string[] | string[][];
9
+ parent2?: string[] | string[][];
10
+ predictFirst?: boolean;
11
+ title?: string;
12
+ prompt?: string;
13
+ objectives?: string[];
14
+ }
15
+ declare function GeneticCrossLab({
16
+ spec,
17
+ loci,
18
+ parent1,
19
+ parent2,
20
+ predictFirst,
21
+ title,
22
+ prompt,
23
+ objectives
24
+ }: GeneticCrossProps): ReactNode;
25
+ //#endregion
26
+ export { GeneticCrossLab, GeneticCrossProps };
@@ -0,0 +1,184 @@
1
+ 'use client';
2
+
3
+ import { CrossGrid } from "./grid.mjs";
4
+ import { comboColorMap, monohybridSpec, resolveModel } from "./core.mjs";
5
+ import { useMemo, useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useLearner } from "@classytic/stage";
8
+
9
+ //#region src/biology/genetic-cross/preset.tsx
10
+ /**
11
+ * GeneticCrossLab — ONE authorable cross tool for every Mendelian pattern, now
12
+ * MULTI-LOCUS. The creator declares one model per gene; the lab derives gametes by
13
+ * independent assortment (one allele per locus → 2ⁿ gametes), fills the Punnett
14
+ * grid via the shared CrossGrid, and reads off the genotype + phenotype ratios.
15
+ *
16
+ * • one locus → monohybrid / multiple alleles / codominance / incomplete dominance
17
+ * • two loci → dihybrid 9:3:3:1 (4×4 grid)
18
+ *
19
+ * The pattern is DATA, not a bespoke widget. PunnettCross is a monohybrid preset of
20
+ * this; SexLinkedCrossLab shares the same CrossGrid.
21
+ */
22
+ const cartesian = (pairs) => pairs.reduce((acc, pair) => acc.flatMap((g) => pair.map((a) => [...g, a])), [[]]);
23
+ function GeneticCrossLab({ spec, loci, parent1, parent2, predictFirst = true, title, prompt, objectives }) {
24
+ const specs = useMemo(() => loci ?? [spec ?? monohybridSpec()], [loci, spec]);
25
+ const models = useMemo(() => specs.map(resolveModel), [specs]);
26
+ const multi = models.length > 1;
27
+ const comboColors = useMemo(() => comboColorMap(models), [models]);
28
+ const learner = useLearner();
29
+ const reported = useRef(false);
30
+ const toPairs = (p, dflt) => {
31
+ if (!p) return dflt;
32
+ return Array.isArray(p[0]) ? p : [p];
33
+ };
34
+ const defaultHet = () => models.map((m) => [m.alleles[0].symbol, m.alleles[Math.min(1, m.alleles.length - 1)].symbol]);
35
+ const defaultP2 = () => models.map((m) => [m.alleles[0].symbol, m.alleles[m.alleles.length - 1].symbol]);
36
+ const [p1, setP1] = useState(() => toPairs(parent1, defaultHet()).map((pr, i) => models[i].norm(pr[0], pr[1])));
37
+ const [p2, setP2] = useState(() => toPairs(parent2, multi ? defaultHet() : defaultP2()).map((pr, i) => models[i].norm(pr[0], pr[1])));
38
+ const gametes1 = cartesian(p1);
39
+ const gametes2 = cartesian(p2);
40
+ const combine = (g1, g2) => {
41
+ const perLocus = models.map((m, i) => ({
42
+ geno: m.norm(g1[i], g2[i]),
43
+ pheno: m.phenotypeOf(g1[i], g2[i]),
44
+ m,
45
+ g1: g1[i],
46
+ g2: g2[i]
47
+ }));
48
+ const genotype = perLocus.map((l) => l.geno.join("")).join("");
49
+ const label = perLocus.map((l) => l.pheno.label).join(" ");
50
+ const color = multi ? comboColors.get(label) ?? "var(--stage-accent)" : perLocus[0].pheno.color;
51
+ let note = "";
52
+ if (!multi) {
53
+ const [a, b] = perLocus[0].geno;
54
+ if (a !== b) {
55
+ const [hi, lo] = models[0].masks(a, b) ? [a, b] : models[0].masks(b, a) ? [b, a] : ["", ""];
56
+ if (hi) note = ` — the recessive ${lo} is still there, masked`;
57
+ }
58
+ }
59
+ return {
60
+ genotype,
61
+ phenotype: {
62
+ label,
63
+ color
64
+ },
65
+ note
66
+ };
67
+ };
68
+ const cycle = (setter, parent, locus, slot) => {
69
+ const syms = models[locus].alleles.map((a) => a.symbol);
70
+ const i = (syms.indexOf(parent[locus][slot]) + 1) % syms.length;
71
+ const nextPair = slot === 0 ? [syms[i], parent[locus][1]] : [parent[locus][0], syms[i]];
72
+ setter(parent.map((pr, L) => L === locus ? models[locus].norm(nextPair[0], nextPair[1]) : pr));
73
+ };
74
+ const traitLabel = multi ? "phenotype" : models[0].trait;
75
+ const alleleStyle = (locus, s) => ({
76
+ color: multi ? "var(--stage-fg)" : models[0].phenotypeColor(models[0].phenotypeOf(s, s).label),
77
+ fontWeight: 800
78
+ });
79
+ const parentRow = (name, parent, setter) => /* @__PURE__ */ jsxs("span", {
80
+ style: {
81
+ display: "inline-flex",
82
+ alignItems: "center",
83
+ gap: 8,
84
+ flexWrap: "wrap"
85
+ },
86
+ children: [
87
+ name,
88
+ ":",
89
+ parent.map((pair, L) => /* @__PURE__ */ jsx("span", {
90
+ style: {
91
+ display: "inline-flex",
92
+ gap: 2,
93
+ padding: "2px 4px",
94
+ borderRadius: 8,
95
+ background: "color-mix(in oklab, var(--stage-fg) 6%, transparent)"
96
+ },
97
+ children: pair.map((s, ai) => /* @__PURE__ */ jsx("button", {
98
+ type: "button",
99
+ className: "lab-chip",
100
+ style: {
101
+ minWidth: 26,
102
+ fontSize: 16,
103
+ ...alleleStyle(L, s)
104
+ },
105
+ onClick: () => cycle(setter, parent, L, ai),
106
+ "aria-label": `${name} gene ${L + 1} allele ${ai + 1}: ${s}, tap to change`,
107
+ children: s
108
+ }, ai))
109
+ }, L))
110
+ ]
111
+ });
112
+ const header = /* @__PURE__ */ jsxs("div", {
113
+ style: {
114
+ display: "flex",
115
+ gap: 16,
116
+ marginBottom: 12,
117
+ flexWrap: "wrap",
118
+ alignItems: "center"
119
+ },
120
+ children: [
121
+ parentRow("Parent 1", p1, setP1),
122
+ parentRow("Parent 2", p2, setP2),
123
+ /* @__PURE__ */ jsx("span", {
124
+ style: {
125
+ fontSize: 12,
126
+ color: "var(--stage-muted)"
127
+ },
128
+ children: "(tap an allele to cycle it)"
129
+ })
130
+ ]
131
+ });
132
+ const legend = /* @__PURE__ */ jsx("p", {
133
+ style: {
134
+ fontSize: 12,
135
+ color: "var(--stage-muted)",
136
+ margin: "0 0 8px"
137
+ },
138
+ children: models.map((m, i) => /* @__PURE__ */ jsxs("span", { children: [
139
+ multi ? `Gene ${i + 1}: ` : `Trait: ${m.trait} · `,
140
+ m.alleles.map((a, j) => /* @__PURE__ */ jsxs("span", { children: [
141
+ /* @__PURE__ */ jsx("b", {
142
+ style: alleleStyle(i, a.symbol),
143
+ children: a.symbol
144
+ }),
145
+ "=",
146
+ a.trait,
147
+ j < m.alleles.length - 1 ? ", " : ""
148
+ ] }, a.symbol)),
149
+ i < models.length - 1 ? " · " : ""
150
+ ] }, i))
151
+ });
152
+ return /* @__PURE__ */ jsx(CrossGrid, {
153
+ gametes1,
154
+ gametes2,
155
+ gameteLabel: (g) => g.join(""),
156
+ combine,
157
+ traitLabel,
158
+ resetKey: JSON.stringify([p1, p2]),
159
+ predictFirst,
160
+ header,
161
+ legend,
162
+ title: title ?? (multi ? "Dihybrid cross — 9 : 3 : 3 : 1" : "The cross you can count"),
163
+ prompt: prompt ?? (multi ? "Two genes assort independently — four gametes each, sixteen boxes, four phenotype classes." : "Alleles segregate into gametes, recombine, and the ratio falls out."),
164
+ objectives,
165
+ showGenotypeTally: !multi,
166
+ onReveal: () => {
167
+ if (!reported.current) {
168
+ reported.current = true;
169
+ learner?.report({
170
+ activity: "genetic-cross",
171
+ correct: true,
172
+ score: {
173
+ raw: 1,
174
+ max: 1
175
+ },
176
+ completion: true
177
+ });
178
+ }
179
+ }
180
+ });
181
+ }
182
+
183
+ //#endregion
184
+ export { GeneticCrossLab };
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/biology/genetic-cross/sex-linked.d.ts
4
+ interface SexLinkedCrossProps {
5
+ allele?: string;
6
+ dominant?: string;
7
+ recessive?: string;
8
+ mother?: [string, string];
9
+ father?: string;
10
+ predictFirst?: boolean;
11
+ title?: string;
12
+ prompt?: string;
13
+ objectives?: string[];
14
+ }
15
+ declare function SexLinkedCrossLab({
16
+ allele,
17
+ dominant,
18
+ recessive,
19
+ mother,
20
+ father,
21
+ predictFirst,
22
+ title,
23
+ prompt,
24
+ objectives
25
+ }: SexLinkedCrossProps): ReactNode;
26
+ //#endregion
27
+ export { SexLinkedCrossLab, SexLinkedCrossProps };
@@ -0,0 +1,226 @@
1
+ 'use client';
2
+
3
+ import { CrossGrid } from "./grid.mjs";
4
+ import { useRef, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useLearner } from "@classytic/stage";
7
+
8
+ //#region src/biology/genetic-cross/sex-linked.tsx
9
+ /**
10
+ * SexLinkedCrossLab — an X-linked gene cross (colour blindness, haemophilia…) on
11
+ * the shared CrossGrid. The biology that's special — the Y carries no allele, so
12
+ * males are HEMIZYGOUS (a single recessive X shows) — lives here; the grid/tally/
13
+ * predict UI is reused. The payoff: affected sons from a carrier mother, while
14
+ * daughters are carriers, not affected.
15
+ */
16
+ const SUP = {
17
+ A: "ᴬ",
18
+ B: "ᴮ",
19
+ C: "ᶜ",
20
+ D: "ᴰ",
21
+ G: "ᴳ",
22
+ H: "ᴴ",
23
+ N: "ᴺ",
24
+ R: "ᴿ",
25
+ a: "ᵃ",
26
+ b: "ᵇ",
27
+ c: "ᶜ",
28
+ d: "ᵈ",
29
+ g: "ᵍ",
30
+ h: "ʰ",
31
+ n: "ⁿ",
32
+ r: "ʳ"
33
+ };
34
+ const xTok = (letter) => `X${SUP[letter] ?? `^${letter}`}`;
35
+ const COL = {
36
+ domF: "var(--stage-good)",
37
+ recF: "var(--stage-danger)",
38
+ domM: "var(--stage-accent)",
39
+ recM: "var(--stage-warn)"
40
+ };
41
+ function SexLinkedCrossLab({ allele = "B", dominant = "normal", recessive = "colour-blind", mother = ["B", "b"], father = "B", predictFirst = true, title, prompt, objectives }) {
42
+ const L = allele;
43
+ const XD = xTok(L.toUpperCase());
44
+ const Xr = xTok(L.toLowerCase());
45
+ const learner = useLearner();
46
+ const reported = useRef(false);
47
+ const toTok = (letter) => letter.toUpperCase() === letter ? XD : Xr;
48
+ const [mom, setMom] = useState([toTok(mother[0]), toTok(mother[1])]);
49
+ const [dad, setDad] = useState(toTok(father));
50
+ const gametes1 = [[mom[0]], [mom[1]]];
51
+ const gametes2 = [[dad], ["Y"]];
52
+ const isDom = (t) => t === XD;
53
+ const combine = (g1, g2) => {
54
+ const mx = g1[0], fx = g2[0];
55
+ if (fx === "Y") {
56
+ const affected = !isDom(mx);
57
+ return {
58
+ genotype: `${mx}Y`,
59
+ phenotype: {
60
+ label: `${affected ? recessive : dominant} ♂`,
61
+ color: affected ? COL.recM : COL.domM
62
+ },
63
+ note: ` — males are hemizygous: one ${Xr} is enough to show ${recessive}`
64
+ };
65
+ }
66
+ const xs = [mx, fx].sort((a, b) => (isDom(a) ? -1 : 1) - (isDom(b) ? -1 : 1));
67
+ const domPresent = isDom(mx) || isDom(fx);
68
+ const carrier = domPresent && (!isDom(mx) || !isDom(fx));
69
+ return {
70
+ genotype: `${xs[0]}${xs[1]}`,
71
+ phenotype: {
72
+ label: `${domPresent ? dominant : recessive} ♀`,
73
+ color: domPresent ? COL.domF : COL.recF
74
+ },
75
+ note: carrier ? ` — a carrier (one ${Xr}), ${dominant} herself but can pass it on` : ""
76
+ };
77
+ };
78
+ const cycleMom = (i) => setMom((m) => m.map((t, j) => j === i ? t === XD ? Xr : XD : t));
79
+ const cycleDad = () => setDad((d) => d === XD ? Xr : XD);
80
+ const tokStyle = (t) => ({
81
+ color: isDom(t) ? "var(--stage-good)" : "var(--stage-danger)",
82
+ fontWeight: 800
83
+ });
84
+ const header = /* @__PURE__ */ jsxs("div", {
85
+ style: {
86
+ display: "flex",
87
+ gap: 16,
88
+ marginBottom: 12,
89
+ flexWrap: "wrap",
90
+ alignItems: "center"
91
+ },
92
+ children: [
93
+ /* @__PURE__ */ jsxs("span", {
94
+ style: {
95
+ display: "inline-flex",
96
+ alignItems: "center",
97
+ gap: 4
98
+ },
99
+ children: [
100
+ "Mother ♀:",
101
+ /* @__PURE__ */ jsx("button", {
102
+ type: "button",
103
+ className: "lab-chip",
104
+ style: {
105
+ minWidth: 34,
106
+ ...tokStyle(mom[0])
107
+ },
108
+ onClick: () => cycleMom(0),
109
+ "aria-label": "mother first X allele",
110
+ children: mom[0]
111
+ }),
112
+ /* @__PURE__ */ jsx("button", {
113
+ type: "button",
114
+ className: "lab-chip",
115
+ style: {
116
+ minWidth: 34,
117
+ ...tokStyle(mom[1])
118
+ },
119
+ onClick: () => cycleMom(1),
120
+ "aria-label": "mother second X allele",
121
+ children: mom[1]
122
+ })
123
+ ]
124
+ }),
125
+ /* @__PURE__ */ jsxs("span", {
126
+ style: {
127
+ display: "inline-flex",
128
+ alignItems: "center",
129
+ gap: 4
130
+ },
131
+ children: [
132
+ "Father ♂:",
133
+ /* @__PURE__ */ jsx("button", {
134
+ type: "button",
135
+ className: "lab-chip",
136
+ style: {
137
+ minWidth: 34,
138
+ ...tokStyle(dad)
139
+ },
140
+ onClick: cycleDad,
141
+ "aria-label": "father X allele",
142
+ children: dad
143
+ }),
144
+ /* @__PURE__ */ jsx("span", {
145
+ style: {
146
+ fontWeight: 800,
147
+ color: "var(--stage-muted)"
148
+ },
149
+ children: "Y"
150
+ })
151
+ ]
152
+ }),
153
+ /* @__PURE__ */ jsxs("span", {
154
+ style: {
155
+ fontSize: 12,
156
+ color: "var(--stage-muted)"
157
+ },
158
+ children: [
159
+ "(tap an X allele to switch ",
160
+ XD,
161
+ "/",
162
+ Xr,
163
+ ")"
164
+ ]
165
+ })
166
+ ]
167
+ });
168
+ const legend = /* @__PURE__ */ jsxs("p", {
169
+ style: {
170
+ fontSize: 12,
171
+ color: "var(--stage-muted)",
172
+ margin: "0 0 8px"
173
+ },
174
+ children: [
175
+ "X-linked gene: ",
176
+ /* @__PURE__ */ jsx("b", {
177
+ style: { color: "var(--stage-good)" },
178
+ children: XD
179
+ }),
180
+ "=",
181
+ dominant,
182
+ " (dominant), ",
183
+ /* @__PURE__ */ jsx("b", {
184
+ style: { color: "var(--stage-danger)" },
185
+ children: Xr
186
+ }),
187
+ "=",
188
+ recessive,
189
+ " (recessive). The ",
190
+ /* @__PURE__ */ jsx("b", { children: "Y" }),
191
+ " carries no copy."
192
+ ]
193
+ });
194
+ return /* @__PURE__ */ jsx(CrossGrid, {
195
+ gametes1,
196
+ gametes2,
197
+ gameteLabel: (g) => g[0],
198
+ combine,
199
+ traitLabel: "phenotype & sex",
200
+ resetKey: JSON.stringify([mom, dad]),
201
+ predictFirst,
202
+ header,
203
+ legend,
204
+ title: title ?? "Sex linkage — why mostly sons are affected",
205
+ prompt: prompt ?? "The gene rides on the X. A carrier mother passes it to half her sons — who, with no second X, show it.",
206
+ objectives,
207
+ showGenotypeTally: true,
208
+ onReveal: () => {
209
+ if (!reported.current) {
210
+ reported.current = true;
211
+ learner?.report({
212
+ activity: "sex-linked-cross",
213
+ correct: true,
214
+ score: {
215
+ raw: 1,
216
+ max: 1
217
+ },
218
+ completion: true
219
+ });
220
+ }
221
+ }
222
+ });
223
+ }
224
+
225
+ //#endregion
226
+ export { SexLinkedCrossLab };