@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,435 @@
1
+ 'use client';
2
+
3
+ import { clamp } from "../../core/util.mjs";
4
+ import { Callout, LabFrame } from "../../kit/frame.mjs";
5
+ import { useCheckpoint } from "../../kit/pedagogy.mjs";
6
+ import { AngleArc, RightAngleMark } from "../../kit/diagram.mjs";
7
+ import { useState } from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Circle, Label, MovableDot, Polygon, Segment, Stage } from "@classytic/stage";
10
+
11
+ //#region src/math/broken-tree/preset.tsx
12
+ /**
13
+ * BrokenTreeLab, the "tree snaps in the wind" trig word problem, but as a thing you
14
+ * PLAY WITH, not a labelled wireframe. A whole tree of height H stands by a house at
15
+ * distance D. DRAG the break point up/down the trunk: the leafy top snaps off, bends
16
+ * over, and its tip slides along the ground in real time. Break it at the right height
17
+ * and the falling top just reaches the house, that's the goal + the payoff.
18
+ *
19
+ * Physics of the bend: the broken top is a RIGID piece of length L = H − h that pivots
20
+ * at the break (height h) and swings down until its tip touches the ground, landing at
21
+ * d = √(L² − h²) with tan θ = h / d at the tip.
22
+ * (It can only reach the ground while h ≤ H/2, i.e. the broken piece is long enough.)
23
+ * So as you break LOWER, the top is longer and lands FARTHER, you feel the relationship
24
+ * instead of reading it. The classic "find the original height" is the same triangle.
25
+ *
26
+ * Direct manipulation (MovableDot on the trunk) + a real tree (trunk + foliage) + a
27
+ * target = the template for how the trig-scenario library should FEEL. Authorable via
28
+ * props (originalHeight, target, …); tokenised where it can be, nature colours for the tree.
29
+ */
30
+ const C_TRUNK = "oklch(0.46 0.06 60)";
31
+ const C_LEAF = "oklch(0.62 0.15 145)";
32
+ const C_LEAF_DK = "oklch(0.5 0.14 150)";
33
+ const fmt$1 = (n) => Number.isFinite(n) ? n.toFixed(1) : ", ";
34
+ /** A leafy crown: layered blobs, darker low/sides + lighter on top for depth. Transparency
35
+ * is applied to the WHOLE group (a single <g opacity>) so overlapping blobs don't compound
36
+ * into blotchy dark patches, the foliage reads as one flat-tinted shape. */
37
+ function Crown({ at, r, opacity = 1 }) {
38
+ const blob = (dx, dy, rr, c) => /* @__PURE__ */ jsx(Circle, {
39
+ center: {
40
+ x: at.x + dx,
41
+ y: at.y + dy
42
+ },
43
+ r: rr,
44
+ color: "none",
45
+ fill: c,
46
+ fillOpacity: 1,
47
+ weight: 0
48
+ });
49
+ return /* @__PURE__ */ jsxs("g", {
50
+ opacity,
51
+ children: [
52
+ blob(-r * .55, -r * .1, r * .72, C_LEAF_DK),
53
+ blob(r * .55, -r * .05, r * .7, C_LEAF_DK),
54
+ blob(0, -r * .35, r * .62, C_LEAF_DK),
55
+ blob(0, r * .05, r * .92, C_LEAF),
56
+ blob(-r * .32, r * .5, r * .5, C_LEAF),
57
+ blob(r * .34, r * .46, r * .56, C_LEAF)
58
+ ]
59
+ });
60
+ }
61
+ function BrokenTreeLab({ originalHeight = 18, target = 12, breakHeight = 3, title = "Snap the tree so its top reaches the house", prompt = "Drag the break point up or down the trunk. The top bends to the ground, break it lower and it falls farther.", height = 340, activity = "broken-tree" } = {}) {
62
+ const H = originalHeight;
63
+ const [breakH, setBreakH] = useState(breakHeight);
64
+ const h = clamp(breakH, .5, H / 2 - .05);
65
+ const L = H - h;
66
+ const d = Math.sqrt(Math.max(0, L * L - h * h));
67
+ const deg = Math.atan2(h, d || 1e-6) * 180 / Math.PI;
68
+ const hasGoal = typeof target === "number";
69
+ const reached = hasGoal && Math.abs(d - target) < .3;
70
+ useCheckpoint({
71
+ solved: reached,
72
+ activity
73
+ });
74
+ const foot = {
75
+ x: 0,
76
+ y: 0
77
+ };
78
+ const brk = {
79
+ x: 0,
80
+ y: h
81
+ };
82
+ const tip = {
83
+ x: d,
84
+ y: 0
85
+ };
86
+ const far = Math.max(d, target ?? 0, H) + 2;
87
+ const pad = far * .08;
88
+ const view = {
89
+ xMin: -pad * 2,
90
+ xMax: far,
91
+ yMin: -pad,
92
+ yMax: H + pad
93
+ };
94
+ const nx = h / (L || 1), ny = d / (L || 1);
95
+ const lf = .34;
96
+ const Lmid = {
97
+ x: brk.x + (tip.x - brk.x) * lf + nx * .9,
98
+ y: brk.y + (tip.y - brk.y) * lf + ny * .9
99
+ };
100
+ const crownAt = {
101
+ x: brk.x + (tip.x - brk.x) * .66,
102
+ y: brk.y + (tip.y - brk.y) * .66 + 1
103
+ };
104
+ const Hx = -pad * 1.4;
105
+ const houseC = reached ? "var(--stage-good)" : "var(--stage-muted)";
106
+ const figure = /* @__PURE__ */ jsxs(Stage, {
107
+ view,
108
+ height,
109
+ preserveAspect: true,
110
+ ariaLabel: `Broken tree: original height ${fmt$1(H)}, broke at ${fmt$1(h)}, top reaches ${fmt$1(d)} along the ground`,
111
+ children: [
112
+ /* @__PURE__ */ jsx(Polygon, {
113
+ points: [
114
+ {
115
+ x: -pad * 2,
116
+ y: 0
117
+ },
118
+ {
119
+ x: far,
120
+ y: 0
121
+ },
122
+ {
123
+ x: far,
124
+ y: -pad
125
+ },
126
+ {
127
+ x: -pad * 2,
128
+ y: -pad
129
+ }
130
+ ],
131
+ color: "none",
132
+ fill: "oklch(0.62 0.13 145)",
133
+ fillOpacity: .14,
134
+ weight: 0
135
+ }),
136
+ /* @__PURE__ */ jsx(Segment, {
137
+ from: {
138
+ x: -pad * 2,
139
+ y: 0
140
+ },
141
+ to: {
142
+ x: far,
143
+ y: 0
144
+ },
145
+ color: "oklch(0.5 0.08 145)",
146
+ weight: 2,
147
+ opacity: .65
148
+ }),
149
+ /* @__PURE__ */ jsx(Segment, {
150
+ from: {
151
+ x: Hx,
152
+ y: 0
153
+ },
154
+ to: {
155
+ x: Hx,
156
+ y: H
157
+ },
158
+ color: "var(--stage-muted)",
159
+ weight: 1,
160
+ opacity: .7
161
+ }),
162
+ /* @__PURE__ */ jsx(Segment, {
163
+ from: {
164
+ x: Hx - .4,
165
+ y: 0
166
+ },
167
+ to: {
168
+ x: Hx + .4,
169
+ y: 0
170
+ },
171
+ color: "var(--stage-muted)",
172
+ weight: 1,
173
+ opacity: .7
174
+ }),
175
+ /* @__PURE__ */ jsx(Segment, {
176
+ from: {
177
+ x: Hx - .4,
178
+ y: H
179
+ },
180
+ to: {
181
+ x: Hx + .4,
182
+ y: H
183
+ },
184
+ color: "var(--stage-muted)",
185
+ weight: 1,
186
+ opacity: .7
187
+ }),
188
+ /* @__PURE__ */ jsx(Label, {
189
+ x: Hx,
190
+ y: H / 2,
191
+ text: `H = ${fmt$1(H)} m`,
192
+ color: "var(--stage-muted)",
193
+ size: 11,
194
+ dx: -5,
195
+ anchor: "end"
196
+ }),
197
+ /* @__PURE__ */ jsx(Segment, {
198
+ from: foot,
199
+ to: {
200
+ x: 0,
201
+ y: H
202
+ },
203
+ color: "var(--stage-muted)",
204
+ weight: 2,
205
+ dashed: true,
206
+ opacity: .35
207
+ }),
208
+ /* @__PURE__ */ jsx(Crown, {
209
+ at: {
210
+ x: 0,
211
+ y: H - .6
212
+ },
213
+ r: 2,
214
+ opacity: .16
215
+ }),
216
+ hasGoal && /* @__PURE__ */ jsxs(Fragment$1, { children: [
217
+ /* @__PURE__ */ jsx(Polygon, {
218
+ points: [
219
+ {
220
+ x: target - 1,
221
+ y: 0
222
+ },
223
+ {
224
+ x: target + 1,
225
+ y: 0
226
+ },
227
+ {
228
+ x: target + 1,
229
+ y: 1.8
230
+ },
231
+ {
232
+ x: target - 1,
233
+ y: 1.8
234
+ }
235
+ ],
236
+ color: houseC,
237
+ fill: houseC,
238
+ fillOpacity: .16,
239
+ weight: 1.5
240
+ }),
241
+ /* @__PURE__ */ jsx(Polygon, {
242
+ points: [
243
+ {
244
+ x: target - 1.35,
245
+ y: 1.8
246
+ },
247
+ {
248
+ x: target,
249
+ y: 3
250
+ },
251
+ {
252
+ x: target + 1.35,
253
+ y: 1.8
254
+ }
255
+ ],
256
+ color: houseC,
257
+ fill: houseC,
258
+ fillOpacity: .28,
259
+ weight: 1.5
260
+ }),
261
+ /* @__PURE__ */ jsx(Polygon, {
262
+ points: [
263
+ {
264
+ x: target - .3,
265
+ y: 0
266
+ },
267
+ {
268
+ x: target + .3,
269
+ y: 0
270
+ },
271
+ {
272
+ x: target + .3,
273
+ y: 1.1
274
+ },
275
+ {
276
+ x: target - .3,
277
+ y: 1.1
278
+ }
279
+ ],
280
+ color: houseC,
281
+ fill: houseC,
282
+ fillOpacity: .42,
283
+ weight: 1
284
+ }),
285
+ /* @__PURE__ */ jsx(Label, {
286
+ x: target,
287
+ y: 0,
288
+ text: `house · ${fmt$1(target)} m`,
289
+ color: "var(--stage-muted)",
290
+ size: 11,
291
+ dy: 16
292
+ })
293
+ ] }),
294
+ /* @__PURE__ */ jsx(Polygon, {
295
+ points: [
296
+ foot,
297
+ brk,
298
+ tip
299
+ ],
300
+ color: "var(--stage-accent)",
301
+ fill: "var(--stage-accent)",
302
+ fillOpacity: .12,
303
+ weight: 0
304
+ }),
305
+ /* @__PURE__ */ jsx(Segment, {
306
+ from: foot,
307
+ to: brk,
308
+ color: C_TRUNK,
309
+ weight: 6
310
+ }),
311
+ /* @__PURE__ */ jsx(Segment, {
312
+ from: brk,
313
+ to: tip,
314
+ color: C_TRUNK,
315
+ weight: 5
316
+ }),
317
+ /* @__PURE__ */ jsx(Crown, {
318
+ at: crownAt,
319
+ r: 1.25
320
+ }),
321
+ /* @__PURE__ */ jsx(RightAngleMark, {
322
+ at: foot,
323
+ u: {
324
+ x: 0,
325
+ y: 1
326
+ },
327
+ v: {
328
+ x: 1,
329
+ y: 0
330
+ }
331
+ }),
332
+ /* @__PURE__ */ jsx(AngleArc, {
333
+ at: tip,
334
+ from: {
335
+ x: -1,
336
+ y: 0
337
+ },
338
+ to: {
339
+ x: brk.x - tip.x,
340
+ y: brk.y - tip.y
341
+ },
342
+ rPx: 30,
343
+ label: `θ = ${Math.round(deg)}°`
344
+ }),
345
+ /* @__PURE__ */ jsx(Label, {
346
+ x: 0,
347
+ y: h / 2,
348
+ text: `h = ${fmt$1(h)}`,
349
+ color: C_TRUNK,
350
+ size: 12,
351
+ weight: 700,
352
+ dx: -10,
353
+ anchor: "end"
354
+ }),
355
+ /* @__PURE__ */ jsx(Label, {
356
+ x: Lmid.x,
357
+ y: Lmid.y,
358
+ text: `L = ${fmt$1(L)}`,
359
+ color: C_TRUNK,
360
+ size: 12,
361
+ weight: 700,
362
+ anchor: "middle"
363
+ }),
364
+ /* @__PURE__ */ jsx(Label, {
365
+ x: d / 2,
366
+ y: 0,
367
+ text: `d = ${fmt$1(d)}`,
368
+ color: "var(--stage-fg)",
369
+ size: 12,
370
+ weight: 700,
371
+ dy: 16
372
+ }),
373
+ /* @__PURE__ */ jsx(MovableDot, {
374
+ value: brk,
375
+ onMove: (p) => setBreakH(clamp(p.y, .5, H / 2 - .05)),
376
+ color: "var(--stage-accent)",
377
+ ariaLabel: "break point, drag up or down the trunk"
378
+ })
379
+ ]
380
+ });
381
+ return /* @__PURE__ */ jsx(LabFrame, {
382
+ title,
383
+ prompt,
384
+ aside: /* @__PURE__ */ jsxs("div", {
385
+ style: {
386
+ display: "flex",
387
+ flexDirection: "column",
388
+ gap: 10
389
+ },
390
+ children: [hasGoal && /* @__PURE__ */ jsx("div", {
391
+ className: "lab-pill",
392
+ "data-state": reached ? "ok" : "no",
393
+ role: "status",
394
+ style: { alignSelf: "flex-start" },
395
+ children: reached ? "✓ The top reaches the house!" : `the top lands ${fmt$1(d)} m out, ${d > target ? "break it higher" : "break it lower"}`
396
+ }), /* @__PURE__ */ jsx(Callout, {
397
+ tone: "result",
398
+ children: /* @__PURE__ */ jsxs("div", {
399
+ style: {
400
+ display: "grid",
401
+ gap: 6,
402
+ fontVariantNumeric: "tabular-nums",
403
+ fontSize: 13
404
+ },
405
+ children: [
406
+ /* @__PURE__ */ jsxs("span", { children: ["original height H = ", /* @__PURE__ */ jsx("strong", { children: fmt$1(H) })] }),
407
+ /* @__PURE__ */ jsxs("span", { children: [
408
+ "broke at h = ",
409
+ /* @__PURE__ */ jsx("strong", {
410
+ style: { color: C_TRUNK },
411
+ children: fmt$1(h)
412
+ }),
413
+ " · fell top L = ",
414
+ /* @__PURE__ */ jsx("strong", { children: fmt$1(L) })
415
+ ] }),
416
+ /* @__PURE__ */ jsxs("span", { children: [
417
+ "reaches d = ",
418
+ /* @__PURE__ */ jsx("strong", { children: fmt$1(d) }),
419
+ " at θ = ",
420
+ /* @__PURE__ */ jsxs("strong", { children: [Math.round(deg), "°"] })
421
+ ] }),
422
+ /* @__PURE__ */ jsx("span", {
423
+ style: { color: "var(--stage-muted)" },
424
+ children: "tan θ = h/d · L = H − h · d = √(L² − h²)"
425
+ })
426
+ ]
427
+ })
428
+ })]
429
+ }),
430
+ children: figure
431
+ });
432
+ }
433
+
434
+ //#endregion
435
+ export { BrokenTreeLab };
@@ -0,0 +1 @@
1
+ import { CircleLab, CircleProps } from "./preset.mjs";
@@ -0,0 +1,44 @@
1
+ import { LabAskSpec } from "../../kit/ask.mjs";
2
+ import { ReactNode } from "react";
3
+ import { Vec2 } from "@classytic/stage";
4
+
5
+ //#region src/math/circle/preset.d.ts
6
+ interface CircleProps {
7
+ center?: Vec2;
8
+ radius?: number;
9
+ /** Show a point on the rim with its tangent (⊥ to the radius). */
10
+ showTangent?: boolean;
11
+ /** Initial tangent-point position, degrees round the circle. */
12
+ tangentAngleDeg?: number;
13
+ /** Also show the expanded x² + y² + Dx + Ey + F = 0 form. */
14
+ showExpanded?: boolean;
15
+ view?: {
16
+ xMin: number;
17
+ xMax: number;
18
+ yMin: number;
19
+ yMax: number;
20
+ };
21
+ height?: number;
22
+ /** Drag snap step (0 = free). Default 1. */
23
+ snap?: number;
24
+ title?: string;
25
+ prompt?: string;
26
+ ask?: LabAskSpec;
27
+ activity?: string;
28
+ }
29
+ declare function CircleLab({
30
+ center: center0,
31
+ radius,
32
+ showTangent,
33
+ tangentAngleDeg,
34
+ showExpanded,
35
+ view,
36
+ height,
37
+ snap,
38
+ title,
39
+ prompt,
40
+ ask,
41
+ activity
42
+ }?: CircleProps): ReactNode;
43
+ //#endregion
44
+ export { CircleLab, CircleProps };
@@ -0,0 +1,198 @@
1
+ 'use client';
2
+
3
+ import { Callout, LabFrame } from "../../kit/frame.mjs";
4
+ import { RightAngleMark } from "../../kit/diagram.mjs";
5
+ import { LabAsk } from "../../kit/ask.mjs";
6
+ import { CoordPlane, circleExpandedTex, circleTex, distance, lineFrom, lineTex, num, snapPoint } from "../../kit/coords.mjs";
7
+ import { useState } from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Circle, Dot, Line, MovableDot, Segment } from "@classytic/stage";
10
+
11
+ //#region src/math/circle/preset.tsx
12
+ /**
13
+ * CircleLab, the coordinate-geometry circle, as a thing you drag. Move the
14
+ * CENTRE (a, b) and pull the RIM to set the radius r; the equation
15
+ * (x − a)² + (y − b)² = r² updates live, and (optionally) its expanded form
16
+ * x² + y² + Dx + Ey + F = 0, the shape Edexcel hands you to complete-the-square.
17
+ *
18
+ * Turn on `showTangent` and a point rides the rim: the tangent there is drawn
19
+ * perpendicular to the radius (right-angle marked), which is the other classic
20
+ * circle question. Authorable via props + an optional checked answer (AskBox):
21
+ * "find the centre", "find the radius", "give the equation of the tangent".
22
+ */
23
+ const C_CIRCLE = "var(--stage-accent)";
24
+ const C_CENTER = "var(--stage-good)";
25
+ const C_TAN = "var(--stage-accent-2)";
26
+ const DEFAULT_VIEW = {
27
+ xMin: -7,
28
+ xMax: 7,
29
+ yMin: -7,
30
+ yMax: 7
31
+ };
32
+ function CircleLab({ center: center0 = {
33
+ x: 0,
34
+ y: 0
35
+ }, radius = 4, showTangent = false, tangentAngleDeg = 45, showExpanded = false, view = DEFAULT_VIEW, height = 400, snap = 1, title = "The circle", prompt = "Drag the centre to move it; drag the rim to resize. (x − a)² + (y − b)² = r².", ask, activity = "circle" } = {}) {
36
+ const [center, setCenter] = useState(center0);
37
+ const [rim, setRim] = useState({
38
+ x: center0.x + radius,
39
+ y: center0.y
40
+ });
41
+ const [tAng, setTAng] = useState(tangentAngleDeg * Math.PI / 180);
42
+ const r = Math.max(.5, distance(center, rim));
43
+ const { x: a, y: b } = center;
44
+ const T = {
45
+ x: a + r * Math.cos(tAng),
46
+ y: b + r * Math.sin(tAng)
47
+ };
48
+ const tdx = -(T.y - b), tdy = T.x - a;
49
+ const tangent = Math.abs(tdx) < 1e-9 ? {
50
+ m: Infinity,
51
+ c: NaN,
52
+ vertical: T.x
53
+ } : lineFrom(tdy / tdx, T);
54
+ const readouts = [
55
+ {
56
+ label: "centre (a, b)",
57
+ value: `(${num(a)}, ${num(b)})`
58
+ },
59
+ {
60
+ label: "radius r",
61
+ value: num(r)
62
+ },
63
+ {
64
+ label: "equation",
65
+ value: circleTex(a, b, r)
66
+ }
67
+ ];
68
+ if (showExpanded) readouts.push({
69
+ label: "expanded",
70
+ value: circleExpandedTex(a, b, r)
71
+ });
72
+ if (showTangent) readouts.push({
73
+ label: "tangent",
74
+ value: lineTex(tangent)
75
+ });
76
+ const figure = /* @__PURE__ */ jsxs(CoordPlane, {
77
+ view,
78
+ height,
79
+ ariaLabel: `Circle ${circleTex(a, b, r)}`,
80
+ children: [
81
+ /* @__PURE__ */ jsx(Circle, {
82
+ center,
83
+ r,
84
+ color: C_CIRCLE,
85
+ fill: C_CIRCLE,
86
+ fillOpacity: .07,
87
+ weight: 2.5
88
+ }),
89
+ /* @__PURE__ */ jsx(Segment, {
90
+ from: center,
91
+ to: rim,
92
+ color: "var(--stage-muted)",
93
+ weight: 1.5,
94
+ dashed: true
95
+ }),
96
+ showTangent && /* @__PURE__ */ jsxs(Fragment$1, { children: [
97
+ /* @__PURE__ */ jsx(Segment, {
98
+ from: center,
99
+ to: T,
100
+ color: C_TAN,
101
+ weight: 1.5,
102
+ dashed: true
103
+ }),
104
+ tangent.vertical !== void 0 ? /* @__PURE__ */ jsx(Line, {
105
+ from: {
106
+ x: tangent.vertical,
107
+ y: 0
108
+ },
109
+ to: {
110
+ x: tangent.vertical,
111
+ y: 1
112
+ },
113
+ color: C_TAN,
114
+ weight: 2.5
115
+ }) : /* @__PURE__ */ jsx(Line, {
116
+ from: {
117
+ x: 0,
118
+ y: tangent.c
119
+ },
120
+ to: {
121
+ x: 1,
122
+ y: tangent.c + tangent.m
123
+ },
124
+ color: C_TAN,
125
+ weight: 2.5
126
+ }),
127
+ /* @__PURE__ */ jsx(RightAngleMark, {
128
+ at: T,
129
+ u: {
130
+ x: T.x - a,
131
+ y: T.y - b
132
+ },
133
+ v: tangent.vertical !== void 0 ? {
134
+ x: 0,
135
+ y: 1
136
+ } : {
137
+ x: 1,
138
+ y: tangent.m
139
+ }
140
+ }),
141
+ /* @__PURE__ */ jsx(MovableDot, {
142
+ value: T,
143
+ onMove: (p) => setTAng(Math.atan2(p.y - b, p.x - a)),
144
+ color: C_TAN,
145
+ ariaLabel: "tangent point, drag it round the rim"
146
+ })
147
+ ] }),
148
+ /* @__PURE__ */ jsx(MovableDot, {
149
+ value: center,
150
+ onMove: (p) => setCenter(snapPoint(p, snap)),
151
+ snap,
152
+ color: C_CENTER,
153
+ ariaLabel: "centre, drag to move the circle"
154
+ }),
155
+ /* @__PURE__ */ jsx(MovableDot, {
156
+ value: rim,
157
+ onMove: (p) => setRim(snapPoint(p, snap)),
158
+ snap,
159
+ color: C_CIRCLE,
160
+ ariaLabel: "rim, drag to change the radius"
161
+ }),
162
+ /* @__PURE__ */ jsx(Dot, {
163
+ x: a,
164
+ y: b,
165
+ r: 2.5,
166
+ color: C_CENTER
167
+ })
168
+ ]
169
+ });
170
+ return /* @__PURE__ */ jsx(LabFrame, {
171
+ title,
172
+ prompt,
173
+ aside: /* @__PURE__ */ jsx(Callout, {
174
+ tone: "result",
175
+ children: /* @__PURE__ */ jsx("div", {
176
+ style: {
177
+ display: "grid",
178
+ gap: 6,
179
+ fontVariantNumeric: "tabular-nums",
180
+ fontSize: 13
181
+ },
182
+ children: readouts.map((rr, i) => /* @__PURE__ */ jsxs("span", { children: [
183
+ rr.label,
184
+ ": ",
185
+ /* @__PURE__ */ jsx("strong", { children: rr.value })
186
+ ] }, i))
187
+ })
188
+ }),
189
+ footer: ask ? /* @__PURE__ */ jsx(LabAsk, {
190
+ ask,
191
+ activity
192
+ }) : void 0,
193
+ children: figure
194
+ });
195
+ }
196
+
197
+ //#endregion
198
+ export { CircleLab };