@classytic/stage 0.2.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.
- package/LICENSE +1 -1
- package/README.md +5 -1
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/assets/index.mjs +0 -1
- package/dist/atomic/aufbau.d.mts +144 -0
- package/dist/atomic/aufbau.mjs +384 -0
- package/dist/atomic/elements.d.mts +67 -0
- package/dist/atomic/elements.mjs +785 -0
- package/dist/atomic/emission.d.mts +112 -0
- package/dist/atomic/emission.mjs +179 -0
- package/dist/atomic/index.d.mts +8 -0
- package/dist/atomic/index.mjs +9 -0
- package/dist/atomic/periodic.d.mts +82 -0
- package/dist/atomic/periodic.mjs +231 -0
- package/dist/atomic/properties.d.mts +100 -0
- package/dist/atomic/properties.mjs +574 -0
- package/dist/atomic/shells.d.mts +137 -0
- package/dist/atomic/shells.mjs +170 -0
- package/dist/atomic/trends.d.mts +148 -0
- package/dist/atomic/trends.mjs +225 -0
- package/dist/builder/Palette.mjs +50 -89
- package/dist/builder/SceneBuilder.mjs +15 -73
- package/dist/chem/chromatography.d.mts +66 -0
- package/dist/chem/chromatography.mjs +63 -0
- package/dist/chem/complex.d.mts +114 -0
- package/dist/chem/complex.mjs +234 -0
- package/dist/chem/cycle.d.mts +75 -0
- package/dist/chem/cycle.mjs +145 -0
- package/dist/chem/equation.d.mts +86 -0
- package/dist/chem/equation.mjs +168 -0
- package/dist/chem/formula.d.mts +90 -0
- package/dist/chem/formula.mjs +201 -0
- package/dist/chem/functional-groups.d.mts +31 -0
- package/dist/chem/functional-groups.mjs +187 -0
- package/dist/chem/hazard.d.mts +94 -0
- package/dist/chem/hazard.mjs +329 -0
- package/dist/chem/index.d.mts +34 -33
- package/dist/chem/index.mjs +34 -28
- package/dist/chem/ionic.d.mts +98 -0
- package/dist/chem/ionic.mjs +156 -0
- package/dist/chem/layout.d.mts +46 -0
- package/dist/chem/layout.mjs +342 -0
- package/dist/chem/lewis.d.mts +79 -0
- package/dist/chem/lewis.mjs +163 -0
- package/dist/chem/molecular-orbital.d.mts +114 -0
- package/dist/chem/molecular-orbital.mjs +201 -0
- package/dist/chem/molecule.d.mts +154 -0
- package/dist/chem/molecule.mjs +282 -0
- package/dist/chem/nmr.d.mts +153 -0
- package/dist/chem/nmr.mjs +165 -0
- package/dist/chem/polymer.d.mts +65 -0
- package/dist/chem/polymer.mjs +179 -0
- package/dist/chem/redox.d.mts +138 -0
- package/dist/chem/redox.mjs +328 -0
- package/dist/chem/relations.d.mts +183 -0
- package/dist/chem/relations.mjs +299 -0
- package/dist/chem/skeleton.d.mts +51 -0
- package/dist/chem/skeleton.mjs +186 -0
- package/dist/chem/solution.d.mts +116 -0
- package/dist/chem/solution.mjs +186 -0
- package/dist/chem/species.d.mts +47 -0
- package/dist/chem/species.mjs +128 -0
- package/dist/chem/stereo.d.mts +108 -0
- package/dist/chem/stereo.mjs +286 -0
- package/dist/chem/stoichiometry.d.mts +95 -0
- package/dist/chem/stoichiometry.mjs +145 -0
- package/dist/chem/synthesis.d.mts +113 -0
- package/dist/chem/synthesis.mjs +281 -0
- package/dist/chem/vsepr.d.mts +80 -0
- package/dist/chem/vsepr.mjs +247 -0
- package/dist/circuit/ac.d.mts +163 -0
- package/dist/circuit/ac.mjs +452 -0
- package/dist/circuit/dc.d.mts +92 -0
- package/dist/circuit/dc.mjs +333 -0
- package/dist/circuit/index.d.mts +5 -92
- package/dist/circuit/index.mjs +5 -332
- package/dist/circuit/network.d.mts +99 -0
- package/dist/circuit/network.mjs +440 -0
- package/dist/circuit/topology.d.mts +102 -0
- package/dist/circuit/topology.mjs +143 -0
- package/dist/colour/absorption.d.mts +79 -0
- package/dist/colour/absorption.mjs +137 -0
- package/dist/colour/index.d.mts +6 -0
- package/dist/colour/index.mjs +7 -0
- package/dist/colour/name.d.mts +14 -0
- package/dist/colour/name.mjs +76 -0
- package/dist/colour/observer.d.mts +31 -0
- package/dist/colour/observer.mjs +46 -0
- package/dist/colour/spectrum.d.mts +61 -0
- package/dist/colour/spectrum.mjs +108 -0
- package/dist/colour/srgb.d.mts +49 -0
- package/dist/colour/srgb.mjs +108 -0
- package/dist/core/constants.d.mts +138 -0
- package/dist/core/constants.mjs +139 -0
- package/dist/core/index.d.mts +4 -1
- package/dist/core/index.mjs +4 -1
- package/dist/core/math.d.mts +26 -0
- package/dist/core/math.mjs +37 -0
- package/dist/core/vec3.d.mts +94 -0
- package/dist/core/vec3.mjs +123 -0
- package/dist/core/worked.d.mts +35 -0
- package/dist/core/worked.mjs +44 -0
- package/dist/electro/cell.d.mts +102 -0
- package/dist/electro/cell.mjs +170 -0
- package/dist/electro/conductivity.d.mts +157 -0
- package/dist/electro/conductivity.mjs +156 -0
- package/dist/electro/couples.d.mts +114 -0
- package/dist/electro/couples.mjs +334 -0
- package/dist/electro/electrolysis.d.mts +96 -0
- package/dist/electro/electrolysis.mjs +274 -0
- package/dist/electro/faraday.d.mts +150 -0
- package/dist/electro/faraday.mjs +118 -0
- package/dist/electro/index.d.mts +6 -0
- package/dist/electro/index.mjs +7 -0
- package/dist/finance/accounting/adjustments.d.mts +17 -0
- package/dist/finance/accounting/adjustments.mjs +202 -0
- package/dist/finance/accounting/analysis.d.mts +8 -0
- package/dist/finance/accounting/analysis.mjs +205 -0
- package/dist/finance/accounting/clubs.d.mts +21 -0
- package/dist/finance/accounting/clubs.mjs +217 -0
- package/dist/finance/accounting/company-statements.d.mts +7 -0
- package/dist/finance/accounting/company-statements.mjs +150 -0
- package/dist/finance/accounting/harness.d.mts +7 -0
- package/dist/finance/accounting/harness.mjs +45 -0
- package/dist/finance/accounting/index.d.mts +18 -0
- package/dist/finance/accounting/index.mjs +18 -0
- package/dist/finance/accounting/journalize.d.mts +16 -0
- package/dist/finance/accounting/journalize.mjs +128 -0
- package/dist/finance/accounting/manufacturing.d.mts +8 -0
- package/dist/finance/accounting/manufacturing.mjs +236 -0
- package/dist/finance/accounting/partnership.d.mts +7 -0
- package/dist/finance/accounting/partnership.mjs +152 -0
- package/dist/finance/accounting/period-case.d.mts +6 -0
- package/dist/finance/accounting/period-case.mjs +71 -0
- package/dist/finance/accounting/post.d.mts +9 -0
- package/dist/finance/accounting/post.mjs +84 -0
- package/dist/finance/accounting/precision.d.mts +9 -0
- package/dist/finance/accounting/precision.mjs +15 -0
- package/dist/finance/accounting/rules.d.mts +21 -0
- package/dist/finance/accounting/rules.mjs +37 -0
- package/dist/finance/accounting/solve.d.mts +28 -0
- package/dist/finance/accounting/solve.mjs +92 -0
- package/dist/finance/accounting/statements.d.mts +7 -0
- package/dist/finance/accounting/statements.mjs +142 -0
- package/dist/finance/accounting/types.d.mts +649 -0
- package/dist/finance/accounting/validate.d.mts +7 -0
- package/dist/finance/accounting/validate.mjs +67 -0
- package/dist/finance/accounting/verification.d.mts +24 -0
- package/dist/finance/accounting/verification.mjs +386 -0
- package/dist/finance/bizsim.d.mts +75 -0
- package/dist/finance/bizsim.mjs +296 -0
- package/dist/finance/index.d.mts +95 -0
- package/dist/finance/index.mjs +145 -0
- package/dist/finance/investment-math.d.mts +7 -0
- package/dist/finance/investment-math.mjs +18 -0
- package/dist/finance/management-accounting/budgeting.d.mts +7 -0
- package/dist/finance/management-accounting/budgeting.mjs +189 -0
- package/dist/finance/management-accounting/cash-budget.d.mts +7 -0
- package/dist/finance/management-accounting/cash-budget.mjs +154 -0
- package/dist/finance/management-accounting/costing.d.mts +8 -0
- package/dist/finance/management-accounting/costing.mjs +175 -0
- package/dist/finance/management-accounting/decisions.d.mts +8 -0
- package/dist/finance/management-accounting/decisions.mjs +164 -0
- package/dist/finance/management-accounting/index.d.mts +13 -0
- package/dist/finance/management-accounting/index.mjs +13 -0
- package/dist/finance/management-accounting/integrated-budget.d.mts +8 -0
- package/dist/finance/management-accounting/integrated-budget.mjs +67 -0
- package/dist/finance/management-accounting/inventory-costing.d.mts +7 -0
- package/dist/finance/management-accounting/inventory-costing.mjs +173 -0
- package/dist/finance/management-accounting/investment-appraisal.d.mts +7 -0
- package/dist/finance/management-accounting/investment-appraisal.mjs +148 -0
- package/dist/finance/management-accounting/management-case.d.mts +8 -0
- package/dist/finance/management-accounting/management-case.mjs +91 -0
- package/dist/finance/management-accounting/master-budget.d.mts +7 -0
- package/dist/finance/management-accounting/master-budget.mjs +137 -0
- package/dist/finance/management-accounting/production-costing.d.mts +8 -0
- package/dist/finance/management-accounting/production-costing.mjs +214 -0
- package/dist/finance/management-accounting/types.d.mts +644 -0
- package/dist/finance/management-accounting/variances.d.mts +7 -0
- package/dist/finance/management-accounting/variances.mjs +150 -0
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +5 -5
- package/dist/interaction/MovableDot.mjs +19 -0
- package/dist/interaction/useDraggable.mjs +24 -4
- package/dist/math/analysis.d.mts +61 -0
- package/dist/math/analysis.mjs +187 -0
- package/dist/math/answer-check.d.mts +50 -0
- package/dist/math/answer-check.mjs +106 -0
- package/dist/math/calculus.d.mts +17 -1
- package/dist/math/calculus.mjs +365 -2
- package/dist/math/complex.d.mts +93 -0
- package/dist/math/complex.mjs +239 -0
- package/dist/math/expr.d.mts +23 -0
- package/dist/math/expr.mjs +36 -0
- package/dist/math/index.d.mts +9 -23
- package/dist/math/index.mjs +9 -38
- package/dist/math/latex.mjs +10 -1
- package/dist/math/parse.mjs +1 -1
- package/dist/math/poly.d.mts +55 -0
- package/dist/math/poly.mjs +273 -0
- package/dist/math/rearrange.d.mts +14 -0
- package/dist/math/rearrange.mjs +125 -0
- package/dist/math/solve.d.mts +21 -0
- package/dist/math/solve.mjs +75 -0
- package/dist/networking/addressing.d.mts +26 -0
- package/dist/networking/addressing.mjs +33 -0
- package/dist/networking/cloud/access.d.mts +36 -0
- package/dist/networking/cloud/access.mjs +95 -0
- package/dist/networking/cloud/containers.d.mts +43 -0
- package/dist/networking/cloud/containers.mjs +54 -0
- package/dist/networking/cloud/edge.d.mts +17 -0
- package/dist/networking/cloud/edge.mjs +31 -0
- package/dist/networking/cloud/failure-domains.d.mts +19 -0
- package/dist/networking/cloud/failure-domains.mjs +22 -0
- package/dist/networking/cloud/geo-routing.d.mts +22 -0
- package/dist/networking/cloud/geo-routing.mjs +64 -0
- package/dist/networking/cloud/index.d.mts +18 -0
- package/dist/networking/cloud/index.mjs +19 -0
- package/dist/networking/cloud/inference-reliability.d.mts +30 -0
- package/dist/networking/cloud/inference-reliability.mjs +76 -0
- package/dist/networking/cloud/inference.d.mts +118 -0
- package/dist/networking/cloud/inference.mjs +179 -0
- package/dist/networking/cloud/infrastructure.d.mts +45 -0
- package/dist/networking/cloud/infrastructure.mjs +96 -0
- package/dist/networking/cloud/observability.d.mts +24 -0
- package/dist/networking/cloud/observability.mjs +34 -0
- package/dist/networking/cloud/orchestration.d.mts +32 -0
- package/dist/networking/cloud/orchestration.mjs +38 -0
- package/dist/networking/cloud/recovery.d.mts +21 -0
- package/dist/networking/cloud/recovery.mjs +27 -0
- package/dist/networking/cloud/releases.d.mts +42 -0
- package/dist/networking/cloud/releases.mjs +135 -0
- package/dist/networking/cloud/scaling.d.mts +25 -0
- package/dist/networking/cloud/scaling.mjs +65 -0
- package/dist/networking/cloud/secrets.d.mts +39 -0
- package/dist/networking/cloud/secrets.mjs +68 -0
- package/dist/networking/cloud/server-deployment.d.mts +29 -0
- package/dist/networking/cloud/server-deployment.mjs +72 -0
- package/dist/networking/cloud/storage.d.mts +16 -0
- package/dist/networking/cloud/storage.mjs +58 -0
- package/dist/networking/cloud/vpc.d.mts +18 -0
- package/dist/networking/cloud/vpc.mjs +100 -0
- package/dist/networking/delivery.d.mts +34 -0
- package/dist/networking/delivery.mjs +52 -0
- package/dist/networking/index.d.mts +47 -0
- package/dist/networking/index.mjs +47 -0
- package/dist/networking/ipv6.d.mts +28 -0
- package/dist/networking/ipv6.mjs +17 -0
- package/dist/networking/journeys.d.mts +83 -0
- package/dist/networking/journeys.mjs +161 -0
- package/dist/networking/models/airtime.d.mts +87 -0
- package/dist/networking/models/airtime.mjs +130 -0
- package/dist/networking/models/cellular.d.mts +157 -0
- package/dist/networking/models/cellular.mjs +252 -0
- package/dist/networking/models/encapsulation.d.mts +98 -0
- package/dist/networking/models/encapsulation.mjs +132 -0
- package/dist/networking/models/handover.d.mts +116 -0
- package/dist/networking/models/handover.mjs +209 -0
- package/dist/networking/models/handshake.d.mts +90 -0
- package/dist/networking/models/handshake.mjs +122 -0
- package/dist/networking/models/index.d.mts +14 -0
- package/dist/networking/models/index.mjs +15 -0
- package/dist/networking/models/media.d.mts +82 -0
- package/dist/networking/models/media.mjs +188 -0
- package/dist/networking/models/satellite.d.mts +86 -0
- package/dist/networking/models/satellite.mjs +121 -0
- package/dist/networking/models/spectrum.d.mts +83 -0
- package/dist/networking/models/spectrum.mjs +235 -0
- package/dist/networking/models/switch.d.mts +80 -0
- package/dist/networking/models/switch.mjs +155 -0
- package/dist/networking/models/vlan.d.mts +62 -0
- package/dist/networking/models/vlan.mjs +100 -0
- package/dist/networking/models/vpn.d.mts +66 -0
- package/dist/networking/models/vpn.mjs +125 -0
- package/dist/networking/models/wifi-privacy.d.mts +82 -0
- package/dist/networking/models/wifi-privacy.mjs +130 -0
- package/dist/networking/models/wifi.d.mts +240 -0
- package/dist/networking/models/wifi.mjs +562 -0
- package/dist/networking/nat-traversal.d.mts +24 -0
- package/dist/networking/nat-traversal.mjs +38 -0
- package/dist/networking/protocols.d.mts +17 -0
- package/dist/networking/protocols.mjs +57 -0
- package/dist/networking/queue.d.mts +12 -0
- package/dist/networking/queue.mjs +18 -0
- package/dist/networking/route-learning.d.mts +23 -0
- package/dist/networking/route-learning.mjs +43 -0
- package/dist/networking/routing.d.mts +11 -0
- package/dist/networking/routing.mjs +25 -0
- package/dist/networking/signals.d.mts +26 -0
- package/dist/networking/signals.mjs +35 -0
- package/dist/networking/subnet.d.mts +49 -0
- package/dist/networking/subnet.mjs +89 -0
- package/dist/networking/tcp-reliability.d.mts +24 -0
- package/dist/networking/tcp-reliability.mjs +38 -0
- package/dist/networking/topology/contract.d.mts +123 -0
- package/dist/networking/topology/index.d.mts +4 -0
- package/dist/networking/topology/index.mjs +4 -0
- package/dist/networking/topology/presets.d.mts +7 -0
- package/dist/networking/topology/presets.mjs +302 -0
- package/dist/networking/topology/simulation.d.mts +8 -0
- package/dist/networking/topology/simulation.mjs +179 -0
- package/dist/networking/wireless.d.mts +11 -0
- package/dist/networking/wireless.mjs +17 -0
- package/dist/optics/imaging.d.mts +218 -0
- package/dist/optics/imaging.mjs +276 -0
- package/dist/optics/index.d.mts +7 -0
- package/dist/optics/index.mjs +8 -0
- package/dist/optics/laws.d.mts +70 -0
- package/dist/optics/laws.mjs +195 -0
- package/dist/optics/prism.d.mts +148 -0
- package/dist/optics/prism.mjs +197 -0
- package/dist/optics/refraction.d.mts +201 -0
- package/dist/optics/refraction.mjs +270 -0
- package/dist/optics/wave-optics.d.mts +171 -0
- package/dist/optics/wave-optics.mjs +259 -0
- package/dist/physics/ac/index.d.mts +183 -0
- package/dist/physics/ac/index.mjs +203 -0
- package/dist/physics/dynamics/forces.d.mts +98 -0
- package/dist/physics/dynamics/forces.mjs +153 -0
- package/dist/physics/dynamics/friction.d.mts +76 -0
- package/dist/physics/dynamics/friction.mjs +119 -0
- package/dist/physics/dynamics/system.d.mts +68 -0
- package/dist/physics/dynamics/system.mjs +125 -0
- package/dist/physics/electrostatics/index.d.mts +169 -0
- package/dist/physics/electrostatics/index.mjs +249 -0
- package/dist/physics/energy/centre-of-mass.d.mts +115 -0
- package/dist/physics/energy/centre-of-mass.mjs +180 -0
- package/dist/physics/energy/conservation.d.mts +81 -0
- package/dist/physics/energy/conservation.mjs +129 -0
- package/dist/physics/energy/power.d.mts +90 -0
- package/dist/physics/energy/power.mjs +167 -0
- package/dist/physics/energy/spring.d.mts +73 -0
- package/dist/physics/energy/spring.mjs +129 -0
- package/dist/physics/energy/store.d.mts +63 -0
- package/dist/physics/energy/store.mjs +108 -0
- package/dist/physics/energy/theorem.d.mts +65 -0
- package/dist/physics/energy/theorem.mjs +113 -0
- package/dist/physics/energy/work.d.mts +114 -0
- package/dist/physics/energy/work.mjs +219 -0
- package/dist/physics/gravitation/body.d.mts +85 -0
- package/dist/physics/gravitation/body.mjs +168 -0
- package/dist/physics/gravitation/kepler.d.mts +127 -0
- package/dist/physics/gravitation/kepler.mjs +216 -0
- package/dist/physics/gravitation/law.d.mts +117 -0
- package/dist/physics/gravitation/law.mjs +175 -0
- package/dist/physics/gravitation/orbit.d.mts +119 -0
- package/dist/physics/gravitation/orbit.mjs +202 -0
- package/dist/physics/gravitation/potential.d.mts +114 -0
- package/dist/physics/gravitation/potential.mjs +202 -0
- package/dist/physics/gravitation/variation.d.mts +97 -0
- package/dist/physics/gravitation/variation.mjs +175 -0
- package/dist/physics/index.d.mts +35 -0
- package/dist/physics/index.mjs +36 -0
- package/dist/physics/integral-sweep.d.mts +63 -0
- package/dist/physics/integral-sweep.mjs +126 -0
- package/dist/physics/kinematics/equations.d.mts +47 -0
- package/dist/physics/kinematics/equations.mjs +126 -0
- package/dist/physics/kinematics/free-fall.d.mts +53 -0
- package/dist/physics/kinematics/free-fall.mjs +71 -0
- package/dist/physics/kinematics/given.d.mts +16 -0
- package/dist/physics/kinematics/given.mjs +55 -0
- package/dist/physics/kinematics/roots.d.mts +41 -0
- package/dist/physics/kinematics/roots.mjs +72 -0
- package/dist/physics/kinematics/solve.d.mts +52 -0
- package/dist/physics/kinematics/solve.mjs +172 -0
- package/dist/physics/magnetism/biot-savart.d.mts +161 -0
- package/dist/physics/magnetism/biot-savart.mjs +353 -0
- package/dist/physics/magnetism/flux.d.mts +94 -0
- package/dist/physics/magnetism/flux.mjs +313 -0
- package/dist/physics/magnetism/geomagnetism.d.mts +151 -0
- package/dist/physics/magnetism/geomagnetism.mjs +184 -0
- package/dist/physics/magnetism/index.d.mts +12 -0
- package/dist/physics/magnetism/index.mjs +74 -0
- package/dist/physics/magnetism/lorentz.d.mts +28 -0
- package/dist/physics/magnetism/lorentz.mjs +88 -0
- package/dist/physics/magnetism/magnetic-force.d.mts +102 -0
- package/dist/physics/magnetism/magnetic-force.mjs +169 -0
- package/dist/physics/momentum/collide.d.mts +77 -0
- package/dist/physics/momentum/collide.mjs +115 -0
- package/dist/physics/momentum/impulse.d.mts +89 -0
- package/dist/physics/momentum/impulse.mjs +159 -0
- package/dist/physics/momentum/planar.d.mts +60 -0
- package/dist/physics/momentum/planar.mjs +110 -0
- package/dist/physics/projectile.d.mts +107 -0
- package/dist/physics/projectile.mjs +185 -0
- package/dist/physics/rotation/angular.d.mts +85 -0
- package/dist/physics/rotation/angular.mjs +130 -0
- package/dist/physics/rotation/circular.d.mts +79 -0
- package/dist/physics/rotation/circular.mjs +131 -0
- package/dist/physics/rotation/inertia.d.mts +164 -0
- package/dist/physics/rotation/inertia.mjs +332 -0
- package/dist/physics/rotation/torque.d.mts +65 -0
- package/dist/physics/rotation/torque.mjs +134 -0
- package/dist/physics/vectors.d.mts +64 -0
- package/dist/physics/vectors.mjs +114 -0
- package/dist/primitives/Dot.d.mts +2 -15
- package/dist/primitives/Dot.mjs +6 -4
- package/dist/primitives/Grid.d.mts +33 -17
- package/dist/primitives/Grid.mjs +89 -17
- package/dist/primitives/Label.d.mts +1 -14
- package/dist/primitives/Label.mjs +3 -2
- package/dist/primitives/Lines.d.mts +4 -32
- package/dist/primitives/Lines.mjs +10 -8
- package/dist/primitives/Shapes.d.mts +5 -43
- package/dist/primitives/Shapes.mjs +12 -10
- package/dist/primitives/index.d.mts +2 -2
- package/dist/primitives/index.mjs +2 -2
- package/dist/primitives/props.mjs +31 -0
- package/dist/quantity/index.d.mts +119 -0
- package/dist/quantity/index.mjs +417 -0
- package/dist/relation/derive.d.mts +74 -0
- package/dist/relation/derive.mjs +73 -0
- package/dist/relation/index.d.mts +56 -0
- package/dist/relation/index.mjs +234 -0
- package/dist/scene/Scene.d.mts +6 -1
- package/dist/scene/Scene.mjs +15 -40
- package/dist/scene/evaluators.mjs +1 -1
- package/dist/sim/thermal.mjs +45 -20
- package/dist/thermo/calorimetry.d.mts +207 -0
- package/dist/thermo/calorimetry.mjs +345 -0
- package/dist/thermo/cycles.d.mts +142 -0
- package/dist/thermo/cycles.mjs +256 -0
- package/dist/thermo/entropy.d.mts +87 -0
- package/dist/thermo/entropy.mjs +140 -0
- package/dist/thermo/expansion.d.mts +130 -0
- package/dist/thermo/expansion.mjs +178 -0
- package/dist/thermo/gas.d.mts +197 -0
- package/dist/thermo/gas.mjs +279 -0
- package/dist/thermo/heat-transfer.d.mts +164 -0
- package/dist/thermo/heat-transfer.mjs +217 -0
- package/dist/thermo/index.d.mts +9 -82
- package/dist/thermo/index.mjs +9 -132
- package/dist/thermo/processes.d.mts +95 -0
- package/dist/thermo/processes.mjs +154 -0
- package/dist/thermo/temperature.d.mts +174 -0
- package/dist/thermo/temperature.mjs +236 -0
- package/dist/view/Stage.mjs +4 -11
- package/dist/waves/damping.d.mts +224 -0
- package/dist/waves/damping.mjs +317 -0
- package/dist/waves/doppler.d.mts +72 -0
- package/dist/waves/doppler.mjs +125 -0
- package/dist/waves/index.d.mts +10 -0
- package/dist/waves/index.mjs +10 -0
- package/dist/waves/pendulum.d.mts +130 -0
- package/dist/waves/pendulum.mjs +211 -0
- package/dist/waves/pitch.d.mts +125 -0
- package/dist/waves/pitch.mjs +158 -0
- package/dist/waves/shm.d.mts +170 -0
- package/dist/waves/shm.mjs +279 -0
- package/dist/waves/springs.d.mts +103 -0
- package/dist/waves/springs.mjs +176 -0
- package/dist/waves/superposition.d.mts +124 -0
- package/dist/waves/superposition.mjs +196 -0
- package/dist/waves/wave.d.mts +154 -0
- package/dist/waves/wave.mjs +178 -0
- package/package.json +103 -23
- package/styles.css +125 -8
- package/dist/assets/kit/index.mjs +0 -4
|
@@ -1,50 +1,22 @@
|
|
|
1
1
|
import { Vec2 } from "../core/vec.mjs";
|
|
2
2
|
import { StyleProps } from "./props.mjs";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
3
|
|
|
5
4
|
//#region src/primitives/Lines.d.ts
|
|
6
5
|
interface SegmentProps extends StyleProps {
|
|
7
6
|
from: Vec2;
|
|
8
7
|
to: Vec2;
|
|
9
8
|
}
|
|
10
|
-
declare
|
|
11
|
-
from,
|
|
12
|
-
to,
|
|
13
|
-
color,
|
|
14
|
-
weight,
|
|
15
|
-
opacity,
|
|
16
|
-
dashed
|
|
17
|
-
}: SegmentProps): ReactNode;
|
|
9
|
+
declare const Segment: import("react").NamedExoticComponent<SegmentProps>;
|
|
18
10
|
interface LineProps extends StyleProps {
|
|
19
11
|
from: Vec2;
|
|
20
12
|
to: Vec2;
|
|
21
13
|
}
|
|
22
|
-
declare
|
|
23
|
-
|
|
24
|
-
to,
|
|
25
|
-
color,
|
|
26
|
-
weight,
|
|
27
|
-
opacity,
|
|
28
|
-
dashed
|
|
29
|
-
}: LineProps): ReactNode;
|
|
30
|
-
declare function Ray({
|
|
31
|
-
from,
|
|
32
|
-
to,
|
|
33
|
-
color,
|
|
34
|
-
weight,
|
|
35
|
-
opacity,
|
|
36
|
-
dashed
|
|
37
|
-
}: LineProps): ReactNode;
|
|
14
|
+
declare const Line: import("react").NamedExoticComponent<LineProps>;
|
|
15
|
+
declare const Ray: import("react").NamedExoticComponent<LineProps>;
|
|
38
16
|
interface VectorProps extends StyleProps {
|
|
39
17
|
tail?: Vec2;
|
|
40
18
|
tip: Vec2;
|
|
41
19
|
}
|
|
42
|
-
declare
|
|
43
|
-
tail,
|
|
44
|
-
tip,
|
|
45
|
-
color,
|
|
46
|
-
weight,
|
|
47
|
-
opacity
|
|
48
|
-
}: VectorProps): ReactNode;
|
|
20
|
+
declare const Vector: import("react").NamedExoticComponent<VectorProps>;
|
|
49
21
|
//#endregion
|
|
50
22
|
export { Line, LineProps, Ray, Segment, SegmentProps, Vector, VectorProps };
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { fmt } from "../core/coords.mjs";
|
|
4
4
|
import { useCoords } from "../core/context.mjs";
|
|
5
|
+
import { geomPropsEqual } from "./props.mjs";
|
|
6
|
+
import { memo } from "react";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
|
|
7
9
|
//#region src/primitives/Lines.tsx
|
|
@@ -14,7 +16,7 @@ const extend = (c, a, b, back) => {
|
|
|
14
16
|
const big = Math.hypot(c.width, c.height) * 2;
|
|
15
17
|
return [back ? [a[0] - ux * big, a[1] - uy * big] : a, [a[0] + ux * big, a[1] + uy * big]];
|
|
16
18
|
};
|
|
17
|
-
function Segment({ from, to, color = "var(--stage-fg)", weight = 2, opacity = 1, dashed }) {
|
|
19
|
+
const Segment = memo(function Segment({ from, to, color = "var(--stage-fg)", weight = 2, opacity = 1, dashed }) {
|
|
18
20
|
const c = useCoords();
|
|
19
21
|
const a = c.toPx(from.x, from.y);
|
|
20
22
|
const b = c.toPx(to.x, to.y);
|
|
@@ -29,8 +31,8 @@ function Segment({ from, to, color = "var(--stage-fg)", weight = 2, opacity = 1,
|
|
|
29
31
|
strokeLinecap: "round",
|
|
30
32
|
strokeDasharray: dashed ? "6 6" : void 0
|
|
31
33
|
});
|
|
32
|
-
}
|
|
33
|
-
function Line({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1, dashed }) {
|
|
34
|
+
}, geomPropsEqual);
|
|
35
|
+
const Line = memo(function Line({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1, dashed }) {
|
|
34
36
|
const c = useCoords();
|
|
35
37
|
const [p1, p2] = extend(c, c.toPx(from.x, from.y), c.toPx(to.x, to.y), true);
|
|
36
38
|
return /* @__PURE__ */ jsx("line", {
|
|
@@ -43,8 +45,8 @@ function Line({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1,
|
|
|
43
45
|
opacity,
|
|
44
46
|
strokeDasharray: dashed ? "6 6" : void 0
|
|
45
47
|
});
|
|
46
|
-
}
|
|
47
|
-
function Ray({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1, dashed }) {
|
|
48
|
+
}, geomPropsEqual);
|
|
49
|
+
const Ray = memo(function Ray({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1, dashed }) {
|
|
48
50
|
const c = useCoords();
|
|
49
51
|
const [p1, p2] = extend(c, c.toPx(from.x, from.y), c.toPx(to.x, to.y), false);
|
|
50
52
|
return /* @__PURE__ */ jsx("line", {
|
|
@@ -57,8 +59,8 @@ function Ray({ from, to, color = "var(--stage-axis)", weight = 2, opacity = 1, d
|
|
|
57
59
|
opacity,
|
|
58
60
|
strokeDasharray: dashed ? "6 6" : void 0
|
|
59
61
|
});
|
|
60
|
-
}
|
|
61
|
-
function Vector({ tail = {
|
|
62
|
+
}, geomPropsEqual);
|
|
63
|
+
const Vector = memo(function Vector({ tail = {
|
|
62
64
|
x: 0,
|
|
63
65
|
y: 0
|
|
64
66
|
}, tip, color = "var(--stage-accent-2)", weight = 2.5, opacity = 1 }) {
|
|
@@ -76,7 +78,7 @@ function Vector({ tail = {
|
|
|
76
78
|
strokeLinecap: "round",
|
|
77
79
|
markerEnd: "url(#stage-arrow)"
|
|
78
80
|
});
|
|
79
|
-
}
|
|
81
|
+
}, geomPropsEqual);
|
|
80
82
|
|
|
81
83
|
//#endregion
|
|
82
84
|
export { Line, Ray, Segment, Vector };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Vec2 } from "../core/vec.mjs";
|
|
2
2
|
import { StyleProps } from "./props.mjs";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
3
|
|
|
5
4
|
//#region src/primitives/Shapes.d.ts
|
|
6
5
|
interface CircleProps extends StyleProps {
|
|
@@ -9,15 +8,7 @@ interface CircleProps extends StyleProps {
|
|
|
9
8
|
fill?: string;
|
|
10
9
|
fillOpacity?: number;
|
|
11
10
|
}
|
|
12
|
-
declare
|
|
13
|
-
center,
|
|
14
|
-
r,
|
|
15
|
-
color,
|
|
16
|
-
fill,
|
|
17
|
-
fillOpacity,
|
|
18
|
-
weight,
|
|
19
|
-
opacity
|
|
20
|
-
}: CircleProps): ReactNode;
|
|
11
|
+
declare const Circle: import("react").NamedExoticComponent<CircleProps>;
|
|
21
12
|
interface EllipseProps extends StyleProps {
|
|
22
13
|
center: Vec2;
|
|
23
14
|
rx: number;
|
|
@@ -25,52 +16,23 @@ interface EllipseProps extends StyleProps {
|
|
|
25
16
|
fill?: string;
|
|
26
17
|
fillOpacity?: number;
|
|
27
18
|
}
|
|
28
|
-
declare
|
|
29
|
-
center,
|
|
30
|
-
rx,
|
|
31
|
-
ry,
|
|
32
|
-
color,
|
|
33
|
-
fill,
|
|
34
|
-
fillOpacity,
|
|
35
|
-
weight,
|
|
36
|
-
opacity
|
|
37
|
-
}: EllipseProps): ReactNode;
|
|
19
|
+
declare const Ellipse: import("react").NamedExoticComponent<EllipseProps>;
|
|
38
20
|
interface PolygonProps extends StyleProps {
|
|
39
21
|
points: Vec2[];
|
|
40
22
|
fill?: string;
|
|
41
23
|
fillOpacity?: number;
|
|
42
24
|
}
|
|
43
|
-
declare
|
|
44
|
-
points,
|
|
45
|
-
color,
|
|
46
|
-
fill,
|
|
47
|
-
fillOpacity,
|
|
48
|
-
weight,
|
|
49
|
-
opacity
|
|
50
|
-
}: PolygonProps): ReactNode;
|
|
25
|
+
declare const Polygon: import("react").NamedExoticComponent<PolygonProps>;
|
|
51
26
|
interface PolylineProps extends StyleProps {
|
|
52
27
|
points: Vec2[];
|
|
53
28
|
}
|
|
54
|
-
declare
|
|
55
|
-
points,
|
|
56
|
-
color,
|
|
57
|
-
weight,
|
|
58
|
-
opacity,
|
|
59
|
-
dashed
|
|
60
|
-
}: PolylineProps): ReactNode;
|
|
29
|
+
declare const Polyline: import("react").NamedExoticComponent<PolylineProps>;
|
|
61
30
|
/** Low-level pixel-space path (d is already in pixels). */
|
|
62
31
|
interface PathProps extends StyleProps {
|
|
63
32
|
d: string;
|
|
64
33
|
fill?: string;
|
|
65
34
|
fillOpacity?: number;
|
|
66
35
|
}
|
|
67
|
-
declare
|
|
68
|
-
d,
|
|
69
|
-
color,
|
|
70
|
-
fill,
|
|
71
|
-
fillOpacity,
|
|
72
|
-
weight,
|
|
73
|
-
opacity
|
|
74
|
-
}: PathProps): ReactNode;
|
|
36
|
+
declare const Path: import("react").NamedExoticComponent<PathProps>;
|
|
75
37
|
//#endregion
|
|
76
38
|
export { Circle, CircleProps, Ellipse, EllipseProps, Path, PathProps, Polygon, PolygonProps, Polyline, PolylineProps };
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { fmt } from "../core/coords.mjs";
|
|
4
4
|
import { useCoords } from "../core/context.mjs";
|
|
5
|
+
import { geomPropsEqual } from "./props.mjs";
|
|
6
|
+
import { memo } from "react";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
|
|
7
9
|
//#region src/primitives/Shapes.tsx
|
|
@@ -9,7 +11,7 @@ const toPoints = (c, points) => points.map((p) => {
|
|
|
9
11
|
const [x, y] = c.toPx(p.x, p.y);
|
|
10
12
|
return `${fmt(x)},${fmt(y)}`;
|
|
11
13
|
}).join(" ");
|
|
12
|
-
function Circle({ center, r, color = "var(--stage-accent)", fill = "none", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
14
|
+
const Circle = memo(function Circle({ center, r, color = "var(--stage-accent)", fill = "none", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
13
15
|
const c = useCoords();
|
|
14
16
|
const [cx, cy] = c.toPx(center.x, center.y);
|
|
15
17
|
return /* @__PURE__ */ jsx("ellipse", {
|
|
@@ -23,8 +25,8 @@ function Circle({ center, r, color = "var(--stage-accent)", fill = "none", fillO
|
|
|
23
25
|
fillOpacity: fill === "none" ? void 0 : fillOpacity,
|
|
24
26
|
opacity
|
|
25
27
|
});
|
|
26
|
-
}
|
|
27
|
-
function Ellipse({ center, rx, ry, color = "var(--stage-accent)", fill = "none", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
28
|
+
}, geomPropsEqual);
|
|
29
|
+
const Ellipse = memo(function Ellipse({ center, rx, ry, color = "var(--stage-accent)", fill = "none", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
28
30
|
const c = useCoords();
|
|
29
31
|
const [cx, cy] = c.toPx(center.x, center.y);
|
|
30
32
|
return /* @__PURE__ */ jsx("ellipse", {
|
|
@@ -38,8 +40,8 @@ function Ellipse({ center, rx, ry, color = "var(--stage-accent)", fill = "none",
|
|
|
38
40
|
fillOpacity: fill === "none" ? void 0 : fillOpacity,
|
|
39
41
|
opacity
|
|
40
42
|
});
|
|
41
|
-
}
|
|
42
|
-
function Polygon({ points, color = "var(--stage-accent)", fill = "var(--stage-accent)", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
43
|
+
}, geomPropsEqual);
|
|
44
|
+
const Polygon = memo(function Polygon({ points, color = "var(--stage-accent)", fill = "var(--stage-accent)", fillOpacity = .12, weight = 2, opacity = 1 }) {
|
|
43
45
|
return /* @__PURE__ */ jsx("polygon", {
|
|
44
46
|
points: toPoints(useCoords(), points),
|
|
45
47
|
stroke: color,
|
|
@@ -49,8 +51,8 @@ function Polygon({ points, color = "var(--stage-accent)", fill = "var(--stage-ac
|
|
|
49
51
|
opacity,
|
|
50
52
|
strokeLinejoin: "round"
|
|
51
53
|
});
|
|
52
|
-
}
|
|
53
|
-
function Polyline({ points, color = "var(--stage-fg)", weight = 2, opacity = 1, dashed }) {
|
|
54
|
+
}, geomPropsEqual);
|
|
55
|
+
const Polyline = memo(function Polyline({ points, color = "var(--stage-fg)", weight = 2, opacity = 1, dashed }) {
|
|
54
56
|
return /* @__PURE__ */ jsx("polyline", {
|
|
55
57
|
points: toPoints(useCoords(), points),
|
|
56
58
|
fill: "none",
|
|
@@ -61,8 +63,8 @@ function Polyline({ points, color = "var(--stage-fg)", weight = 2, opacity = 1,
|
|
|
61
63
|
strokeLinecap: "round",
|
|
62
64
|
strokeDasharray: dashed ? "6 6" : void 0
|
|
63
65
|
});
|
|
64
|
-
}
|
|
65
|
-
function Path({ d, color = "var(--stage-fg)", fill = "none", fillOpacity = 1, weight = 2, opacity = 1 }) {
|
|
66
|
+
}, geomPropsEqual);
|
|
67
|
+
const Path = memo(function Path({ d, color = "var(--stage-fg)", fill = "none", fillOpacity = 1, weight = 2, opacity = 1 }) {
|
|
66
68
|
return /* @__PURE__ */ jsx("path", {
|
|
67
69
|
d,
|
|
68
70
|
stroke: color,
|
|
@@ -73,7 +75,7 @@ function Path({ d, color = "var(--stage-fg)", fill = "none", fillOpacity = 1, we
|
|
|
73
75
|
strokeLinejoin: "round",
|
|
74
76
|
strokeLinecap: "round"
|
|
75
77
|
});
|
|
76
|
-
}
|
|
78
|
+
}, geomPropsEqual);
|
|
77
79
|
|
|
78
80
|
//#endregion
|
|
79
81
|
export { Circle, Ellipse, Path, Polygon, Polyline };
|
|
@@ -4,7 +4,7 @@ import { Line, LineProps, Ray, Segment, SegmentProps, Vector, VectorProps } from
|
|
|
4
4
|
import { Circle, CircleProps, Ellipse, EllipseProps, Path, PathProps, Polygon, PolygonProps, Polyline, PolylineProps } from "./Shapes.mjs";
|
|
5
5
|
import { Label, LabelProps } from "./Label.mjs";
|
|
6
6
|
import { Tex, TexProps } from "./Tex.mjs";
|
|
7
|
-
import { Axes, AxesProps, Grid, GridProps, niceStep } from "./Grid.mjs";
|
|
7
|
+
import { Axes, AxesProps, ClearZone, Grid, GridProps, clearOfLabel, niceStep } from "./Grid.mjs";
|
|
8
8
|
import { OfXProps, OfYProps, ParametricProps, Plot } from "./Plot.mjs";
|
|
9
9
|
import { CanvasLayer, CanvasLayerProps } from "./CanvasLayer.mjs";
|
|
10
|
-
export { type A11yProps, Axes, type AxesProps, CanvasLayer, type CanvasLayerProps, Circle, type CircleProps, Dot, type DotProps, Ellipse, type EllipseProps, Grid, type GridProps, Label, type LabelProps, Line, type LineProps, type OfXProps, type OfYProps, type ParametricProps, Path, type PathProps, Plot, Point, Polygon, type PolygonProps, Polyline, type PolylineProps, Ray, Segment, type SegmentProps, type StyleProps, Tex, type TexProps, Vector, type VectorProps, niceStep };
|
|
10
|
+
export { type A11yProps, Axes, type AxesProps, CanvasLayer, type CanvasLayerProps, Circle, type CircleProps, type ClearZone, Dot, type DotProps, Ellipse, type EllipseProps, Grid, type GridProps, Label, type LabelProps, Line, type LineProps, type OfXProps, type OfYProps, type ParametricProps, Path, type PathProps, Plot, Point, Polygon, type PolygonProps, Polyline, type PolylineProps, Ray, Segment, type SegmentProps, type StyleProps, Tex, type TexProps, Vector, type VectorProps, clearOfLabel, niceStep };
|
|
@@ -3,8 +3,8 @@ import { Line, Ray, Segment, Vector } from "./Lines.mjs";
|
|
|
3
3
|
import { Circle, Ellipse, Path, Polygon, Polyline } from "./Shapes.mjs";
|
|
4
4
|
import { Label } from "./Label.mjs";
|
|
5
5
|
import { Tex } from "./Tex.mjs";
|
|
6
|
-
import { Axes, Grid, niceStep } from "./Grid.mjs";
|
|
6
|
+
import { Axes, Grid, clearOfLabel, niceStep } from "./Grid.mjs";
|
|
7
7
|
import { Plot } from "./Plot.mjs";
|
|
8
8
|
import { CanvasLayer } from "./CanvasLayer.mjs";
|
|
9
9
|
|
|
10
|
-
export { Axes, CanvasLayer, Circle, Dot, Ellipse, Grid, Label, Line, Path, Plot, Point, Polygon, Polyline, Ray, Segment, Tex, Vector, niceStep };
|
|
10
|
+
export { Axes, CanvasLayer, Circle, Dot, Ellipse, Grid, Label, Line, Path, Plot, Point, Polygon, Polyline, Ray, Segment, Tex, Vector, clearOfLabel, niceStep };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/primitives/props.ts
|
|
2
|
+
const MAX_DEPTH = 4;
|
|
3
|
+
const valEq = (a, b, depth) => {
|
|
4
|
+
if (Object.is(a, b)) return true;
|
|
5
|
+
if (depth <= 0) return false;
|
|
6
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
7
|
+
if ("$$typeof" in a || "$$typeof" in b) return false;
|
|
8
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
9
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
10
|
+
for (let i = 0; i < a.length; i++) if (!valEq(a[i], b[i], depth - 1)) return false;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const ka = Object.keys(a);
|
|
14
|
+
if (ka.length !== Object.keys(b).length) return false;
|
|
15
|
+
for (const k of ka) {
|
|
16
|
+
if (!(k in b)) return false;
|
|
17
|
+
if (!valEq(a[k], b[k], depth - 1)) return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Value-based props comparator for `React.memo` on geometry primitives.
|
|
23
|
+
* Labs recreate `Vec2`/`points` objects every render (often 60×/s under a frame
|
|
24
|
+
* tick), so identity-based memo never hits; comparing coordinate VALUES lets
|
|
25
|
+
* static shapes skip reconciliation while anything that actually moved still
|
|
26
|
+
* re-renders. Functions and React elements compare by reference (safe fallback).
|
|
27
|
+
*/
|
|
28
|
+
const geomPropsEqual = (prev, next) => valEq(prev, next, MAX_DEPTH);
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { geomPropsEqual };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//#region src/quantity/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* quantity, a number that knows its unit.
|
|
4
|
+
*
|
|
5
|
+
* The model: every quantity is stored as its value in SI BASE UNITS plus a dimension vector over
|
|
6
|
+
* (kg, m, s, mol, K, A). A unit string is a recipe for converting to that pair, so arithmetic is
|
|
7
|
+
* ordinary arithmetic on the SI values and integer addition on the exponents:
|
|
8
|
+
*
|
|
9
|
+
* a · b → si = a.si · b.si, dim = a.dim + b.dim
|
|
10
|
+
* a / b → si = a.si / b.si, dim = a.dim − b.dim
|
|
11
|
+
* a ± b → requires a.dim = b.dim
|
|
12
|
+
*
|
|
13
|
+
* Why this matters more than it looks. "Choose the right formula" is, operationally, "choose the
|
|
14
|
+
* one whose units cancel to the unit the answer is in", and cm³-against-dm³ is the single most
|
|
15
|
+
* common arithmetic error in A-level chemistry. Under this model that error cannot be made:
|
|
16
|
+
*
|
|
17
|
+
* qty(0.100, 'mol/dm3').times(qty(24.50, 'cm3')) → 2.45e-3 mol
|
|
18
|
+
*
|
|
19
|
+
* is simply correct, because both volumes reduce to m³ and the factors cancel. (An earlier plan
|
|
20
|
+
* said this case should THROW, on the grounds that cm³ "is not" dm³. That would be a worse design:
|
|
21
|
+
* it rejects a valid calculation and leaves the author to do the conversion by hand, which is the
|
|
22
|
+
* step that goes wrong.) What does throw is genuine nonsense: adding a mass to a volume, or asking
|
|
23
|
+
* for a mass in dm³.
|
|
24
|
+
*
|
|
25
|
+
* SCOPE, deliberately small: dimensional analysis over a fixed table of the units the Cambridge
|
|
26
|
+
* syllabuses actually use. Not a general units library, not arbitrary dimensional algebra, no
|
|
27
|
+
* user-defined units. The whole of A-level chemistry and physics fits in the table below.
|
|
28
|
+
*
|
|
29
|
+
* Pure: no React, no pixels.
|
|
30
|
+
*/
|
|
31
|
+
/** SI base dimensions. Everything in the table reduces to integer powers of these. */
|
|
32
|
+
declare const BASE: readonly ["kg", "m", "s", "mol", "K", "A"];
|
|
33
|
+
type Base = (typeof BASE)[number];
|
|
34
|
+
/** Integer powers of the base dimensions. Absent key = power 0. */
|
|
35
|
+
type Dimension = Readonly<Partial<Record<Base, number>>>;
|
|
36
|
+
declare const DIMENSIONLESS: Dimension;
|
|
37
|
+
declare const mulDim: (a: Dimension, b: Dimension) => Dimension;
|
|
38
|
+
declare const divDim: (a: Dimension, b: Dimension) => Dimension;
|
|
39
|
+
/** Raise a dimension to an integer power. A fractional power is legal only if it leaves every
|
|
40
|
+
* exponent an integer, which is what makes `sqrt(Ka·c)` work and `sqrt(mol)` fail. */
|
|
41
|
+
declare function powDim(a: Dimension, n: number): Dimension;
|
|
42
|
+
declare const sameDim: (a: Dimension, b: Dimension) => boolean;
|
|
43
|
+
declare const isDimensionless: (a: Dimension) => boolean;
|
|
44
|
+
/** For error messages, where "1" would read as a number rather than as "has no units". */
|
|
45
|
+
declare const describeDimension: (d: Dimension) => string;
|
|
46
|
+
/**
|
|
47
|
+
* "kg·m^2/s^2·mol": readable in an error message AND parseable by `parseUnit`.
|
|
48
|
+
*
|
|
49
|
+
* Both properties are required. It names the dimension in messages, and it also names the unit of
|
|
50
|
+
* a quantity produced by arithmetic, which is then re-read the next time that quantity is used. An
|
|
51
|
+
* earlier version emitted `m2`, which reads back as an unknown unit rather than as m², so a
|
|
52
|
+
* perfectly good result became unusable one operation later.
|
|
53
|
+
*/
|
|
54
|
+
declare function formatDimension(d: Dimension): string;
|
|
55
|
+
interface ResolvedUnit {
|
|
56
|
+
readonly dim: Dimension;
|
|
57
|
+
readonly factor: number;
|
|
58
|
+
readonly offset?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a unit string to a dimension and a factor.
|
|
62
|
+
*
|
|
63
|
+
* Grammar: atoms separated by `·`, `*` or a space are multiplied; **every** segment after a `/` is
|
|
64
|
+
* a denominator, so `J/K/mol` is J·K⁻¹·mol⁻¹. That reading is the chemistry convention and it is
|
|
65
|
+
* stated here because `a/b/c` is genuinely ambiguous in general.
|
|
66
|
+
*
|
|
67
|
+
* An atom may carry an integer exponent written with a caret: `mol^2`, `dm3^2` (which is dm⁶, the
|
|
68
|
+
* denominator of a Ksp for a 1:2 salt). The caret is REQUIRED rather than optional, because a
|
|
69
|
+
* trailing digit is already part of the name in `dm3` and `cm3`, so `dm6` would have to be read as
|
|
70
|
+
* both a name and a power.
|
|
71
|
+
*/
|
|
72
|
+
declare function parseUnit(spec: string): ResolvedUnit;
|
|
73
|
+
/** The units this kernel knows, for an error message or an editor. */
|
|
74
|
+
declare const knownUnits: () => string[];
|
|
75
|
+
/**
|
|
76
|
+
* A value with a unit. Immutable: every operation returns a new Quantity.
|
|
77
|
+
*
|
|
78
|
+
* `si` is the value in SI base units and is the single source of truth; `unit` is only how it is
|
|
79
|
+
* currently being displayed.
|
|
80
|
+
*/
|
|
81
|
+
declare class Quantity {
|
|
82
|
+
readonly si: number;
|
|
83
|
+
readonly dim: Dimension;
|
|
84
|
+
readonly unit: string;
|
|
85
|
+
/** True only for a Celsius temperature. Carried rather than re-derived: see `requireScale`. */
|
|
86
|
+
private readonly onScale;
|
|
87
|
+
private constructor();
|
|
88
|
+
static of(value: number, unit: string): Quantity;
|
|
89
|
+
/** Build directly from an SI value, naming the unit from the dimension. */
|
|
90
|
+
static fromSI(si: number, dim: Dimension): Quantity;
|
|
91
|
+
/** The number, expressed in `this.unit`. */
|
|
92
|
+
get value(): number;
|
|
93
|
+
/** The number, expressed in `unit`. Throws if the dimensions differ. */
|
|
94
|
+
in(unit: string): number;
|
|
95
|
+
/** The same quantity, displayed in `unit`. */
|
|
96
|
+
to(unit: string): Quantity;
|
|
97
|
+
private requireScale;
|
|
98
|
+
times(other: Quantity | number): Quantity;
|
|
99
|
+
over(other: Quantity | number): Quantity;
|
|
100
|
+
plus(other: Quantity): Quantity;
|
|
101
|
+
/**
|
|
102
|
+
* Note what this CANNOT do: subtract two Celsius temperatures. The SI difference would be right
|
|
103
|
+
* (a kelvin interval) but the result would be displayed back on the Celsius scale, where 12.5 K
|
|
104
|
+
* reads as −260.65 °C. `requireScale` refuses it, and `.to('K')` on both sides is the fix.
|
|
105
|
+
*/
|
|
106
|
+
minus(other: Quantity): Quantity;
|
|
107
|
+
pow(n: number): Quantity;
|
|
108
|
+
private requireSame;
|
|
109
|
+
/** Equal within a RELATIVE tolerance (default 1e-9), after reducing both to SI. */
|
|
110
|
+
equals(other: Quantity, tol?: number): boolean;
|
|
111
|
+
/** "2.45e-3 mol", at `sf` significant figures. */
|
|
112
|
+
toString(sf?: number): string;
|
|
113
|
+
}
|
|
114
|
+
/** `qty(24.50, 'cm3')`. */
|
|
115
|
+
declare const qty: (value: number, unit: string) => Quantity;
|
|
116
|
+
/** The SI-coherent name for a dimension: 'mol', 'J', or a composed 'kg·m2/s2'. */
|
|
117
|
+
declare function canonicalUnit(dim: Dimension): string;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { Base, DIMENSIONLESS, Dimension, Quantity, canonicalUnit, describeDimension, divDim, formatDimension, isDimensionless, knownUnits, mulDim, parseUnit, powDim, qty, sameDim };
|