@classytic/labs 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/biology/enzyme-rate/preset.mjs +5 -5
- package/dist/biology/genetic-cross/core.d.mts +7 -7
- package/dist/biology/genetic-cross/core.mjs +4 -4
- package/dist/biology/genetic-cross/grid.mjs +132 -123
- package/dist/biology/genetic-cross/preset.mjs +4 -4
- package/dist/biology/genetic-cross/sex-linked.mjs +7 -7
- package/dist/biology/photosynthesis-factors/preset.mjs +8 -8
- package/dist/biology/respiration/preset.mjs +4 -4
- package/dist/biology/sequence/central-dogma.mjs +5 -5
- package/dist/biology/sequence/core.d.mts +6 -6
- package/dist/biology/sequence/core.mjs +1 -1
- package/dist/biology/sequence/preset.mjs +6 -6
- package/dist/blocks/authoring.mjs +5 -5
- package/dist/blocks/biology.d.mts +2 -2
- package/dist/blocks/biology.mjs +5 -5
- package/dist/blocks/chem.d.mts +2 -2
- package/dist/blocks/chem.mjs +13 -13
- package/dist/blocks/circuits.d.mts +293 -4
- package/dist/blocks/circuits.mjs +874 -9
- package/dist/blocks/discrete.d.mts +30 -2
- package/dist/blocks/discrete.mjs +74 -4
- package/dist/blocks/economics.mjs +1 -1
- package/dist/blocks/geography.mjs +1 -1
- package/dist/blocks/geometry.mjs +3 -3
- package/dist/blocks/ict.d.mts +90 -1
- package/dist/blocks/ict.mjs +217 -7
- package/dist/blocks/index.d.mts +3064 -657
- package/dist/blocks/index.mjs +9 -9
- package/dist/blocks/lab-block.mjs +5 -5
- package/dist/blocks/lab-config.d.mts +1 -1
- package/dist/blocks/lab-config.mjs +4 -4
- package/dist/blocks/lab-gallery.d.mts +1 -1
- package/dist/blocks/lab-gallery.mjs +2 -2
- package/dist/blocks/language.d.mts +6 -6
- package/dist/blocks/language.mjs +12 -12
- package/dist/blocks/lesson.mjs +4 -4
- package/dist/blocks/math.d.mts +577 -11
- package/dist/blocks/math.mjs +1648 -14
- package/dist/blocks/ml.d.mts +45 -1
- package/dist/blocks/ml.mjs +80 -6
- package/dist/blocks/physics.d.mts +9 -4
- package/dist/blocks/physics.mjs +75 -28
- package/dist/blocks/statistics.mjs +1 -1
- package/dist/build/CircuitEditor.d.mts +14 -0
- package/dist/build/CircuitEditor.mjs +787 -0
- package/dist/build/CircuitPlayer.d.mts +19 -0
- package/dist/build/CircuitPlayer.mjs +53 -0
- package/dist/build/CircuitScene.d.mts +61 -0
- package/dist/build/CircuitScene.mjs +383 -0
- package/dist/build/contract.d.mts +116 -0
- package/dist/build/editor-ops.d.mts +65 -0
- package/dist/build/editor-ops.mjs +306 -0
- package/dist/build/editor-ui.mjs +121 -0
- package/dist/build/flow.d.mts +14 -0
- package/dist/build/flow.mjs +119 -0
- package/dist/build/index.d.mts +10 -0
- package/dist/build/index.mjs +10 -0
- package/dist/build/parts/ammeter.d.mts +1 -0
- package/dist/build/parts/ammeter.mjs +32 -0
- package/dist/build/parts/bulb.d.mts +1 -0
- package/dist/build/parts/bulb.mjs +50 -0
- package/dist/build/parts/capacitor.d.mts +1 -0
- package/dist/build/parts/capacitor.mjs +26 -0
- package/dist/build/parts/cell.d.mts +1 -0
- package/dist/build/parts/cell.mjs +40 -0
- package/dist/build/parts/diode.d.mts +1 -0
- package/dist/build/parts/diode.mjs +33 -0
- package/dist/build/parts/index.d.mts +5 -0
- package/dist/build/parts/index.mjs +43 -0
- package/dist/build/parts/mosfet.d.mts +1 -0
- package/dist/build/parts/mosfet.mjs +95 -0
- package/dist/build/parts/node.d.mts +1 -0
- package/dist/build/parts/node.mjs +32 -0
- package/dist/build/parts/resistor.d.mts +1 -0
- package/dist/build/parts/resistor.mjs +49 -0
- package/dist/build/parts/shared.mjs +42 -0
- package/dist/build/parts/switch.d.mts +1 -0
- package/dist/build/parts/switch.mjs +34 -0
- package/dist/build/parts.d.mts +1 -0
- package/dist/build/registry.d.mts +9 -0
- package/dist/build/registry.mjs +15 -0
- package/dist/build/solve.d.mts +8 -0
- package/dist/build/solve.mjs +0 -0
- package/dist/catalog/registry.d.mts +2 -2
- package/dist/catalog/templates.d.mts +1 -1
- package/dist/catalog/templates.mjs +6 -6
- package/dist/chem/battery.mjs +1 -1
- package/dist/chem/bohr-atom.mjs +4 -4
- package/dist/chem/diffusion/preset.mjs +4 -4
- package/dist/chem/electrochem/preset.mjs +5 -5
- package/dist/chem/equilibrium/preset.d.mts +1 -1
- package/dist/chem/equilibrium/preset.mjs +6 -6
- package/dist/chem/gas-box/preset.mjs +6 -6
- package/dist/chem/kinetics/preset.mjs +6 -6
- package/dist/chem/periodic-trends/preset.mjs +7 -7
- package/dist/chem/reaction-lab.mjs +3 -3
- package/dist/chem/reaction-profile.mjs +4 -4
- package/dist/chem/solution/dilution.mjs +6 -6
- package/dist/chem/solution/field.d.mts +2 -2
- package/dist/chem/solution/field.mjs +2 -2
- package/dist/chem/solution/solution-box.mjs +7 -7
- package/dist/chem/stoichiometry/preset.mjs +5 -5
- package/dist/chem/titration/preset.mjs +5 -5
- package/dist/circuits/ac-dc/asset.mjs +1 -1
- package/dist/circuits/ac-dc/preset.mjs +2 -2
- package/dist/circuits/brownout/index.d.mts +1 -0
- package/dist/circuits/brownout/preset.d.mts +22 -0
- package/dist/circuits/brownout/preset.mjs +399 -0
- package/dist/circuits/capacitor-leak/preset.mjs +13 -8
- package/dist/circuits/circuit/asset.mjs +71 -14
- package/dist/circuits/circuit/preset.mjs +23 -5
- package/dist/circuits/circuit-builder.mjs +60 -132
- package/dist/circuits/circuit-lab.mjs +60 -40
- package/dist/circuits/cmos-gate/index.d.mts +1 -0
- package/dist/circuits/cmos-gate/preset.d.mts +75 -0
- package/dist/circuits/cmos-gate/preset.mjs +1491 -0
- package/dist/circuits/diode/index.d.mts +1 -0
- package/dist/circuits/diode/preset.d.mts +25 -0
- package/dist/circuits/diode/preset.mjs +266 -0
- package/dist/circuits/index.d.mts +7 -1
- package/dist/circuits/index.mjs +7 -1
- package/dist/circuits/rc-charging/index.d.mts +1 -0
- package/dist/circuits/rc-charging/preset.d.mts +27 -0
- package/dist/circuits/rc-charging/preset.mjs +329 -0
- package/dist/circuits/semiconductor/index.d.mts +1 -0
- package/dist/circuits/semiconductor/preset.d.mts +102 -0
- package/dist/circuits/semiconductor/preset.mjs +1855 -0
- package/dist/circuits/transistor/index.d.mts +1 -0
- package/dist/circuits/transistor/preset.d.mts +27 -0
- package/dist/circuits/transistor/preset.mjs +329 -0
- package/dist/commerce/accounting/core.d.mts +1 -1
- package/dist/commerce/accounting/equation-balance.mjs +5 -5
- package/dist/commerce/accounting/journal-poster.mjs +8 -8
- package/dist/commerce/accounting/statement-sorter.mjs +4 -4
- package/dist/commerce/economics/core.d.mts +2 -2
- package/dist/commerce/economics/core.mjs +1 -1
- package/dist/commerce/economics/demand-shift-vs-move.mjs +6 -6
- package/dist/commerce/economics/elasticity-revenue.mjs +6 -6
- package/dist/commerce/economics/market-equilibrium.mjs +5 -5
- package/dist/core/easing.d.mts +3 -3
- package/dist/core/easing.mjs +2 -2
- package/dist/core/numeric.d.mts +3 -3
- package/dist/core/numeric.mjs +2 -2
- package/dist/core/reactive.d.mts +1 -1
- package/dist/core/reactive.mjs +1 -1
- package/dist/core/rng.d.mts +2 -2
- package/dist/core/rng.mjs +1 -1
- package/dist/core/tex.mjs +2 -2
- package/dist/core/timeline.d.mts +1 -1
- package/dist/core/timeline.mjs +1 -1
- package/dist/core/util.mjs +11 -1
- package/dist/discrete/arrangements/preset.mjs +6 -14
- package/dist/discrete/bayes/preset.mjs +43 -35
- package/dist/discrete/binomial/preset.mjs +2 -2
- package/dist/discrete/combination-studio/figure.d.mts +6 -0
- package/dist/discrete/combination-studio/figure.mjs +159 -0
- package/dist/discrete/combination-studio/index.d.mts +2 -0
- package/dist/discrete/combination-studio/preset.d.mts +44 -0
- package/dist/discrete/combination-studio/preset.mjs +440 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -3
- package/dist/discrete/core/combinatorics.mjs +38 -3
- package/dist/discrete/core/pigeonhole.d.mts +1 -1
- package/dist/discrete/core/pigeonhole.mjs +1 -1
- package/dist/discrete/core/probability.d.mts +3 -3
- package/dist/discrete/core/probability.mjs +3 -3
- package/dist/discrete/core/sets.d.mts +1 -1
- package/dist/discrete/counting-slots/preset.mjs +8 -8
- package/dist/discrete/counting-tree/preset.mjs +65 -8
- package/dist/discrete/expected-value/preset.mjs +13 -13
- package/dist/discrete/hypergeometric/preset.mjs +48 -15
- package/dist/discrete/index.d.mts +4 -2
- package/dist/discrete/index.mjs +4 -2
- package/dist/discrete/karnaugh/preset.mjs +26 -20
- package/dist/discrete/lln/preset.mjs +44 -3
- package/dist/discrete/logic-circuit/preset.mjs +2 -2
- package/dist/discrete/monte-carlo/preset.d.mts +1 -1
- package/dist/discrete/monte-carlo/preset.mjs +14 -14
- package/dist/discrete/monty-hall/preset.mjs +6 -6
- package/dist/discrete/outcome-builder/preset.mjs +3 -3
- package/dist/discrete/pascal/preset.mjs +37 -7
- package/dist/discrete/rules.d.mts +20 -0
- package/dist/discrete/rules.mjs +264 -0
- package/dist/discrete/sample-space/preset.mjs +4 -4
- package/dist/discrete/selection/preset.mjs +7 -13
- package/dist/discrete/truth-table/preset.mjs +32 -9
- package/dist/discrete/venn/preset.mjs +71 -48
- package/dist/geography/cycle-lab/preset.mjs +17 -10
- package/dist/geography/cycles.d.mts +3 -3
- package/dist/geography/cycles.mjs +3 -3
- package/dist/geometry/board/preset.d.mts +2 -0
- package/dist/geometry/board/preset.mjs +11 -15
- package/dist/geometry/builder.mjs +3 -3
- package/dist/ict/number-systems/base-odometer.mjs +4 -4
- package/dist/ict/number-systems/bit-grouper.d.mts +1 -1
- package/dist/ict/number-systems/bit-grouper.mjs +4 -4
- package/dist/ict/number-systems/place-value-dial.d.mts +1 -1
- package/dist/ict/number-systems/place-value-dial.mjs +3 -3
- package/dist/ict/number-systems/wheel.d.mts +3 -3
- package/dist/ict/number-systems/wheel.mjs +4 -4
- package/dist/kit/annotate.mjs +3 -3
- package/dist/kit/answer-check.d.mts +2 -2
- package/dist/kit/answer-check.mjs +34 -6
- package/dist/kit/ask.d.mts +19 -0
- package/dist/kit/ask.mjs +46 -0
- package/dist/kit/bar-strip.mjs +53 -0
- package/dist/kit/calc.d.mts +33 -0
- package/dist/kit/calc.mjs +27 -0
- package/dist/kit/carrier-engine.mjs +147 -0
- package/dist/kit/clue-scene.d.mts +86 -0
- package/dist/kit/clue-scene.mjs +424 -0
- package/dist/kit/cluster.d.mts +30 -0
- package/dist/kit/cluster.mjs +81 -0
- package/dist/kit/controls.mjs +11 -5
- package/dist/kit/coords.d.mts +88 -0
- package/dist/kit/coords.mjs +192 -0
- package/dist/kit/data-scene.d.mts +27 -0
- package/dist/kit/data-scene.mjs +199 -0
- package/dist/kit/diagram.mjs +111 -50
- package/dist/kit/electronics.mjs +552 -60
- package/dist/kit/expr-analysis.d.mts +18 -6
- package/dist/kit/expr-analysis.mjs +82 -28
- package/dist/kit/frame.d.mts +3 -3
- package/dist/kit/frame.mjs +25 -6
- package/dist/kit/gameshow.mjs +2 -2
- package/dist/kit/index.d.mts +14 -2
- package/dist/kit/index.mjs +13 -1
- package/dist/kit/logic-gates.mjs +246 -47
- package/dist/kit/palette.mjs +26 -0
- package/dist/kit/pedagogy.d.mts +4 -4
- package/dist/kit/pedagogy.mjs +21 -17
- package/dist/kit/play.d.mts +1 -1
- package/dist/kit/play.mjs +3 -3
- package/dist/kit/predict.d.mts +55 -0
- package/dist/kit/predict.mjs +146 -0
- package/dist/kit/receipt.d.mts +29 -0
- package/dist/kit/receipt.mjs +94 -0
- package/dist/kit/rich.mjs +2 -2
- package/dist/kit/rule.d.mts +59 -0
- package/dist/kit/rule.mjs +215 -0
- package/dist/kit/scale.mjs +1 -1
- package/dist/kit/scene-library.d.mts +22 -0
- package/dist/kit/scene-library.mjs +311 -0
- package/dist/kit/scene-studio.d.mts +14 -0
- package/dist/kit/scene-studio.mjs +338 -0
- package/dist/kit/scenes.d.mts +31 -0
- package/dist/kit/scenes.mjs +569 -0
- package/dist/kit/slot-fill.d.mts +61 -0
- package/dist/kit/slot-fill.mjs +207 -0
- package/dist/kit/solve.d.mts +21 -0
- package/dist/kit/solve.mjs +75 -0
- package/dist/kit/space.mjs +5 -5
- package/dist/kit/steps.mjs +2 -2
- package/dist/kit/vessel.d.mts +69 -0
- package/dist/kit/vessel.mjs +191 -0
- package/dist/language/agreement/preset.mjs +2 -2
- package/dist/language/article-lens/preset.d.mts +1 -1
- package/dist/language/article-lens/preset.mjs +8 -8
- package/dist/language/deck.d.mts +3 -3
- package/dist/language/deck.mjs +1 -1
- package/dist/language/preposition-scene/preset.d.mts +2 -2
- package/dist/language/preposition-scene/preset.mjs +5 -5
- package/dist/language/sentence-builder/preset.mjs +5 -5
- package/dist/language/transform/preset.d.mts +2 -2
- package/dist/language/transform/preset.mjs +5 -5
- package/dist/language/ui.d.mts +3 -3
- package/dist/language/ui.mjs +4 -4
- package/dist/language/word-match/preset.mjs +3 -3
- package/dist/logic/LogicBuildLab.d.mts +22 -0
- package/dist/logic/LogicBuildLab.mjs +170 -0
- package/dist/logic/LogicEditScene.d.mts +31 -0
- package/dist/logic/LogicEditScene.mjs +276 -0
- package/dist/logic/LogicEditor.d.mts +14 -0
- package/dist/logic/LogicEditor.mjs +413 -0
- package/dist/logic/LogicScene.d.mts +32 -0
- package/dist/logic/LogicScene.mjs +277 -0
- package/dist/logic/contract.d.mts +72 -0
- package/dist/logic/display.d.mts +24 -0
- package/dist/logic/display.mjs +127 -0
- package/dist/logic/edit-ops.d.mts +44 -0
- package/dist/logic/edit-ops.mjs +177 -0
- package/dist/logic/evaluate.d.mts +11 -0
- package/dist/logic/evaluate.mjs +93 -0
- package/dist/logic/gates.d.mts +10 -0
- package/dist/logic/gates.mjs +73 -0
- package/dist/logic/index.d.mts +14 -0
- package/dist/logic/index.mjs +13 -0
- package/dist/logic/lab.d.mts +32 -0
- package/dist/logic/lab.mjs +160 -0
- package/dist/logic/presets.d.mts +12 -0
- package/dist/logic/presets.mjs +241 -0
- package/dist/logic/registry.d.mts +9 -0
- package/dist/logic/registry.mjs +15 -0
- package/dist/math/area-model/preset.mjs +70 -44
- package/dist/math/balance-algebra/preset.mjs +14 -5
- package/dist/math/broken-tree/index.d.mts +1 -0
- package/dist/math/broken-tree/preset.d.mts +26 -0
- package/dist/math/broken-tree/preset.mjs +435 -0
- package/dist/math/circle/index.d.mts +1 -0
- package/dist/math/circle/preset.d.mts +44 -0
- package/dist/math/circle/preset.mjs +198 -0
- package/dist/math/complex/core.d.mts +93 -0
- package/dist/math/complex/core.mjs +239 -0
- package/dist/math/complex/index.d.mts +3 -0
- package/dist/math/complex/preset.d.mts +31 -0
- package/dist/math/complex/preset.mjs +377 -0
- package/dist/math/complex/rules.d.mts +6 -0
- package/dist/math/complex/rules.mjs +121 -0
- package/dist/math/conic/index.d.mts +1 -0
- package/dist/math/conic/preset.d.mts +30 -0
- package/dist/math/conic/preset.mjs +334 -0
- package/dist/math/derivation.mjs +5 -5
- package/dist/math/derivative-explorer/preset.mjs +5 -5
- package/dist/math/domain-range/index.d.mts +1 -0
- package/dist/math/domain-range/preset.d.mts +33 -0
- package/dist/math/domain-range/preset.mjs +313 -0
- package/dist/math/fraction-bar/index.d.mts +1 -0
- package/dist/math/fraction-bar/preset.d.mts +27 -0
- package/dist/math/fraction-bar/preset.mjs +197 -0
- package/dist/math/function-machine/preset.mjs +2 -2
- package/dist/math/gradient-descent.mjs +6 -6
- package/dist/math/grapher/preset.d.mts +1 -1
- package/dist/math/grapher/preset.mjs +4 -4
- package/dist/math/harmonic-form/preset.mjs +6 -6
- package/dist/math/index.d.mts +27 -2
- package/dist/math/index.mjs +27 -2
- package/dist/math/integral-explorer/preset.mjs +2 -2
- package/dist/math/interactive/preset.mjs +3 -3
- package/dist/math/limit-explorer/preset.mjs +4 -4
- package/dist/math/linear-model/index.d.mts +1 -0
- package/dist/math/linear-model/preset.d.mts +53 -0
- package/dist/math/linear-model/preset.mjs +164 -0
- package/dist/math/linear-system/preset.mjs +4 -4
- package/dist/math/mystery-bucket/preset.mjs +6 -6
- package/dist/math/number-line/preset.mjs +3 -2
- package/dist/math/parabola/preset.mjs +4 -3
- package/dist/math/pattern/preset.mjs +7 -13
- package/dist/math/percent-bar/index.d.mts +1 -0
- package/dist/math/percent-bar/preset.d.mts +37 -0
- package/dist/math/percent-bar/preset.mjs +275 -0
- package/dist/math/poly/core.d.mts +50 -0
- package/dist/math/poly/core.mjs +268 -0
- package/dist/math/poly/index.d.mts +3 -0
- package/dist/math/poly/preset.d.mts +23 -0
- package/dist/math/poly/preset.mjs +141 -0
- package/dist/math/poly/steps.d.mts +10 -0
- package/dist/math/poly/steps.mjs +99 -0
- package/dist/math/rate-machine/index.d.mts +1 -0
- package/dist/math/rate-machine/preset.d.mts +35 -0
- package/dist/math/rate-machine/preset.mjs +281 -0
- package/dist/math/ratio-share/index.d.mts +1 -0
- package/dist/math/ratio-share/preset.d.mts +24 -0
- package/dist/math/ratio-share/preset.mjs +204 -0
- package/dist/math/receipt/index.d.mts +1 -0
- package/dist/math/receipt/preset.d.mts +22 -0
- package/dist/math/receipt/preset.mjs +137 -0
- package/dist/math/sequence-predict/index.d.mts +1 -0
- package/dist/math/sequence-predict/preset.d.mts +34 -0
- package/dist/math/sequence-predict/preset.mjs +130 -0
- package/dist/math/straight-line/index.d.mts +1 -0
- package/dist/math/straight-line/preset.d.mts +37 -0
- package/dist/math/straight-line/preset.mjs +374 -0
- package/dist/math/system-solve/index.d.mts +1 -0
- package/dist/math/system-solve/preset.d.mts +21 -0
- package/dist/math/system-solve/preset.mjs +227 -0
- package/dist/math/transform/index.d.mts +1 -0
- package/dist/math/transform/preset.d.mts +41 -0
- package/dist/math/transform/preset.mjs +343 -0
- package/dist/math/triangle-trig/preset.mjs +12 -9
- package/dist/math/trig/core.d.mts +37 -0
- package/dist/math/trig/core.mjs +150 -0
- package/dist/math/trig/diagrams.d.mts +1 -0
- package/dist/math/trig/diagrams.mjs +321 -0
- package/dist/math/trig/index.d.mts +3 -0
- package/dist/math/trig/preset.d.mts +25 -0
- package/dist/math/trig/preset.mjs +260 -0
- package/dist/math/trig/rules.d.mts +6 -0
- package/dist/math/trig/rules.mjs +159 -0
- package/dist/math/trig-explorer.mjs +4 -4
- package/dist/ml/boundary/preset.mjs +8 -3
- package/dist/ml/classifier/preset.mjs +31 -6
- package/dist/ml/kmeans/preset.mjs +4 -4
- package/dist/ml/knn/preset.mjs +47 -12
- package/dist/ml/regression/preset.mjs +36 -7
- package/dist/physics/atwood/preset.mjs +4 -4
- package/dist/physics/bullet-walls/preset.d.mts +1 -1
- package/dist/physics/bullet-walls/preset.mjs +7 -7
- package/dist/physics/carnot/preset.mjs +6 -6
- package/dist/physics/circular-motion/preset.mjs +36 -5
- package/dist/physics/collision-track/preset.mjs +35 -5
- package/dist/physics/efficiency/preset.d.mts +2 -2
- package/dist/physics/efficiency/preset.mjs +5 -5
- package/dist/physics/electric-field/preset.mjs +32 -23
- package/dist/physics/electric-flux/index.d.mts +1 -0
- package/dist/physics/electric-flux/preset.d.mts +29 -0
- package/dist/physics/electric-flux/preset.mjs +264 -0
- package/dist/physics/energy-skate/preset.mjs +5 -5
- package/dist/physics/entropy/preset.mjs +7 -7
- package/dist/physics/expansion/preset.mjs +13 -13
- package/dist/physics/exponential/asset.mjs +1 -1
- package/dist/physics/exponential/preset.mjs +4 -4
- package/dist/physics/gas-process/preset.mjs +3 -3
- package/dist/physics/gauss-law/index.d.mts +1 -0
- package/dist/physics/gauss-law/preset.d.mts +20 -0
- package/dist/physics/gauss-law/preset.mjs +286 -0
- package/dist/physics/gravitation/preset.mjs +7 -7
- package/dist/physics/gravity-drop.mjs +4 -4
- package/dist/physics/heat-transfer/preset.d.mts +1 -1
- package/dist/physics/heat-transfer/preset.mjs +10 -10
- package/dist/physics/impulse/preset.mjs +5 -5
- package/dist/physics/index.d.mts +4 -1
- package/dist/physics/index.mjs +4 -1
- package/dist/physics/kepler/preset.mjs +4 -4
- package/dist/physics/lever/preset.mjs +3 -3
- package/dist/physics/lorentz/preset.mjs +11 -11
- package/dist/physics/magnetism/preset.mjs +3 -3
- package/dist/physics/optics/preset.mjs +2 -2
- package/dist/physics/orbit-lab.mjs +5 -5
- package/dist/physics/projectile-lab.mjs +4 -4
- package/dist/physics/rain-relative/preset.mjs +5 -5
- package/dist/physics/ramp-forces/preset.mjs +5 -5
- package/dist/physics/river-boat.mjs +6 -6
- package/dist/physics/shm/preset.mjs +9 -9
- package/dist/physics/stopping-distance/preset.mjs +3 -3
- package/dist/physics/temperature-scales/preset.mjs +105 -116
- package/dist/physics/terminal-velocity/preset.mjs +5 -5
- package/dist/physics/thermal/preset.mjs +5 -5
- package/dist/physics/vector-board/preset.mjs +7 -6
- package/dist/physics/vector-scene.mjs +2 -2
- package/dist/physics/vector-types/preset.mjs +37 -3
- package/dist/physics/water-density/preset.mjs +12 -12
- package/dist/physics/waves/doppler.mjs +2 -2
- package/dist/physics/waves/preset.mjs +4 -4
- package/dist/physics/waves/ripple.mjs +6 -6
- package/dist/physics/waves/string.mjs +5 -5
- package/dist/physics/work-energy/preset.mjs +4 -4
- package/dist/physics/work-potential/index.d.mts +1 -0
- package/dist/physics/work-potential/preset.d.mts +20 -0
- package/dist/physics/work-potential/preset.mjs +276 -0
- package/dist/schemas/index.d.mts +6 -6
- package/dist/schemas/index.mjs +3 -3
- package/dist/statistics/center-spread/preset.mjs +3 -3
- package/dist/statistics/core/descriptive.d.mts +2 -2
- package/dist/statistics/core/descriptive.mjs +2 -2
- package/dist/statistics/core/normal.d.mts +3 -3
- package/dist/statistics/core/normal.mjs +3 -3
- package/dist/statistics/core/sequences.d.mts +1 -1
- package/dist/statistics/galton/preset.mjs +2 -2
- package/dist/statistics/histogram/preset.mjs +6 -6
- package/dist/statistics/normal/preset.mjs +2 -2
- package/dist/statistics/sampling/preset.mjs +4 -4
- package/dist/statistics/sequence/preset.mjs +58 -15
- package/dist/statistics/z-table/preset.mjs +17 -4
- package/package.json +11 -3
- package/styles.css +4 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { BulbGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { labelOf, num, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/bulb.tsx
|
|
8
|
+
/** Lamp / bulb: a resistor that glows. `ohms` sets its resistance; brightness tracks |current|. */
|
|
9
|
+
const BULB = {
|
|
10
|
+
kind: "bulb",
|
|
11
|
+
label: "Lamp",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: {
|
|
14
|
+
ohms: 100,
|
|
15
|
+
maxPower: 2
|
|
16
|
+
},
|
|
17
|
+
controls: [{
|
|
18
|
+
key: "ohms",
|
|
19
|
+
label: "Resistance",
|
|
20
|
+
unit: "Ω",
|
|
21
|
+
min: 1,
|
|
22
|
+
max: 1e4,
|
|
23
|
+
step: 10
|
|
24
|
+
}, {
|
|
25
|
+
key: "maxPower",
|
|
26
|
+
label: "Power rating",
|
|
27
|
+
unit: "W",
|
|
28
|
+
min: 0,
|
|
29
|
+
max: 50,
|
|
30
|
+
step: .1
|
|
31
|
+
}],
|
|
32
|
+
terminalAt: term2,
|
|
33
|
+
toElems: (i, n) => [{
|
|
34
|
+
kind: "R",
|
|
35
|
+
n1: n("a"),
|
|
36
|
+
n2: n("b"),
|
|
37
|
+
value: num(i.props?.ohms, 100)
|
|
38
|
+
}],
|
|
39
|
+
render: (i, s) => render2(i, labelOf(i) ?? "lamp", (cx, cy, h, l) => /* @__PURE__ */ jsx(BulbGlyph, {
|
|
40
|
+
cx,
|
|
41
|
+
cy,
|
|
42
|
+
half: h,
|
|
43
|
+
live: s.live,
|
|
44
|
+
brightness: Math.max(0, Math.min(1, Math.abs(s.i) * 40)),
|
|
45
|
+
label: l
|
|
46
|
+
}))
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { BULB };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { CapacitorGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { labelOf, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/capacitor.tsx
|
|
8
|
+
/** Capacitor: stores charge. Open at DC (no element here); the transient solver gives it dynamics. */
|
|
9
|
+
const CAPACITOR = {
|
|
10
|
+
kind: "capacitor",
|
|
11
|
+
label: "Capacitor",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: { farads: 1e-5 },
|
|
14
|
+
terminalAt: term2,
|
|
15
|
+
toElems: () => [],
|
|
16
|
+
render: (i, s) => render2(i, labelOf(i), (cx, cy, h, l) => /* @__PURE__ */ jsx(CapacitorGlyph, {
|
|
17
|
+
cx,
|
|
18
|
+
cy,
|
|
19
|
+
half: h,
|
|
20
|
+
live: s.live,
|
|
21
|
+
label: l
|
|
22
|
+
}))
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { CAPACITOR };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { CellGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { num, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/cell.tsx
|
|
8
|
+
/** Battery / cell: an ideal voltage source. `volts` sets its EMF; it drives the loop current. */
|
|
9
|
+
const CELL = {
|
|
10
|
+
kind: "cell",
|
|
11
|
+
label: "Battery",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: { volts: 5 },
|
|
14
|
+
controls: [{
|
|
15
|
+
key: "volts",
|
|
16
|
+
label: "Voltage",
|
|
17
|
+
unit: "V",
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 24,
|
|
20
|
+
step: .5
|
|
21
|
+
}],
|
|
22
|
+
terminalAt: term2,
|
|
23
|
+
toElems: (i, n) => [{
|
|
24
|
+
kind: "V",
|
|
25
|
+
n1: n("a"),
|
|
26
|
+
n2: n("b"),
|
|
27
|
+
value: num(i.props?.volts, 5),
|
|
28
|
+
id: i.id
|
|
29
|
+
}],
|
|
30
|
+
render: (i, s) => render2(i, `${num(i.props?.volts, 5)} V`, (cx, cy, h, l) => /* @__PURE__ */ jsx(CellGlyph, {
|
|
31
|
+
cx,
|
|
32
|
+
cy,
|
|
33
|
+
half: h,
|
|
34
|
+
live: s.live,
|
|
35
|
+
label: l
|
|
36
|
+
}))
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { CELL };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { DiodeGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { labelOf, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/diode.tsx
|
|
8
|
+
/** Diode: one-way valve (Shockley model in the solver). Conducts a→b above ~0.7 V, blocks reverse. */
|
|
9
|
+
const DIODE = {
|
|
10
|
+
kind: "diode",
|
|
11
|
+
label: "Diode",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: {},
|
|
14
|
+
terminalAt: term2,
|
|
15
|
+
toElems: (i, n) => [{
|
|
16
|
+
kind: "D",
|
|
17
|
+
n1: n("a"),
|
|
18
|
+
n2: n("b"),
|
|
19
|
+
value: 0,
|
|
20
|
+
id: i.id
|
|
21
|
+
}],
|
|
22
|
+
render: (i, s) => render2(i, labelOf(i), (cx, cy, h, l) => /* @__PURE__ */ jsx(DiodeGlyph, {
|
|
23
|
+
cx,
|
|
24
|
+
cy,
|
|
25
|
+
half: h,
|
|
26
|
+
live: s.live,
|
|
27
|
+
conducting: s.live,
|
|
28
|
+
label: l
|
|
29
|
+
}))
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DIODE };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { registerPart } from "../registry.mjs";
|
|
2
|
+
import { CELL } from "./cell.mjs";
|
|
3
|
+
import { RESISTOR } from "./resistor.mjs";
|
|
4
|
+
import { BULB } from "./bulb.mjs";
|
|
5
|
+
import { SWITCH } from "./switch.mjs";
|
|
6
|
+
import { DIODE } from "./diode.mjs";
|
|
7
|
+
import { CAPACITOR } from "./capacitor.mjs";
|
|
8
|
+
import { AMMETER } from "./ammeter.mjs";
|
|
9
|
+
import { NODE } from "./node.mjs";
|
|
10
|
+
import { NMOS, PMOS } from "./mosfet.mjs";
|
|
11
|
+
|
|
12
|
+
//#region src/build/parts/index.ts
|
|
13
|
+
/**
|
|
14
|
+
* Built-in part registry. Each component is its own module (cell, resistor, bulb, switch,
|
|
15
|
+
* diode, capacitor, mosfet, node, ammeter), self-contained: its pins, electrical stamp, glyph,
|
|
16
|
+
* tunables and any tap behaviour. This barrel is the ONE place that wires them into the live
|
|
17
|
+
* registry. Add a component = add a file here and one line below. Nothing else special-cases a
|
|
18
|
+
* part kind, so the solver and renderer stay component-agnostic.
|
|
19
|
+
*/
|
|
20
|
+
/** The built-ins in palette order. */
|
|
21
|
+
const BUILTIN_PARTS = [
|
|
22
|
+
CELL,
|
|
23
|
+
RESISTOR,
|
|
24
|
+
BULB,
|
|
25
|
+
SWITCH,
|
|
26
|
+
DIODE,
|
|
27
|
+
CAPACITOR,
|
|
28
|
+
AMMETER,
|
|
29
|
+
NODE,
|
|
30
|
+
NMOS,
|
|
31
|
+
PMOS
|
|
32
|
+
];
|
|
33
|
+
let registered = false;
|
|
34
|
+
/** Register the built-in parts (idempotent). Imported for its side effect. */
|
|
35
|
+
function registerBuiltinParts() {
|
|
36
|
+
if (registered) return;
|
|
37
|
+
registered = true;
|
|
38
|
+
BUILTIN_PARTS.forEach(registerPart);
|
|
39
|
+
}
|
|
40
|
+
registerBuiltinParts();
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { registerBuiltinParts };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { MosfetGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { num } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/mosfet.tsx
|
|
8
|
+
const MOS_HALF = 34, GATE_OFF = 37;
|
|
9
|
+
const mosTerminal = (i, pin) => {
|
|
10
|
+
const { x, y } = i.at;
|
|
11
|
+
return pin === "d" ? {
|
|
12
|
+
x,
|
|
13
|
+
y: y - MOS_HALF
|
|
14
|
+
} : pin === "s" ? {
|
|
15
|
+
x,
|
|
16
|
+
y: y + MOS_HALF
|
|
17
|
+
} : {
|
|
18
|
+
x: x - GATE_OFF,
|
|
19
|
+
y
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const mosDef = (kind, pmos) => ({
|
|
23
|
+
kind,
|
|
24
|
+
label: pmos ? "PMOS" : "NMOS",
|
|
25
|
+
pins: [
|
|
26
|
+
"d",
|
|
27
|
+
"s",
|
|
28
|
+
"g"
|
|
29
|
+
],
|
|
30
|
+
defaultProps: {
|
|
31
|
+
vth: 2,
|
|
32
|
+
k: .5,
|
|
33
|
+
maxPower: .5,
|
|
34
|
+
maxVoltage: 20
|
|
35
|
+
},
|
|
36
|
+
controls: [
|
|
37
|
+
{
|
|
38
|
+
key: "vth",
|
|
39
|
+
label: "Threshold",
|
|
40
|
+
unit: "V",
|
|
41
|
+
min: .5,
|
|
42
|
+
max: 5,
|
|
43
|
+
step: .1
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "k",
|
|
47
|
+
label: "Gain k",
|
|
48
|
+
min: .1,
|
|
49
|
+
max: 2,
|
|
50
|
+
step: .1
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "maxPower",
|
|
54
|
+
label: "Power rating",
|
|
55
|
+
unit: "W",
|
|
56
|
+
min: 0,
|
|
57
|
+
max: 50,
|
|
58
|
+
step: .1
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "maxVoltage",
|
|
62
|
+
label: "Breakdown V",
|
|
63
|
+
unit: "V",
|
|
64
|
+
min: 0,
|
|
65
|
+
max: 100,
|
|
66
|
+
step: 1
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
terminalAt: mosTerminal,
|
|
70
|
+
toElems: (i, n) => [{
|
|
71
|
+
kind: "M",
|
|
72
|
+
pmos,
|
|
73
|
+
n1: n("d"),
|
|
74
|
+
n2: n("s"),
|
|
75
|
+
n3: n("g"),
|
|
76
|
+
value: 0,
|
|
77
|
+
vth: num(i.props?.vth, 2),
|
|
78
|
+
k: num(i.props?.k, .5),
|
|
79
|
+
id: i.id
|
|
80
|
+
}],
|
|
81
|
+
render: (i, s) => /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(MosfetGlyph, {
|
|
82
|
+
cx: i.at.x + 9,
|
|
83
|
+
cy: i.at.y,
|
|
84
|
+
half: MOS_HALF,
|
|
85
|
+
pmos,
|
|
86
|
+
on: s.live,
|
|
87
|
+
live: s.live,
|
|
88
|
+
label: i.props?.label
|
|
89
|
+
}) }, i.id)
|
|
90
|
+
});
|
|
91
|
+
const NMOS = mosDef("nmos", false);
|
|
92
|
+
const PMOS = mosDef("pmos", true);
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { NMOS, PMOS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { JunctionDot } from "../../kit/electronics.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/build/parts/node.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Junction node: a free connection point (one pin, no element = a perfect conductor). Every
|
|
9
|
+
* wire touching it shares one electrical net, so it is how parallel branches, bridges and
|
|
10
|
+
* ladders are built. The editor only ever creates one ON a wire (a tap), and prunes any that
|
|
11
|
+
* fall below two connections, so junctions never float as clutter.
|
|
12
|
+
*/
|
|
13
|
+
const NODE = {
|
|
14
|
+
kind: "node",
|
|
15
|
+
label: "Node (junction)",
|
|
16
|
+
pins: ["j"],
|
|
17
|
+
defaultProps: {},
|
|
18
|
+
terminalAt: (i) => ({
|
|
19
|
+
x: i.at.x,
|
|
20
|
+
y: i.at.y
|
|
21
|
+
}),
|
|
22
|
+
toElems: () => [],
|
|
23
|
+
render: (i, s) => /* @__PURE__ */ jsx(JunctionDot, {
|
|
24
|
+
x: i.at.x,
|
|
25
|
+
y: i.at.y,
|
|
26
|
+
live: s.live,
|
|
27
|
+
r: 5
|
|
28
|
+
}, i.id)
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { NODE };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ResistorGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { num, ohmLabel, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/resistor.tsx
|
|
8
|
+
/** Resistor: an ohmic element. `ohms` sets its resistance; current = V across it / ohms. */
|
|
9
|
+
const RESISTOR = {
|
|
10
|
+
kind: "resistor",
|
|
11
|
+
label: "Resistor",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: {
|
|
14
|
+
ohms: 1e3,
|
|
15
|
+
maxPower: .5
|
|
16
|
+
},
|
|
17
|
+
controls: [{
|
|
18
|
+
key: "ohms",
|
|
19
|
+
label: "Resistance",
|
|
20
|
+
unit: "Ω",
|
|
21
|
+
min: 1,
|
|
22
|
+
max: 1e5,
|
|
23
|
+
step: 10
|
|
24
|
+
}, {
|
|
25
|
+
key: "maxPower",
|
|
26
|
+
label: "Power rating",
|
|
27
|
+
unit: "W",
|
|
28
|
+
min: 0,
|
|
29
|
+
max: 50,
|
|
30
|
+
step: .05
|
|
31
|
+
}],
|
|
32
|
+
terminalAt: term2,
|
|
33
|
+
toElems: (i, n) => [{
|
|
34
|
+
kind: "R",
|
|
35
|
+
n1: n("a"),
|
|
36
|
+
n2: n("b"),
|
|
37
|
+
value: num(i.props?.ohms, 1e3)
|
|
38
|
+
}],
|
|
39
|
+
render: (i, s) => render2(i, ohmLabel(num(i.props?.ohms, 1e3)), (cx, cy, h, l) => /* @__PURE__ */ jsx(ResistorGlyph, {
|
|
40
|
+
cx,
|
|
41
|
+
cy,
|
|
42
|
+
half: h,
|
|
43
|
+
live: s.live,
|
|
44
|
+
label: l
|
|
45
|
+
}))
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { RESISTOR };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/build/parts/shared.tsx
|
|
6
|
+
/** centre → terminal distance for a 2-terminal part, px. */
|
|
7
|
+
const HALF = 30;
|
|
8
|
+
const num = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
|
|
9
|
+
const ohmLabel = (r) => r >= 1e3 ? `${r / 1e3} kΩ` : `${r} Ω`;
|
|
10
|
+
const labelOf = (i) => i.props?.label ?? void 0;
|
|
11
|
+
/** terminal world position for a 2-terminal part (a = left/top, b = right/bottom). */
|
|
12
|
+
function term2(inst, pin) {
|
|
13
|
+
const { x, y } = inst.at, o = inst.orient ?? "h", s = pin === "a" ? -1 : 1;
|
|
14
|
+
return o === "v" ? {
|
|
15
|
+
x,
|
|
16
|
+
y: y + s * 30
|
|
17
|
+
} : {
|
|
18
|
+
x: x + s * 30,
|
|
19
|
+
y
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** render a 2-terminal glyph at the instance, rotated for 'v', label kept horizontal. */
|
|
23
|
+
function render2(inst, label, glyph) {
|
|
24
|
+
const { x, y } = inst.at;
|
|
25
|
+
if ((inst.orient ?? "h") === "v") return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("g", {
|
|
26
|
+
transform: `rotate(90 ${x} ${y})`,
|
|
27
|
+
children: glyph(x, y, 30, void 0)
|
|
28
|
+
}), label && /* @__PURE__ */ jsx("text", {
|
|
29
|
+
x: x + 30 + 8,
|
|
30
|
+
y: y + 4,
|
|
31
|
+
fill: "var(--stage-fg)",
|
|
32
|
+
fontSize: 11,
|
|
33
|
+
fontWeight: 600,
|
|
34
|
+
textAnchor: "start",
|
|
35
|
+
style: { pointerEvents: "none" },
|
|
36
|
+
children: label
|
|
37
|
+
})] }, inst.id);
|
|
38
|
+
return /* @__PURE__ */ jsx("g", { children: glyph(x, y, 30, label) }, inst.id);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { labelOf, num, ohmLabel, render2, term2 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { SwitchGlyph } from "../../kit/electronics.mjs";
|
|
4
|
+
import { labelOf, render2, term2 } from "./shared.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/build/parts/switch.tsx
|
|
8
|
+
/** Switch: closed = a 0 V short (conducts), open = no element (breaks the loop). Tap to toggle. */
|
|
9
|
+
const SWITCH = {
|
|
10
|
+
kind: "switch",
|
|
11
|
+
label: "Switch",
|
|
12
|
+
pins: ["a", "b"],
|
|
13
|
+
defaultProps: { closed: false },
|
|
14
|
+
terminalAt: term2,
|
|
15
|
+
toElems: (i, n) => i.props?.closed ? [{
|
|
16
|
+
kind: "V",
|
|
17
|
+
n1: n("a"),
|
|
18
|
+
n2: n("b"),
|
|
19
|
+
value: 0,
|
|
20
|
+
id: i.id
|
|
21
|
+
}] : [],
|
|
22
|
+
render: (i, s) => render2(i, labelOf(i), (cx, cy, h, l) => /* @__PURE__ */ jsx(SwitchGlyph, {
|
|
23
|
+
cx,
|
|
24
|
+
cy,
|
|
25
|
+
half: h,
|
|
26
|
+
live: s.live,
|
|
27
|
+
closed: !!i.props?.closed,
|
|
28
|
+
label: l
|
|
29
|
+
})),
|
|
30
|
+
tap: (i) => ({ closed: !i.props?.closed })
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { SWITCH };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { registerBuiltinParts } from "./parts/index.mjs";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PartDef, PartKind } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/build/registry.d.ts
|
|
4
|
+
declare function registerPart(def: PartDef): void;
|
|
5
|
+
declare function getPart(kind: PartKind): PartDef | undefined;
|
|
6
|
+
/** Every registered part (drives the builder palette). */
|
|
7
|
+
declare function listParts(): PartDef[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getPart, listParts, registerPart };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/build/registry.ts
|
|
2
|
+
const REGISTRY = /* @__PURE__ */ new Map();
|
|
3
|
+
function registerPart(def) {
|
|
4
|
+
REGISTRY.set(def.kind, def);
|
|
5
|
+
}
|
|
6
|
+
function getPart(kind) {
|
|
7
|
+
return REGISTRY.get(kind);
|
|
8
|
+
}
|
|
9
|
+
/** Every registered part (drives the builder palette). */
|
|
10
|
+
function listParts() {
|
|
11
|
+
return [...REGISTRY.values()];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getPart, listParts, registerPart };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CircuitDoc, CircuitSolution, PartInstance, PartState } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/build/solve.d.ts
|
|
4
|
+
declare function solveCircuit(doc: CircuitDoc): CircuitSolution;
|
|
5
|
+
/** Derive the drawing state (current/voltage/live) for one part from the solution. */
|
|
6
|
+
declare function partState(part: PartInstance, sol: CircuitSolution): PartState;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { partState, solveCircuit };
|
|
Binary file
|
|
@@ -7,7 +7,7 @@ interface LabTemplate {
|
|
|
7
7
|
id: string;
|
|
8
8
|
/** Human title for the catalog. */
|
|
9
9
|
title: string;
|
|
10
|
-
/** Domain bucket
|
|
10
|
+
/** Domain bucket, 'algebra' | 'calculus' | 'physics' | 'circuits' | … */
|
|
11
11
|
category: string;
|
|
12
12
|
/** One-line description for the catalog card. */
|
|
13
13
|
description?: string;
|
|
@@ -24,7 +24,7 @@ declare function registerLabTemplate(t: LabTemplate): void;
|
|
|
24
24
|
declare function listLabTemplates(): LabTemplate[];
|
|
25
25
|
declare function listLabTemplatesByCategory(category: string): LabTemplate[];
|
|
26
26
|
declare function getLabTemplate(id: string): LabTemplate | undefined;
|
|
27
|
-
/** Result of instantiating a template
|
|
27
|
+
/** Result of instantiating a template, typed errors before a bad scene is built. */
|
|
28
28
|
type InstantiateResult = {
|
|
29
29
|
ok: true;
|
|
30
30
|
doc: SceneDoc;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/catalog/templates.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* Register the built-in lab families. Importing this module imports each
|
|
4
|
-
* preset's doc factory
|
|
4
|
+
* preset's doc factory, which self-registers its stage asset, and adds the
|
|
5
5
|
* family to the registry. New family = add one entry here.
|
|
6
6
|
*/
|
|
7
7
|
/** Register all built-in families. Called from the catalog entry (a used import
|
|
@@ -11,7 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
//#region src/catalog/templates.ts
|
|
12
12
|
/**
|
|
13
13
|
* Register the built-in lab families. Importing this module imports each
|
|
14
|
-
* preset's doc factory
|
|
14
|
+
* preset's doc factory, which self-registers its stage asset, and adds the
|
|
15
15
|
* family to the registry. New family = add one entry here.
|
|
16
16
|
*/
|
|
17
17
|
/** Register all built-in families. Called from the catalog entry (a used import
|
|
@@ -21,7 +21,7 @@ function registerBuiltinTemplates() {
|
|
|
21
21
|
id: "mystery-bucket",
|
|
22
22
|
title: "Mystery bucket (weigh the unknown)",
|
|
23
23
|
category: "algebra",
|
|
24
|
-
description: "Add unit weights until a balance is level
|
|
24
|
+
description: "Add unit weights until a balance is level, discover the hidden weight (the unknown) with no symbols. The essentials opener.",
|
|
25
25
|
paramsSchema: z.object({
|
|
26
26
|
bucketWeight: z.number(),
|
|
27
27
|
maxWeights: z.number().optional()
|
|
@@ -59,7 +59,7 @@ function registerBuiltinTemplates() {
|
|
|
59
59
|
id: "area-model",
|
|
60
60
|
title: "Area model (algebra tiles)",
|
|
61
61
|
category: "algebra",
|
|
62
|
-
description: "(x+a)(x+b) as a partitioned rectangle
|
|
62
|
+
description: "(x+a)(x+b) as a partitioned rectangle, expand or factor.",
|
|
63
63
|
paramsSchema: z.object({
|
|
64
64
|
a: z.number(),
|
|
65
65
|
b: z.number(),
|
|
@@ -93,7 +93,7 @@ function registerBuiltinTemplates() {
|
|
|
93
93
|
id: "balance-lever",
|
|
94
94
|
title: "Lever / torque",
|
|
95
95
|
category: "physics",
|
|
96
|
-
description: "Balance the mobile
|
|
96
|
+
description: "Balance the mobile, set the unknown weight so Σ(w·d) matches.",
|
|
97
97
|
paramsSchema: z.object({
|
|
98
98
|
items: z.array(z.unknown()).optional(),
|
|
99
99
|
start: z.number().optional(),
|
|
@@ -107,7 +107,7 @@ function registerBuiltinTemplates() {
|
|
|
107
107
|
});
|
|
108
108
|
registerLabTemplate({
|
|
109
109
|
id: "optics",
|
|
110
|
-
title: "Optics
|
|
110
|
+
title: "Optics: reflection",
|
|
111
111
|
category: "physics",
|
|
112
112
|
description: "Reflect a light ray off mirrors into the target.",
|
|
113
113
|
defaultParams: {},
|
|
@@ -117,7 +117,7 @@ function registerBuiltinTemplates() {
|
|
|
117
117
|
id: "circuit",
|
|
118
118
|
title: "Circuit",
|
|
119
119
|
category: "circuits",
|
|
120
|
-
description: "Battery + series/parallel branches
|
|
120
|
+
description: "Battery + series/parallel branches, light the bulb.",
|
|
121
121
|
paramsSchema: z.object({
|
|
122
122
|
emf: z.number().optional(),
|
|
123
123
|
branches: z.array(z.unknown()).optional()
|
package/dist/chem/battery.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { Dot, Label, Polygon, Segment, Stage, useFrameLoop } from "@classytic/st
|
|
|
12
12
|
|
|
13
13
|
//#region src/chem/battery.tsx
|
|
14
14
|
/**
|
|
15
|
-
* Battery
|
|
15
|
+
* Battery, a galvanic (voltaic) cell. Two half-cells: at the anode a metal is
|
|
16
16
|
* oxidized and releases electrons; they flow through the external wire to the
|
|
17
17
|
* cathode, where ions are reduced. Watch the electrons stream, see the
|
|
18
18
|
* half-reactions and the cell EMF.
|
package/dist/chem/bohr-atom.mjs
CHANGED
|
@@ -10,13 +10,13 @@ import { Circle, Dot, Label, Stage, useFrameLoop } from "@classytic/stage";
|
|
|
10
10
|
|
|
11
11
|
//#region src/chem/bohr-atom.tsx
|
|
12
12
|
/**
|
|
13
|
-
* BohrAtom
|
|
13
|
+
* BohrAtom, the classic shell model of an atom, animated.
|
|
14
14
|
*
|
|
15
15
|
* Nucleus (Z protons) ringed by electron shells filled 2, 8, 8, 18…; electrons
|
|
16
16
|
* orbit at a steady clip via the engine clock. Drag the proton count to walk the
|
|
17
17
|
* first 20 elements and watch shells fill and close.
|
|
18
18
|
*
|
|
19
|
-
* Now on the @classytic/stage engine (SVG, accessible, themed)
|
|
19
|
+
* Now on the @classytic/stage engine (SVG, accessible, themed), shells are
|
|
20
20
|
* Circles, electrons are Dots, the nucleus is a labelled Circle.
|
|
21
21
|
*/
|
|
22
22
|
const SYMBOLS = [
|
|
@@ -187,7 +187,7 @@ function BohrAtom({ protons, title = "Bohr model of the atom", height = 340 } =
|
|
|
187
187
|
}) });
|
|
188
188
|
return /* @__PURE__ */ jsx(LabFrame, {
|
|
189
189
|
title,
|
|
190
|
-
prompt: "Drag the proton count to walk the first 20 elements
|
|
190
|
+
prompt: "Drag the proton count to walk the first 20 elements, watch the shells fill (2, 8, 8, …).",
|
|
191
191
|
aside: /* @__PURE__ */ jsx(Callout, {
|
|
192
192
|
tone: "result",
|
|
193
193
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -197,7 +197,7 @@ function BohrAtom({ protons, title = "Bohr model of the atom", height = 340 } =
|
|
|
197
197
|
fontVariantNumeric: "tabular-nums"
|
|
198
198
|
},
|
|
199
199
|
children: [
|
|
200
|
-
/* @__PURE__ */ jsxs("span", { children: ["element ", SYMBOLS[z] ?? "
|
|
200
|
+
/* @__PURE__ */ jsxs("span", { children: ["element ", SYMBOLS[z] ?? ", "] }),
|
|
201
201
|
/* @__PURE__ */ jsxs("span", { children: ["Z ", z] }),
|
|
202
202
|
/* @__PURE__ */ jsxs("span", { children: ["config ", shells.join(", ")] })
|
|
203
203
|
]
|