@classytic/labs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/biology/enzyme-rate/index.d.mts +1 -0
- package/dist/biology/enzyme-rate/preset.d.mts +25 -0
- package/dist/biology/enzyme-rate/preset.mjs +256 -0
- package/dist/biology/genetic-cross/core.d.mts +64 -0
- package/dist/biology/genetic-cross/core.mjs +147 -0
- package/dist/biology/genetic-cross/grid.mjs +239 -0
- package/dist/biology/genetic-cross/index.d.mts +3 -0
- package/dist/biology/genetic-cross/preset.d.mts +26 -0
- package/dist/biology/genetic-cross/preset.mjs +184 -0
- package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
- package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
- package/dist/biology/index.d.mts +11 -0
- package/dist/biology/index.mjs +12 -0
- package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
- package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
- package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
- package/dist/biology/punnett-cross/index.d.mts +1 -0
- package/dist/biology/punnett-cross/preset.d.mts +27 -0
- package/dist/biology/punnett-cross/preset.mjs +21 -0
- package/dist/biology/respiration/index.d.mts +1 -0
- package/dist/biology/respiration/preset.d.mts +17 -0
- package/dist/biology/respiration/preset.mjs +179 -0
- package/dist/biology/sequence/central-dogma.d.mts +17 -0
- package/dist/biology/sequence/central-dogma.mjs +339 -0
- package/dist/biology/sequence/core.d.mts +38 -0
- package/dist/biology/sequence/core.mjs +178 -0
- package/dist/biology/sequence/index.d.mts +3 -0
- package/dist/biology/sequence/preset.d.mts +20 -0
- package/dist/biology/sequence/preset.mjs +235 -0
- package/dist/blocks/accounting.d.mts +142 -0
- package/dist/blocks/accounting.mjs +446 -0
- package/dist/blocks/authoring.d.mts +12 -0
- package/dist/blocks/authoring.mjs +705 -0
- package/dist/blocks/biology.d.mts +197 -0
- package/dist/blocks/biology.mjs +513 -0
- package/dist/blocks/chem.d.mts +128 -0
- package/dist/blocks/chem.mjs +486 -0
- package/dist/blocks/circuits.d.mts +86 -0
- package/dist/blocks/circuits.mjs +348 -0
- package/dist/blocks/discrete.d.mts +62 -0
- package/dist/blocks/discrete.mjs +314 -0
- package/dist/blocks/economics.d.mts +56 -0
- package/dist/blocks/economics.mjs +203 -0
- package/dist/blocks/geography.d.mts +58 -0
- package/dist/blocks/geography.mjs +115 -0
- package/dist/blocks/geometry.d.mts +28 -0
- package/dist/blocks/geometry.mjs +160 -0
- package/dist/blocks/ict.d.mts +65 -0
- package/dist/blocks/ict.mjs +197 -0
- package/dist/blocks/index.d.mts +4555 -0
- package/dist/blocks/index.mjs +120 -0
- package/dist/blocks/lab-block.d.mts +16 -0
- package/dist/blocks/lab-block.mjs +74 -0
- package/dist/blocks/lab-config.d.mts +23 -0
- package/dist/blocks/lab-config.mjs +200 -0
- package/dist/blocks/lab-gallery.d.mts +30 -0
- package/dist/blocks/lab-gallery.mjs +208 -0
- package/dist/blocks/language.d.mts +349 -0
- package/dist/blocks/language.mjs +750 -0
- package/dist/blocks/lesson.d.mts +43 -0
- package/dist/blocks/lesson.mjs +140 -0
- package/dist/blocks/math.d.mts +411 -0
- package/dist/blocks/math.mjs +1536 -0
- package/dist/blocks/ml.d.mts +84 -0
- package/dist/blocks/ml.mjs +146 -0
- package/dist/blocks/physics.d.mts +259 -0
- package/dist/blocks/physics.mjs +868 -0
- package/dist/blocks/statistics.d.mts +29 -0
- package/dist/blocks/statistics.mjs +123 -0
- package/dist/catalog/index.d.mts +3 -0
- package/dist/catalog/index.mjs +8 -0
- package/dist/catalog/registry.d.mts +46 -0
- package/dist/catalog/registry.mjs +56 -0
- package/dist/catalog/templates.d.mts +11 -0
- package/dist/catalog/templates.mjs +141 -0
- package/dist/chem/battery.d.mts +16 -0
- package/dist/chem/battery.mjs +311 -0
- package/dist/chem/bohr-atom.d.mts +16 -0
- package/dist/chem/bohr-atom.mjs +212 -0
- package/dist/chem/diffusion/asset.mjs +76 -0
- package/dist/chem/diffusion/index.d.mts +1 -0
- package/dist/chem/diffusion/preset.d.mts +15 -0
- package/dist/chem/diffusion/preset.mjs +188 -0
- package/dist/chem/electrochem/index.d.mts +1 -0
- package/dist/chem/electrochem/preset.d.mts +23 -0
- package/dist/chem/electrochem/preset.mjs +402 -0
- package/dist/chem/equilibrium/index.d.mts +1 -0
- package/dist/chem/equilibrium/preset.d.mts +36 -0
- package/dist/chem/equilibrium/preset.mjs +416 -0
- package/dist/chem/gas-box/index.d.mts +1 -0
- package/dist/chem/gas-box/preset.d.mts +27 -0
- package/dist/chem/gas-box/preset.mjs +395 -0
- package/dist/chem/index.d.mts +16 -0
- package/dist/chem/index.mjs +17 -0
- package/dist/chem/kinetics/index.d.mts +1 -0
- package/dist/chem/kinetics/preset.d.mts +31 -0
- package/dist/chem/kinetics/preset.mjs +478 -0
- package/dist/chem/periodic-trends/index.d.mts +1 -0
- package/dist/chem/periodic-trends/preset.d.mts +21 -0
- package/dist/chem/periodic-trends/preset.mjs +831 -0
- package/dist/chem/reaction-lab.d.mts +18 -0
- package/dist/chem/reaction-lab.mjs +165 -0
- package/dist/chem/reaction-profile.d.mts +21 -0
- package/dist/chem/reaction-profile.mjs +287 -0
- package/dist/chem/solution/dilution.d.mts +27 -0
- package/dist/chem/solution/dilution.mjs +199 -0
- package/dist/chem/solution/field.d.mts +30 -0
- package/dist/chem/solution/field.mjs +145 -0
- package/dist/chem/solution/index.d.mts +3 -0
- package/dist/chem/solution/solution-box.d.mts +28 -0
- package/dist/chem/solution/solution-box.mjs +140 -0
- package/dist/chem/stoichiometry/index.d.mts +1 -0
- package/dist/chem/stoichiometry/preset.d.mts +29 -0
- package/dist/chem/stoichiometry/preset.mjs +392 -0
- package/dist/chem/titration/index.d.mts +1 -0
- package/dist/chem/titration/preset.d.mts +29 -0
- package/dist/chem/titration/preset.mjs +436 -0
- package/dist/circuits/ac-dc/asset.mjs +295 -0
- package/dist/circuits/ac-dc/index.d.mts +1 -0
- package/dist/circuits/ac-dc/preset.d.mts +16 -0
- package/dist/circuits/ac-dc/preset.mjs +134 -0
- package/dist/circuits/capacitor-leak/index.d.mts +1 -0
- package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
- package/dist/circuits/capacitor-leak/preset.mjs +271 -0
- package/dist/circuits/circuit/asset.d.mts +6 -0
- package/dist/circuits/circuit/asset.mjs +367 -0
- package/dist/circuits/circuit/index.d.mts +2 -0
- package/dist/circuits/circuit/preset.d.mts +46 -0
- package/dist/circuits/circuit/preset.mjs +235 -0
- package/dist/circuits/circuit-builder.d.mts +30 -0
- package/dist/circuits/circuit-builder.mjs +412 -0
- package/dist/circuits/circuit-lab.d.mts +20 -0
- package/dist/circuits/circuit-lab.mjs +400 -0
- package/dist/circuits/index.d.mts +7 -0
- package/dist/circuits/index.mjs +8 -0
- package/dist/commerce/accounting/core.d.mts +48 -0
- package/dist/commerce/accounting/core.mjs +57 -0
- package/dist/commerce/accounting/equation-balance.d.mts +35 -0
- package/dist/commerce/accounting/equation-balance.mjs +292 -0
- package/dist/commerce/accounting/index.d.mts +4 -0
- package/dist/commerce/accounting/journal-poster.d.mts +29 -0
- package/dist/commerce/accounting/journal-poster.mjs +472 -0
- package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
- package/dist/commerce/accounting/statement-sorter.mjs +304 -0
- package/dist/commerce/economics/core.d.mts +33 -0
- package/dist/commerce/economics/core.mjs +26 -0
- package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
- package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
- package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
- package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
- package/dist/commerce/economics/index.d.mts +4 -0
- package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
- package/dist/commerce/economics/market-equilibrium.mjs +340 -0
- package/dist/commerce/index.d.mts +9 -0
- package/dist/commerce/index.mjs +10 -0
- package/dist/core/easing.d.mts +28 -0
- package/dist/core/easing.mjs +66 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.mjs +11 -0
- package/dist/core/numeric.d.mts +37 -0
- package/dist/core/numeric.mjs +75 -0
- package/dist/core/reactive.d.mts +24 -0
- package/dist/core/reactive.mjs +51 -0
- package/dist/core/rng.d.mts +21 -0
- package/dist/core/rng.mjs +39 -0
- package/dist/core/tex.d.mts +14 -0
- package/dist/core/tex.mjs +44 -0
- package/dist/core/timeline.d.mts +34 -0
- package/dist/core/timeline.mjs +77 -0
- package/dist/core/util.d.mts +19 -0
- package/dist/core/util.mjs +31 -0
- package/dist/discrete/arrangements/preset.d.mts +28 -0
- package/dist/discrete/arrangements/preset.mjs +304 -0
- package/dist/discrete/bayes/preset.d.mts +33 -0
- package/dist/discrete/bayes/preset.mjs +476 -0
- package/dist/discrete/binomial/preset.d.mts +25 -0
- package/dist/discrete/binomial/preset.mjs +333 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -0
- package/dist/discrete/core/combinatorics.mjs +57 -0
- package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
- package/dist/discrete/core/inclusionExclusion.mjs +30 -0
- package/dist/discrete/core/pigeonhole.d.mts +15 -0
- package/dist/discrete/core/pigeonhole.mjs +24 -0
- package/dist/discrete/core/probability.d.mts +29 -0
- package/dist/discrete/core/probability.mjs +43 -0
- package/dist/discrete/core/sets.d.mts +21 -0
- package/dist/discrete/core/sets.mjs +45 -0
- package/dist/discrete/counting-slots/preset.d.mts +30 -0
- package/dist/discrete/counting-slots/preset.mjs +553 -0
- package/dist/discrete/counting-tree/index.d.mts +1 -0
- package/dist/discrete/counting-tree/preset.d.mts +44 -0
- package/dist/discrete/counting-tree/preset.mjs +364 -0
- package/dist/discrete/expected-value/preset.d.mts +28 -0
- package/dist/discrete/expected-value/preset.mjs +352 -0
- package/dist/discrete/hypergeometric/preset.d.mts +25 -0
- package/dist/discrete/hypergeometric/preset.mjs +330 -0
- package/dist/discrete/index.d.mts +26 -0
- package/dist/discrete/index.mjs +27 -0
- package/dist/discrete/karnaugh/index.d.mts +1 -0
- package/dist/discrete/karnaugh/preset.d.mts +30 -0
- package/dist/discrete/karnaugh/preset.mjs +452 -0
- package/dist/discrete/lln/asset.mjs +206 -0
- package/dist/discrete/lln/index.d.mts +1 -0
- package/dist/discrete/lln/preset.d.mts +17 -0
- package/dist/discrete/lln/preset.mjs +152 -0
- package/dist/discrete/logic-circuit/index.d.mts +1 -0
- package/dist/discrete/logic-circuit/preset.d.mts +47 -0
- package/dist/discrete/logic-circuit/preset.mjs +307 -0
- package/dist/discrete/monte-carlo/index.d.mts +1 -0
- package/dist/discrete/monte-carlo/preset.d.mts +64 -0
- package/dist/discrete/monte-carlo/preset.mjs +446 -0
- package/dist/discrete/monty-hall/index.d.mts +1 -0
- package/dist/discrete/monty-hall/preset.d.mts +23 -0
- package/dist/discrete/monty-hall/preset.mjs +491 -0
- package/dist/discrete/outcome-builder/preset.d.mts +24 -0
- package/dist/discrete/outcome-builder/preset.mjs +283 -0
- package/dist/discrete/pascal/preset.d.mts +24 -0
- package/dist/discrete/pascal/preset.mjs +372 -0
- package/dist/discrete/sample-space/index.d.mts +1 -0
- package/dist/discrete/sample-space/preset.d.mts +42 -0
- package/dist/discrete/sample-space/preset.mjs +395 -0
- package/dist/discrete/selection/preset.d.mts +33 -0
- package/dist/discrete/selection/preset.mjs +406 -0
- package/dist/discrete/truth-table/index.d.mts +1 -0
- package/dist/discrete/truth-table/preset.d.mts +30 -0
- package/dist/discrete/truth-table/preset.mjs +456 -0
- package/dist/discrete/venn/index.d.mts +1 -0
- package/dist/discrete/venn/preset.d.mts +32 -0
- package/dist/discrete/venn/preset.mjs +461 -0
- package/dist/geography/cycle-lab/index.d.mts +1 -0
- package/dist/geography/cycle-lab/preset.d.mts +25 -0
- package/dist/geography/cycle-lab/preset.mjs +254 -0
- package/dist/geography/cycles.d.mts +21 -0
- package/dist/geography/cycles.mjs +205 -0
- package/dist/geography/index.d.mts +4 -0
- package/dist/geography/index.mjs +5 -0
- package/dist/geometry/board/index.d.mts +1 -0
- package/dist/geometry/board/preset.d.mts +71 -0
- package/dist/geometry/board/preset.mjs +148 -0
- package/dist/geometry/builder.d.mts +18 -0
- package/dist/geometry/builder.mjs +332 -0
- package/dist/geometry/index.d.mts +4 -0
- package/dist/geometry/index.mjs +5 -0
- package/dist/geometry/intersecting-circles.d.mts +17 -0
- package/dist/geometry/intersecting-circles.mjs +104 -0
- package/dist/ict/index.d.mts +5 -0
- package/dist/ict/index.mjs +6 -0
- package/dist/ict/number-systems/base-odometer.d.mts +34 -0
- package/dist/ict/number-systems/base-odometer.mjs +160 -0
- package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
- package/dist/ict/number-systems/bit-grouper.mjs +190 -0
- package/dist/ict/number-systems/index.d.mts +4 -0
- package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
- package/dist/ict/number-systems/place-value-dial.mjs +153 -0
- package/dist/ict/number-systems/wheel.d.mts +73 -0
- package/dist/ict/number-systems/wheel.mjs +279 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/kit/anim.mjs +52 -0
- package/dist/kit/annotate.mjs +116 -0
- package/dist/kit/answer-check.d.mts +38 -0
- package/dist/kit/answer-check.mjs +65 -0
- package/dist/kit/asset-util.mjs +15 -0
- package/dist/kit/controls.mjs +77 -0
- package/dist/kit/cycle.d.mts +44 -0
- package/dist/kit/cycle.mjs +188 -0
- package/dist/kit/diagram.mjs +176 -0
- package/dist/kit/electronics.mjs +357 -0
- package/dist/kit/expr-analysis.d.mts +37 -0
- package/dist/kit/expr-analysis.mjs +111 -0
- package/dist/kit/frame.d.mts +70 -0
- package/dist/kit/frame.mjs +205 -0
- package/dist/kit/freq-tree.mjs +99 -0
- package/dist/kit/gameshow.mjs +315 -0
- package/dist/kit/index.d.mts +5 -0
- package/dist/kit/index.mjs +6 -0
- package/dist/kit/logic-gates.d.mts +6 -0
- package/dist/kit/logic-gates.mjs +210 -0
- package/dist/kit/molecules.mjs +178 -0
- package/dist/kit/pedagogy.d.mts +126 -0
- package/dist/kit/pedagogy.mjs +331 -0
- package/dist/kit/play.d.mts +21 -0
- package/dist/kit/play.mjs +52 -0
- package/dist/kit/probability.mjs +141 -0
- package/dist/kit/proportion.mjs +112 -0
- package/dist/kit/reaction.mjs +102 -0
- package/dist/kit/rich.d.mts +10 -0
- package/dist/kit/rich.mjs +21 -0
- package/dist/kit/scale.mjs +230 -0
- package/dist/kit/space.mjs +326 -0
- package/dist/kit/steps.d.mts +24 -0
- package/dist/kit/steps.mjs +57 -0
- package/dist/kit/thermal.mjs +289 -0
- package/dist/language/agreement/index.d.mts +1 -0
- package/dist/language/agreement/preset.d.mts +27 -0
- package/dist/language/agreement/preset.mjs +113 -0
- package/dist/language/article-lens/index.d.mts +1 -0
- package/dist/language/article-lens/preset.d.mts +31 -0
- package/dist/language/article-lens/preset.mjs +125 -0
- package/dist/language/deck.d.mts +45 -0
- package/dist/language/deck.mjs +61 -0
- package/dist/language/icon.d.mts +40 -0
- package/dist/language/icon.mjs +73 -0
- package/dist/language/index.d.mts +10 -0
- package/dist/language/index.mjs +11 -0
- package/dist/language/preposition-scene/index.d.mts +1 -0
- package/dist/language/preposition-scene/preset.d.mts +34 -0
- package/dist/language/preposition-scene/preset.mjs +234 -0
- package/dist/language/sentence-builder/index.d.mts +1 -0
- package/dist/language/sentence-builder/preset.d.mts +32 -0
- package/dist/language/sentence-builder/preset.mjs +122 -0
- package/dist/language/transform/index.d.mts +1 -0
- package/dist/language/transform/preset.d.mts +31 -0
- package/dist/language/transform/preset.mjs +137 -0
- package/dist/language/ui.d.mts +53 -0
- package/dist/language/ui.mjs +88 -0
- package/dist/language/word-match/index.d.mts +1 -0
- package/dist/language/word-match/preset.d.mts +22 -0
- package/dist/language/word-match/preset.mjs +148 -0
- package/dist/math/area-model/asset.d.mts +6 -0
- package/dist/math/area-model/asset.mjs +270 -0
- package/dist/math/area-model/index.d.mts +2 -0
- package/dist/math/area-model/preset.d.mts +29 -0
- package/dist/math/area-model/preset.mjs +243 -0
- package/dist/math/balance-algebra/asset.d.mts +6 -0
- package/dist/math/balance-algebra/asset.mjs +150 -0
- package/dist/math/balance-algebra/index.d.mts +2 -0
- package/dist/math/balance-algebra/preset.d.mts +30 -0
- package/dist/math/balance-algebra/preset.mjs +228 -0
- package/dist/math/derivation.d.mts +22 -0
- package/dist/math/derivation.mjs +113 -0
- package/dist/math/derivative-explorer/index.d.mts +1 -0
- package/dist/math/derivative-explorer/preset.d.mts +19 -0
- package/dist/math/derivative-explorer/preset.mjs +227 -0
- package/dist/math/function-machine/index.d.mts +1 -0
- package/dist/math/function-machine/preset.d.mts +21 -0
- package/dist/math/function-machine/preset.mjs +177 -0
- package/dist/math/gradient-descent.d.mts +23 -0
- package/dist/math/gradient-descent.mjs +473 -0
- package/dist/math/grapher/index.d.mts +1 -0
- package/dist/math/grapher/preset.d.mts +40 -0
- package/dist/math/grapher/preset.mjs +313 -0
- package/dist/math/harmonic-form/index.d.mts +1 -0
- package/dist/math/harmonic-form/preset.d.mts +21 -0
- package/dist/math/harmonic-form/preset.mjs +387 -0
- package/dist/math/index.d.mts +25 -0
- package/dist/math/index.mjs +26 -0
- package/dist/math/integral-explorer/index.d.mts +1 -0
- package/dist/math/integral-explorer/preset.d.mts +23 -0
- package/dist/math/integral-explorer/preset.mjs +217 -0
- package/dist/math/interactive/index.d.mts +1 -0
- package/dist/math/interactive/preset.d.mts +72 -0
- package/dist/math/interactive/preset.mjs +202 -0
- package/dist/math/limit-explorer/index.d.mts +1 -0
- package/dist/math/limit-explorer/preset.d.mts +19 -0
- package/dist/math/limit-explorer/preset.mjs +216 -0
- package/dist/math/linear-system/index.d.mts +1 -0
- package/dist/math/linear-system/preset.d.mts +28 -0
- package/dist/math/linear-system/preset.mjs +164 -0
- package/dist/math/mystery-bucket/asset.d.mts +6 -0
- package/dist/math/mystery-bucket/asset.mjs +145 -0
- package/dist/math/mystery-bucket/index.d.mts +2 -0
- package/dist/math/mystery-bucket/preset.d.mts +36 -0
- package/dist/math/mystery-bucket/preset.mjs +116 -0
- package/dist/math/number-line/index.d.mts +1 -0
- package/dist/math/number-line/preset.d.mts +24 -0
- package/dist/math/number-line/preset.mjs +142 -0
- package/dist/math/parabola/index.d.mts +1 -0
- package/dist/math/parabola/preset.d.mts +13 -0
- package/dist/math/parabola/preset.mjs +79 -0
- package/dist/math/pattern/asset.d.mts +6 -0
- package/dist/math/pattern/asset.mjs +102 -0
- package/dist/math/pattern/index.d.mts +2 -0
- package/dist/math/pattern/preset.d.mts +32 -0
- package/dist/math/pattern/preset.mjs +294 -0
- package/dist/math/triangle-trig/index.d.mts +1 -0
- package/dist/math/triangle-trig/preset.d.mts +47 -0
- package/dist/math/triangle-trig/preset.mjs +245 -0
- package/dist/math/trig-explorer.d.mts +18 -0
- package/dist/math/trig-explorer.mjs +209 -0
- package/dist/ml/boundary/index.d.mts +1 -0
- package/dist/ml/boundary/preset.d.mts +24 -0
- package/dist/ml/boundary/preset.mjs +385 -0
- package/dist/ml/classifier/index.d.mts +1 -0
- package/dist/ml/classifier/preset.d.mts +25 -0
- package/dist/ml/classifier/preset.mjs +315 -0
- package/dist/ml/index.d.mts +6 -0
- package/dist/ml/index.mjs +7 -0
- package/dist/ml/kmeans/index.d.mts +1 -0
- package/dist/ml/kmeans/preset.d.mts +33 -0
- package/dist/ml/kmeans/preset.mjs +236 -0
- package/dist/ml/knn/index.d.mts +1 -0
- package/dist/ml/knn/preset.d.mts +28 -0
- package/dist/ml/knn/preset.mjs +279 -0
- package/dist/ml/regression/index.d.mts +1 -0
- package/dist/ml/regression/preset.d.mts +32 -0
- package/dist/ml/regression/preset.mjs +394 -0
- package/dist/physics/atwood/index.d.mts +1 -0
- package/dist/physics/atwood/preset.d.mts +23 -0
- package/dist/physics/atwood/preset.mjs +312 -0
- package/dist/physics/bullet-walls/index.d.mts +1 -0
- package/dist/physics/bullet-walls/preset.d.mts +28 -0
- package/dist/physics/bullet-walls/preset.mjs +373 -0
- package/dist/physics/carnot/index.d.mts +1 -0
- package/dist/physics/carnot/preset.d.mts +27 -0
- package/dist/physics/carnot/preset.mjs +427 -0
- package/dist/physics/circular-motion/index.d.mts +1 -0
- package/dist/physics/circular-motion/preset.d.mts +25 -0
- package/dist/physics/circular-motion/preset.mjs +293 -0
- package/dist/physics/collision-track/index.d.mts +1 -0
- package/dist/physics/collision-track/preset.d.mts +27 -0
- package/dist/physics/collision-track/preset.mjs +352 -0
- package/dist/physics/efficiency/index.d.mts +1 -0
- package/dist/physics/efficiency/preset.d.mts +33 -0
- package/dist/physics/efficiency/preset.mjs +343 -0
- package/dist/physics/electric-field/index.d.mts +1 -0
- package/dist/physics/electric-field/preset.d.mts +15 -0
- package/dist/physics/electric-field/preset.mjs +306 -0
- package/dist/physics/energy-skate/index.d.mts +1 -0
- package/dist/physics/energy-skate/preset.d.mts +25 -0
- package/dist/physics/energy-skate/preset.mjs +254 -0
- package/dist/physics/entropy/index.d.mts +1 -0
- package/dist/physics/entropy/preset.d.mts +18 -0
- package/dist/physics/entropy/preset.mjs +416 -0
- package/dist/physics/expansion/index.d.mts +1 -0
- package/dist/physics/expansion/preset.d.mts +26 -0
- package/dist/physics/expansion/preset.mjs +609 -0
- package/dist/physics/exponential/asset.mjs +221 -0
- package/dist/physics/exponential/index.d.mts +1 -0
- package/dist/physics/exponential/preset.d.mts +17 -0
- package/dist/physics/exponential/preset.mjs +182 -0
- package/dist/physics/gas-process/index.d.mts +1 -0
- package/dist/physics/gas-process/preset.d.mts +30 -0
- package/dist/physics/gas-process/preset.mjs +384 -0
- package/dist/physics/gravitation/index.d.mts +1 -0
- package/dist/physics/gravitation/preset.d.mts +24 -0
- package/dist/physics/gravitation/preset.mjs +345 -0
- package/dist/physics/gravity-drop.d.mts +9 -0
- package/dist/physics/gravity-drop.mjs +187 -0
- package/dist/physics/heat-transfer/index.d.mts +1 -0
- package/dist/physics/heat-transfer/preset.d.mts +27 -0
- package/dist/physics/heat-transfer/preset.mjs +626 -0
- package/dist/physics/impulse/index.d.mts +1 -0
- package/dist/physics/impulse/preset.d.mts +29 -0
- package/dist/physics/impulse/preset.mjs +453 -0
- package/dist/physics/index.d.mts +43 -0
- package/dist/physics/index.mjs +44 -0
- package/dist/physics/kepler/index.d.mts +1 -0
- package/dist/physics/kepler/preset.d.mts +27 -0
- package/dist/physics/kepler/preset.mjs +257 -0
- package/dist/physics/lever/asset.d.mts +6 -0
- package/dist/physics/lever/asset.mjs +220 -0
- package/dist/physics/lever/index.d.mts +2 -0
- package/dist/physics/lever/preset.d.mts +31 -0
- package/dist/physics/lever/preset.mjs +261 -0
- package/dist/physics/lorentz/index.d.mts +1 -0
- package/dist/physics/lorentz/preset.d.mts +29 -0
- package/dist/physics/lorentz/preset.mjs +367 -0
- package/dist/physics/magnetism/index.d.mts +1 -0
- package/dist/physics/magnetism/preset.d.mts +15 -0
- package/dist/physics/magnetism/preset.mjs +334 -0
- package/dist/physics/optics/asset.d.mts +6 -0
- package/dist/physics/optics/asset.mjs +234 -0
- package/dist/physics/optics/index.d.mts +2 -0
- package/dist/physics/optics/preset.d.mts +14 -0
- package/dist/physics/optics/preset.mjs +202 -0
- package/dist/physics/orbit-lab.d.mts +6 -0
- package/dist/physics/orbit-lab.mjs +222 -0
- package/dist/physics/projectile-lab.d.mts +10 -0
- package/dist/physics/projectile-lab.mjs +354 -0
- package/dist/physics/rain-relative/index.d.mts +1 -0
- package/dist/physics/rain-relative/preset.d.mts +19 -0
- package/dist/physics/rain-relative/preset.mjs +358 -0
- package/dist/physics/ramp-forces/index.d.mts +1 -0
- package/dist/physics/ramp-forces/preset.d.mts +36 -0
- package/dist/physics/ramp-forces/preset.mjs +550 -0
- package/dist/physics/river-boat.d.mts +22 -0
- package/dist/physics/river-boat.mjs +498 -0
- package/dist/physics/shm/index.d.mts +1 -0
- package/dist/physics/shm/preset.d.mts +33 -0
- package/dist/physics/shm/preset.mjs +554 -0
- package/dist/physics/stopping-distance/index.d.mts +1 -0
- package/dist/physics/stopping-distance/preset.d.mts +29 -0
- package/dist/physics/stopping-distance/preset.mjs +662 -0
- package/dist/physics/temperature-scales/index.d.mts +1 -0
- package/dist/physics/temperature-scales/preset.d.mts +15 -0
- package/dist/physics/temperature-scales/preset.mjs +353 -0
- package/dist/physics/terminal-velocity/index.d.mts +1 -0
- package/dist/physics/terminal-velocity/preset.d.mts +26 -0
- package/dist/physics/terminal-velocity/preset.mjs +404 -0
- package/dist/physics/thermal/index.d.mts +1 -0
- package/dist/physics/thermal/preset.d.mts +44 -0
- package/dist/physics/thermal/preset.mjs +373 -0
- package/dist/physics/vector-board/index.d.mts +1 -0
- package/dist/physics/vector-board/preset.d.mts +65 -0
- package/dist/physics/vector-board/preset.mjs +273 -0
- package/dist/physics/vector-board/view.d.mts +49 -0
- package/dist/physics/vector-board/view.mjs +58 -0
- package/dist/physics/vector-scene.d.mts +41 -0
- package/dist/physics/vector-scene.mjs +211 -0
- package/dist/physics/vector-types/index.d.mts +1 -0
- package/dist/physics/vector-types/preset.d.mts +27 -0
- package/dist/physics/vector-types/preset.mjs +192 -0
- package/dist/physics/water-density/index.d.mts +1 -0
- package/dist/physics/water-density/preset.d.mts +18 -0
- package/dist/physics/water-density/preset.mjs +439 -0
- package/dist/physics/waves/core.mjs +33 -0
- package/dist/physics/waves/doppler.d.mts +23 -0
- package/dist/physics/waves/doppler.mjs +260 -0
- package/dist/physics/waves/index.d.mts +4 -0
- package/dist/physics/waves/preset.d.mts +30 -0
- package/dist/physics/waves/preset.mjs +488 -0
- package/dist/physics/waves/ripple.d.mts +26 -0
- package/dist/physics/waves/ripple.mjs +234 -0
- package/dist/physics/waves/string.d.mts +29 -0
- package/dist/physics/waves/string.mjs +289 -0
- package/dist/physics/work-energy/index.d.mts +1 -0
- package/dist/physics/work-energy/preset.d.mts +17 -0
- package/dist/physics/work-energy/preset.mjs +341 -0
- package/dist/schemas/index.d.mts +235 -0
- package/dist/schemas/index.mjs +145 -0
- package/dist/statistics/center-spread/preset.d.mts +34 -0
- package/dist/statistics/center-spread/preset.mjs +323 -0
- package/dist/statistics/core/descriptive.d.mts +35 -0
- package/dist/statistics/core/descriptive.mjs +64 -0
- package/dist/statistics/core/normal.d.mts +21 -0
- package/dist/statistics/core/normal.mjs +37 -0
- package/dist/statistics/core/sequences.d.mts +27 -0
- package/dist/statistics/core/sequences.mjs +35 -0
- package/dist/statistics/galton/preset.d.mts +27 -0
- package/dist/statistics/galton/preset.mjs +331 -0
- package/dist/statistics/histogram/preset.d.mts +27 -0
- package/dist/statistics/histogram/preset.mjs +385 -0
- package/dist/statistics/index.d.mts +11 -0
- package/dist/statistics/index.mjs +12 -0
- package/dist/statistics/normal/preset.d.mts +30 -0
- package/dist/statistics/normal/preset.mjs +400 -0
- package/dist/statistics/sampling/preset.d.mts +32 -0
- package/dist/statistics/sampling/preset.mjs +406 -0
- package/dist/statistics/sequence/preset.d.mts +28 -0
- package/dist/statistics/sequence/preset.mjs +302 -0
- package/dist/statistics/z-table/preset.d.mts +28 -0
- package/dist/statistics/z-table/preset.mjs +348 -0
- package/package.json +266 -0
- package/styles.css +267 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/kit/electronics.tsx
|
|
6
|
+
const WIRE = "var(--stage-wire)";
|
|
7
|
+
const LIVE = "var(--stage-live)";
|
|
8
|
+
const METAL = "var(--stage-metal)";
|
|
9
|
+
const BG = "var(--stage-bg)";
|
|
10
|
+
const FG = "var(--stage-fg)";
|
|
11
|
+
const CHARGE = "var(--stage-charge)";
|
|
12
|
+
const SHEEN = "color-mix(in oklab, var(--stage-sheen) 45%, transparent)";
|
|
13
|
+
/** The two leads + terminal nubs from each terminal to the body edge at ±bodyHalf. */
|
|
14
|
+
function Leads({ cx, cy, half, bodyHalf, live }) {
|
|
15
|
+
const wire = live ? LIVE : WIRE;
|
|
16
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
17
|
+
/* @__PURE__ */ jsx("line", {
|
|
18
|
+
x1: cx - half,
|
|
19
|
+
y1: cy,
|
|
20
|
+
x2: cx - bodyHalf,
|
|
21
|
+
y2: cy,
|
|
22
|
+
stroke: wire,
|
|
23
|
+
strokeWidth: 2.5,
|
|
24
|
+
strokeLinecap: "round"
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ jsx("line", {
|
|
27
|
+
x1: cx + bodyHalf,
|
|
28
|
+
y1: cy,
|
|
29
|
+
x2: cx + half,
|
|
30
|
+
y2: cy,
|
|
31
|
+
stroke: wire,
|
|
32
|
+
strokeWidth: 2.5,
|
|
33
|
+
strokeLinecap: "round"
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx("circle", {
|
|
36
|
+
cx: cx - half,
|
|
37
|
+
cy,
|
|
38
|
+
r: 2.6,
|
|
39
|
+
fill: METAL
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("circle", {
|
|
42
|
+
cx: cx + half,
|
|
43
|
+
cy,
|
|
44
|
+
r: 2.6,
|
|
45
|
+
fill: METAL
|
|
46
|
+
})
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
/** Value/name label above a body of half-height `bodyH`. */
|
|
50
|
+
function GlyphLabel({ cx, cy, bodyH, label }) {
|
|
51
|
+
if (!label) return null;
|
|
52
|
+
return /* @__PURE__ */ jsx("text", {
|
|
53
|
+
x: cx,
|
|
54
|
+
y: cy - bodyH - 7,
|
|
55
|
+
fill: FG,
|
|
56
|
+
fontSize: 11,
|
|
57
|
+
fontWeight: 600,
|
|
58
|
+
textAnchor: "middle",
|
|
59
|
+
style: { pointerEvents: "none" },
|
|
60
|
+
children: label
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* RESISTOR — the IEC/CAIE rectangle (an open box interrupting the wire). The
|
|
65
|
+
* exam-standard symbol; clean token fill + metal outline + a top-edge sheen.
|
|
66
|
+
*/
|
|
67
|
+
function ResistorGlyph({ cx, cy, half, live, label }) {
|
|
68
|
+
const bw = 21;
|
|
69
|
+
const bh = 10;
|
|
70
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Leads, {
|
|
72
|
+
cx,
|
|
73
|
+
cy,
|
|
74
|
+
half,
|
|
75
|
+
bodyHalf: bw,
|
|
76
|
+
live
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx("rect", {
|
|
79
|
+
x: cx - bw,
|
|
80
|
+
y: cy - bh,
|
|
81
|
+
width: bw * 2,
|
|
82
|
+
height: bh * 2,
|
|
83
|
+
rx: 3,
|
|
84
|
+
fill: BG,
|
|
85
|
+
stroke: live ? LIVE : METAL,
|
|
86
|
+
strokeWidth: 2
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsx("line", {
|
|
89
|
+
x1: cx - bw * .7,
|
|
90
|
+
y1: cy - bh + 1.5,
|
|
91
|
+
x2: cx + bw * .7,
|
|
92
|
+
y2: cy - bh + 1.5,
|
|
93
|
+
stroke: SHEEN,
|
|
94
|
+
strokeWidth: 1.4,
|
|
95
|
+
strokeLinecap: "round"
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(GlyphLabel, {
|
|
98
|
+
cx,
|
|
99
|
+
cy,
|
|
100
|
+
bodyH: bh,
|
|
101
|
+
label
|
|
102
|
+
})
|
|
103
|
+
] });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* CELL / BATTERY — one long thin plate (+) and one short thick plate (−). Pass
|
|
107
|
+
* `cells` > 1 to draw a battery (repeated plate pairs). EMF label above.
|
|
108
|
+
*/
|
|
109
|
+
function CellGlyph({ cx, cy, half, live, label, cells = 1 }) {
|
|
110
|
+
const n = Math.max(1, Math.round(cells));
|
|
111
|
+
const gap = 7;
|
|
112
|
+
const span = n * gap * 2 - gap;
|
|
113
|
+
const bodyHalf = span / 2 + 2;
|
|
114
|
+
const longH = 13;
|
|
115
|
+
const shortH = 7;
|
|
116
|
+
const plates = [];
|
|
117
|
+
let x = cx - span / 2;
|
|
118
|
+
for (let i = 0; i < n; i++) {
|
|
119
|
+
plates.push(/* @__PURE__ */ jsx("line", {
|
|
120
|
+
x1: x,
|
|
121
|
+
y1: cy - longH,
|
|
122
|
+
x2: x,
|
|
123
|
+
y2: cy + longH,
|
|
124
|
+
stroke: METAL,
|
|
125
|
+
strokeWidth: 2,
|
|
126
|
+
strokeLinecap: "round"
|
|
127
|
+
}, `l${i}`));
|
|
128
|
+
x += gap;
|
|
129
|
+
plates.push(/* @__PURE__ */ jsx("line", {
|
|
130
|
+
x1: x,
|
|
131
|
+
y1: cy - shortH,
|
|
132
|
+
x2: x,
|
|
133
|
+
y2: cy + shortH,
|
|
134
|
+
stroke: METAL,
|
|
135
|
+
strokeWidth: 4.5,
|
|
136
|
+
strokeLinecap: "round"
|
|
137
|
+
}, `s${i}`));
|
|
138
|
+
x += gap;
|
|
139
|
+
}
|
|
140
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
141
|
+
/* @__PURE__ */ jsx(Leads, {
|
|
142
|
+
cx,
|
|
143
|
+
cy,
|
|
144
|
+
half,
|
|
145
|
+
bodyHalf,
|
|
146
|
+
live
|
|
147
|
+
}),
|
|
148
|
+
plates,
|
|
149
|
+
/* @__PURE__ */ jsx(GlyphLabel, {
|
|
150
|
+
cx,
|
|
151
|
+
cy,
|
|
152
|
+
bodyH: longH,
|
|
153
|
+
label
|
|
154
|
+
})
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* CAPACITOR — two parallel plates with a visible STORED-CHARGE field between them
|
|
159
|
+
* and an optional LEAK. This is the centerpiece glyph: `charge` (0..1) sets how
|
|
160
|
+
* many field lines bridge the plates and their intensity, so a charging cap fills
|
|
161
|
+
* and a leaking cap visibly empties; `leaking` + `leakPhase` drip charge off the
|
|
162
|
+
* lower plate (the "why capacitors don't hold charge forever" picture). All motion
|
|
163
|
+
* is data — the lab's RC integrator lowers `charge` and advances `leakPhase`.
|
|
164
|
+
*/
|
|
165
|
+
function CapacitorGlyph({ cx, cy, half, live, label, charge = 0, leaking, leakPhase = 0, polarised }) {
|
|
166
|
+
const q = Math.max(0, Math.min(1, charge));
|
|
167
|
+
const plateGap = 14;
|
|
168
|
+
const plateH = 18;
|
|
169
|
+
const bodyHalf = 10;
|
|
170
|
+
const lx = cx - plateGap / 2;
|
|
171
|
+
const rx = cx + plateGap / 2;
|
|
172
|
+
const lines = q > .02 ? Math.round(1 + q * 2) : 0;
|
|
173
|
+
const field = [];
|
|
174
|
+
for (let i = 0; i < lines; i++) {
|
|
175
|
+
const fy = cy - plateH * .5 + plateH * (lines === 1 ? .5 : i / (lines - 1));
|
|
176
|
+
field.push(/* @__PURE__ */ jsx("line", {
|
|
177
|
+
x1: lx + 2,
|
|
178
|
+
y1: fy,
|
|
179
|
+
x2: rx - 2,
|
|
180
|
+
y2: fy,
|
|
181
|
+
stroke: CHARGE,
|
|
182
|
+
strokeWidth: 1,
|
|
183
|
+
strokeLinecap: "round",
|
|
184
|
+
opacity: .12 + .3 * q
|
|
185
|
+
}, `f${i}`));
|
|
186
|
+
}
|
|
187
|
+
const drips = [];
|
|
188
|
+
if (leaking && q > .02) for (let d = 0; d < 2; d++) {
|
|
189
|
+
const ph = (leakPhase + d * .5) % 1;
|
|
190
|
+
const dy = cy + plateH + ph * 16;
|
|
191
|
+
drips.push(/* @__PURE__ */ jsx("circle", {
|
|
192
|
+
cx,
|
|
193
|
+
cy: dy,
|
|
194
|
+
r: 2.2,
|
|
195
|
+
fill: CHARGE,
|
|
196
|
+
opacity: (1 - ph) * (.3 + .5 * q)
|
|
197
|
+
}, `d${d}`));
|
|
198
|
+
}
|
|
199
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
200
|
+
/* @__PURE__ */ jsx(Leads, {
|
|
201
|
+
cx,
|
|
202
|
+
cy,
|
|
203
|
+
half,
|
|
204
|
+
bodyHalf,
|
|
205
|
+
live
|
|
206
|
+
}),
|
|
207
|
+
field,
|
|
208
|
+
/* @__PURE__ */ jsx("line", {
|
|
209
|
+
x1: lx,
|
|
210
|
+
y1: cy - plateH,
|
|
211
|
+
x2: lx,
|
|
212
|
+
y2: cy + plateH,
|
|
213
|
+
stroke: METAL,
|
|
214
|
+
strokeWidth: 3.5,
|
|
215
|
+
strokeLinecap: "round"
|
|
216
|
+
}),
|
|
217
|
+
polarised ? /* @__PURE__ */ jsx("path", {
|
|
218
|
+
d: `M ${rx} ${cy - plateH} Q ${rx + 5} ${cy} ${rx} ${cy + plateH}`,
|
|
219
|
+
fill: "none",
|
|
220
|
+
stroke: METAL,
|
|
221
|
+
strokeWidth: 3.5,
|
|
222
|
+
strokeLinecap: "round"
|
|
223
|
+
}) : /* @__PURE__ */ jsx("line", {
|
|
224
|
+
x1: rx,
|
|
225
|
+
y1: cy - plateH,
|
|
226
|
+
x2: rx,
|
|
227
|
+
y2: cy + plateH,
|
|
228
|
+
stroke: METAL,
|
|
229
|
+
strokeWidth: 3.5,
|
|
230
|
+
strokeLinecap: "round"
|
|
231
|
+
}),
|
|
232
|
+
polarised && /* @__PURE__ */ jsx("text", {
|
|
233
|
+
x: lx - 4,
|
|
234
|
+
y: cy - plateH + 2,
|
|
235
|
+
fill: FG,
|
|
236
|
+
fontSize: 11,
|
|
237
|
+
fontWeight: 700,
|
|
238
|
+
textAnchor: "end",
|
|
239
|
+
style: { pointerEvents: "none" },
|
|
240
|
+
children: "+"
|
|
241
|
+
}),
|
|
242
|
+
drips,
|
|
243
|
+
/* @__PURE__ */ jsx(GlyphLabel, {
|
|
244
|
+
cx,
|
|
245
|
+
cy,
|
|
246
|
+
bodyH: plateH,
|
|
247
|
+
label
|
|
248
|
+
})
|
|
249
|
+
] });
|
|
250
|
+
}
|
|
251
|
+
function LampGlyph({ cx, cy, brightness, r = 30 }) {
|
|
252
|
+
const b = Math.max(0, Math.min(1, brightness));
|
|
253
|
+
const hot = b > .04;
|
|
254
|
+
const filament = `color-mix(in oklab, var(--stage-metal) ${Math.round((1 - b) * 100)}%, var(--stage-warn))`;
|
|
255
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
256
|
+
hot && /* @__PURE__ */ jsx("circle", {
|
|
257
|
+
cx,
|
|
258
|
+
cy,
|
|
259
|
+
r: r + 6 + b * 26,
|
|
260
|
+
fill: "url(#stage-grad-thermal)",
|
|
261
|
+
opacity: .18 + .7 * b,
|
|
262
|
+
filter: b > .55 ? "url(#stage-bloom)" : "url(#stage-glow)",
|
|
263
|
+
style: { pointerEvents: "none" }
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ jsx("circle", {
|
|
266
|
+
cx,
|
|
267
|
+
cy,
|
|
268
|
+
r,
|
|
269
|
+
fill: "var(--stage-bg)",
|
|
270
|
+
stroke: hot ? "var(--stage-warn)" : "var(--stage-metal)",
|
|
271
|
+
strokeWidth: 2.5
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ jsx("path", {
|
|
274
|
+
d: `M ${cx - 16} ${cy + 6} q 4 -16 8 0 q 4 16 8 0 q 4 -16 8 0 q 4 16 8 0`,
|
|
275
|
+
fill: "none",
|
|
276
|
+
stroke: filament,
|
|
277
|
+
strokeWidth: hot ? 3 : 2.2,
|
|
278
|
+
strokeLinecap: "round",
|
|
279
|
+
filter: b > .55 ? "url(#stage-bloom)" : void 0
|
|
280
|
+
}),
|
|
281
|
+
b > .6 && /* @__PURE__ */ jsx("circle", {
|
|
282
|
+
cx,
|
|
283
|
+
cy,
|
|
284
|
+
r: 6 + (b - .6) * 14,
|
|
285
|
+
fill: "white",
|
|
286
|
+
opacity: (b - .6) * 1.6,
|
|
287
|
+
filter: "url(#stage-bloom)",
|
|
288
|
+
style: { pointerEvents: "none" }
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ jsx("rect", {
|
|
291
|
+
x: cx - 9,
|
|
292
|
+
y: cy + r - 2,
|
|
293
|
+
width: 18,
|
|
294
|
+
height: 10,
|
|
295
|
+
rx: 2,
|
|
296
|
+
fill: "var(--stage-metal)"
|
|
297
|
+
})
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
/** An AC (~) or DC (=) source; a halo behind it tracks output magnitude `level` (-1..1). */
|
|
301
|
+
function AcDcSourceGlyph({ cx, cy, mode, level, r = 30 }) {
|
|
302
|
+
const live = Math.abs(Math.max(-1, Math.min(1, level)));
|
|
303
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
304
|
+
/* @__PURE__ */ jsx("circle", {
|
|
305
|
+
cx,
|
|
306
|
+
cy,
|
|
307
|
+
r: r + 10,
|
|
308
|
+
fill: "url(#stage-grad-halo)",
|
|
309
|
+
opacity: .25 + .6 * live,
|
|
310
|
+
style: { pointerEvents: "none" }
|
|
311
|
+
}),
|
|
312
|
+
/* @__PURE__ */ jsx("circle", {
|
|
313
|
+
cx,
|
|
314
|
+
cy,
|
|
315
|
+
r,
|
|
316
|
+
fill: "var(--stage-bg)",
|
|
317
|
+
stroke: "var(--stage-accent)",
|
|
318
|
+
strokeWidth: 2.5
|
|
319
|
+
}),
|
|
320
|
+
mode === "ac" ? /* @__PURE__ */ jsx("path", {
|
|
321
|
+
d: `M ${cx - 16} ${cy} q 8 -14 16 0 q 8 14 16 0`,
|
|
322
|
+
fill: "none",
|
|
323
|
+
stroke: "var(--stage-accent)",
|
|
324
|
+
strokeWidth: 3,
|
|
325
|
+
strokeLinecap: "round"
|
|
326
|
+
}) : /* @__PURE__ */ jsxs("g", {
|
|
327
|
+
stroke: "var(--stage-accent)",
|
|
328
|
+
strokeLinecap: "round",
|
|
329
|
+
children: [/* @__PURE__ */ jsx("line", {
|
|
330
|
+
x1: cx - 15,
|
|
331
|
+
y1: cy - 6,
|
|
332
|
+
x2: cx + 15,
|
|
333
|
+
y2: cy - 6,
|
|
334
|
+
strokeWidth: 3.5
|
|
335
|
+
}), /* @__PURE__ */ jsx("line", {
|
|
336
|
+
x1: cx - 15,
|
|
337
|
+
y1: cy + 6,
|
|
338
|
+
x2: cx + 15,
|
|
339
|
+
y2: cy + 6,
|
|
340
|
+
strokeWidth: 2,
|
|
341
|
+
strokeDasharray: "4 4"
|
|
342
|
+
})]
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ jsx("text", {
|
|
345
|
+
x: cx,
|
|
346
|
+
y: cy + r + 18,
|
|
347
|
+
textAnchor: "middle",
|
|
348
|
+
fontSize: 13,
|
|
349
|
+
fontWeight: 700,
|
|
350
|
+
fill: "var(--stage-accent)",
|
|
351
|
+
children: mode.toUpperCase()
|
|
352
|
+
})
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
//#endregion
|
|
357
|
+
export { AcDcSourceGlyph, CapacitorGlyph, CellGlyph, LampGlyph, ResistorGlyph };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Node } from "@classytic/stage";
|
|
2
|
+
|
|
3
|
+
//#region src/kit/expr-analysis.d.ts
|
|
4
|
+
type Fn1 = (x: number) => number;
|
|
5
|
+
/** A straight line y = m·x + c, with the point it was taken at and an evaluator. */
|
|
6
|
+
interface Line {
|
|
7
|
+
m: number;
|
|
8
|
+
c: number;
|
|
9
|
+
at: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
f: Fn1;
|
|
14
|
+
}
|
|
15
|
+
/** Real roots of f on [a,b] via a sign-change scan refined by bisection. */
|
|
16
|
+
declare function roots(f: Fn1, a: number, b: number, opts?: {
|
|
17
|
+
steps?: number;
|
|
18
|
+
tol?: number;
|
|
19
|
+
}): number[];
|
|
20
|
+
/** Points where f and g meet on [a,b]. */
|
|
21
|
+
declare function intersections(f: Fn1, g: Fn1, a: number, b: number, opts?: {
|
|
22
|
+
steps?: number;
|
|
23
|
+
tol?: number;
|
|
24
|
+
}): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}[];
|
|
28
|
+
/** Exact tangent line to `ast` at x = x0 (params baked in via `scope`). */
|
|
29
|
+
declare function tangentAt(ast: Node, x0: number, varName?: string, params?: Record<string, number>): Line | null;
|
|
30
|
+
/** Normal line to `ast` at x = x0 (⟂ the tangent). Null if the tangent is horizontal. */
|
|
31
|
+
declare function normalAt(ast: Node, x0: number, varName?: string, params?: Record<string, number>): Line | null;
|
|
32
|
+
/** Composite-Simpson definite integral ∫_a^b f dx. */
|
|
33
|
+
declare function integrate(f: Fn1, a: number, b: number, n?: number): number;
|
|
34
|
+
/** Unsigned area between f and g over [a,b]. */
|
|
35
|
+
declare function areaBetween(f: Fn1, g: Fn1, a: number, b: number, n?: number): number;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Fn1, Line, areaBetween, integrate, intersections, normalAt, roots, tangentAt };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { differentiate, evaluate } from "@classytic/stage";
|
|
2
|
+
|
|
3
|
+
//#region src/kit/expr-analysis.ts
|
|
4
|
+
/**
|
|
5
|
+
* expr-analysis — the numeric/symbolic "solving" layer of the interactive-problem
|
|
6
|
+
* engine, built on @classytic/stage's expr engine. Pure functions (no React) so a
|
|
7
|
+
* creator's authored config can derive the quantities A-level questions ask for —
|
|
8
|
+
* roots, intersections, tangents/normals, areas — without anyone hand-coding a lab.
|
|
9
|
+
*
|
|
10
|
+
* Everything works on a compiled scalar `Fn1 = (x) => number` (params already baked
|
|
11
|
+
* into the closure) plus, for exact tangents, the parsed `Node` AST.
|
|
12
|
+
*/
|
|
13
|
+
function pushUnique(out, x, tol) {
|
|
14
|
+
if (!out.some((p) => Math.abs(p - x) <= tol)) out.push(x);
|
|
15
|
+
}
|
|
16
|
+
/** Real roots of f on [a,b] via a sign-change scan refined by bisection. */
|
|
17
|
+
function roots(f, a, b, opts = {}) {
|
|
18
|
+
const steps = opts.steps ?? 1e3;
|
|
19
|
+
const tol = opts.tol ?? 1e-9;
|
|
20
|
+
const grid = (b - a) / steps;
|
|
21
|
+
const out = [];
|
|
22
|
+
let xPrev = a;
|
|
23
|
+
let fPrev = f(a);
|
|
24
|
+
for (let i = 1; i <= steps; i++) {
|
|
25
|
+
const x = a + grid * i;
|
|
26
|
+
const fx = f(x);
|
|
27
|
+
if (Number.isFinite(fPrev) && Number.isFinite(fx)) {
|
|
28
|
+
if (fPrev === 0) pushUnique(out, xPrev, grid);
|
|
29
|
+
else if (fPrev * fx < 0) {
|
|
30
|
+
let lo = xPrev;
|
|
31
|
+
let hi = x;
|
|
32
|
+
let flo = fPrev;
|
|
33
|
+
for (let k = 0; k < 80 && hi - lo > tol; k++) {
|
|
34
|
+
const mid = (lo + hi) / 2;
|
|
35
|
+
const fm = f(mid);
|
|
36
|
+
if (!Number.isFinite(fm)) break;
|
|
37
|
+
if (flo * fm <= 0) hi = mid;
|
|
38
|
+
else {
|
|
39
|
+
lo = mid;
|
|
40
|
+
flo = fm;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
pushUnique(out, (lo + hi) / 2, grid);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
xPrev = x;
|
|
47
|
+
fPrev = fx;
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
/** Points where f and g meet on [a,b]. */
|
|
52
|
+
function intersections(f, g, a, b, opts) {
|
|
53
|
+
return roots((x) => f(x) - g(x), a, b, opts).map((x) => ({
|
|
54
|
+
x,
|
|
55
|
+
y: f(x)
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
/** Exact tangent line to `ast` at x = x0 (params baked in via `scope`). */
|
|
59
|
+
function tangentAt(ast, x0, varName = "x", params = {}) {
|
|
60
|
+
const d = differentiate(ast, varName);
|
|
61
|
+
if (!d) return null;
|
|
62
|
+
const m = evaluate(d, {
|
|
63
|
+
...params,
|
|
64
|
+
[varName]: x0
|
|
65
|
+
});
|
|
66
|
+
const y0 = evaluate(ast, {
|
|
67
|
+
...params,
|
|
68
|
+
[varName]: x0
|
|
69
|
+
});
|
|
70
|
+
if (!Number.isFinite(m) || !Number.isFinite(y0)) return null;
|
|
71
|
+
const c = y0 - m * x0;
|
|
72
|
+
return {
|
|
73
|
+
m,
|
|
74
|
+
c,
|
|
75
|
+
at: {
|
|
76
|
+
x: x0,
|
|
77
|
+
y: y0
|
|
78
|
+
},
|
|
79
|
+
f: (x) => m * x + c
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Normal line to `ast` at x = x0 (⟂ the tangent). Null if the tangent is horizontal. */
|
|
83
|
+
function normalAt(ast, x0, varName = "x", params = {}) {
|
|
84
|
+
const t = tangentAt(ast, x0, varName, params);
|
|
85
|
+
if (!t || t.m === 0) return null;
|
|
86
|
+
const m = -1 / t.m;
|
|
87
|
+
const c = t.at.y - m * t.at.x;
|
|
88
|
+
return {
|
|
89
|
+
m,
|
|
90
|
+
c,
|
|
91
|
+
at: t.at,
|
|
92
|
+
f: (x) => m * x + c
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Composite-Simpson definite integral ∫_a^b f dx. */
|
|
96
|
+
function integrate(f, a, b, n = 1e3) {
|
|
97
|
+
if (a === b) return 0;
|
|
98
|
+
let N = Math.max(2, Math.round(n));
|
|
99
|
+
if (N % 2) N++;
|
|
100
|
+
const h = (b - a) / N;
|
|
101
|
+
let s = f(a) + f(b);
|
|
102
|
+
for (let i = 1; i < N; i++) s += (i % 2 ? 4 : 2) * f(a + i * h);
|
|
103
|
+
return h / 3 * s;
|
|
104
|
+
}
|
|
105
|
+
/** Unsigned area between f and g over [a,b]. */
|
|
106
|
+
function areaBetween(f, g, a, b, n = 1e3) {
|
|
107
|
+
return Math.abs(integrate((x) => f(x) - g(x), a, b, n));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
export { areaBetween, integrate, intersections, normalAt, roots, tangentAt };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/kit/frame.d.ts
|
|
4
|
+
/** Per-control creator overrides: two name-lists, ergonomic for authors + agents. */
|
|
5
|
+
interface ControlConfig {
|
|
6
|
+
/** Control names to remove entirely (learner can't see or change them). */
|
|
7
|
+
hide?: string[];
|
|
8
|
+
/** Control names to show read-only (frozen at the creator's initial value). */
|
|
9
|
+
lock?: string[];
|
|
10
|
+
}
|
|
11
|
+
interface LabFrameProps {
|
|
12
|
+
title?: string;
|
|
13
|
+
prompt?: string;
|
|
14
|
+
/** Collapsed "goals" disclosure (the old upfront Objectives wall, tamed). */
|
|
15
|
+
objectives?: string[];
|
|
16
|
+
/** The dominant visual. */
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/** Optional narrow side column (readouts, a guess, a result callout). */
|
|
19
|
+
aside?: ReactNode;
|
|
20
|
+
/** The single controls bar — pass <ControlBar>…</ControlBar>. */
|
|
21
|
+
controls?: ReactNode;
|
|
22
|
+
/** Quiet footer: feedback / hints / reveal / a note. */
|
|
23
|
+
footer?: ReactNode;
|
|
24
|
+
/** Ref on the outer container — e.g. for useInView() to pause a sim off-screen. */
|
|
25
|
+
rootRef?: Ref<HTMLDivElement>;
|
|
26
|
+
/** Creator's per-control hide/lock policy — flows to every Field/Control below. */
|
|
27
|
+
controlConfig?: ControlConfig;
|
|
28
|
+
}
|
|
29
|
+
declare function LabFrame({
|
|
30
|
+
title,
|
|
31
|
+
prompt,
|
|
32
|
+
objectives,
|
|
33
|
+
children,
|
|
34
|
+
aside,
|
|
35
|
+
controls,
|
|
36
|
+
footer,
|
|
37
|
+
rootRef,
|
|
38
|
+
controlConfig
|
|
39
|
+
}: LabFrameProps): ReactNode;
|
|
40
|
+
/** The single controls bar. Put `Field`s (or any control) inside. */
|
|
41
|
+
declare function ControlBar({
|
|
42
|
+
children
|
|
43
|
+
}: {
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}): ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* A labelled control: small-caps label + (control + value) on one row.
|
|
48
|
+
* Participates in creator `controlConfig` via `name ?? label`.
|
|
49
|
+
*/
|
|
50
|
+
declare function Field({
|
|
51
|
+
label,
|
|
52
|
+
name,
|
|
53
|
+
value,
|
|
54
|
+
children
|
|
55
|
+
}: {
|
|
56
|
+
label: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
value?: ReactNode;
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
}): ReactNode;
|
|
61
|
+
/** A highlighted readout box. `tone="result"` for the headline answer. */
|
|
62
|
+
declare function Callout({
|
|
63
|
+
tone,
|
|
64
|
+
children
|
|
65
|
+
}: {
|
|
66
|
+
tone?: 'info' | 'result';
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}): ReactNode;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { Callout, ControlBar, ControlConfig, Field, LabFrame };
|