@classytic/stage 0.3.0 → 0.4.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 (431) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  2. package/dist/atomic/aufbau.d.mts +144 -0
  3. package/dist/atomic/aufbau.mjs +384 -0
  4. package/dist/atomic/elements.d.mts +67 -0
  5. package/dist/atomic/elements.mjs +785 -0
  6. package/dist/atomic/emission.d.mts +112 -0
  7. package/dist/atomic/emission.mjs +179 -0
  8. package/dist/atomic/index.d.mts +8 -0
  9. package/dist/atomic/index.mjs +9 -0
  10. package/dist/atomic/periodic.d.mts +82 -0
  11. package/dist/atomic/periodic.mjs +231 -0
  12. package/dist/atomic/properties.d.mts +100 -0
  13. package/dist/atomic/properties.mjs +574 -0
  14. package/dist/atomic/shells.d.mts +137 -0
  15. package/dist/atomic/shells.mjs +170 -0
  16. package/dist/atomic/trends.d.mts +148 -0
  17. package/dist/atomic/trends.mjs +225 -0
  18. package/dist/chem/chromatography.d.mts +66 -0
  19. package/dist/chem/chromatography.mjs +63 -0
  20. package/dist/chem/complex.d.mts +114 -0
  21. package/dist/chem/complex.mjs +234 -0
  22. package/dist/chem/cycle.d.mts +75 -0
  23. package/dist/chem/cycle.mjs +145 -0
  24. package/dist/chem/equation.d.mts +86 -0
  25. package/dist/chem/equation.mjs +168 -0
  26. package/dist/chem/formula.d.mts +90 -0
  27. package/dist/chem/formula.mjs +201 -0
  28. package/dist/chem/functional-groups.d.mts +31 -0
  29. package/dist/chem/functional-groups.mjs +187 -0
  30. package/dist/chem/hazard.d.mts +94 -0
  31. package/dist/chem/hazard.mjs +329 -0
  32. package/dist/chem/index.d.mts +34 -33
  33. package/dist/chem/index.mjs +34 -28
  34. package/dist/chem/ionic.d.mts +98 -0
  35. package/dist/chem/ionic.mjs +156 -0
  36. package/dist/chem/layout.d.mts +46 -0
  37. package/dist/chem/layout.mjs +342 -0
  38. package/dist/chem/lewis.d.mts +79 -0
  39. package/dist/chem/lewis.mjs +163 -0
  40. package/dist/chem/molecular-orbital.d.mts +114 -0
  41. package/dist/chem/molecular-orbital.mjs +201 -0
  42. package/dist/chem/molecule.d.mts +154 -0
  43. package/dist/chem/molecule.mjs +282 -0
  44. package/dist/chem/nmr.d.mts +153 -0
  45. package/dist/chem/nmr.mjs +165 -0
  46. package/dist/chem/polymer.d.mts +65 -0
  47. package/dist/chem/polymer.mjs +179 -0
  48. package/dist/chem/redox.d.mts +138 -0
  49. package/dist/chem/redox.mjs +328 -0
  50. package/dist/chem/relations.d.mts +183 -0
  51. package/dist/chem/relations.mjs +299 -0
  52. package/dist/chem/skeleton.d.mts +51 -0
  53. package/dist/chem/skeleton.mjs +186 -0
  54. package/dist/chem/solution.d.mts +116 -0
  55. package/dist/chem/solution.mjs +186 -0
  56. package/dist/chem/species.d.mts +47 -0
  57. package/dist/chem/species.mjs +128 -0
  58. package/dist/chem/stereo.d.mts +108 -0
  59. package/dist/chem/stereo.mjs +286 -0
  60. package/dist/chem/stoichiometry.d.mts +95 -0
  61. package/dist/chem/stoichiometry.mjs +145 -0
  62. package/dist/chem/synthesis.d.mts +113 -0
  63. package/dist/chem/synthesis.mjs +281 -0
  64. package/dist/chem/vsepr.d.mts +80 -0
  65. package/dist/chem/vsepr.mjs +247 -0
  66. package/dist/circuit/ac.d.mts +163 -0
  67. package/dist/circuit/ac.mjs +452 -0
  68. package/dist/circuit/dc.d.mts +92 -0
  69. package/dist/circuit/dc.mjs +333 -0
  70. package/dist/circuit/index.d.mts +5 -92
  71. package/dist/circuit/index.mjs +5 -332
  72. package/dist/circuit/network.d.mts +99 -0
  73. package/dist/circuit/network.mjs +440 -0
  74. package/dist/circuit/topology.d.mts +102 -0
  75. package/dist/circuit/topology.mjs +143 -0
  76. package/dist/colour/absorption.d.mts +79 -0
  77. package/dist/colour/absorption.mjs +137 -0
  78. package/dist/colour/index.d.mts +6 -0
  79. package/dist/colour/index.mjs +7 -0
  80. package/dist/colour/name.d.mts +14 -0
  81. package/dist/colour/name.mjs +76 -0
  82. package/dist/colour/observer.d.mts +31 -0
  83. package/dist/colour/observer.mjs +46 -0
  84. package/dist/colour/spectrum.d.mts +61 -0
  85. package/dist/colour/spectrum.mjs +108 -0
  86. package/dist/colour/srgb.d.mts +49 -0
  87. package/dist/colour/srgb.mjs +108 -0
  88. package/dist/core/constants.d.mts +138 -0
  89. package/dist/core/constants.mjs +139 -0
  90. package/dist/core/index.d.mts +3 -1
  91. package/dist/core/index.mjs +3 -1
  92. package/dist/core/vec3.d.mts +94 -0
  93. package/dist/core/vec3.mjs +123 -0
  94. package/dist/core/worked.d.mts +35 -0
  95. package/dist/core/worked.mjs +44 -0
  96. package/dist/electro/cell.d.mts +102 -0
  97. package/dist/electro/cell.mjs +170 -0
  98. package/dist/electro/conductivity.d.mts +157 -0
  99. package/dist/electro/conductivity.mjs +156 -0
  100. package/dist/electro/couples.d.mts +114 -0
  101. package/dist/electro/couples.mjs +334 -0
  102. package/dist/electro/electrolysis.d.mts +96 -0
  103. package/dist/electro/electrolysis.mjs +274 -0
  104. package/dist/electro/faraday.d.mts +150 -0
  105. package/dist/electro/faraday.mjs +118 -0
  106. package/dist/electro/index.d.mts +6 -0
  107. package/dist/electro/index.mjs +7 -0
  108. package/dist/finance/accounting/adjustments.d.mts +17 -0
  109. package/dist/finance/accounting/adjustments.mjs +202 -0
  110. package/dist/finance/accounting/analysis.d.mts +8 -0
  111. package/dist/finance/accounting/analysis.mjs +205 -0
  112. package/dist/finance/accounting/clubs.d.mts +21 -0
  113. package/dist/finance/accounting/clubs.mjs +217 -0
  114. package/dist/finance/accounting/company-statements.d.mts +7 -0
  115. package/dist/finance/accounting/company-statements.mjs +150 -0
  116. package/dist/finance/accounting/harness.d.mts +7 -0
  117. package/dist/finance/accounting/harness.mjs +45 -0
  118. package/dist/finance/accounting/index.d.mts +18 -0
  119. package/dist/finance/accounting/index.mjs +18 -0
  120. package/dist/finance/accounting/journalize.d.mts +16 -0
  121. package/dist/finance/accounting/journalize.mjs +128 -0
  122. package/dist/finance/accounting/manufacturing.d.mts +8 -0
  123. package/dist/finance/accounting/manufacturing.mjs +236 -0
  124. package/dist/finance/accounting/partnership.d.mts +7 -0
  125. package/dist/finance/accounting/partnership.mjs +152 -0
  126. package/dist/finance/accounting/period-case.d.mts +6 -0
  127. package/dist/finance/accounting/period-case.mjs +71 -0
  128. package/dist/finance/accounting/post.d.mts +9 -0
  129. package/dist/finance/accounting/post.mjs +84 -0
  130. package/dist/finance/accounting/precision.d.mts +9 -0
  131. package/dist/finance/accounting/precision.mjs +15 -0
  132. package/dist/finance/accounting/rules.d.mts +21 -0
  133. package/dist/finance/accounting/rules.mjs +37 -0
  134. package/dist/finance/accounting/solve.d.mts +28 -0
  135. package/dist/finance/accounting/solve.mjs +92 -0
  136. package/dist/finance/accounting/statements.d.mts +7 -0
  137. package/dist/finance/accounting/statements.mjs +142 -0
  138. package/dist/finance/accounting/types.d.mts +649 -0
  139. package/dist/finance/accounting/validate.d.mts +7 -0
  140. package/dist/finance/accounting/validate.mjs +67 -0
  141. package/dist/finance/accounting/verification.d.mts +24 -0
  142. package/dist/finance/accounting/verification.mjs +386 -0
  143. package/dist/finance/bizsim.d.mts +21 -39
  144. package/dist/finance/bizsim.mjs +276 -97
  145. package/dist/finance/index.d.mts +20 -43
  146. package/dist/finance/index.mjs +19 -77
  147. package/dist/finance/investment-math.d.mts +7 -0
  148. package/dist/finance/investment-math.mjs +18 -0
  149. package/dist/finance/management-accounting/budgeting.d.mts +7 -0
  150. package/dist/finance/management-accounting/budgeting.mjs +189 -0
  151. package/dist/finance/management-accounting/cash-budget.d.mts +7 -0
  152. package/dist/finance/management-accounting/cash-budget.mjs +154 -0
  153. package/dist/finance/management-accounting/costing.d.mts +8 -0
  154. package/dist/finance/management-accounting/costing.mjs +175 -0
  155. package/dist/finance/management-accounting/decisions.d.mts +8 -0
  156. package/dist/finance/management-accounting/decisions.mjs +164 -0
  157. package/dist/finance/management-accounting/index.d.mts +13 -0
  158. package/dist/finance/management-accounting/index.mjs +13 -0
  159. package/dist/finance/management-accounting/integrated-budget.d.mts +8 -0
  160. package/dist/finance/management-accounting/integrated-budget.mjs +67 -0
  161. package/dist/finance/management-accounting/inventory-costing.d.mts +7 -0
  162. package/dist/finance/management-accounting/inventory-costing.mjs +173 -0
  163. package/dist/finance/management-accounting/investment-appraisal.d.mts +7 -0
  164. package/dist/finance/management-accounting/investment-appraisal.mjs +148 -0
  165. package/dist/finance/management-accounting/management-case.d.mts +8 -0
  166. package/dist/finance/management-accounting/management-case.mjs +91 -0
  167. package/dist/finance/management-accounting/master-budget.d.mts +7 -0
  168. package/dist/finance/management-accounting/master-budget.mjs +137 -0
  169. package/dist/finance/management-accounting/production-costing.d.mts +8 -0
  170. package/dist/finance/management-accounting/production-costing.mjs +214 -0
  171. package/dist/finance/management-accounting/types.d.mts +644 -0
  172. package/dist/finance/management-accounting/variances.d.mts +7 -0
  173. package/dist/finance/management-accounting/variances.mjs +150 -0
  174. package/dist/index.d.mts +6 -6
  175. package/dist/index.mjs +1 -1
  176. package/dist/math/analysis.d.mts +61 -0
  177. package/dist/math/analysis.mjs +187 -0
  178. package/dist/math/answer-check.d.mts +50 -0
  179. package/dist/math/answer-check.mjs +106 -0
  180. package/dist/math/calculus.d.mts +4 -9
  181. package/dist/math/calculus.mjs +216 -7
  182. package/dist/math/complex.d.mts +93 -0
  183. package/dist/math/complex.mjs +239 -0
  184. package/dist/math/expr.d.mts +23 -0
  185. package/dist/math/expr.mjs +36 -0
  186. package/dist/math/index.d.mts +8 -22
  187. package/dist/math/index.mjs +8 -37
  188. package/dist/math/latex.mjs +2 -1
  189. package/dist/math/parse.mjs +1 -1
  190. package/dist/math/poly.d.mts +55 -0
  191. package/dist/math/poly.mjs +273 -0
  192. package/dist/math/rearrange.d.mts +14 -0
  193. package/dist/math/rearrange.mjs +125 -0
  194. package/dist/math/solve.d.mts +21 -0
  195. package/dist/math/solve.mjs +75 -0
  196. package/dist/networking/addressing.d.mts +26 -0
  197. package/dist/networking/addressing.mjs +33 -0
  198. package/dist/networking/cloud/access.d.mts +36 -0
  199. package/dist/networking/cloud/access.mjs +95 -0
  200. package/dist/networking/cloud/containers.d.mts +43 -0
  201. package/dist/networking/cloud/containers.mjs +54 -0
  202. package/dist/networking/cloud/edge.d.mts +17 -0
  203. package/dist/networking/cloud/edge.mjs +31 -0
  204. package/dist/networking/cloud/failure-domains.d.mts +19 -0
  205. package/dist/networking/cloud/failure-domains.mjs +22 -0
  206. package/dist/networking/cloud/geo-routing.d.mts +22 -0
  207. package/dist/networking/cloud/geo-routing.mjs +64 -0
  208. package/dist/networking/cloud/index.d.mts +18 -0
  209. package/dist/networking/cloud/index.mjs +19 -0
  210. package/dist/networking/cloud/inference-reliability.d.mts +30 -0
  211. package/dist/networking/cloud/inference-reliability.mjs +76 -0
  212. package/dist/networking/cloud/inference.d.mts +118 -0
  213. package/dist/networking/cloud/inference.mjs +179 -0
  214. package/dist/networking/cloud/infrastructure.d.mts +45 -0
  215. package/dist/networking/cloud/infrastructure.mjs +96 -0
  216. package/dist/networking/cloud/observability.d.mts +24 -0
  217. package/dist/networking/cloud/observability.mjs +34 -0
  218. package/dist/networking/cloud/orchestration.d.mts +32 -0
  219. package/dist/networking/cloud/orchestration.mjs +38 -0
  220. package/dist/networking/cloud/recovery.d.mts +21 -0
  221. package/dist/networking/cloud/recovery.mjs +27 -0
  222. package/dist/networking/cloud/releases.d.mts +42 -0
  223. package/dist/networking/cloud/releases.mjs +135 -0
  224. package/dist/networking/cloud/scaling.d.mts +25 -0
  225. package/dist/networking/cloud/scaling.mjs +65 -0
  226. package/dist/networking/cloud/secrets.d.mts +39 -0
  227. package/dist/networking/cloud/secrets.mjs +68 -0
  228. package/dist/networking/cloud/server-deployment.d.mts +29 -0
  229. package/dist/networking/cloud/server-deployment.mjs +72 -0
  230. package/dist/networking/cloud/storage.d.mts +16 -0
  231. package/dist/networking/cloud/storage.mjs +58 -0
  232. package/dist/networking/cloud/vpc.d.mts +18 -0
  233. package/dist/networking/cloud/vpc.mjs +100 -0
  234. package/dist/networking/delivery.d.mts +34 -0
  235. package/dist/networking/delivery.mjs +52 -0
  236. package/dist/networking/index.d.mts +47 -0
  237. package/dist/networking/index.mjs +47 -0
  238. package/dist/networking/ipv6.d.mts +28 -0
  239. package/dist/networking/ipv6.mjs +17 -0
  240. package/dist/networking/journeys.d.mts +83 -0
  241. package/dist/networking/journeys.mjs +161 -0
  242. package/dist/networking/models/airtime.d.mts +87 -0
  243. package/dist/networking/models/airtime.mjs +130 -0
  244. package/dist/networking/models/cellular.d.mts +157 -0
  245. package/dist/networking/models/cellular.mjs +252 -0
  246. package/dist/networking/models/encapsulation.d.mts +98 -0
  247. package/dist/networking/models/encapsulation.mjs +132 -0
  248. package/dist/networking/models/handover.d.mts +116 -0
  249. package/dist/networking/models/handover.mjs +209 -0
  250. package/dist/networking/models/handshake.d.mts +90 -0
  251. package/dist/networking/models/handshake.mjs +122 -0
  252. package/dist/networking/models/index.d.mts +14 -0
  253. package/dist/networking/models/index.mjs +15 -0
  254. package/dist/networking/models/media.d.mts +82 -0
  255. package/dist/networking/models/media.mjs +188 -0
  256. package/dist/networking/models/satellite.d.mts +86 -0
  257. package/dist/networking/models/satellite.mjs +121 -0
  258. package/dist/networking/models/spectrum.d.mts +83 -0
  259. package/dist/networking/models/spectrum.mjs +235 -0
  260. package/dist/networking/models/switch.d.mts +80 -0
  261. package/dist/networking/models/switch.mjs +155 -0
  262. package/dist/networking/models/vlan.d.mts +62 -0
  263. package/dist/networking/models/vlan.mjs +100 -0
  264. package/dist/networking/models/vpn.d.mts +66 -0
  265. package/dist/networking/models/vpn.mjs +125 -0
  266. package/dist/networking/models/wifi-privacy.d.mts +82 -0
  267. package/dist/networking/models/wifi-privacy.mjs +130 -0
  268. package/dist/networking/models/wifi.d.mts +240 -0
  269. package/dist/networking/models/wifi.mjs +562 -0
  270. package/dist/networking/nat-traversal.d.mts +24 -0
  271. package/dist/networking/nat-traversal.mjs +38 -0
  272. package/dist/networking/protocols.d.mts +17 -0
  273. package/dist/networking/protocols.mjs +57 -0
  274. package/dist/networking/queue.d.mts +12 -0
  275. package/dist/networking/queue.mjs +18 -0
  276. package/dist/networking/route-learning.d.mts +23 -0
  277. package/dist/networking/route-learning.mjs +43 -0
  278. package/dist/networking/routing.d.mts +11 -0
  279. package/dist/networking/routing.mjs +25 -0
  280. package/dist/networking/signals.d.mts +26 -0
  281. package/dist/networking/signals.mjs +35 -0
  282. package/dist/networking/subnet.d.mts +49 -0
  283. package/dist/networking/subnet.mjs +89 -0
  284. package/dist/networking/tcp-reliability.d.mts +24 -0
  285. package/dist/networking/tcp-reliability.mjs +38 -0
  286. package/dist/networking/topology/contract.d.mts +123 -0
  287. package/dist/networking/topology/index.d.mts +4 -0
  288. package/dist/networking/topology/index.mjs +4 -0
  289. package/dist/networking/topology/presets.d.mts +7 -0
  290. package/dist/networking/topology/presets.mjs +302 -0
  291. package/dist/networking/topology/simulation.d.mts +8 -0
  292. package/dist/networking/topology/simulation.mjs +179 -0
  293. package/dist/networking/wireless.d.mts +11 -0
  294. package/dist/networking/wireless.mjs +17 -0
  295. package/dist/optics/imaging.d.mts +218 -0
  296. package/dist/optics/imaging.mjs +276 -0
  297. package/dist/optics/index.d.mts +7 -0
  298. package/dist/optics/index.mjs +8 -0
  299. package/dist/optics/laws.d.mts +70 -0
  300. package/dist/optics/laws.mjs +195 -0
  301. package/dist/optics/prism.d.mts +148 -0
  302. package/dist/optics/prism.mjs +197 -0
  303. package/dist/optics/refraction.d.mts +201 -0
  304. package/dist/optics/refraction.mjs +270 -0
  305. package/dist/optics/wave-optics.d.mts +171 -0
  306. package/dist/optics/wave-optics.mjs +259 -0
  307. package/dist/physics/ac/index.d.mts +183 -0
  308. package/dist/physics/ac/index.mjs +203 -0
  309. package/dist/physics/dynamics/forces.d.mts +98 -0
  310. package/dist/physics/dynamics/forces.mjs +153 -0
  311. package/dist/physics/dynamics/friction.d.mts +76 -0
  312. package/dist/physics/dynamics/friction.mjs +119 -0
  313. package/dist/physics/dynamics/system.d.mts +68 -0
  314. package/dist/physics/dynamics/system.mjs +125 -0
  315. package/dist/physics/electrostatics/index.d.mts +169 -0
  316. package/dist/physics/electrostatics/index.mjs +249 -0
  317. package/dist/physics/energy/centre-of-mass.d.mts +115 -0
  318. package/dist/physics/energy/centre-of-mass.mjs +180 -0
  319. package/dist/physics/energy/conservation.d.mts +81 -0
  320. package/dist/physics/energy/conservation.mjs +129 -0
  321. package/dist/physics/energy/power.d.mts +90 -0
  322. package/dist/physics/energy/power.mjs +167 -0
  323. package/dist/physics/energy/spring.d.mts +73 -0
  324. package/dist/physics/energy/spring.mjs +129 -0
  325. package/dist/physics/energy/store.d.mts +63 -0
  326. package/dist/physics/energy/store.mjs +108 -0
  327. package/dist/physics/energy/theorem.d.mts +65 -0
  328. package/dist/physics/energy/theorem.mjs +113 -0
  329. package/dist/physics/energy/work.d.mts +114 -0
  330. package/dist/physics/energy/work.mjs +219 -0
  331. package/dist/physics/gravitation/body.d.mts +85 -0
  332. package/dist/physics/gravitation/body.mjs +168 -0
  333. package/dist/physics/gravitation/kepler.d.mts +127 -0
  334. package/dist/physics/gravitation/kepler.mjs +216 -0
  335. package/dist/physics/gravitation/law.d.mts +117 -0
  336. package/dist/physics/gravitation/law.mjs +175 -0
  337. package/dist/physics/gravitation/orbit.d.mts +119 -0
  338. package/dist/physics/gravitation/orbit.mjs +202 -0
  339. package/dist/physics/gravitation/potential.d.mts +114 -0
  340. package/dist/physics/gravitation/potential.mjs +202 -0
  341. package/dist/physics/gravitation/variation.d.mts +97 -0
  342. package/dist/physics/gravitation/variation.mjs +175 -0
  343. package/dist/physics/index.d.mts +35 -0
  344. package/dist/physics/index.mjs +36 -0
  345. package/dist/physics/integral-sweep.d.mts +63 -0
  346. package/dist/physics/integral-sweep.mjs +126 -0
  347. package/dist/physics/kinematics/equations.d.mts +47 -0
  348. package/dist/physics/kinematics/equations.mjs +126 -0
  349. package/dist/physics/kinematics/free-fall.d.mts +53 -0
  350. package/dist/physics/kinematics/free-fall.mjs +71 -0
  351. package/dist/physics/kinematics/given.d.mts +16 -0
  352. package/dist/physics/kinematics/given.mjs +55 -0
  353. package/dist/physics/kinematics/roots.d.mts +41 -0
  354. package/dist/physics/kinematics/roots.mjs +72 -0
  355. package/dist/physics/kinematics/solve.d.mts +52 -0
  356. package/dist/physics/kinematics/solve.mjs +172 -0
  357. package/dist/physics/magnetism/biot-savart.d.mts +161 -0
  358. package/dist/physics/magnetism/biot-savart.mjs +353 -0
  359. package/dist/physics/magnetism/flux.d.mts +94 -0
  360. package/dist/physics/magnetism/flux.mjs +313 -0
  361. package/dist/physics/magnetism/geomagnetism.d.mts +151 -0
  362. package/dist/physics/magnetism/geomagnetism.mjs +184 -0
  363. package/dist/physics/magnetism/index.d.mts +12 -0
  364. package/dist/physics/magnetism/index.mjs +74 -0
  365. package/dist/physics/magnetism/lorentz.d.mts +28 -0
  366. package/dist/physics/magnetism/lorentz.mjs +88 -0
  367. package/dist/physics/magnetism/magnetic-force.d.mts +102 -0
  368. package/dist/physics/magnetism/magnetic-force.mjs +169 -0
  369. package/dist/physics/momentum/collide.d.mts +77 -0
  370. package/dist/physics/momentum/collide.mjs +115 -0
  371. package/dist/physics/momentum/impulse.d.mts +89 -0
  372. package/dist/physics/momentum/impulse.mjs +159 -0
  373. package/dist/physics/momentum/planar.d.mts +60 -0
  374. package/dist/physics/momentum/planar.mjs +110 -0
  375. package/dist/physics/projectile.d.mts +107 -0
  376. package/dist/physics/projectile.mjs +185 -0
  377. package/dist/physics/rotation/angular.d.mts +85 -0
  378. package/dist/physics/rotation/angular.mjs +130 -0
  379. package/dist/physics/rotation/circular.d.mts +79 -0
  380. package/dist/physics/rotation/circular.mjs +131 -0
  381. package/dist/physics/rotation/inertia.d.mts +164 -0
  382. package/dist/physics/rotation/inertia.mjs +332 -0
  383. package/dist/physics/rotation/torque.d.mts +65 -0
  384. package/dist/physics/rotation/torque.mjs +134 -0
  385. package/dist/physics/vectors.d.mts +64 -0
  386. package/dist/physics/vectors.mjs +114 -0
  387. package/dist/quantity/index.d.mts +119 -0
  388. package/dist/quantity/index.mjs +417 -0
  389. package/dist/relation/derive.d.mts +74 -0
  390. package/dist/relation/derive.mjs +73 -0
  391. package/dist/relation/index.d.mts +56 -0
  392. package/dist/relation/index.mjs +234 -0
  393. package/dist/scene/evaluators.mjs +1 -1
  394. package/dist/sim/thermal.mjs +45 -20
  395. package/dist/thermo/calorimetry.d.mts +207 -0
  396. package/dist/thermo/calorimetry.mjs +345 -0
  397. package/dist/thermo/cycles.d.mts +142 -0
  398. package/dist/thermo/cycles.mjs +256 -0
  399. package/dist/thermo/entropy.d.mts +87 -0
  400. package/dist/thermo/entropy.mjs +140 -0
  401. package/dist/thermo/expansion.d.mts +130 -0
  402. package/dist/thermo/expansion.mjs +178 -0
  403. package/dist/thermo/gas.d.mts +197 -0
  404. package/dist/thermo/gas.mjs +279 -0
  405. package/dist/thermo/heat-transfer.d.mts +164 -0
  406. package/dist/thermo/heat-transfer.mjs +217 -0
  407. package/dist/thermo/index.d.mts +9 -82
  408. package/dist/thermo/index.mjs +9 -132
  409. package/dist/thermo/processes.d.mts +95 -0
  410. package/dist/thermo/processes.mjs +154 -0
  411. package/dist/thermo/temperature.d.mts +174 -0
  412. package/dist/thermo/temperature.mjs +236 -0
  413. package/dist/waves/damping.d.mts +224 -0
  414. package/dist/waves/damping.mjs +317 -0
  415. package/dist/waves/doppler.d.mts +72 -0
  416. package/dist/waves/doppler.mjs +125 -0
  417. package/dist/waves/index.d.mts +10 -0
  418. package/dist/waves/index.mjs +10 -0
  419. package/dist/waves/pendulum.d.mts +130 -0
  420. package/dist/waves/pendulum.mjs +211 -0
  421. package/dist/waves/pitch.d.mts +125 -0
  422. package/dist/waves/pitch.mjs +158 -0
  423. package/dist/waves/shm.d.mts +170 -0
  424. package/dist/waves/shm.mjs +279 -0
  425. package/dist/waves/springs.d.mts +103 -0
  426. package/dist/waves/springs.mjs +176 -0
  427. package/dist/waves/superposition.d.mts +124 -0
  428. package/dist/waves/superposition.mjs +196 -0
  429. package/dist/waves/wave.d.mts +154 -0
  430. package/dist/waves/wave.mjs +178 -0
  431. package/package.json +74 -2
@@ -0,0 +1,108 @@
1
+ //#region src/colour/srgb.ts
2
+ /** The sRGB / Rec. 709 matrix, for a D65 white point. */
3
+ function xyzToLinear(xyz) {
4
+ const { X, Y, Z } = xyz;
5
+ return {
6
+ r: 3.2406 * X - 1.5372 * Y - .4986 * Z,
7
+ g: -.9689 * X + 1.8758 * Y + .0415 * Z,
8
+ b: .0557 * X - .204 * Y + 1.057 * Z
9
+ };
10
+ }
11
+ /**
12
+ * Divide out the lamp, so the reference white comes out exactly white.
13
+ *
14
+ * The sRGB matrix above is defined for a D65 white point and this engine integrates against an
15
+ * equal-energy white, which are not the same colour. Without this step a spectrum that absorbs
16
+ * NOTHING came back as `#ffe6e2`, a faint pink, and every hue after it was rotated by the
17
+ * difference: a yellow solution was named orange. That is a chromatic adaptation, the von Kries
18
+ * kind, and in RGB it is one division per channel.
19
+ *
20
+ * It is also the physically honest statement. The lamp is what we call white; a colour here is what
21
+ * the sample does TO that lamp.
22
+ */
23
+ const whiteBalance = (rgb, white) => ({
24
+ r: white.r === 0 ? 0 : rgb.r / white.r,
25
+ g: white.g === 0 ? 0 : rgb.g / white.g,
26
+ b: white.b === 0 ? 0 : rgb.b / white.b
27
+ });
28
+ /**
29
+ * Bring a colour into gamut: clamp the negative channels, then scale to fit.
30
+ *
31
+ * A pure wavelength is more saturated than three phosphors can make, so its linear RGB has a
32
+ * negative component and something has to give. The alternative tried here first was to desaturate,
33
+ * mixing toward grey of the same luminance until the negative channel reached zero, on the argument
34
+ * that desaturation preserves hue and clamping does not.
35
+ *
36
+ * Measured across the spectrum at 20 nm, that argument is simply wrong for this data, and in the
37
+ * red it is badly wrong. Desaturating 650 nm gives `#ff004e`, a pink, because the green channel is
38
+ * far more negative than the blue: mixing far enough to lift green to zero carries blue up past it.
39
+ * Clamping gives `#ff0000`. The same holds at 530 nm, where desaturating produces a mint green and
40
+ * clamping produces green. Published spectral colour tables agree with the clamped values.
41
+ *
42
+ * The lesson is that the hue-preservation argument applies to a colour with ONE offending channel,
43
+ * and a spectral colour usually has two of unequal size.
44
+ */
45
+ function fitGamut(rgb) {
46
+ const clamped = {
47
+ r: Math.max(0, rgb.r),
48
+ g: Math.max(0, rgb.g),
49
+ b: Math.max(0, rgb.b)
50
+ };
51
+ const high = Math.max(clamped.r, clamped.g, clamped.b);
52
+ if (high <= 1) return clamped;
53
+ return {
54
+ r: clamped.r / high,
55
+ g: clamped.g / high,
56
+ b: clamped.b / high
57
+ };
58
+ }
59
+ /** The sRGB transfer function: not a plain 1/2.2 power, and the linear toe near black matters. */
60
+ const encode = (v) => {
61
+ const c = Math.max(0, Math.min(1, v));
62
+ return c <= .0031308 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - .055;
63
+ };
64
+ /** Linear RGB to 8-bit sRGB, fitting the gamut first. */
65
+ function linearToSRGB(rgb) {
66
+ const fit = fitGamut(rgb);
67
+ return {
68
+ r: Math.round(encode(fit.r) * 255),
69
+ g: Math.round(encode(fit.g) * 255),
70
+ b: Math.round(encode(fit.b) * 255)
71
+ };
72
+ }
73
+ /** Tristimulus values straight to a displayable colour. */
74
+ const xyzToSRGB = (xyz) => linearToSRGB(xyzToLinear(xyz));
75
+ /** `#rrggbb`, for anything that draws. */
76
+ const hexOf = (c) => "#" + [
77
+ c.r,
78
+ c.g,
79
+ c.b
80
+ ].map((v) => Math.max(0, Math.min(255, v)).toString(16).padStart(2, "0")).join("");
81
+ /** Hue in degrees, saturation and lightness each 0 to 1. The form a colour NAME is decided from. */
82
+ function hslOf(c) {
83
+ const r = c.r / 255;
84
+ const g = c.g / 255;
85
+ const b = c.b / 255;
86
+ const max = Math.max(r, g, b);
87
+ const min = Math.min(r, g, b);
88
+ const l = (max + min) / 2;
89
+ const d = max - min;
90
+ if (d === 0) return {
91
+ h: 0,
92
+ s: 0,
93
+ l
94
+ };
95
+ const s = d / (1 - Math.abs(2 * l - 1));
96
+ let h;
97
+ if (max === r) h = (g - b) / d % 6;
98
+ else if (max === g) h = (b - r) / d + 2;
99
+ else h = (r - g) / d + 4;
100
+ return {
101
+ h: (h * 60 % 360 + 360) % 360,
102
+ s,
103
+ l
104
+ };
105
+ }
106
+
107
+ //#endregion
108
+ export { fitGamut, hexOf, hslOf, linearToSRGB, whiteBalance, xyzToLinear, xyzToSRGB };
@@ -0,0 +1,138 @@
1
+ //#region src/core/constants.d.ts
2
+ /**
3
+ * Universal physical constants, in SI, as the single place a number like the gas
4
+ * constant is written down.
5
+ *
6
+ * Written because `R` had three definitions in this package: `thermo/index.ts`
7
+ * and `chem/index.ts` both declared `8.314462618`, and `chem/relations.ts`
8
+ * carried `8.31446262` inside its `CONSTANTS` table. The last of those is the
9
+ * same constant rounded one digit shorter, which is the failure mode worth
10
+ * naming: a duplicated constant does not stay duplicated, it drifts, and then
11
+ * two parts of one calculation disagree in the eighth figure for no reason a
12
+ * reader can find.
13
+ *
14
+ * Values are CODATA 2018. The four that are EXACT by the 2019 SI redefinition
15
+ * are marked as such, because "exact" changes what a test may assert: a defined
16
+ * constant can be compared for equality, a measured one can only be compared to
17
+ * a tolerance.
18
+ *
19
+ * Domain kernels re-export what they need under their own name, so
20
+ * `@classytic/stage/thermo` still exports `R` and nothing downstream has to know
21
+ * this file exists. What they must not do is write the number again.
22
+ */
23
+ /** Avogadro constant, per mole. EXACT by definition. */
24
+ declare const AVOGADRO = 6.02214076e+23;
25
+ /** Boltzmann constant, J/K. EXACT by definition. */
26
+ declare const BOLTZMANN = 1.380649e-23;
27
+ /**
28
+ * Molar gas constant, J/(mol·K). EXACT, being the product of two exact
29
+ * constants: R = N_A · k_B.
30
+ *
31
+ * Written as that product rather than as a literal, so the identity cannot rot.
32
+ * A reader who doubts the digits can check the multiplication instead of a
33
+ * table.
34
+ */
35
+ declare const GAS_CONSTANT: number;
36
+ /** Elementary charge, C. EXACT by definition. */
37
+ declare const ELEMENTARY_CHARGE = 1.602176634e-19;
38
+ /** Speed of light in vacuum, m/s. EXACT: it is what DEFINES the metre. */
39
+ declare const SPEED_OF_LIGHT = 299792458;
40
+ /** Planck constant, J·s. EXACT: it is what defines the kilogram. */
41
+ declare const PLANCK = 6.62607015e-34;
42
+ /** Reduced Planck constant, J·s. */
43
+ declare const PLANCK_REDUCED: number;
44
+ /**
45
+ * `hc` in eV·nm, so a photon's energy in electronvolts is `HC_EV_NM / lambdaNm`.
46
+ *
47
+ * The most useful derived constant at this level, and worth its own export
48
+ * rather than making every caller assemble it, because the assembly is where
49
+ * the factors of 1e-9 and 1.602e-19 go missing.
50
+ */
51
+ declare const HC_EV_NM: number;
52
+ /** Permeability of free space, N/A². */
53
+ declare const VACUUM_PERMEABILITY = 0.00000125663706212;
54
+ /**
55
+ * Permittivity of free space, F/m, derived from c and μ₀ rather than tabulated.
56
+ *
57
+ * Because c² = 1/(μ₀ε₀) is not a coincidence to be checked against a table, it
58
+ * is what Maxwell's equations SAY, and it is the argument that light is an
59
+ * electromagnetic wave. Writing ε₀ as a literal beside the other two lets a
60
+ * typo break the identity silently; writing it as the rearrangement cannot.
61
+ */
62
+ declare const VACUUM_PERMITTIVITY: number;
63
+ /** Faraday constant, C/mol: the charge on a mole of electrons. EXACT. */
64
+ declare const FARADAY: number;
65
+ /** Standard atmosphere, Pa. EXACT by definition. */
66
+ declare const STANDARD_ATMOSPHERE = 101325;
67
+ /**
68
+ * Molar volume of an ideal gas at 0 °C and one atmosphere, in cubic decimetres
69
+ * (litres) per mole. The 22.4 dm³ every chemistry course quotes.
70
+ *
71
+ * Written as RT/p rather than as 22.4, because the number is a CONSEQUENCE of a
72
+ * stated temperature and pressure and not a property of gases. "STP" has meant
73
+ * two different pressures in living memory: IUPAC moved it to 100 kPa in 1982,
74
+ * which gives 22.711 dm³/mol instead, and a syllabus still teaching 22.4 is
75
+ * using the older atmosphere. Anyone who needs the other one changes the
76
+ * pressure here and can see what they changed.
77
+ */
78
+ declare const MOLAR_GAS_VOLUME_STP: number;
79
+ /** Molar volume at 25 °C and one atmosphere, dm³/mol: room-temperature questions. */
80
+ declare const MOLAR_GAS_VOLUME_RTP: number;
81
+ /** Stefan-Boltzmann constant, W/(m²·K⁴). Derived from the exact four. */
82
+ declare const STEFAN_BOLTZMANN = 5.670374419e-8;
83
+ /** Wien displacement-law constant, m·K. */
84
+ declare const WIEN_DISPLACEMENT = 0.002897771955;
85
+ /**
86
+ * Newtonian constant of gravitation, m³/(kg·s²). CODATA 2018.
87
+ *
88
+ * The ODD ONE OUT in this file, and worth saying why rather than filing it silently beside the
89
+ * others. Every constant above is either exact by definition or known to nine or more figures.
90
+ * This one is known to FOUR, with a relative uncertainty around 2×10⁻⁵, which makes it the
91
+ * worst-measured constant in physics by a wide margin: it has been measured for two centuries and
92
+ * independent modern experiments still disagree past the fourth digit. Gravity is simply too weak
93
+ * to shield from everything else in the room.
94
+ *
95
+ * That has a consequence a gravitation kernel cannot hide from. `GM` for the Earth is known to ten
96
+ * significant figures because it is measured DIRECTLY, from how satellites move; `M` alone is known
97
+ * to four, because getting it out of `GM` means dividing by this. So a lab that quotes the Earth's
98
+ * mass to six figures is quoting precision that does not exist, and the product `GM` is the honest
99
+ * number to carry. `physics/gravitation/body.ts` carries it.
100
+ *
101
+ * Textbooks in different countries print 6.67e-11, 6.673e-11 or 6.674e-11 and a mark scheme will
102
+ * accept any of them at three figures. Kernels take it as a DEFAULT PARAMETER rather than reading
103
+ * it directly, so a lesson can pass the value its own syllabus prints and still get the marks.
104
+ */
105
+ declare const GRAVITATIONAL_CONSTANT = 6.6743e-11;
106
+ /**
107
+ * The offset between the Celsius and Kelvin scales, K.
108
+ *
109
+ * Note that this is a SHIFT and not a conversion factor, which is the whole
110
+ * reason `quantity` refuses to multiply by a Celsius temperature. 20 °C is not
111
+ * twice 10 °C; 293.15 K is not twice 283.15 K either, but at least the second
112
+ * pair is on a scale where a ratio means something.
113
+ */
114
+ declare const ZERO_CELSIUS_K = 273.15;
115
+ /**
116
+ * The triple point of water, K. EXACT before 2019, when it defined the kelvin;
117
+ * now a measured quantity that happens to sit within 0.1 mK of 273.16.
118
+ *
119
+ * Kept because the constant-volume gas thermometer is still calibrated against
120
+ * it in every syllabus, and T = 273.16 · (p/p_triple) is the definition those
121
+ * questions use.
122
+ */
123
+ declare const WATER_TRIPLE_POINT_K = 273.16;
124
+ /** Standard atmosphere, Pa. EXACT by convention. */
125
+ declare const ATMOSPHERE_PA = 101325;
126
+ /** Standard acceleration of free fall, m/s². EXACT by convention. */
127
+ declare const STANDARD_GRAVITY = 9.80665;
128
+ /**
129
+ * The mechanical equivalent of heat, J/cal.
130
+ *
131
+ * Joule's constant, and a historical unit conversion rather than a constant of
132
+ * nature: it is exactly 4.184 because the thermochemical calorie was DEFINED
133
+ * that way once heat was understood to be energy. That is the point of the
134
+ * experiment, so the number is kept where a lesson about it can reach it.
135
+ */
136
+ declare const JOULES_PER_CALORIE = 4.184;
137
+ //#endregion
138
+ export { ATMOSPHERE_PA, AVOGADRO, BOLTZMANN, ELEMENTARY_CHARGE, FARADAY, GAS_CONSTANT, GRAVITATIONAL_CONSTANT, HC_EV_NM, JOULES_PER_CALORIE, MOLAR_GAS_VOLUME_RTP, MOLAR_GAS_VOLUME_STP, PLANCK, PLANCK_REDUCED, SPEED_OF_LIGHT, STANDARD_ATMOSPHERE, STANDARD_GRAVITY, STEFAN_BOLTZMANN, VACUUM_PERMEABILITY, VACUUM_PERMITTIVITY, WATER_TRIPLE_POINT_K, WIEN_DISPLACEMENT, ZERO_CELSIUS_K };
@@ -0,0 +1,139 @@
1
+ //#region src/core/constants.ts
2
+ /**
3
+ * Universal physical constants, in SI, as the single place a number like the gas
4
+ * constant is written down.
5
+ *
6
+ * Written because `R` had three definitions in this package: `thermo/index.ts`
7
+ * and `chem/index.ts` both declared `8.314462618`, and `chem/relations.ts`
8
+ * carried `8.31446262` inside its `CONSTANTS` table. The last of those is the
9
+ * same constant rounded one digit shorter, which is the failure mode worth
10
+ * naming: a duplicated constant does not stay duplicated, it drifts, and then
11
+ * two parts of one calculation disagree in the eighth figure for no reason a
12
+ * reader can find.
13
+ *
14
+ * Values are CODATA 2018. The four that are EXACT by the 2019 SI redefinition
15
+ * are marked as such, because "exact" changes what a test may assert: a defined
16
+ * constant can be compared for equality, a measured one can only be compared to
17
+ * a tolerance.
18
+ *
19
+ * Domain kernels re-export what they need under their own name, so
20
+ * `@classytic/stage/thermo` still exports `R` and nothing downstream has to know
21
+ * this file exists. What they must not do is write the number again.
22
+ */
23
+ /** Avogadro constant, per mole. EXACT by definition. */
24
+ const AVOGADRO = 602214076e15;
25
+ /** Boltzmann constant, J/K. EXACT by definition. */
26
+ const BOLTZMANN = 1380649e-29;
27
+ /**
28
+ * Molar gas constant, J/(mol·K). EXACT, being the product of two exact
29
+ * constants: R = N_A · k_B.
30
+ *
31
+ * Written as that product rather than as a literal, so the identity cannot rot.
32
+ * A reader who doubts the digits can check the multiplication instead of a
33
+ * table.
34
+ */
35
+ const GAS_CONSTANT = AVOGADRO * BOLTZMANN;
36
+ /** Elementary charge, C. EXACT by definition. */
37
+ const ELEMENTARY_CHARGE = 1602176634e-28;
38
+ /** Speed of light in vacuum, m/s. EXACT: it is what DEFINES the metre. */
39
+ const SPEED_OF_LIGHT = 299792458;
40
+ /** Planck constant, J·s. EXACT: it is what defines the kilogram. */
41
+ const PLANCK = 662607015e-42;
42
+ /** Reduced Planck constant, J·s. */
43
+ const PLANCK_REDUCED = PLANCK / (2 * Math.PI);
44
+ /**
45
+ * `hc` in eV·nm, so a photon's energy in electronvolts is `HC_EV_NM / lambdaNm`.
46
+ *
47
+ * The most useful derived constant at this level, and worth its own export
48
+ * rather than making every caller assemble it, because the assembly is where
49
+ * the factors of 1e-9 and 1.602e-19 go missing.
50
+ */
51
+ const HC_EV_NM = PLANCK * SPEED_OF_LIGHT / (ELEMENTARY_CHARGE * 1e-9);
52
+ /** Permeability of free space, N/A². */
53
+ const VACUUM_PERMEABILITY = 125663706212e-17;
54
+ /**
55
+ * Permittivity of free space, F/m, derived from c and μ₀ rather than tabulated.
56
+ *
57
+ * Because c² = 1/(μ₀ε₀) is not a coincidence to be checked against a table, it
58
+ * is what Maxwell's equations SAY, and it is the argument that light is an
59
+ * electromagnetic wave. Writing ε₀ as a literal beside the other two lets a
60
+ * typo break the identity silently; writing it as the rearrangement cannot.
61
+ */
62
+ const VACUUM_PERMITTIVITY = 1 / (VACUUM_PERMEABILITY * SPEED_OF_LIGHT * SPEED_OF_LIGHT);
63
+ /** Faraday constant, C/mol: the charge on a mole of electrons. EXACT. */
64
+ const FARADAY = AVOGADRO * ELEMENTARY_CHARGE;
65
+ /** Standard atmosphere, Pa. EXACT by definition. */
66
+ const STANDARD_ATMOSPHERE = 101325;
67
+ /**
68
+ * Molar volume of an ideal gas at 0 °C and one atmosphere, in cubic decimetres
69
+ * (litres) per mole. The 22.4 dm³ every chemistry course quotes.
70
+ *
71
+ * Written as RT/p rather than as 22.4, because the number is a CONSEQUENCE of a
72
+ * stated temperature and pressure and not a property of gases. "STP" has meant
73
+ * two different pressures in living memory: IUPAC moved it to 100 kPa in 1982,
74
+ * which gives 22.711 dm³/mol instead, and a syllabus still teaching 22.4 is
75
+ * using the older atmosphere. Anyone who needs the other one changes the
76
+ * pressure here and can see what they changed.
77
+ */
78
+ const MOLAR_GAS_VOLUME_STP = GAS_CONSTANT * 273.15 * 1e3 / STANDARD_ATMOSPHERE;
79
+ /** Molar volume at 25 °C and one atmosphere, dm³/mol: room-temperature questions. */
80
+ const MOLAR_GAS_VOLUME_RTP = GAS_CONSTANT * 298.15 * 1e3 / STANDARD_ATMOSPHERE;
81
+ /** Stefan-Boltzmann constant, W/(m²·K⁴). Derived from the exact four. */
82
+ const STEFAN_BOLTZMANN = 5.670374419e-8;
83
+ /** Wien displacement-law constant, m·K. */
84
+ const WIEN_DISPLACEMENT = .002897771955;
85
+ /**
86
+ * Newtonian constant of gravitation, m³/(kg·s²). CODATA 2018.
87
+ *
88
+ * The ODD ONE OUT in this file, and worth saying why rather than filing it silently beside the
89
+ * others. Every constant above is either exact by definition or known to nine or more figures.
90
+ * This one is known to FOUR, with a relative uncertainty around 2×10⁻⁵, which makes it the
91
+ * worst-measured constant in physics by a wide margin: it has been measured for two centuries and
92
+ * independent modern experiments still disagree past the fourth digit. Gravity is simply too weak
93
+ * to shield from everything else in the room.
94
+ *
95
+ * That has a consequence a gravitation kernel cannot hide from. `GM` for the Earth is known to ten
96
+ * significant figures because it is measured DIRECTLY, from how satellites move; `M` alone is known
97
+ * to four, because getting it out of `GM` means dividing by this. So a lab that quotes the Earth's
98
+ * mass to six figures is quoting precision that does not exist, and the product `GM` is the honest
99
+ * number to carry. `physics/gravitation/body.ts` carries it.
100
+ *
101
+ * Textbooks in different countries print 6.67e-11, 6.673e-11 or 6.674e-11 and a mark scheme will
102
+ * accept any of them at three figures. Kernels take it as a DEFAULT PARAMETER rather than reading
103
+ * it directly, so a lesson can pass the value its own syllabus prints and still get the marks.
104
+ */
105
+ const GRAVITATIONAL_CONSTANT = 66743e-15;
106
+ /**
107
+ * The offset between the Celsius and Kelvin scales, K.
108
+ *
109
+ * Note that this is a SHIFT and not a conversion factor, which is the whole
110
+ * reason `quantity` refuses to multiply by a Celsius temperature. 20 °C is not
111
+ * twice 10 °C; 293.15 K is not twice 283.15 K either, but at least the second
112
+ * pair is on a scale where a ratio means something.
113
+ */
114
+ const ZERO_CELSIUS_K = 273.15;
115
+ /**
116
+ * The triple point of water, K. EXACT before 2019, when it defined the kelvin;
117
+ * now a measured quantity that happens to sit within 0.1 mK of 273.16.
118
+ *
119
+ * Kept because the constant-volume gas thermometer is still calibrated against
120
+ * it in every syllabus, and T = 273.16 · (p/p_triple) is the definition those
121
+ * questions use.
122
+ */
123
+ const WATER_TRIPLE_POINT_K = 273.16;
124
+ /** Standard atmosphere, Pa. EXACT by convention. */
125
+ const ATMOSPHERE_PA = 101325;
126
+ /** Standard acceleration of free fall, m/s². EXACT by convention. */
127
+ const STANDARD_GRAVITY = 9.80665;
128
+ /**
129
+ * The mechanical equivalent of heat, J/cal.
130
+ *
131
+ * Joule's constant, and a historical unit conversion rather than a constant of
132
+ * nature: it is exactly 4.184 because the thermochemical calorie was DEFINED
133
+ * that way once heat was understood to be energy. That is the point of the
134
+ * experiment, so the number is kept where a lesson about it can reach it.
135
+ */
136
+ const JOULES_PER_CALORIE = 4.184;
137
+
138
+ //#endregion
139
+ export { ATMOSPHERE_PA, AVOGADRO, BOLTZMANN, ELEMENTARY_CHARGE, FARADAY, GAS_CONSTANT, GRAVITATIONAL_CONSTANT, HC_EV_NM, JOULES_PER_CALORIE, MOLAR_GAS_VOLUME_RTP, MOLAR_GAS_VOLUME_STP, PLANCK, PLANCK_REDUCED, SPEED_OF_LIGHT, STANDARD_ATMOSPHERE, STANDARD_GRAVITY, STEFAN_BOLTZMANN, VACUUM_PERMEABILITY, VACUUM_PERMITTIVITY, WATER_TRIPLE_POINT_K, WIEN_DISPLACEMENT, ZERO_CELSIUS_K };
@@ -1,9 +1,11 @@
1
1
  import { Matrix, Vec2, mat, vec } from "./vec.mjs";
2
2
  import { CoordinateSystem, CoordsOptions, ViewBox, createCoords, fmt } from "./coords.mjs";
3
3
  import { ControlMap, ControlSpec, ControlSurface, getControlSurface, listControlSurfaces, onControlChange, useControlSurface } from "./control.mjs";
4
+ import { Calc, CalcStep, Worked, calc, texNum } from "./worked.mjs";
5
+ import { Vec3, ZERO3, add3, angleBetween3, basisFor3, cross3, dist3, distToSegment3, dot3, lerp3, mag3, midpoint3, reject3, scale3, sub3, unit3, v3, vec3 } from "./vec3.mjs";
4
6
  import { CoordsContext, DragOverlayContext, StageRefContext, useCoords, useDragOverlay, useStageRef } from "./context.mjs";
5
7
  import { ClockProvider, ClockProviderProps, FrameDriver, FrameInfo, useFrameLoop } from "./clock.mjs";
6
8
  import { Learner, LearnerProvider, LearnerResult, PriorAttempts, useLearner } from "./learner.mjs";
7
9
  import { EaseFn, EaseName, Keyframe, OscillateOpts, SpringOpts, WaveShape, ease, lerp, oscillate, prefersReducedMotion, spring, timeline } from "./motion.mjs";
8
10
  import { approxEq, clamp, clamp01, gcd, remap, round, snapTo, toDeg, toRad } from "./math.mjs";
9
- export { ClockProvider, type ClockProviderProps, type ControlMap, type ControlSpec, type ControlSurface, type CoordinateSystem, CoordsContext, type CoordsOptions, DragOverlayContext, type EaseFn, type EaseName, type FrameDriver, type FrameInfo, type Keyframe, type Learner, LearnerProvider, type LearnerResult, type Matrix, type OscillateOpts, type PriorAttempts, type SpringOpts, StageRefContext, type Vec2, type ViewBox, type WaveShape, approxEq, clamp, clamp01, createCoords, ease, fmt, gcd, getControlSurface, lerp, listControlSurfaces, mat, onControlChange, oscillate, prefersReducedMotion, remap, round, snapTo, spring, timeline, toDeg, toRad, useControlSurface, useCoords, useDragOverlay, useFrameLoop, useLearner, useStageRef, vec };
11
+ export { Calc, type CalcStep, ClockProvider, type ClockProviderProps, type ControlMap, type ControlSpec, type ControlSurface, type CoordinateSystem, CoordsContext, type CoordsOptions, DragOverlayContext, type EaseFn, type EaseName, type FrameDriver, type FrameInfo, type Keyframe, type Learner, LearnerProvider, type LearnerResult, type Matrix, type OscillateOpts, type PriorAttempts, type SpringOpts, StageRefContext, type Vec2, type Vec3, type ViewBox, type WaveShape, type Worked, ZERO3, add3, angleBetween3, approxEq, basisFor3, calc, clamp, clamp01, createCoords, cross3, dist3, distToSegment3, dot3, ease, fmt, gcd, getControlSurface, lerp, lerp3, listControlSurfaces, mag3, mat, midpoint3, onControlChange, oscillate, prefersReducedMotion, reject3, remap, round, scale3, snapTo, spring, sub3, texNum, timeline, toDeg, toRad, unit3, useControlSurface, useCoords, useDragOverlay, useFrameLoop, useLearner, useStageRef, v3, vec, vec3 };
@@ -6,5 +6,7 @@ import { getControlSurface, listControlSurfaces, onControlChange, useControlSurf
6
6
  import { LearnerProvider, useLearner } from "./learner.mjs";
7
7
  import { approxEq, clamp, clamp01, gcd, remap, round, snapTo, toDeg, toRad } from "./math.mjs";
8
8
  import { ease, lerp, oscillate, prefersReducedMotion, spring, timeline } from "./motion.mjs";
9
+ import { ZERO3, add3, angleBetween3, basisFor3, cross3, dist3, distToSegment3, dot3, lerp3, mag3, midpoint3, reject3, scale3, sub3, unit3, v3, vec3 } from "./vec3.mjs";
10
+ import { Calc, calc, texNum } from "./worked.mjs";
9
11
 
10
- export { ClockProvider, CoordsContext, DragOverlayContext, LearnerProvider, StageRefContext, approxEq, clamp, clamp01, createCoords, ease, fmt, gcd, getControlSurface, lerp, listControlSurfaces, mat, onControlChange, oscillate, prefersReducedMotion, remap, round, snapTo, spring, timeline, toDeg, toRad, useControlSurface, useCoords, useDragOverlay, useFrameLoop, useLearner, useStageRef, vec };
12
+ export { Calc, ClockProvider, CoordsContext, DragOverlayContext, LearnerProvider, StageRefContext, ZERO3, add3, angleBetween3, approxEq, basisFor3, calc, clamp, clamp01, createCoords, cross3, dist3, distToSegment3, dot3, ease, fmt, gcd, getControlSurface, lerp, lerp3, listControlSurfaces, mag3, mat, midpoint3, onControlChange, oscillate, prefersReducedMotion, reject3, remap, round, scale3, snapTo, spring, sub3, texNum, timeline, toDeg, toRad, unit3, useControlSurface, useCoords, useDragOverlay, useFrameLoop, useLearner, useStageRef, v3, vec, vec3 };
@@ -0,0 +1,94 @@
1
+ //#region src/core/vec3.d.ts
2
+ /**
3
+ * 3D vector algebra, as the companion to `vec.ts`.
4
+ *
5
+ * Written because five files had grown their own copy: `chem/vsepr.ts` here,
6
+ * and four separate ones in labs (`physics/fields/spatial-core.ts`,
7
+ * `physics/biot-savart/core.ts`, `physics/magnetism/flux-core.ts`,
8
+ * `physics/magnetism/force-core.ts`). Each declared the same `{x,y,z}` shape
9
+ * and the same six operations, and a cross product written five times is five
10
+ * chances to get the sign wrong in one of them.
11
+ *
12
+ * The shape matches `Vec2`: a plain object, not a tuple or a class, so it
13
+ * serialises straight into scene JSON and reads the same way at a breakpoint.
14
+ *
15
+ * The named export is `vec3`, an object of operations, mirroring `vec`. The
16
+ * individual functions are also exported, because a line integral written with
17
+ * `vec3.add(vec3.scale(...))` everywhere is harder to check against the physics
18
+ * than one written with `add` and `scale`.
19
+ */
20
+ interface Vec3 {
21
+ x: number;
22
+ y: number;
23
+ z: number;
24
+ }
25
+ declare const v3: (x: number, y: number, z: number) => Vec3;
26
+ declare const ZERO3: Vec3;
27
+ declare const add3: (a: Vec3, b: Vec3) => Vec3;
28
+ declare const sub3: (a: Vec3, b: Vec3) => Vec3;
29
+ declare const scale3: (a: Vec3, k: number) => Vec3;
30
+ declare const dot3: (a: Vec3, b: Vec3) => number;
31
+ /**
32
+ * Right-handed cross product: a × b.
33
+ *
34
+ * The handedness is the whole content of this function. x̂ × ŷ = ẑ, which is
35
+ * what makes the right-hand rule come out right everywhere downstream, from a
36
+ * magnetic force to a torque to a surface normal.
37
+ */
38
+ declare const cross3: (a: Vec3, b: Vec3) => Vec3;
39
+ declare const mag3: (a: Vec3) => number;
40
+ declare const dist3: (a: Vec3, b: Vec3) => number;
41
+ /**
42
+ * Unit vector, which THROWS on a zero vector rather than returning one.
43
+ *
44
+ * A zero-length direction is always a caller's mistake: a segment with no
45
+ * length, a field point exactly on a source, an axis nobody set. Returning
46
+ * `{0,0,0}` or dividing by a `|| 1` guard lets that mistake travel silently
47
+ * into a picture, which is how a diagram ends up subtly wrong with every test
48
+ * still green.
49
+ */
50
+ declare const unit3: (a: Vec3) => Vec3;
51
+ /** Linear interpolation, with t = 0 at `a` and t = 1 at `b`. */
52
+ declare const lerp3: (a: Vec3, b: Vec3, t: number) => Vec3;
53
+ declare const midpoint3: (a: Vec3, b: Vec3) => Vec3;
54
+ /** Angle between two vectors, in radians, clamped against floating-point drift. */
55
+ declare const angleBetween3: (a: Vec3, b: Vec3) => number;
56
+ /**
57
+ * The component of `a` perpendicular to `onto`, with the parallel part removed.
58
+ *
59
+ * The workhorse of anything that needs an in-plane direction: a flux loop's
60
+ * axes, a force resolved across a field, a distance from a line.
61
+ */
62
+ declare const reject3: (a: Vec3, onto: Vec3) => Vec3;
63
+ /** Shortest distance from a point to the segment ab, not to the infinite line. */
64
+ declare const distToSegment3: (p: Vec3, a: Vec3, b: Vec3) => number;
65
+ /**
66
+ * Two perpendicular unit vectors spanning the plane with this normal.
67
+ *
68
+ * A `preferred` direction becomes the FIRST axis, projected into the plane.
69
+ * Note that it must be projected and not merely passed to a cross product:
70
+ * `cross(preferred, n)` returns something perpendicular to `preferred`, which
71
+ * silently swaps the two axes and hands back a frame the caller did not ask
72
+ * for. That bug cost real time in the flux integrator.
73
+ */
74
+ declare const basisFor3: (normal: Vec3, preferred?: Vec3) => [Vec3, Vec3];
75
+ declare const vec3: {
76
+ v: (x: number, y: number, z: number) => Vec3;
77
+ add: (a: Vec3, b: Vec3) => Vec3;
78
+ sub: (a: Vec3, b: Vec3) => Vec3;
79
+ scale: (a: Vec3, k: number) => Vec3;
80
+ dot: (a: Vec3, b: Vec3) => number;
81
+ cross: (a: Vec3, b: Vec3) => Vec3;
82
+ mag: (a: Vec3) => number;
83
+ dist: (a: Vec3, b: Vec3) => number;
84
+ unit: (a: Vec3) => Vec3;
85
+ lerp: (a: Vec3, b: Vec3, t: number) => Vec3;
86
+ midpoint: (a: Vec3, b: Vec3) => Vec3;
87
+ angleBetween: (a: Vec3, b: Vec3) => number;
88
+ reject: (a: Vec3, onto: Vec3) => Vec3;
89
+ distToSegment: (p: Vec3, a: Vec3, b: Vec3) => number;
90
+ basisFor: (normal: Vec3, preferred?: Vec3) => [Vec3, Vec3];
91
+ ZERO: Vec3;
92
+ };
93
+ //#endregion
94
+ export { Vec3, ZERO3, add3, angleBetween3, basisFor3, cross3, dist3, distToSegment3, dot3, lerp3, mag3, midpoint3, reject3, scale3, sub3, unit3, v3, vec3 };
@@ -0,0 +1,123 @@
1
+ //#region src/core/vec3.ts
2
+ const v3 = (x, y, z) => ({
3
+ x,
4
+ y,
5
+ z
6
+ });
7
+ const ZERO3 = {
8
+ x: 0,
9
+ y: 0,
10
+ z: 0
11
+ };
12
+ const add3 = (a, b) => ({
13
+ x: a.x + b.x,
14
+ y: a.y + b.y,
15
+ z: a.z + b.z
16
+ });
17
+ const sub3 = (a, b) => ({
18
+ x: a.x - b.x,
19
+ y: a.y - b.y,
20
+ z: a.z - b.z
21
+ });
22
+ const scale3 = (a, k) => ({
23
+ x: a.x * k,
24
+ y: a.y * k,
25
+ z: a.z * k
26
+ });
27
+ const dot3 = (a, b) => a.x * b.x + a.y * b.y + a.z * b.z;
28
+ /**
29
+ * Right-handed cross product: a × b.
30
+ *
31
+ * The handedness is the whole content of this function. x̂ × ŷ = ẑ, which is
32
+ * what makes the right-hand rule come out right everywhere downstream, from a
33
+ * magnetic force to a torque to a surface normal.
34
+ */
35
+ const cross3 = (a, b) => ({
36
+ x: a.y * b.z - a.z * b.y,
37
+ y: a.z * b.x - a.x * b.z,
38
+ z: a.x * b.y - a.y * b.x
39
+ });
40
+ const mag3 = (a) => Math.sqrt(dot3(a, a));
41
+ const dist3 = (a, b) => mag3(sub3(a, b));
42
+ /**
43
+ * Unit vector, which THROWS on a zero vector rather than returning one.
44
+ *
45
+ * A zero-length direction is always a caller's mistake: a segment with no
46
+ * length, a field point exactly on a source, an axis nobody set. Returning
47
+ * `{0,0,0}` or dividing by a `|| 1` guard lets that mistake travel silently
48
+ * into a picture, which is how a diagram ends up subtly wrong with every test
49
+ * still green.
50
+ */
51
+ const unit3 = (a) => {
52
+ const m = mag3(a);
53
+ if (m === 0) throw new RangeError("A zero-length vector has no direction.");
54
+ return scale3(a, 1 / m);
55
+ };
56
+ /** Linear interpolation, with t = 0 at `a` and t = 1 at `b`. */
57
+ const lerp3 = (a, b, t) => add3(a, scale3(sub3(b, a), t));
58
+ const midpoint3 = (a, b) => lerp3(a, b, .5);
59
+ /** Angle between two vectors, in radians, clamped against floating-point drift. */
60
+ const angleBetween3 = (a, b) => {
61
+ const denominator = mag3(a) * mag3(b);
62
+ if (denominator === 0) throw new RangeError("A zero-length vector has no angle.");
63
+ return Math.acos(Math.min(1, Math.max(-1, dot3(a, b) / denominator)));
64
+ };
65
+ /**
66
+ * The component of `a` perpendicular to `onto`, with the parallel part removed.
67
+ *
68
+ * The workhorse of anything that needs an in-plane direction: a flux loop's
69
+ * axes, a force resolved across a field, a distance from a line.
70
+ */
71
+ const reject3 = (a, onto) => {
72
+ const n = unit3(onto);
73
+ return sub3(a, scale3(n, dot3(a, n)));
74
+ };
75
+ /** Shortest distance from a point to the segment ab, not to the infinite line. */
76
+ const distToSegment3 = (p, a, b) => {
77
+ const ab = sub3(b, a);
78
+ const lengthSq = dot3(ab, ab);
79
+ if (lengthSq === 0) return dist3(p, a);
80
+ return dist3(p, add3(a, scale3(ab, Math.max(0, Math.min(1, dot3(sub3(p, a), ab) / lengthSq)))));
81
+ };
82
+ /**
83
+ * Two perpendicular unit vectors spanning the plane with this normal.
84
+ *
85
+ * A `preferred` direction becomes the FIRST axis, projected into the plane.
86
+ * Note that it must be projected and not merely passed to a cross product:
87
+ * `cross(preferred, n)` returns something perpendicular to `preferred`, which
88
+ * silently swaps the two axes and hands back a frame the caller did not ask
89
+ * for. That bug cost real time in the flux integrator.
90
+ */
91
+ const basisFor3 = (normal, preferred) => {
92
+ const n = unit3(normal);
93
+ if (preferred) {
94
+ const inPlane = sub3(preferred, scale3(n, dot3(preferred, n)));
95
+ if (mag3(inPlane) > 1e-9) {
96
+ const u = unit3(inPlane);
97
+ return [u, cross3(n, u)];
98
+ }
99
+ }
100
+ const u = unit3(cross3(Math.abs(n.z) < .9 ? v3(0, 0, 1) : v3(1, 0, 0), n));
101
+ return [u, cross3(n, u)];
102
+ };
103
+ const vec3 = {
104
+ v: v3,
105
+ add: add3,
106
+ sub: sub3,
107
+ scale: scale3,
108
+ dot: dot3,
109
+ cross: cross3,
110
+ mag: mag3,
111
+ dist: dist3,
112
+ unit: unit3,
113
+ lerp: lerp3,
114
+ midpoint: midpoint3,
115
+ angleBetween: angleBetween3,
116
+ reject: reject3,
117
+ distToSegment: distToSegment3,
118
+ basisFor: basisFor3,
119
+ ZERO: ZERO3
120
+ };
121
+
122
+ //#endregion
123
+ export { ZERO3, add3, angleBetween3, basisFor3, cross3, dist3, distToSegment3, dot3, lerp3, mag3, midpoint3, reject3, scale3, sub3, unit3, v3, vec3 };
@@ -0,0 +1,35 @@
1
+ //#region src/core/worked.d.ts
2
+ /**
3
+ * Worked calculations: the shape a kernel uses to SHOW ITS WORKING.
4
+ *
5
+ * A kernel that returns only an answer cannot teach. This is the data a kernel emits instead: the
6
+ * value plus every substitution and simplification that produced it, each as a LaTeX line with an
7
+ * optional note saying why that step follows. Pure and dependency-free; rendering is somebody
8
+ * else's job (in labs, `kit/rule`'s RuleCard and WorkedSteps).
9
+ *
10
+ * It lives in stage rather than in labs because the kernels are what produce it. A relation solver
11
+ * or a redox balancer that emits worked steps cannot describe its own return type if the type
12
+ * lives in a consumer. The renderer can stay downstream; the shape cannot.
13
+ */
14
+ /** One line of a worked calculation: a LaTeX expression + an optional plain note. */
15
+ interface CalcStep {
16
+ tex: string;
17
+ /** Why this step follows ("substitute n = 5", "the falling product"). */
18
+ note?: string;
19
+ }
20
+ /** The result of a worked calculation: the final value + the steps that got there. */
21
+ interface Worked {
22
+ value: number;
23
+ steps: CalcStep[];
24
+ }
25
+ /** A tiny fluent builder: calc().step('…','…').step('…').done(value). */
26
+ declare class Calc {
27
+ private readonly _steps;
28
+ step(tex: string, note?: string): this;
29
+ done(value: number): Worked;
30
+ }
31
+ declare const calc: () => Calc;
32
+ /** Format a number for inline LaTeX (thin-space thousands so big counts read). */
33
+ declare function texNum(n: number): string;
34
+ //#endregion
35
+ export { Calc, CalcStep, Worked, calc, texNum };