@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,273 @@
1
+ 'use client';
2
+
3
+ import { toDeg } from "../../core/util.mjs";
4
+ import { RichText } from "../../kit/rich.mjs";
5
+ import { Callout, LabFrame, LiveRegion } from "../../kit/frame.mjs";
6
+ import { Feedback, HintLadder, useCheckpoint, useHints } from "../../kit/pedagogy.mjs";
7
+ import { AngleArc, LabeledVector, RightAngleMark } from "../../kit/diagram.mjs";
8
+ import { Fragment, useEffect, useMemo, useState } from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Axes, Label, MovableDot, Segment, Stage, Vector, vec } from "@classytic/stage";
11
+
12
+ //#region src/physics/vector-board/preset.tsx
13
+ /**
14
+ * VectorBoard — the GENERAL, authorable vector lab (CAIE/IGCSE).
15
+ *
16
+ * A creator declares vectors (tail, components, colour, label, draggable) + how
17
+ * to combine them (`sum` → resultant, tip-to-tail / parallelogram; `diff` →
18
+ * relative velocity, the rain / "V_RC = V_C − V_A" case) + an optional
19
+ * drag-to-match goal. From this one board: resultant addition, component
20
+ * resolution, river-crossing, walking-home, relative-velocity — all as DATA.
21
+ *
22
+ * Built entirely on @classytic/stage primitives (Vector, MovableDot, Axes, vec
23
+ * math, useLearner) + the shared LabeledVector / AngleArc helpers — nothing
24
+ * reinvented. Drag a head, watch the resultant + angle update; land it on the
25
+ * target to solve.
26
+ */
27
+ const ORIGIN = {
28
+ x: 0,
29
+ y: 0
30
+ };
31
+ const PALETTE = [
32
+ "var(--stage-accent)",
33
+ "var(--stage-accent-2)",
34
+ "var(--stage-good)"
35
+ ];
36
+ /**
37
+ * Frame the board to everything that matters — origin, every arrow tip, the
38
+ * resultant, and the goal — with padding, snapped to integers for clean axes.
39
+ * Computed from the AUTHORED vectors (not live drag state) so the view stays put
40
+ * while the learner drags, and the resultant can never shoot off-frame.
41
+ */
42
+ function autoView(vectors, combine, goal) {
43
+ const comps = vectors.map((v) => v.comp);
44
+ const pts = [ORIGIN];
45
+ vectors.forEach((v, i) => pts.push(vec.add(v.tail ?? ORIGIN, comps[i] ?? ORIGIN)));
46
+ if (combine === "diff") pts.push(vec.sub(comps[0] ?? ORIGIN, comps[1] ?? ORIGIN));
47
+ else if (combine !== "none") pts.push(comps.reduce((a, c) => vec.add(a, c), ORIGIN));
48
+ if (goal) pts.push(goal.match);
49
+ const xs = pts.map((p) => p.x);
50
+ const ys = pts.map((p) => p.y);
51
+ const pad = 1.6;
52
+ return {
53
+ xMin: Math.floor(Math.min(0, ...xs) - pad),
54
+ xMax: Math.ceil(Math.max(0, ...xs) + pad),
55
+ yMin: Math.floor(Math.min(0, ...ys) - pad),
56
+ yMax: Math.ceil(Math.max(0, ...ys) + pad)
57
+ };
58
+ }
59
+ function VectorBoardLab({ view: viewProp, vectors, combine = "sum", resultantLabel = "R", resultantColor = "var(--stage-warn)", show = {
60
+ angle: true,
61
+ magnitude: true
62
+ }, goal, snap = 1, objectives, hints: hintList, title = "Vectors", prompt = "Drag the arrow heads.", height = 320 }) {
63
+ const [comps, setComps] = useState(() => vectors.map((v) => v.comp));
64
+ useEffect(() => {
65
+ setComps(vectors.map((v) => v.comp));
66
+ }, [vectors]);
67
+ const view = useMemo(() => viewProp ?? autoView(vectors, combine, goal), [
68
+ viewProp,
69
+ vectors,
70
+ combine,
71
+ goal
72
+ ]);
73
+ const tailOf = (i) => vectors[i]?.tail ?? ORIGIN;
74
+ const tipOf = (i) => vec.add(tailOf(i), comps[i] ?? ORIGIN);
75
+ const snapV = (v) => snap ? Math.round(v / snap) * snap : v;
76
+ const resultant = useMemo(() => {
77
+ if (combine === "none" || comps.length === 0) return null;
78
+ if (combine === "diff") return vec.sub(comps[0] ?? ORIGIN, comps[1] ?? ORIGIN);
79
+ return comps.reduce((acc, c) => vec.add(acc, c), ORIGIN);
80
+ }, [comps, combine]);
81
+ const tol = goal?.tol ?? .45;
82
+ const solved = !!(goal && resultant && vec.dist(resultant, goal.match) <= tol);
83
+ const hints = useHints(hintList);
84
+ useCheckpoint({
85
+ solved,
86
+ activity: "vector-board",
87
+ hintsUsed: hints.count
88
+ });
89
+ const resMag = resultant ? vec.mag(resultant) : 0;
90
+ const resDeg = resultant ? Math.round(toDeg(vec.angle(resultant))) : 0;
91
+ const resColor = solved ? "var(--stage-good)" : resultantColor;
92
+ const showResultant = !!resultant && !(combine === "sum" && vectors.length === 1);
93
+ const misconception = goal && !solved && resultant && Math.abs(vec.mag(resultant) - vec.mag(goal.match)) < tol ? "Right length — now fix the direction (rotate it onto the target)." : void 0;
94
+ const figure = /* @__PURE__ */ jsxs(Stage, {
95
+ view,
96
+ height,
97
+ preserveAspect: true,
98
+ ariaLabel: `${title}; resultant magnitude ${resMag.toFixed(1)} at ${resDeg} degrees`,
99
+ children: [
100
+ /* @__PURE__ */ jsx(Axes, { labels: true }),
101
+ goal && /* @__PURE__ */ jsx(Vector, {
102
+ tail: ORIGIN,
103
+ tip: goal.match,
104
+ color: "var(--stage-good)",
105
+ weight: 2,
106
+ opacity: .28
107
+ }),
108
+ show.parallelogram && combine === "sum" && resultant && comps.length === 2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Segment, {
109
+ from: comps[0] ?? ORIGIN,
110
+ to: resultant,
111
+ color: "var(--stage-muted)",
112
+ dashed: true,
113
+ weight: 1.2,
114
+ opacity: .6
115
+ }), /* @__PURE__ */ jsx(Segment, {
116
+ from: comps[1] ?? ORIGIN,
117
+ to: resultant,
118
+ color: "var(--stage-muted)",
119
+ dashed: true,
120
+ weight: 1.2,
121
+ opacity: .6
122
+ })] }),
123
+ vectors.map((v, i) => {
124
+ const col = v.color ?? PALETTE[i % PALETTE.length];
125
+ const c = comps[i];
126
+ if (!c) return null;
127
+ const t = tailOf(i);
128
+ const magStr = vec.mag(c).toFixed(1);
129
+ const text = v.label ? show.magnitude ? `|${v.label}| = ${magStr}` : v.label : show.magnitude ? magStr : "";
130
+ const at = {
131
+ x: t.x + c.x * .62,
132
+ y: t.y + c.y * .62
133
+ };
134
+ const L = Math.hypot(c.x, c.y) || 1;
135
+ let pmx = -c.y / L, pmy = c.x / L;
136
+ const ref = resultant ?? {
137
+ x: c.x,
138
+ y: c.y
139
+ };
140
+ if (pmx * (ref.x - at.x) + pmy * (ref.y - at.y) > 0) {
141
+ pmx = -pmx;
142
+ pmy = -pmy;
143
+ }
144
+ const dx = pmx * 26;
145
+ const dy = -pmy * 26;
146
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(LabeledVector, {
147
+ tail: t,
148
+ comp: c,
149
+ color: col
150
+ }), text && /* @__PURE__ */ jsx(Label, {
151
+ x: at.x,
152
+ y: at.y,
153
+ text,
154
+ color: col,
155
+ dx,
156
+ dy,
157
+ size: 12
158
+ })] }, v.id ?? i);
159
+ }),
160
+ resultant && /* @__PURE__ */ jsxs(Fragment$1, { children: [
161
+ show.components && /* @__PURE__ */ jsxs(Fragment$1, { children: [
162
+ /* @__PURE__ */ jsx(Segment, {
163
+ from: ORIGIN,
164
+ to: {
165
+ x: resultant.x,
166
+ y: 0
167
+ },
168
+ color: "var(--stage-muted)",
169
+ dashed: true,
170
+ weight: 1.2,
171
+ opacity: .7
172
+ }),
173
+ /* @__PURE__ */ jsx(Segment, {
174
+ from: {
175
+ x: resultant.x,
176
+ y: 0
177
+ },
178
+ to: resultant,
179
+ color: "var(--stage-muted)",
180
+ dashed: true,
181
+ weight: 1.2,
182
+ opacity: .7
183
+ }),
184
+ /* @__PURE__ */ jsx(RightAngleMark, {
185
+ at: {
186
+ x: resultant.x,
187
+ y: 0
188
+ },
189
+ u: {
190
+ x: -Math.sign(resultant.x || 1),
191
+ y: 0
192
+ },
193
+ v: {
194
+ x: 0,
195
+ y: Math.sign(resultant.y || 1)
196
+ }
197
+ })
198
+ ] }),
199
+ showResultant && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(LabeledVector, {
200
+ tail: ORIGIN,
201
+ comp: resultant,
202
+ color: resColor,
203
+ weight: 3.5
204
+ }), /* @__PURE__ */ jsx(Label, {
205
+ x: resultant.x,
206
+ y: resultant.y,
207
+ text: resultantLabel,
208
+ color: resColor,
209
+ dx: 12,
210
+ dy: -10,
211
+ size: 13
212
+ })] }),
213
+ show.angle && /* @__PURE__ */ jsx(AngleArc, {
214
+ at: ORIGIN,
215
+ from: {
216
+ x: 1,
217
+ y: 0
218
+ },
219
+ to: resultant,
220
+ label: `${Math.abs(resDeg)}°`
221
+ })
222
+ ] }),
223
+ vectors.map((v, i) => v.drag ? /* @__PURE__ */ jsx(MovableDot, {
224
+ value: tipOf(i),
225
+ onMove: (p) => setComps((cs) => cs.map((c, j) => j === i ? {
226
+ x: snapV(p.x) - tailOf(i).x,
227
+ y: snapV(p.y) - tailOf(i).y
228
+ } : c)),
229
+ range: {
230
+ min: Math.min(view.xMin, view.yMin),
231
+ max: Math.max(view.xMax, view.yMax)
232
+ },
233
+ color: v.color ?? PALETTE[i % PALETTE.length],
234
+ ariaLabel: `${v.label ?? "vector"} head`
235
+ }, `d${v.id ?? i}`) : null)
236
+ ]
237
+ });
238
+ return /* @__PURE__ */ jsx(LabFrame, {
239
+ title,
240
+ prompt,
241
+ objectives,
242
+ footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [
243
+ /* @__PURE__ */ jsxs(Callout, {
244
+ tone: solved ? "result" : "info",
245
+ children: [/* @__PURE__ */ jsxs("span", {
246
+ style: {
247
+ fontWeight: 600,
248
+ fontVariantNumeric: "tabular-nums"
249
+ },
250
+ children: [
251
+ /* @__PURE__ */ jsx(RichText, { children: resultantLabel }),
252
+ " = ",
253
+ resMag.toFixed(1),
254
+ " @ ",
255
+ resDeg,
256
+ "°"
257
+ ]
258
+ }), goal && /* @__PURE__ */ jsx(Feedback, {
259
+ ok: solved,
260
+ misconception,
261
+ okText: "On target",
262
+ tryText: "Match the target"
263
+ })]
264
+ }),
265
+ goal && /* @__PURE__ */ jsx(HintLadder, { hints }),
266
+ /* @__PURE__ */ jsx(LiveRegion, { children: goal ? solved ? "On target" : misconception ?? `Resultant ${resMag.toFixed(1)} at ${resDeg} degrees` : "" })
267
+ ] }),
268
+ children: figure
269
+ });
270
+ }
271
+
272
+ //#endregion
273
+ export { VectorBoardLab };
@@ -0,0 +1,49 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/physics/vector-board/view.d.ts
4
+ interface FlatVec {
5
+ label?: string;
6
+ dx?: number | string;
7
+ dy?: number | string;
8
+ color?: string;
9
+ drag?: boolean;
10
+ }
11
+ interface VectorBoardViewProps {
12
+ vectors?: FlatVec[];
13
+ combine?: 'sum' | 'diff' | 'none';
14
+ goalX?: number | string;
15
+ goalY?: number | string;
16
+ tol?: number;
17
+ components?: boolean;
18
+ angle?: boolean;
19
+ parallelogram?: boolean;
20
+ title?: string;
21
+ prompt?: string;
22
+ view?: {
23
+ xMin: number;
24
+ xMax: number;
25
+ yMin: number;
26
+ yMax: number;
27
+ };
28
+ resultantLabel?: string;
29
+ objectives?: string[];
30
+ hints?: string[];
31
+ }
32
+ declare function VectorBoardView({
33
+ vectors,
34
+ combine,
35
+ goalX,
36
+ goalY,
37
+ tol,
38
+ components,
39
+ angle,
40
+ parallelogram,
41
+ title,
42
+ prompt,
43
+ view,
44
+ resultantLabel,
45
+ objectives,
46
+ hints
47
+ }: VectorBoardViewProps): ReactNode;
48
+ //#endregion
49
+ export { VectorBoardView };
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+
3
+ import { VectorBoardLab } from "./preset.mjs";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/physics/vector-board/view.tsx
7
+ /** Default vectors for a freshly-inserted block. */
8
+ const VECTOR_BOARD_DEMO = [{
9
+ label: "a",
10
+ dx: 3,
11
+ dy: 1,
12
+ color: "var(--stage-accent)",
13
+ drag: true
14
+ }, {
15
+ label: "b",
16
+ dx: 1,
17
+ dy: 2,
18
+ color: "var(--stage-accent-2)",
19
+ drag: true
20
+ }];
21
+ function VectorBoardView({ vectors, combine = "sum", goalX, goalY, tol, components, angle, parallelogram, title, prompt, view, resultantLabel, objectives, hints }) {
22
+ const vs = (vectors ?? []).map((v) => ({
23
+ comp: {
24
+ x: Number(v.dx) || 0,
25
+ y: Number(v.dy) || 0
26
+ },
27
+ label: v.label,
28
+ color: v.color || void 0,
29
+ drag: !!v.drag
30
+ }));
31
+ const goal = goalX !== void 0 && goalX !== "" && goalY !== void 0 && goalY !== "" ? {
32
+ match: {
33
+ x: Number(goalX) || 0,
34
+ y: Number(goalY) || 0
35
+ },
36
+ tol
37
+ } : void 0;
38
+ return /* @__PURE__ */ jsx(VectorBoardLab, {
39
+ view,
40
+ vectors: vs,
41
+ combine,
42
+ resultantLabel,
43
+ goal,
44
+ objectives,
45
+ hints,
46
+ show: {
47
+ components,
48
+ angle,
49
+ parallelogram,
50
+ magnitude: true
51
+ },
52
+ title: title ?? "Vectors",
53
+ prompt: prompt ?? (goal ? "Drag the heads so the resultant lands on the target." : "Drag the arrow heads.")
54
+ });
55
+ }
56
+
57
+ //#endregion
58
+ export { VECTOR_BOARD_DEMO, VectorBoardView };
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/physics/vector-scene.d.ts
4
+ interface SceneVector {
5
+ id: string;
6
+ /** Base components (ignored if `combine` is set). */
7
+ dx?: number;
8
+ dy?: number;
9
+ /** Anchor the tail at another vector's tip (tip-to-tail); default = origin. */
10
+ from?: string;
11
+ /** Derived: components = of[0] (op) of[1]. */
12
+ combine?: {
13
+ op: 'add' | 'sub';
14
+ of: [string, string];
15
+ };
16
+ /** Drag the tip to set dx,dy (base vectors only). */
17
+ draggable?: boolean;
18
+ /** Show dashed x/y component decomposition. */
19
+ components?: boolean;
20
+ color?: string;
21
+ label?: string;
22
+ }
23
+ interface VectorSceneProps {
24
+ vectors?: SceneVector[];
25
+ view?: {
26
+ xMin: number;
27
+ xMax: number;
28
+ yMin: number;
29
+ yMax: number;
30
+ };
31
+ title?: string;
32
+ height?: number;
33
+ }
34
+ declare function VectorScene({
35
+ vectors,
36
+ view,
37
+ title,
38
+ height
39
+ }?: VectorSceneProps): ReactNode;
40
+ //#endregion
41
+ export { SceneVector, VectorScene, VectorSceneProps };
@@ -0,0 +1,211 @@
1
+ 'use client';
2
+
3
+ import { clamp, toDeg } from "../core/util.mjs";
4
+ import { LabFrame } from "../kit/frame.mjs";
5
+ import { LabeledVector } from "../kit/diagram.mjs";
6
+ import { useEffect, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Axes, Dot, Grid, MovableDot, Stage } from "@classytic/stage";
9
+
10
+ //#region src/physics/vector-scene.tsx
11
+ /**
12
+ * VectorScene — a GENERAL vector-algebra board (not one problem), now on the
13
+ * @classytic/stage engine (SVG arrows, draggable tips, accessible).
14
+ *
15
+ * A creator declares named vectors; some are draggable (drag the tip to set
16
+ * direction & magnitude), some are *derived* (sum or difference of others), and
17
+ * any vector can be anchored tip-to-tail on another. The board shows the arrows,
18
+ * optional dashed component (sin/cos) decomposition, and per-vector magnitude +
19
+ * angle. One authored scene each = river crossing, rain-on-a-walker, relative
20
+ * velocity, force balance, projectile components, … thousands of problems from
21
+ * one tool.
22
+ *
23
+ * <VectorScene vectors={[
24
+ * { id:'boat', dx:0, dy:4, draggable:true, label:'boat' },
25
+ * { id:'cur', dx:2, dy:0, label:'current' },
26
+ * { id:'R', combine:{op:'add', of:['boat','cur']}, label:'resultant', components:true },
27
+ * ]} />
28
+ */
29
+ const DEFAULT = [
30
+ {
31
+ id: "a",
32
+ dx: 3,
33
+ dy: 1,
34
+ draggable: true,
35
+ label: "a",
36
+ color: "var(--stage-accent)"
37
+ },
38
+ {
39
+ id: "b",
40
+ dx: 1,
41
+ dy: 3,
42
+ draggable: true,
43
+ label: "b",
44
+ color: "var(--stage-accent-2)"
45
+ },
46
+ {
47
+ id: "R",
48
+ combine: {
49
+ op: "add",
50
+ of: ["a", "b"]
51
+ },
52
+ label: "a + b",
53
+ color: "var(--stage-good)",
54
+ components: true
55
+ }
56
+ ];
57
+ function resolveScene(vectors, overrides) {
58
+ const comp = /* @__PURE__ */ new Map();
59
+ const tail = /* @__PURE__ */ new Map();
60
+ const out = [];
61
+ for (const v of vectors) {
62
+ let c;
63
+ if (v.combine) {
64
+ const a = comp.get(v.combine.of[0]) ?? {
65
+ x: 0,
66
+ y: 0
67
+ };
68
+ const b = comp.get(v.combine.of[1]) ?? {
69
+ x: 0,
70
+ y: 0
71
+ };
72
+ c = v.combine.op === "sub" ? {
73
+ x: a.x - b.x,
74
+ y: a.y - b.y
75
+ } : {
76
+ x: a.x + b.x,
77
+ y: a.y + b.y
78
+ };
79
+ } else c = overrides[v.id] ?? {
80
+ x: v.dx ?? 0,
81
+ y: v.dy ?? 0
82
+ };
83
+ comp.set(v.id, c);
84
+ const anchor = v.from && tail.has(v.from) ? {
85
+ x: tail.get(v.from).x + comp.get(v.from).x,
86
+ y: tail.get(v.from).y + comp.get(v.from).y
87
+ } : {
88
+ x: 0,
89
+ y: 0
90
+ };
91
+ tail.set(v.id, anchor);
92
+ out.push({
93
+ id: v.id,
94
+ tail: anchor,
95
+ comp: c,
96
+ color: v.color ?? "var(--stage-accent)",
97
+ label: v.label,
98
+ components: v.components,
99
+ draggable: v.draggable && !v.combine
100
+ });
101
+ }
102
+ return out;
103
+ }
104
+ function autoView(vectors) {
105
+ const r = resolveScene(vectors, {});
106
+ const xs = [0], ys = [0];
107
+ for (const v of r) {
108
+ xs.push(v.tail.x, v.tail.x + v.comp.x);
109
+ ys.push(v.tail.y, v.tail.y + v.comp.y);
110
+ }
111
+ const pad = 1.5;
112
+ const span = Math.max(2, Math.max(...xs) - Math.min(...xs), Math.max(...ys) - Math.min(...ys));
113
+ const cx = (Math.max(...xs) + Math.min(...xs)) / 2, cy = (Math.max(...ys) + Math.min(...ys)) / 2;
114
+ const half = span / 2 + pad;
115
+ return {
116
+ xMin: cx - half,
117
+ xMax: cx + half,
118
+ yMin: cy - half,
119
+ yMax: cy + half
120
+ };
121
+ }
122
+ function VectorScene({ vectors, view, title = "Vectors", height = 340 } = {}) {
123
+ const vecs = vectors && vectors.length ? vectors : DEFAULT;
124
+ const [overrides, setOverrides] = useState({});
125
+ useEffect(() => {
126
+ setOverrides({});
127
+ }, [vecs.map((v) => `${v.id}:${v.dx},${v.dy}`).join("|")]);
128
+ const v = view ?? autoView(vecs);
129
+ const resolved = resolveScene(vecs, overrides);
130
+ const drawable = resolved.filter((r) => Math.hypot(r.comp.x, r.comp.y) > 1e-6);
131
+ const draggables = resolved.filter((r) => r.draggable);
132
+ const labelled = drawable.filter((r) => r.label);
133
+ const figure = /* @__PURE__ */ jsx("div", {
134
+ style: {
135
+ borderRadius: 14,
136
+ overflow: "hidden",
137
+ background: "var(--stage-bg)",
138
+ border: "1px solid var(--stage-grid)"
139
+ },
140
+ children: /* @__PURE__ */ jsxs(Stage, {
141
+ view: v,
142
+ height,
143
+ ariaLabel: `Vector diagram: ${drawable.map((r) => r.label ?? r.id).join(", ")}`,
144
+ children: [
145
+ /* @__PURE__ */ jsx(Grid, {}),
146
+ /* @__PURE__ */ jsx(Axes, {}),
147
+ /* @__PURE__ */ jsx(Dot, {
148
+ x: 0,
149
+ y: 0,
150
+ r: 3,
151
+ color: "var(--stage-fg)",
152
+ opacity: .6
153
+ }),
154
+ drawable.map((r) => /* @__PURE__ */ jsx(LabeledVector, {
155
+ tail: r.tail,
156
+ comp: r.comp,
157
+ color: r.color,
158
+ label: r.label,
159
+ components: r.components
160
+ }, r.id)),
161
+ draggables.map((r) => /* @__PURE__ */ jsx(MovableDot, {
162
+ value: {
163
+ x: r.tail.x + r.comp.x,
164
+ y: r.tail.y + r.comp.y
165
+ },
166
+ onMove: (p) => setOverrides((o) => ({
167
+ ...o,
168
+ [r.id]: {
169
+ x: clamp(p.x - r.tail.x, -50, 50),
170
+ y: clamp(p.y - r.tail.y, -50, 50)
171
+ }
172
+ })),
173
+ color: r.color,
174
+ ariaLabel: `tip of vector ${r.label ?? r.id}`
175
+ }, `h-${r.id}`))
176
+ ]
177
+ })
178
+ });
179
+ const aside = labelled.length > 0 ? /* @__PURE__ */ jsx("div", {
180
+ style: {
181
+ display: "grid",
182
+ gap: 4,
183
+ fontVariantNumeric: "tabular-nums",
184
+ fontWeight: 600
185
+ },
186
+ children: labelled.map((r) => {
187
+ const mag = Math.hypot(r.comp.x, r.comp.y);
188
+ const ang = toDeg(Math.atan2(r.comp.y, r.comp.x));
189
+ return /* @__PURE__ */ jsxs("span", {
190
+ style: { color: r.color },
191
+ children: [
192
+ r.label,
193
+ ": ",
194
+ mag.toFixed(2),
195
+ " ∠ ",
196
+ ang.toFixed(0),
197
+ "°"
198
+ ]
199
+ }, r.id);
200
+ })
201
+ }) : void 0;
202
+ return /* @__PURE__ */ jsx(LabFrame, {
203
+ title,
204
+ prompt: draggables.length > 0 ? "Drag a vector’s tip to change it — sums and components update live." : void 0,
205
+ aside,
206
+ children: figure
207
+ });
208
+ }
209
+
210
+ //#endregion
211
+ export { VectorScene };
@@ -0,0 +1 @@
1
+ import { TypePanel, VectorTypesLab, VectorTypesProps } from "./preset.mjs";
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+ import { Vec2 } from "@classytic/stage";
3
+
4
+ //#region src/physics/vector-types/preset.d.ts
5
+ interface PanelVec {
6
+ tail?: Vec2;
7
+ comp: Vec2;
8
+ color?: string;
9
+ label?: string;
10
+ }
11
+ interface TypePanel {
12
+ name: string;
13
+ caption: string;
14
+ vectors?: PanelVec[];
15
+ /** Show a dot at the origin (null vector / position origin O). */
16
+ origin?: boolean;
17
+ }
18
+ interface VectorTypesProps {
19
+ types?: TypePanel[];
20
+ title?: string;
21
+ }
22
+ declare function VectorTypesLab({
23
+ types,
24
+ title
25
+ }: VectorTypesProps): ReactNode;
26
+ //#endregion
27
+ export { TypePanel, VectorTypesLab, VectorTypesProps };