@classytic/labs 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  2. package/dist/biology/enzyme-rate/preset.mjs +5 -5
  3. package/dist/biology/genetic-cross/core.d.mts +7 -7
  4. package/dist/biology/genetic-cross/core.mjs +4 -4
  5. package/dist/biology/genetic-cross/grid.mjs +132 -123
  6. package/dist/biology/genetic-cross/preset.mjs +4 -4
  7. package/dist/biology/genetic-cross/sex-linked.mjs +7 -7
  8. package/dist/biology/photosynthesis-factors/preset.mjs +8 -8
  9. package/dist/biology/respiration/preset.mjs +4 -4
  10. package/dist/biology/sequence/central-dogma.mjs +5 -5
  11. package/dist/biology/sequence/core.d.mts +6 -6
  12. package/dist/biology/sequence/core.mjs +1 -1
  13. package/dist/biology/sequence/preset.mjs +6 -6
  14. package/dist/blocks/authoring.mjs +5 -5
  15. package/dist/blocks/biology.d.mts +2 -2
  16. package/dist/blocks/biology.mjs +5 -5
  17. package/dist/blocks/chem.d.mts +2 -2
  18. package/dist/blocks/chem.mjs +13 -13
  19. package/dist/blocks/circuits.d.mts +293 -4
  20. package/dist/blocks/circuits.mjs +874 -9
  21. package/dist/blocks/discrete.d.mts +30 -2
  22. package/dist/blocks/discrete.mjs +74 -4
  23. package/dist/blocks/economics.mjs +1 -1
  24. package/dist/blocks/geography.mjs +1 -1
  25. package/dist/blocks/geometry.mjs +3 -3
  26. package/dist/blocks/ict.d.mts +90 -1
  27. package/dist/blocks/ict.mjs +217 -7
  28. package/dist/blocks/index.d.mts +3064 -657
  29. package/dist/blocks/index.mjs +9 -9
  30. package/dist/blocks/lab-block.mjs +5 -5
  31. package/dist/blocks/lab-config.d.mts +1 -1
  32. package/dist/blocks/lab-config.mjs +4 -4
  33. package/dist/blocks/lab-gallery.d.mts +1 -1
  34. package/dist/blocks/lab-gallery.mjs +2 -2
  35. package/dist/blocks/language.d.mts +6 -6
  36. package/dist/blocks/language.mjs +12 -12
  37. package/dist/blocks/lesson.mjs +4 -4
  38. package/dist/blocks/math.d.mts +577 -11
  39. package/dist/blocks/math.mjs +1648 -14
  40. package/dist/blocks/ml.d.mts +45 -1
  41. package/dist/blocks/ml.mjs +80 -6
  42. package/dist/blocks/physics.d.mts +9 -4
  43. package/dist/blocks/physics.mjs +75 -28
  44. package/dist/blocks/statistics.mjs +1 -1
  45. package/dist/build/CircuitEditor.d.mts +14 -0
  46. package/dist/build/CircuitEditor.mjs +787 -0
  47. package/dist/build/CircuitPlayer.d.mts +19 -0
  48. package/dist/build/CircuitPlayer.mjs +53 -0
  49. package/dist/build/CircuitScene.d.mts +61 -0
  50. package/dist/build/CircuitScene.mjs +383 -0
  51. package/dist/build/contract.d.mts +116 -0
  52. package/dist/build/editor-ops.d.mts +65 -0
  53. package/dist/build/editor-ops.mjs +306 -0
  54. package/dist/build/editor-ui.mjs +121 -0
  55. package/dist/build/flow.d.mts +14 -0
  56. package/dist/build/flow.mjs +119 -0
  57. package/dist/build/index.d.mts +10 -0
  58. package/dist/build/index.mjs +10 -0
  59. package/dist/build/parts/ammeter.d.mts +1 -0
  60. package/dist/build/parts/ammeter.mjs +32 -0
  61. package/dist/build/parts/bulb.d.mts +1 -0
  62. package/dist/build/parts/bulb.mjs +50 -0
  63. package/dist/build/parts/capacitor.d.mts +1 -0
  64. package/dist/build/parts/capacitor.mjs +26 -0
  65. package/dist/build/parts/cell.d.mts +1 -0
  66. package/dist/build/parts/cell.mjs +40 -0
  67. package/dist/build/parts/diode.d.mts +1 -0
  68. package/dist/build/parts/diode.mjs +33 -0
  69. package/dist/build/parts/index.d.mts +5 -0
  70. package/dist/build/parts/index.mjs +43 -0
  71. package/dist/build/parts/mosfet.d.mts +1 -0
  72. package/dist/build/parts/mosfet.mjs +95 -0
  73. package/dist/build/parts/node.d.mts +1 -0
  74. package/dist/build/parts/node.mjs +32 -0
  75. package/dist/build/parts/resistor.d.mts +1 -0
  76. package/dist/build/parts/resistor.mjs +49 -0
  77. package/dist/build/parts/shared.mjs +42 -0
  78. package/dist/build/parts/switch.d.mts +1 -0
  79. package/dist/build/parts/switch.mjs +34 -0
  80. package/dist/build/parts.d.mts +1 -0
  81. package/dist/build/registry.d.mts +9 -0
  82. package/dist/build/registry.mjs +15 -0
  83. package/dist/build/solve.d.mts +8 -0
  84. package/dist/build/solve.mjs +0 -0
  85. package/dist/catalog/registry.d.mts +2 -2
  86. package/dist/catalog/templates.d.mts +1 -1
  87. package/dist/catalog/templates.mjs +6 -6
  88. package/dist/chem/battery.mjs +1 -1
  89. package/dist/chem/bohr-atom.mjs +4 -4
  90. package/dist/chem/diffusion/preset.mjs +4 -4
  91. package/dist/chem/electrochem/preset.mjs +5 -5
  92. package/dist/chem/equilibrium/preset.d.mts +1 -1
  93. package/dist/chem/equilibrium/preset.mjs +6 -6
  94. package/dist/chem/gas-box/preset.mjs +6 -6
  95. package/dist/chem/kinetics/preset.mjs +6 -6
  96. package/dist/chem/periodic-trends/preset.mjs +7 -7
  97. package/dist/chem/reaction-lab.mjs +3 -3
  98. package/dist/chem/reaction-profile.mjs +4 -4
  99. package/dist/chem/solution/dilution.mjs +6 -6
  100. package/dist/chem/solution/field.d.mts +2 -2
  101. package/dist/chem/solution/field.mjs +2 -2
  102. package/dist/chem/solution/solution-box.mjs +7 -7
  103. package/dist/chem/stoichiometry/preset.mjs +5 -5
  104. package/dist/chem/titration/preset.mjs +5 -5
  105. package/dist/circuits/ac-dc/asset.mjs +1 -1
  106. package/dist/circuits/ac-dc/preset.mjs +2 -2
  107. package/dist/circuits/brownout/index.d.mts +1 -0
  108. package/dist/circuits/brownout/preset.d.mts +22 -0
  109. package/dist/circuits/brownout/preset.mjs +399 -0
  110. package/dist/circuits/capacitor-leak/preset.mjs +13 -8
  111. package/dist/circuits/circuit/asset.mjs +71 -14
  112. package/dist/circuits/circuit/preset.mjs +23 -5
  113. package/dist/circuits/circuit-builder.mjs +60 -132
  114. package/dist/circuits/circuit-lab.mjs +60 -40
  115. package/dist/circuits/cmos-gate/index.d.mts +1 -0
  116. package/dist/circuits/cmos-gate/preset.d.mts +75 -0
  117. package/dist/circuits/cmos-gate/preset.mjs +1491 -0
  118. package/dist/circuits/diode/index.d.mts +1 -0
  119. package/dist/circuits/diode/preset.d.mts +25 -0
  120. package/dist/circuits/diode/preset.mjs +266 -0
  121. package/dist/circuits/index.d.mts +7 -1
  122. package/dist/circuits/index.mjs +7 -1
  123. package/dist/circuits/rc-charging/index.d.mts +1 -0
  124. package/dist/circuits/rc-charging/preset.d.mts +27 -0
  125. package/dist/circuits/rc-charging/preset.mjs +329 -0
  126. package/dist/circuits/semiconductor/index.d.mts +1 -0
  127. package/dist/circuits/semiconductor/preset.d.mts +102 -0
  128. package/dist/circuits/semiconductor/preset.mjs +1855 -0
  129. package/dist/circuits/transistor/index.d.mts +1 -0
  130. package/dist/circuits/transistor/preset.d.mts +27 -0
  131. package/dist/circuits/transistor/preset.mjs +329 -0
  132. package/dist/commerce/accounting/core.d.mts +1 -1
  133. package/dist/commerce/accounting/equation-balance.mjs +5 -5
  134. package/dist/commerce/accounting/journal-poster.mjs +8 -8
  135. package/dist/commerce/accounting/statement-sorter.mjs +4 -4
  136. package/dist/commerce/economics/core.d.mts +2 -2
  137. package/dist/commerce/economics/core.mjs +1 -1
  138. package/dist/commerce/economics/demand-shift-vs-move.mjs +6 -6
  139. package/dist/commerce/economics/elasticity-revenue.mjs +6 -6
  140. package/dist/commerce/economics/market-equilibrium.mjs +5 -5
  141. package/dist/core/easing.d.mts +3 -3
  142. package/dist/core/easing.mjs +2 -2
  143. package/dist/core/numeric.d.mts +3 -3
  144. package/dist/core/numeric.mjs +2 -2
  145. package/dist/core/reactive.d.mts +1 -1
  146. package/dist/core/reactive.mjs +1 -1
  147. package/dist/core/rng.d.mts +2 -2
  148. package/dist/core/rng.mjs +1 -1
  149. package/dist/core/tex.mjs +2 -2
  150. package/dist/core/timeline.d.mts +1 -1
  151. package/dist/core/timeline.mjs +1 -1
  152. package/dist/core/util.mjs +11 -1
  153. package/dist/discrete/arrangements/preset.mjs +6 -14
  154. package/dist/discrete/bayes/preset.mjs +43 -35
  155. package/dist/discrete/binomial/preset.mjs +2 -2
  156. package/dist/discrete/combination-studio/figure.d.mts +6 -0
  157. package/dist/discrete/combination-studio/figure.mjs +159 -0
  158. package/dist/discrete/combination-studio/index.d.mts +2 -0
  159. package/dist/discrete/combination-studio/preset.d.mts +44 -0
  160. package/dist/discrete/combination-studio/preset.mjs +440 -0
  161. package/dist/discrete/core/combinatorics.d.mts +23 -3
  162. package/dist/discrete/core/combinatorics.mjs +38 -3
  163. package/dist/discrete/core/pigeonhole.d.mts +1 -1
  164. package/dist/discrete/core/pigeonhole.mjs +1 -1
  165. package/dist/discrete/core/probability.d.mts +3 -3
  166. package/dist/discrete/core/probability.mjs +3 -3
  167. package/dist/discrete/core/sets.d.mts +1 -1
  168. package/dist/discrete/counting-slots/preset.mjs +8 -8
  169. package/dist/discrete/counting-tree/preset.mjs +65 -8
  170. package/dist/discrete/expected-value/preset.mjs +13 -13
  171. package/dist/discrete/hypergeometric/preset.mjs +48 -15
  172. package/dist/discrete/index.d.mts +4 -2
  173. package/dist/discrete/index.mjs +4 -2
  174. package/dist/discrete/karnaugh/preset.mjs +26 -20
  175. package/dist/discrete/lln/preset.mjs +44 -3
  176. package/dist/discrete/logic-circuit/preset.mjs +2 -2
  177. package/dist/discrete/monte-carlo/preset.d.mts +1 -1
  178. package/dist/discrete/monte-carlo/preset.mjs +14 -14
  179. package/dist/discrete/monty-hall/preset.mjs +6 -6
  180. package/dist/discrete/outcome-builder/preset.mjs +3 -3
  181. package/dist/discrete/pascal/preset.mjs +37 -7
  182. package/dist/discrete/rules.d.mts +20 -0
  183. package/dist/discrete/rules.mjs +264 -0
  184. package/dist/discrete/sample-space/preset.mjs +4 -4
  185. package/dist/discrete/selection/preset.mjs +7 -13
  186. package/dist/discrete/truth-table/preset.mjs +32 -9
  187. package/dist/discrete/venn/preset.mjs +71 -48
  188. package/dist/geography/cycle-lab/preset.mjs +17 -10
  189. package/dist/geography/cycles.d.mts +3 -3
  190. package/dist/geography/cycles.mjs +3 -3
  191. package/dist/geometry/board/preset.d.mts +2 -0
  192. package/dist/geometry/board/preset.mjs +11 -15
  193. package/dist/geometry/builder.mjs +3 -3
  194. package/dist/ict/number-systems/base-odometer.mjs +4 -4
  195. package/dist/ict/number-systems/bit-grouper.d.mts +1 -1
  196. package/dist/ict/number-systems/bit-grouper.mjs +4 -4
  197. package/dist/ict/number-systems/place-value-dial.d.mts +1 -1
  198. package/dist/ict/number-systems/place-value-dial.mjs +3 -3
  199. package/dist/ict/number-systems/wheel.d.mts +3 -3
  200. package/dist/ict/number-systems/wheel.mjs +4 -4
  201. package/dist/kit/annotate.mjs +3 -3
  202. package/dist/kit/answer-check.d.mts +2 -2
  203. package/dist/kit/answer-check.mjs +34 -6
  204. package/dist/kit/ask.d.mts +19 -0
  205. package/dist/kit/ask.mjs +46 -0
  206. package/dist/kit/bar-strip.mjs +53 -0
  207. package/dist/kit/calc.d.mts +33 -0
  208. package/dist/kit/calc.mjs +27 -0
  209. package/dist/kit/carrier-engine.mjs +147 -0
  210. package/dist/kit/clue-scene.d.mts +86 -0
  211. package/dist/kit/clue-scene.mjs +424 -0
  212. package/dist/kit/cluster.d.mts +30 -0
  213. package/dist/kit/cluster.mjs +81 -0
  214. package/dist/kit/controls.mjs +11 -5
  215. package/dist/kit/coords.d.mts +88 -0
  216. package/dist/kit/coords.mjs +192 -0
  217. package/dist/kit/data-scene.d.mts +27 -0
  218. package/dist/kit/data-scene.mjs +199 -0
  219. package/dist/kit/diagram.mjs +111 -50
  220. package/dist/kit/electronics.mjs +552 -60
  221. package/dist/kit/expr-analysis.d.mts +18 -6
  222. package/dist/kit/expr-analysis.mjs +82 -28
  223. package/dist/kit/frame.d.mts +3 -3
  224. package/dist/kit/frame.mjs +25 -6
  225. package/dist/kit/gameshow.mjs +2 -2
  226. package/dist/kit/index.d.mts +14 -2
  227. package/dist/kit/index.mjs +13 -1
  228. package/dist/kit/logic-gates.mjs +246 -47
  229. package/dist/kit/palette.mjs +26 -0
  230. package/dist/kit/pedagogy.d.mts +4 -4
  231. package/dist/kit/pedagogy.mjs +21 -17
  232. package/dist/kit/play.d.mts +1 -1
  233. package/dist/kit/play.mjs +3 -3
  234. package/dist/kit/predict.d.mts +55 -0
  235. package/dist/kit/predict.mjs +146 -0
  236. package/dist/kit/receipt.d.mts +29 -0
  237. package/dist/kit/receipt.mjs +94 -0
  238. package/dist/kit/rich.mjs +2 -2
  239. package/dist/kit/rule.d.mts +59 -0
  240. package/dist/kit/rule.mjs +215 -0
  241. package/dist/kit/scale.mjs +1 -1
  242. package/dist/kit/scene-library.d.mts +22 -0
  243. package/dist/kit/scene-library.mjs +311 -0
  244. package/dist/kit/scene-studio.d.mts +14 -0
  245. package/dist/kit/scene-studio.mjs +338 -0
  246. package/dist/kit/scenes.d.mts +31 -0
  247. package/dist/kit/scenes.mjs +569 -0
  248. package/dist/kit/slot-fill.d.mts +61 -0
  249. package/dist/kit/slot-fill.mjs +207 -0
  250. package/dist/kit/solve.d.mts +21 -0
  251. package/dist/kit/solve.mjs +75 -0
  252. package/dist/kit/space.mjs +5 -5
  253. package/dist/kit/steps.mjs +2 -2
  254. package/dist/kit/vessel.d.mts +69 -0
  255. package/dist/kit/vessel.mjs +191 -0
  256. package/dist/language/agreement/preset.mjs +2 -2
  257. package/dist/language/article-lens/preset.d.mts +1 -1
  258. package/dist/language/article-lens/preset.mjs +8 -8
  259. package/dist/language/deck.d.mts +3 -3
  260. package/dist/language/deck.mjs +1 -1
  261. package/dist/language/preposition-scene/preset.d.mts +2 -2
  262. package/dist/language/preposition-scene/preset.mjs +5 -5
  263. package/dist/language/sentence-builder/preset.mjs +5 -5
  264. package/dist/language/transform/preset.d.mts +2 -2
  265. package/dist/language/transform/preset.mjs +5 -5
  266. package/dist/language/ui.d.mts +3 -3
  267. package/dist/language/ui.mjs +4 -4
  268. package/dist/language/word-match/preset.mjs +3 -3
  269. package/dist/logic/LogicBuildLab.d.mts +22 -0
  270. package/dist/logic/LogicBuildLab.mjs +170 -0
  271. package/dist/logic/LogicEditScene.d.mts +31 -0
  272. package/dist/logic/LogicEditScene.mjs +276 -0
  273. package/dist/logic/LogicEditor.d.mts +14 -0
  274. package/dist/logic/LogicEditor.mjs +413 -0
  275. package/dist/logic/LogicScene.d.mts +32 -0
  276. package/dist/logic/LogicScene.mjs +277 -0
  277. package/dist/logic/contract.d.mts +72 -0
  278. package/dist/logic/display.d.mts +24 -0
  279. package/dist/logic/display.mjs +127 -0
  280. package/dist/logic/edit-ops.d.mts +44 -0
  281. package/dist/logic/edit-ops.mjs +177 -0
  282. package/dist/logic/evaluate.d.mts +11 -0
  283. package/dist/logic/evaluate.mjs +93 -0
  284. package/dist/logic/gates.d.mts +10 -0
  285. package/dist/logic/gates.mjs +73 -0
  286. package/dist/logic/index.d.mts +14 -0
  287. package/dist/logic/index.mjs +13 -0
  288. package/dist/logic/lab.d.mts +32 -0
  289. package/dist/logic/lab.mjs +160 -0
  290. package/dist/logic/presets.d.mts +12 -0
  291. package/dist/logic/presets.mjs +241 -0
  292. package/dist/logic/registry.d.mts +9 -0
  293. package/dist/logic/registry.mjs +15 -0
  294. package/dist/math/area-model/preset.mjs +70 -44
  295. package/dist/math/balance-algebra/preset.mjs +14 -5
  296. package/dist/math/broken-tree/index.d.mts +1 -0
  297. package/dist/math/broken-tree/preset.d.mts +26 -0
  298. package/dist/math/broken-tree/preset.mjs +435 -0
  299. package/dist/math/circle/index.d.mts +1 -0
  300. package/dist/math/circle/preset.d.mts +44 -0
  301. package/dist/math/circle/preset.mjs +198 -0
  302. package/dist/math/complex/core.d.mts +93 -0
  303. package/dist/math/complex/core.mjs +239 -0
  304. package/dist/math/complex/index.d.mts +3 -0
  305. package/dist/math/complex/preset.d.mts +31 -0
  306. package/dist/math/complex/preset.mjs +377 -0
  307. package/dist/math/complex/rules.d.mts +6 -0
  308. package/dist/math/complex/rules.mjs +121 -0
  309. package/dist/math/conic/index.d.mts +1 -0
  310. package/dist/math/conic/preset.d.mts +30 -0
  311. package/dist/math/conic/preset.mjs +334 -0
  312. package/dist/math/derivation.mjs +5 -5
  313. package/dist/math/derivative-explorer/preset.mjs +5 -5
  314. package/dist/math/domain-range/index.d.mts +1 -0
  315. package/dist/math/domain-range/preset.d.mts +33 -0
  316. package/dist/math/domain-range/preset.mjs +313 -0
  317. package/dist/math/fraction-bar/index.d.mts +1 -0
  318. package/dist/math/fraction-bar/preset.d.mts +27 -0
  319. package/dist/math/fraction-bar/preset.mjs +197 -0
  320. package/dist/math/function-machine/preset.mjs +2 -2
  321. package/dist/math/gradient-descent.mjs +6 -6
  322. package/dist/math/grapher/preset.d.mts +1 -1
  323. package/dist/math/grapher/preset.mjs +4 -4
  324. package/dist/math/harmonic-form/preset.mjs +6 -6
  325. package/dist/math/index.d.mts +27 -2
  326. package/dist/math/index.mjs +27 -2
  327. package/dist/math/integral-explorer/preset.mjs +2 -2
  328. package/dist/math/interactive/preset.mjs +3 -3
  329. package/dist/math/limit-explorer/preset.mjs +4 -4
  330. package/dist/math/linear-model/index.d.mts +1 -0
  331. package/dist/math/linear-model/preset.d.mts +53 -0
  332. package/dist/math/linear-model/preset.mjs +164 -0
  333. package/dist/math/linear-system/preset.mjs +4 -4
  334. package/dist/math/mystery-bucket/preset.mjs +6 -6
  335. package/dist/math/number-line/preset.mjs +3 -2
  336. package/dist/math/parabola/preset.mjs +4 -3
  337. package/dist/math/pattern/preset.mjs +7 -13
  338. package/dist/math/percent-bar/index.d.mts +1 -0
  339. package/dist/math/percent-bar/preset.d.mts +37 -0
  340. package/dist/math/percent-bar/preset.mjs +275 -0
  341. package/dist/math/poly/core.d.mts +50 -0
  342. package/dist/math/poly/core.mjs +268 -0
  343. package/dist/math/poly/index.d.mts +3 -0
  344. package/dist/math/poly/preset.d.mts +23 -0
  345. package/dist/math/poly/preset.mjs +141 -0
  346. package/dist/math/poly/steps.d.mts +10 -0
  347. package/dist/math/poly/steps.mjs +99 -0
  348. package/dist/math/rate-machine/index.d.mts +1 -0
  349. package/dist/math/rate-machine/preset.d.mts +35 -0
  350. package/dist/math/rate-machine/preset.mjs +281 -0
  351. package/dist/math/ratio-share/index.d.mts +1 -0
  352. package/dist/math/ratio-share/preset.d.mts +24 -0
  353. package/dist/math/ratio-share/preset.mjs +204 -0
  354. package/dist/math/receipt/index.d.mts +1 -0
  355. package/dist/math/receipt/preset.d.mts +22 -0
  356. package/dist/math/receipt/preset.mjs +137 -0
  357. package/dist/math/sequence-predict/index.d.mts +1 -0
  358. package/dist/math/sequence-predict/preset.d.mts +34 -0
  359. package/dist/math/sequence-predict/preset.mjs +130 -0
  360. package/dist/math/straight-line/index.d.mts +1 -0
  361. package/dist/math/straight-line/preset.d.mts +37 -0
  362. package/dist/math/straight-line/preset.mjs +374 -0
  363. package/dist/math/system-solve/index.d.mts +1 -0
  364. package/dist/math/system-solve/preset.d.mts +21 -0
  365. package/dist/math/system-solve/preset.mjs +227 -0
  366. package/dist/math/transform/index.d.mts +1 -0
  367. package/dist/math/transform/preset.d.mts +41 -0
  368. package/dist/math/transform/preset.mjs +343 -0
  369. package/dist/math/triangle-trig/preset.mjs +12 -9
  370. package/dist/math/trig/core.d.mts +37 -0
  371. package/dist/math/trig/core.mjs +150 -0
  372. package/dist/math/trig/diagrams.d.mts +1 -0
  373. package/dist/math/trig/diagrams.mjs +321 -0
  374. package/dist/math/trig/index.d.mts +3 -0
  375. package/dist/math/trig/preset.d.mts +25 -0
  376. package/dist/math/trig/preset.mjs +260 -0
  377. package/dist/math/trig/rules.d.mts +6 -0
  378. package/dist/math/trig/rules.mjs +159 -0
  379. package/dist/math/trig-explorer.mjs +4 -4
  380. package/dist/ml/boundary/preset.mjs +8 -3
  381. package/dist/ml/classifier/preset.mjs +31 -6
  382. package/dist/ml/kmeans/preset.mjs +4 -4
  383. package/dist/ml/knn/preset.mjs +47 -12
  384. package/dist/ml/regression/preset.mjs +36 -7
  385. package/dist/physics/atwood/preset.mjs +4 -4
  386. package/dist/physics/bullet-walls/preset.d.mts +1 -1
  387. package/dist/physics/bullet-walls/preset.mjs +7 -7
  388. package/dist/physics/carnot/preset.mjs +6 -6
  389. package/dist/physics/circular-motion/preset.mjs +36 -5
  390. package/dist/physics/collision-track/preset.mjs +35 -5
  391. package/dist/physics/efficiency/preset.d.mts +2 -2
  392. package/dist/physics/efficiency/preset.mjs +5 -5
  393. package/dist/physics/electric-field/preset.mjs +32 -23
  394. package/dist/physics/electric-flux/index.d.mts +1 -0
  395. package/dist/physics/electric-flux/preset.d.mts +29 -0
  396. package/dist/physics/electric-flux/preset.mjs +264 -0
  397. package/dist/physics/energy-skate/preset.mjs +5 -5
  398. package/dist/physics/entropy/preset.mjs +7 -7
  399. package/dist/physics/expansion/preset.mjs +13 -13
  400. package/dist/physics/exponential/asset.mjs +1 -1
  401. package/dist/physics/exponential/preset.mjs +4 -4
  402. package/dist/physics/gas-process/preset.mjs +3 -3
  403. package/dist/physics/gauss-law/index.d.mts +1 -0
  404. package/dist/physics/gauss-law/preset.d.mts +20 -0
  405. package/dist/physics/gauss-law/preset.mjs +286 -0
  406. package/dist/physics/gravitation/preset.mjs +7 -7
  407. package/dist/physics/gravity-drop.mjs +4 -4
  408. package/dist/physics/heat-transfer/preset.d.mts +1 -1
  409. package/dist/physics/heat-transfer/preset.mjs +10 -10
  410. package/dist/physics/impulse/preset.mjs +5 -5
  411. package/dist/physics/index.d.mts +4 -1
  412. package/dist/physics/index.mjs +4 -1
  413. package/dist/physics/kepler/preset.mjs +4 -4
  414. package/dist/physics/lever/preset.mjs +3 -3
  415. package/dist/physics/lorentz/preset.mjs +11 -11
  416. package/dist/physics/magnetism/preset.mjs +3 -3
  417. package/dist/physics/optics/preset.mjs +2 -2
  418. package/dist/physics/orbit-lab.mjs +5 -5
  419. package/dist/physics/projectile-lab.mjs +4 -4
  420. package/dist/physics/rain-relative/preset.mjs +5 -5
  421. package/dist/physics/ramp-forces/preset.mjs +5 -5
  422. package/dist/physics/river-boat.mjs +6 -6
  423. package/dist/physics/shm/preset.mjs +9 -9
  424. package/dist/physics/stopping-distance/preset.mjs +3 -3
  425. package/dist/physics/temperature-scales/preset.mjs +105 -116
  426. package/dist/physics/terminal-velocity/preset.mjs +5 -5
  427. package/dist/physics/thermal/preset.mjs +5 -5
  428. package/dist/physics/vector-board/preset.mjs +7 -6
  429. package/dist/physics/vector-scene.mjs +2 -2
  430. package/dist/physics/vector-types/preset.mjs +37 -3
  431. package/dist/physics/water-density/preset.mjs +12 -12
  432. package/dist/physics/waves/doppler.mjs +2 -2
  433. package/dist/physics/waves/preset.mjs +4 -4
  434. package/dist/physics/waves/ripple.mjs +6 -6
  435. package/dist/physics/waves/string.mjs +5 -5
  436. package/dist/physics/work-energy/preset.mjs +4 -4
  437. package/dist/physics/work-potential/index.d.mts +1 -0
  438. package/dist/physics/work-potential/preset.d.mts +20 -0
  439. package/dist/physics/work-potential/preset.mjs +276 -0
  440. package/dist/schemas/index.d.mts +6 -6
  441. package/dist/schemas/index.mjs +3 -3
  442. package/dist/statistics/center-spread/preset.mjs +3 -3
  443. package/dist/statistics/core/descriptive.d.mts +2 -2
  444. package/dist/statistics/core/descriptive.mjs +2 -2
  445. package/dist/statistics/core/normal.d.mts +3 -3
  446. package/dist/statistics/core/normal.mjs +3 -3
  447. package/dist/statistics/core/sequences.d.mts +1 -1
  448. package/dist/statistics/galton/preset.mjs +2 -2
  449. package/dist/statistics/histogram/preset.mjs +6 -6
  450. package/dist/statistics/normal/preset.mjs +2 -2
  451. package/dist/statistics/sampling/preset.mjs +4 -4
  452. package/dist/statistics/sequence/preset.mjs +58 -15
  453. package/dist/statistics/z-table/preset.mjs +17 -4
  454. package/package.json +11 -3
  455. package/styles.css +4 -1
@@ -0,0 +1,424 @@
1
+ 'use client';
2
+
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/kit/clue-scene.tsx
6
+ /** Total a clue evaluates to, given the unknowns' answers (kept consistent by construction). */
7
+ function clueTotal(clue, unknowns) {
8
+ return clue.coeffs.reduce((s, c, i) => s + c * (unknowns[i]?.answer ?? 0), 0);
9
+ }
10
+ const chipColor = (u) => u.color ?? "var(--stage-accent)";
11
+ /** A coloured token for an unknown (the reusable atom of every scene). */
12
+ function UnknownChip({ u, size = 30, withLabel = false }) {
13
+ return /* @__PURE__ */ jsxs("span", {
14
+ style: {
15
+ display: "inline-grid",
16
+ justifyItems: "center",
17
+ gap: 2,
18
+ verticalAlign: "middle"
19
+ },
20
+ children: [/* @__PURE__ */ jsx("span", {
21
+ "aria-label": u.label ?? u.sym,
22
+ style: {
23
+ width: size,
24
+ height: size,
25
+ borderRadius: 8,
26
+ display: "grid",
27
+ placeItems: "center",
28
+ fontSize: size * .6,
29
+ lineHeight: 1,
30
+ background: `color-mix(in oklab, ${chipColor(u)} 22%, transparent)`,
31
+ border: `2px solid ${chipColor(u)}`
32
+ },
33
+ children: u.sym
34
+ }), withLabel && u.label && /* @__PURE__ */ jsx("span", {
35
+ style: {
36
+ fontSize: 10,
37
+ color: "var(--stage-muted)"
38
+ },
39
+ children: u.label
40
+ })]
41
+ });
42
+ }
43
+ const fmtTotal = (n, currency = "", unit = "") => `${currency}${Math.round(n * 100) / 100}${unit ? " " + unit : ""}`;
44
+ /** Tiles: "2▲ + 1● = 12". Universal, reads as the equation it is. */
45
+ function ClueTiles({ clue, unknowns, currency, unit }) {
46
+ return /* @__PURE__ */ jsxs("div", {
47
+ style: {
48
+ display: "flex",
49
+ alignItems: "center",
50
+ gap: 8,
51
+ flexWrap: "wrap",
52
+ fontSize: 18,
53
+ fontWeight: 700,
54
+ padding: "8px 12px",
55
+ borderRadius: 12,
56
+ background: "color-mix(in oklab, var(--stage-fg) 5%, transparent)"
57
+ },
58
+ children: [
59
+ clue.coeffs.map((c, i) => ({
60
+ c,
61
+ u: unknowns[i]
62
+ })).filter((t) => t.c !== 0).map((t, i) => /* @__PURE__ */ jsxs("span", {
63
+ style: {
64
+ display: "inline-flex",
65
+ alignItems: "center",
66
+ gap: 4
67
+ },
68
+ children: [
69
+ i > 0 && /* @__PURE__ */ jsx("span", {
70
+ style: {
71
+ color: "var(--stage-muted)",
72
+ margin: "0 2px"
73
+ },
74
+ children: "+"
75
+ }),
76
+ t.c,
77
+ /* @__PURE__ */ jsx(UnknownChip, {
78
+ u: t.u,
79
+ size: 28
80
+ })
81
+ ]
82
+ }, i)),
83
+ /* @__PURE__ */ jsx("span", {
84
+ style: { color: "var(--stage-muted)" },
85
+ children: "="
86
+ }),
87
+ /* @__PURE__ */ jsx("strong", { children: fmtTotal(clueTotal(clue, unknowns), currency, unit) })
88
+ ]
89
+ });
90
+ }
91
+ /** Receipt: a shop bill listing quantities and the total (unit prices unknown). */
92
+ function ClueReceipt({ clue, unknowns, currency = "$", store = "Receipt" }) {
93
+ const lines = clue.coeffs.map((c, i) => ({
94
+ c,
95
+ u: unknowns[i]
96
+ })).filter((t) => t.c !== 0);
97
+ const row = {
98
+ display: "flex",
99
+ justifyContent: "space-between",
100
+ gap: 16,
101
+ alignItems: "center"
102
+ };
103
+ return /* @__PURE__ */ jsxs("div", {
104
+ style: {
105
+ width: 210,
106
+ padding: 14,
107
+ borderRadius: 12,
108
+ border: "2px solid color-mix(in oklab, var(--stage-fg) 18%, transparent)",
109
+ background: "color-mix(in oklab, var(--stage-fg) 4%, var(--stage-bg))",
110
+ display: "grid",
111
+ gap: 8,
112
+ fontVariantNumeric: "tabular-nums"
113
+ },
114
+ children: [
115
+ /* @__PURE__ */ jsx("div", {
116
+ style: { fontWeight: 800 },
117
+ children: store
118
+ }),
119
+ lines.map((t, i) => /* @__PURE__ */ jsx("div", {
120
+ style: {
121
+ ...row,
122
+ color: "var(--stage-muted)"
123
+ },
124
+ children: /* @__PURE__ */ jsxs("span", {
125
+ style: {
126
+ display: "inline-flex",
127
+ alignItems: "center",
128
+ gap: 6
129
+ },
130
+ children: [
131
+ t.c,
132
+ " ",
133
+ /* @__PURE__ */ jsx(UnknownChip, {
134
+ u: t.u,
135
+ size: 22
136
+ }),
137
+ " ",
138
+ t.u.label
139
+ ]
140
+ })
141
+ }, i)),
142
+ /* @__PURE__ */ jsx("div", { style: { borderTop: "1px dashed color-mix(in oklab, var(--stage-fg) 30%, transparent)" } }),
143
+ /* @__PURE__ */ jsxs("div", {
144
+ style: {
145
+ ...row,
146
+ fontWeight: 800
147
+ },
148
+ children: [/* @__PURE__ */ jsx("span", { children: "Total" }), /* @__PURE__ */ jsx("span", {
149
+ style: { color: "var(--stage-good)" },
150
+ children: fmtTotal(clueTotal(clue, unknowns), currency)
151
+ })]
152
+ })
153
+ ]
154
+ });
155
+ }
156
+ /** Balance: buckets (one per coeff, coloured by type) on the left pan vs a weight on the right. */
157
+ function ClueBalance({ clue, unknowns, unit = "kg" }) {
158
+ const W = 240, H = 132;
159
+ const beamY = 34, pivX = W / 2, panY = 70;
160
+ const lpx = pivX - 70, rpx = 190;
161
+ const buckets = [];
162
+ clue.coeffs.forEach((c, i) => {
163
+ for (let k = 0; k < c; k++) buckets.push({
164
+ color: unknowns[i]?.color ?? "var(--stage-accent)",
165
+ sym: unknowns[i]?.sym ?? ""
166
+ });
167
+ });
168
+ const bw = Math.min(26, 110 / Math.max(1, buckets.length));
169
+ const Bucket = ({ x, color, sym }) => {
170
+ const w = bw * .86, h = bw * 1.1, topY = panY - h;
171
+ return /* @__PURE__ */ jsxs("g", { children: [
172
+ /* @__PURE__ */ jsx("path", {
173
+ d: `M ${x - w / 2} ${topY} L ${x - w / 2 + 2} ${panY - 2} L ${x + w / 2 - 2} ${panY - 2} L ${x + w / 2} ${topY} Z`,
174
+ fill: `color-mix(in oklab, ${color} 30%, var(--stage-bg))`,
175
+ stroke: color,
176
+ strokeWidth: 1.6,
177
+ strokeLinejoin: "round"
178
+ }),
179
+ /* @__PURE__ */ jsx("ellipse", {
180
+ cx: x,
181
+ cy: topY,
182
+ rx: w / 2,
183
+ ry: 2.4,
184
+ fill: color,
185
+ fillOpacity: .5
186
+ }),
187
+ /* @__PURE__ */ jsx("text", {
188
+ x,
189
+ y: topY + h * .62,
190
+ fontSize: bw * .5,
191
+ textAnchor: "middle",
192
+ dominantBaseline: "middle",
193
+ children: sym
194
+ })
195
+ ] });
196
+ };
197
+ const total = clueTotal(clue, unknowns);
198
+ const bx0 = lpx - (buckets.length - 1) * bw / 2;
199
+ return /* @__PURE__ */ jsxs("svg", {
200
+ width: W,
201
+ height: H,
202
+ viewBox: `0 0 ${W} ${H}`,
203
+ role: "img",
204
+ "aria-label": `balance: ${buckets.length} buckets weigh ${total} ${unit}`,
205
+ children: [
206
+ /* @__PURE__ */ jsx("path", {
207
+ d: `M ${pivX - 12} ${H - 10} L 132 ${H - 10} L ${pivX} 40 Z`,
208
+ fill: "var(--stage-metal, #8a8a8a)"
209
+ }),
210
+ /* @__PURE__ */ jsx("rect", {
211
+ x: pivX - 78,
212
+ y: beamY - 3,
213
+ width: 156,
214
+ height: 6,
215
+ rx: 3,
216
+ fill: "var(--stage-metal, #8a8a8a)"
217
+ }),
218
+ [lpx, rpx].map((px, i) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
219
+ x1: px,
220
+ y1: beamY,
221
+ x2: px,
222
+ y2: panY,
223
+ stroke: "color-mix(in oklab, var(--stage-fg) 40%, transparent)",
224
+ strokeWidth: 1.5
225
+ }), /* @__PURE__ */ jsx("path", {
226
+ d: `M ${px - 34} ${panY} Q ${px} 84 ${px + 34} ${panY}`,
227
+ fill: "none",
228
+ stroke: "var(--stage-metal, #8a8a8a)",
229
+ strokeWidth: 2.5,
230
+ strokeLinecap: "round"
231
+ })] }, i)),
232
+ buckets.map((b, i) => /* @__PURE__ */ jsx(Bucket, {
233
+ x: bx0 + i * bw,
234
+ color: b.color,
235
+ sym: b.sym
236
+ }, i)),
237
+ /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("rect", {
238
+ x: rpx - 26,
239
+ y: panY - 34,
240
+ width: 52,
241
+ height: 30,
242
+ rx: 6,
243
+ fill: "var(--stage-bg)",
244
+ stroke: "color-mix(in oklab, var(--stage-fg) 35%, transparent)",
245
+ strokeWidth: 1.5
246
+ }), /* @__PURE__ */ jsxs("text", {
247
+ x: rpx,
248
+ y: panY - 18,
249
+ fontSize: 14,
250
+ fontWeight: 800,
251
+ textAnchor: "middle",
252
+ dominantBaseline: "middle",
253
+ fill: "var(--stage-fg)",
254
+ children: [total, unit ? " " + unit : ""]
255
+ })] })
256
+ ]
257
+ });
258
+ }
259
+ /** Bar model (tape diagram): each clue is one bar of unit cells grouped by unknown = total. */
260
+ function ClueBar({ clue, unknowns, currency, unit }) {
261
+ return /* @__PURE__ */ jsxs("div", {
262
+ style: {
263
+ display: "flex",
264
+ alignItems: "center",
265
+ gap: 8,
266
+ padding: "8px 12px",
267
+ borderRadius: 12,
268
+ background: "color-mix(in oklab, var(--stage-fg) 5%, transparent)"
269
+ },
270
+ children: [
271
+ /* @__PURE__ */ jsx("div", {
272
+ style: {
273
+ display: "flex",
274
+ gap: 5
275
+ },
276
+ children: clue.coeffs.map((c, i) => ({
277
+ c,
278
+ u: unknowns[i]
279
+ })).filter((t) => t.c !== 0).map((t, ti) => /* @__PURE__ */ jsx("div", {
280
+ style: { display: "flex" },
281
+ children: Array.from({ length: t.c }).map((_, k) => /* @__PURE__ */ jsx("div", {
282
+ style: {
283
+ width: 30,
284
+ height: 34,
285
+ display: "grid",
286
+ placeItems: "center",
287
+ fontSize: 14,
288
+ background: `color-mix(in oklab, ${chipColor(t.u)} 28%, transparent)`,
289
+ border: `1.5px solid ${chipColor(t.u)}`,
290
+ borderRadius: t.c === 1 ? 8 : k === 0 ? "8px 0 0 8px" : k === t.c - 1 ? "0 8px 8px 0" : 0,
291
+ marginLeft: k > 0 ? -1.5 : 0
292
+ },
293
+ children: t.u.sym
294
+ }, k))
295
+ }, ti))
296
+ }),
297
+ /* @__PURE__ */ jsx("span", {
298
+ style: {
299
+ color: "var(--stage-muted)",
300
+ fontWeight: 700
301
+ },
302
+ children: "="
303
+ }),
304
+ /* @__PURE__ */ jsx("strong", {
305
+ style: {
306
+ fontSize: 16,
307
+ fontVariantNumeric: "tabular-nums"
308
+ },
309
+ children: fmtTotal(clueTotal(clue, unknowns), currency, unit)
310
+ })
311
+ ]
312
+ });
313
+ }
314
+ /** Coin piles: each unknown is a stack of coins (coloured by type) = a money total. */
315
+ function ClueCoins({ clue, unknowns, currency = "$" }) {
316
+ return /* @__PURE__ */ jsxs("div", {
317
+ style: {
318
+ display: "flex",
319
+ alignItems: "center",
320
+ gap: 8,
321
+ padding: "8px 12px",
322
+ borderRadius: 12,
323
+ background: "color-mix(in oklab, var(--stage-fg) 5%, transparent)"
324
+ },
325
+ children: [
326
+ clue.coeffs.map((c, i) => ({
327
+ c,
328
+ u: unknowns[i]
329
+ })).filter((t) => t.c !== 0).map((t, ti) => /* @__PURE__ */ jsxs("span", {
330
+ style: {
331
+ display: "inline-flex",
332
+ alignItems: "flex-end",
333
+ gap: 6
334
+ },
335
+ children: [ti > 0 && /* @__PURE__ */ jsx("span", {
336
+ style: {
337
+ color: "var(--stage-muted)",
338
+ fontWeight: 700,
339
+ marginBottom: 8
340
+ },
341
+ children: "+"
342
+ }), /* @__PURE__ */ jsx("span", {
343
+ style: {
344
+ position: "relative",
345
+ width: 30,
346
+ height: 16 + t.c * 7
347
+ },
348
+ children: Array.from({ length: t.c }).map((_, k) => /* @__PURE__ */ jsx("span", {
349
+ style: {
350
+ position: "absolute",
351
+ bottom: k * 7,
352
+ left: 0,
353
+ width: 30,
354
+ height: 16,
355
+ borderRadius: "50%",
356
+ border: `1.5px solid color-mix(in oklab, ${chipColor(t.u)} 65%, black)`,
357
+ background: `radial-gradient(circle at 40% 35%, color-mix(in oklab, ${chipColor(t.u)} 70%, white), ${chipColor(t.u)})`,
358
+ display: "grid",
359
+ placeItems: "center",
360
+ fontSize: 9
361
+ },
362
+ children: t.u.sym
363
+ }, k))
364
+ })]
365
+ }, ti)),
366
+ /* @__PURE__ */ jsx("span", {
367
+ style: {
368
+ color: "var(--stage-muted)",
369
+ fontWeight: 700
370
+ },
371
+ children: "="
372
+ }),
373
+ /* @__PURE__ */ jsx("strong", {
374
+ style: {
375
+ fontSize: 16,
376
+ fontVariantNumeric: "tabular-nums"
377
+ },
378
+ children: fmtTotal(clueTotal(clue, unknowns), currency)
379
+ })
380
+ ]
381
+ });
382
+ }
383
+ const CLUE_REGISTRY = /* @__PURE__ */ new Map();
384
+ function registerClueScene(meta) {
385
+ CLUE_REGISTRY.set(meta.name, meta);
386
+ }
387
+ function getClueScene(name) {
388
+ return CLUE_REGISTRY.get(name);
389
+ }
390
+ function listClueScenes() {
391
+ return [...CLUE_REGISTRY.values()];
392
+ }
393
+ registerClueScene({
394
+ name: "tiles",
395
+ label: "Algebra tiles",
396
+ render: (q) => /* @__PURE__ */ jsx(ClueTiles, { ...q })
397
+ });
398
+ registerClueScene({
399
+ name: "receipt",
400
+ label: "Shop receipt",
401
+ render: (q) => /* @__PURE__ */ jsx(ClueReceipt, { ...q })
402
+ });
403
+ registerClueScene({
404
+ name: "balance",
405
+ label: "Bucket balance",
406
+ render: (q) => /* @__PURE__ */ jsx(ClueBalance, { ...q })
407
+ });
408
+ registerClueScene({
409
+ name: "bar",
410
+ label: "Bar model",
411
+ render: (q) => /* @__PURE__ */ jsx(ClueBar, { ...q })
412
+ });
413
+ registerClueScene({
414
+ name: "coins",
415
+ label: "Coin piles",
416
+ render: (q) => /* @__PURE__ */ jsx(ClueCoins, { ...q })
417
+ });
418
+ /** Render one clue in the chosen scene (registry name). Creators extend via registerClueScene. */
419
+ function ClueScene({ kind, ...rest }) {
420
+ return getClueScene(kind)?.render(rest) ?? /* @__PURE__ */ jsx(ClueTiles, { ...rest });
421
+ }
422
+
423
+ //#endregion
424
+ export { ClueBalance, ClueBar, ClueCoins, ClueReceipt, ClueScene, ClueTiles, UnknownChip, clueTotal, getClueScene, listClueScenes, registerClueScene };
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/kit/cluster.d.ts
4
+ interface DotClusterProps {
5
+ count: number;
6
+ /** Highlight the last `highlight` items (e.g. the ones added this step). */
7
+ highlight?: number;
8
+ /** Diameter of the dish (px). */
9
+ size?: number;
10
+ color?: string;
11
+ highlightColor?: string;
12
+ /** Dish ring tint; set `emphasis` to draw the bold "current" ring. */
13
+ emphasis?: boolean;
14
+ /** Caption above (e.g. "Day 2"). */
15
+ label?: string;
16
+ /** Chip below (the value, or "?" while hidden). */
17
+ value?: ReactNode;
18
+ }
19
+ declare function DotCluster({
20
+ count,
21
+ highlight,
22
+ size,
23
+ color,
24
+ highlightColor,
25
+ emphasis,
26
+ label,
27
+ value
28
+ }: DotClusterProps): ReactNode;
29
+ //#endregion
30
+ export { DotCluster, DotClusterProps };
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/kit/cluster.tsx
6
+ const GOLDEN = Math.PI * (3 - Math.sqrt(5));
7
+ function DotCluster({ count, highlight = 0, size = 120, color = "color-mix(in oklab, var(--stage-fg) 55%, transparent)", highlightColor = "var(--stage-accent)", emphasis = false, label, value }) {
8
+ const capH = label ? 24 : 6;
9
+ const capB = value != null ? 30 : 6;
10
+ const dishR = size / 2;
11
+ const cx = dishR;
12
+ const cy = capH + dishR;
13
+ const total = capH + size + capB;
14
+ const n = Math.max(0, Math.round(count));
15
+ const dotR = Math.max(2.2, Math.min(7, dishR * .78 / Math.sqrt(Math.max(1, n))));
16
+ const fitR = dishR - dotR - 3;
17
+ const dots = [];
18
+ for (let i = 0; i < n; i++) {
19
+ const r = Math.sqrt((i + .5) / n) * fitR;
20
+ const th = i * GOLDEN;
21
+ const x = cx + r * Math.cos(th);
22
+ const y = cy + r * Math.sin(th);
23
+ const isNew = i >= n - highlight;
24
+ dots.push(/* @__PURE__ */ jsx("circle", {
25
+ cx: x,
26
+ cy: y,
27
+ r: dotR,
28
+ fill: isNew ? highlightColor : color,
29
+ opacity: isNew ? .95 : .8
30
+ }, i));
31
+ }
32
+ return /* @__PURE__ */ jsxs("svg", {
33
+ width: size,
34
+ height: total,
35
+ viewBox: `0 0 ${size} ${total}`,
36
+ role: "img",
37
+ "aria-label": `${label ? label + ": " : ""}${value != null && value !== "?" ? value : count} items`,
38
+ children: [
39
+ label && /* @__PURE__ */ jsx("text", {
40
+ x: cx,
41
+ y: 14,
42
+ fontSize: 13,
43
+ fontWeight: 700,
44
+ fill: "var(--stage-fg)",
45
+ textAnchor: "middle",
46
+ children: label
47
+ }),
48
+ /* @__PURE__ */ jsx("circle", {
49
+ cx,
50
+ cy,
51
+ r: dishR - 1,
52
+ fill: "color-mix(in oklab, var(--stage-fg) 7%, transparent)",
53
+ stroke: emphasis ? highlightColor : "color-mix(in oklab, var(--stage-fg) 22%, transparent)",
54
+ strokeWidth: emphasis ? 2.5 : 1.5
55
+ }),
56
+ dots,
57
+ value != null && /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("rect", {
58
+ x: cx - 16,
59
+ y: capH + size - 8,
60
+ width: 32,
61
+ height: 24,
62
+ rx: 5,
63
+ fill: "var(--stage-bg)",
64
+ stroke: "color-mix(in oklab, var(--stage-fg) 30%, transparent)",
65
+ strokeWidth: 1.5
66
+ }), /* @__PURE__ */ jsx("text", {
67
+ x: cx,
68
+ y: capH + size + 4,
69
+ fontSize: 14,
70
+ fontWeight: 800,
71
+ fill: "var(--stage-fg)",
72
+ textAnchor: "middle",
73
+ dominantBaseline: "middle",
74
+ children: value
75
+ })] })
76
+ ]
77
+ });
78
+ }
79
+
80
+ //#endregion
81
+ export { DotCluster };
@@ -12,7 +12,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
12
12
  function LabStyles() {
13
13
  return null;
14
14
  }
15
- function Stepper({ value, onChange, min = 0, max = 99, label }) {
15
+ function Stepper({ value, onChange, min = 0, max = 99, step = 1, label }) {
16
16
  return /* @__PURE__ */ jsxs("span", {
17
17
  className: "lab-stepper",
18
18
  role: "group",
@@ -21,14 +21,14 @@ function Stepper({ value, onChange, min = 0, max = 99, label }) {
21
21
  /* @__PURE__ */ jsx("button", {
22
22
  type: "button",
23
23
  "aria-label": `decrease${label ? " " + label : ""}`,
24
- onClick: () => onChange(Math.max(min, value - 1)),
24
+ onClick: () => onChange(Math.max(min, value - step)),
25
25
  children: "−"
26
26
  }),
27
27
  /* @__PURE__ */ jsx("b", { children: value }),
28
28
  /* @__PURE__ */ jsx("button", {
29
29
  type: "button",
30
30
  "aria-label": `increase${label ? " " + label : ""}`,
31
- onClick: () => onChange(Math.min(max, value + 1)),
31
+ onClick: () => onChange(Math.min(max, value + step)),
32
32
  children: "+"
33
33
  })
34
34
  ]
@@ -50,16 +50,19 @@ function StatusPill({ ok, children }) {
50
50
  children
51
51
  });
52
52
  }
53
- function Chip({ selected, onClick, children }) {
53
+ function Chip({ selected, onClick, children, ...a11y }) {
54
54
  return /* @__PURE__ */ jsx("button", {
55
55
  type: "button",
56
56
  className: "lab-chip",
57
57
  "data-sel": selected,
58
58
  onClick,
59
+ ...a11y,
59
60
  children
60
61
  });
61
62
  }
62
63
  function Slider(props) {
64
+ const pct = props.max > props.min ? Math.max(0, Math.min(100, (props.value - props.min) / (props.max - props.min) * 100)) : 0;
65
+ const fill = `linear-gradient(to right, var(--primary, oklch(0.59 0.22 261)) 0 ${pct}%, color-mix(in oklab, currentColor 20%, transparent) ${pct}% 100%)`;
63
66
  return /* @__PURE__ */ jsx("input", {
64
67
  type: "range",
65
68
  className: "lab-slider",
@@ -69,7 +72,10 @@ function Slider(props) {
69
72
  step: props.step,
70
73
  "aria-label": props.ariaLabel,
71
74
  onChange: (e) => props.onChange(Number(e.currentTarget.value)),
72
- style: props.style
75
+ style: {
76
+ background: fill,
77
+ ...props.style
78
+ }
73
79
  });
74
80
  }
75
81
 
@@ -0,0 +1,88 @@
1
+ import { ReactNode } from "react";
2
+ import { Vec2 } from "@classytic/stage";
3
+
4
+ //#region src/kit/coords.d.ts
5
+ /** A straight line: either oblique/horizontal y = m·x + c, or vertical x = `vertical`. */
6
+ interface Lin {
7
+ m: number;
8
+ c: number;
9
+ /** Set for a vertical line x = value (m is then ±∞). */
10
+ vertical?: number;
11
+ }
12
+ /** The line through two points (vertical-safe). */
13
+ declare function lineThrough(a: Vec2, b: Vec2): Lin;
14
+ /** The line of gradient m through point p. */
15
+ declare function lineFrom(m: number, p: Vec2): Lin;
16
+ /** The line parallel to `l` through p (same gradient). */
17
+ declare function parallelThrough(l: Lin, p: Vec2): Lin;
18
+ /** The line perpendicular to `l` through p (gradient −1/m; verticals ↔ horizontals). */
19
+ declare function perpThrough(l: Lin, p: Vec2): Lin;
20
+ /** Where two lines cross (null if parallel). Vertical-safe. */
21
+ declare function intersectLines(l1: Lin, l2: Lin): Vec2 | null;
22
+ declare function distance(a: Vec2, b: Vec2): number;
23
+ declare function midpoint(a: Vec2, b: Vec2): Vec2;
24
+ /** Round to a clean string, trims trailing zeros; up to `dp` decimals. */
25
+ declare function num(n: number, dp?: number): string;
26
+ /** Human-readable equation of a line: "y = 2x − 3", "x = 4", "y = 5". */
27
+ declare function lineTex(l: Lin, dp?: number): string;
28
+ /** Intercept form "x/a + y/b = 1" for a line cutting the axes at (a,0),(0,b). */
29
+ declare function interceptTex(a: number, b: number, dp?: number): string;
30
+ /** Circle "(x − a)² + (y − b)² = r²" with centre (a,b). */
31
+ declare function circleTex(a: number, b: number, r: number, dp?: number): string;
32
+ /** Expanded circle x² + y² + Dx + Ey + F = 0 (the completing-the-square form). */
33
+ declare function circleExpandedTex(a: number, b: number, r: number, dp?: number): string;
34
+ /** Snap a value to the nearest `step` (0 → no snap). */
35
+ declare function snapTo(v: number, step?: number): number;
36
+ declare function snapPoint(p: Vec2, step?: number): Vec2;
37
+ interface CoordPlaneProps {
38
+ view: {
39
+ xMin: number;
40
+ xMax: number;
41
+ yMin: number;
42
+ yMax: number;
43
+ };
44
+ height?: number;
45
+ ariaLabel?: string;
46
+ /** Grid/axis tick spacing in math units (default: auto via niceStep). */
47
+ step?: number;
48
+ /** Per-axis tick spacing overrides (for tall-thin / short-wide plots). */
49
+ stepX?: number;
50
+ stepY?: number;
51
+ /** Inner padding in px, room for axis labels so they are not clipped at the edge. */
52
+ pad?: number;
53
+ /** Show numeric labels on the axes (default true). */
54
+ labels?: boolean;
55
+ /**
56
+ * Equal x/y scaling. ON by default, geometry (circles, perpendiculars, angles)
57
+ * needs it. Function plots that want a stretched y pass false.
58
+ */
59
+ preserveAspect?: boolean;
60
+ children?: ReactNode;
61
+ }
62
+ /** The framed coordinate plane every coord-geometry lab draws on. */
63
+ declare function CoordPlane({
64
+ view,
65
+ height,
66
+ ariaLabel,
67
+ step,
68
+ stepX,
69
+ stepY,
70
+ pad,
71
+ labels,
72
+ preserveAspect,
73
+ children
74
+ }: CoordPlaneProps): ReactNode;
75
+ /** The rise/run right-triangle under a line segment, makes "gradient = Δy/Δx" visible. */
76
+ declare function GradientTriangle({
77
+ a,
78
+ b,
79
+ color,
80
+ showLabels
81
+ }: {
82
+ a: Vec2;
83
+ b: Vec2;
84
+ color?: string;
85
+ showLabels?: boolean;
86
+ }): ReactNode;
87
+ //#endregion
88
+ export { CoordPlane, CoordPlaneProps, GradientTriangle, Lin, circleExpandedTex, circleTex, distance, interceptTex, intersectLines, lineFrom, lineTex, lineThrough, midpoint, num, parallelThrough, perpThrough, snapPoint, snapTo };