@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,374 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Callout, LabFrame } from "../../kit/frame.mjs";
|
|
4
|
+
import { RightAngleMark } from "../../kit/diagram.mjs";
|
|
5
|
+
import { LabAsk } from "../../kit/ask.mjs";
|
|
6
|
+
import { CoordPlane, GradientTriangle, distance, interceptTex, intersectLines, lineFrom, lineTex, lineThrough, midpoint, num, parallelThrough, perpThrough, snapPoint } from "../../kit/coords.mjs";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Dot, Label, Line, MovableDot } from "@classytic/stage";
|
|
10
|
+
|
|
11
|
+
//#region src/math/straight-line/preset.tsx
|
|
12
|
+
/**
|
|
13
|
+
* StraightLineLab, one authorable lab that covers the whole Edexcel/IGCSE
|
|
14
|
+
* "equation of a straight line" spine, switched by `mode`:
|
|
15
|
+
*
|
|
16
|
+
* two-point drag A and B → the line through them, with the gradient
|
|
17
|
+
* shown as a rise/run triangle and the live y = m·x + c.
|
|
18
|
+
* gradient-intercept drag the y-intercept (on the y-axis) and a slope handle ,
|
|
19
|
+
* feel how m tilts and c slides the line.
|
|
20
|
+
* intercept-form drag the x- and y-intercepts → x/a + y/b = 1.
|
|
21
|
+
* parallel a FIXED given line; drag a point P; the parallel line
|
|
22
|
+
* through P is built live (same gradient).
|
|
23
|
+
* perpendicular same, but the ⊥ line (gradient −1/m); the right angle at
|
|
24
|
+
* the crossing is marked and m₁·m₂ = −1 is shown.
|
|
25
|
+
*
|
|
26
|
+
* Direct manipulation on a CoordPlane + an optional checked question (AskBox).
|
|
27
|
+
* A creator authors a real exam question by setting the mode, the given line /
|
|
28
|
+
* starting points, and the answer to check, no code.
|
|
29
|
+
*/
|
|
30
|
+
const C_LINE = "var(--stage-accent)";
|
|
31
|
+
const C_GIVEN = "var(--stage-accent-2)";
|
|
32
|
+
const C_A = "var(--stage-good)";
|
|
33
|
+
const C_B = "var(--stage-accent)";
|
|
34
|
+
const DEFAULT_VIEW = {
|
|
35
|
+
xMin: -8,
|
|
36
|
+
xMax: 8,
|
|
37
|
+
yMin: -6,
|
|
38
|
+
yMax: 6
|
|
39
|
+
};
|
|
40
|
+
const DEFAULTS = {
|
|
41
|
+
"two-point": {
|
|
42
|
+
a: {
|
|
43
|
+
x: -3,
|
|
44
|
+
y: -2
|
|
45
|
+
},
|
|
46
|
+
b: {
|
|
47
|
+
x: 4,
|
|
48
|
+
y: 3
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"gradient-intercept": {
|
|
52
|
+
a: {
|
|
53
|
+
x: 0,
|
|
54
|
+
y: 1
|
|
55
|
+
},
|
|
56
|
+
b: {
|
|
57
|
+
x: 3,
|
|
58
|
+
y: 3
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"intercept-form": {
|
|
62
|
+
a: {
|
|
63
|
+
x: 4,
|
|
64
|
+
y: 0
|
|
65
|
+
},
|
|
66
|
+
b: {
|
|
67
|
+
x: 0,
|
|
68
|
+
y: 3
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
parallel: {
|
|
72
|
+
a: {
|
|
73
|
+
x: 2,
|
|
74
|
+
y: -3
|
|
75
|
+
},
|
|
76
|
+
b: {
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 0
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
perpendicular: {
|
|
82
|
+
a: {
|
|
83
|
+
x: 2,
|
|
84
|
+
y: -3
|
|
85
|
+
},
|
|
86
|
+
b: {
|
|
87
|
+
x: 0,
|
|
88
|
+
y: 0
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const PROMPTS = {
|
|
93
|
+
"two-point": "Drag A and B. The gradient is the rise over the run; the equation is y = m·x + c.",
|
|
94
|
+
"gradient-intercept": "Drag the y-intercept up the y-axis, and the handle to tilt the gradient.",
|
|
95
|
+
"intercept-form": "Drag where the line cuts each axis. Intercept form: x/a + y/b = 1.",
|
|
96
|
+
parallel: "Drag P. The new line stays parallel to the given one, same gradient, different intercept.",
|
|
97
|
+
perpendicular: "Drag P. The new line is perpendicular to the given one: its gradient is −1/m, so m₁·m₂ = −1."
|
|
98
|
+
};
|
|
99
|
+
function StraightLineLab(props = {}) {
|
|
100
|
+
const mode = props.mode ?? "two-point";
|
|
101
|
+
const { given = {
|
|
102
|
+
m: .5,
|
|
103
|
+
c: 2
|
|
104
|
+
}, view = DEFAULT_VIEW, height = 380, snap = 1, showDistance = false, title = "The straight line", prompt = PROMPTS[mode], ask, activity = `straight-line-${mode}` } = props;
|
|
105
|
+
const def = DEFAULTS[mode];
|
|
106
|
+
const [A, setA] = useState(props.pointA ?? def.a);
|
|
107
|
+
const [B, setB] = useState(props.pointB ?? def.b);
|
|
108
|
+
const [P, setP] = useState(props.through ?? {
|
|
109
|
+
x: -2,
|
|
110
|
+
y: 2
|
|
111
|
+
});
|
|
112
|
+
const snapP = (p) => snapPoint(p, snap);
|
|
113
|
+
const givenLine = lineFrom(given.m, {
|
|
114
|
+
x: 0,
|
|
115
|
+
y: given.c
|
|
116
|
+
});
|
|
117
|
+
let line;
|
|
118
|
+
let scene;
|
|
119
|
+
const readouts = [];
|
|
120
|
+
if (mode === "parallel" || mode === "perpendicular") {
|
|
121
|
+
line = mode === "parallel" ? parallelThrough(givenLine, P) : perpThrough(givenLine, P);
|
|
122
|
+
const cross = intersectLines(givenLine, line);
|
|
123
|
+
readouts.push({
|
|
124
|
+
label: "given line",
|
|
125
|
+
value: lineTex(givenLine)
|
|
126
|
+
});
|
|
127
|
+
readouts.push({
|
|
128
|
+
label: "new line",
|
|
129
|
+
value: lineTex(line)
|
|
130
|
+
});
|
|
131
|
+
if (mode === "parallel") readouts.push({
|
|
132
|
+
label: "gradients",
|
|
133
|
+
value: `both m = ${num(given.m)}`
|
|
134
|
+
});
|
|
135
|
+
else readouts.push({
|
|
136
|
+
label: "m₁ · m₂",
|
|
137
|
+
value: `${num(given.m)} · ${num(line.m)} = ${num(given.m * (Number.isFinite(line.m) ? line.m : 0))}${Number.isFinite(line.m) ? "" : " (⊥ vertical)"}`
|
|
138
|
+
});
|
|
139
|
+
scene = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
140
|
+
/* @__PURE__ */ jsx(Line, {
|
|
141
|
+
from: {
|
|
142
|
+
x: 0,
|
|
143
|
+
y: givenLine.c
|
|
144
|
+
},
|
|
145
|
+
to: {
|
|
146
|
+
x: 1,
|
|
147
|
+
y: givenLine.c + givenLine.m
|
|
148
|
+
},
|
|
149
|
+
color: C_GIVEN,
|
|
150
|
+
weight: 2.5
|
|
151
|
+
}),
|
|
152
|
+
line.vertical !== void 0 ? /* @__PURE__ */ jsx(Line, {
|
|
153
|
+
from: {
|
|
154
|
+
x: line.vertical,
|
|
155
|
+
y: 0
|
|
156
|
+
},
|
|
157
|
+
to: {
|
|
158
|
+
x: line.vertical,
|
|
159
|
+
y: 1
|
|
160
|
+
},
|
|
161
|
+
color: C_LINE,
|
|
162
|
+
weight: 3
|
|
163
|
+
}) : /* @__PURE__ */ jsx(Line, {
|
|
164
|
+
from: {
|
|
165
|
+
x: 0,
|
|
166
|
+
y: line.c
|
|
167
|
+
},
|
|
168
|
+
to: {
|
|
169
|
+
x: 1,
|
|
170
|
+
y: line.c + line.m
|
|
171
|
+
},
|
|
172
|
+
color: C_LINE,
|
|
173
|
+
weight: 3
|
|
174
|
+
}),
|
|
175
|
+
cross && mode === "perpendicular" && /* @__PURE__ */ jsx(RightAngleMark, {
|
|
176
|
+
at: cross,
|
|
177
|
+
u: {
|
|
178
|
+
x: 1,
|
|
179
|
+
y: givenLine.m
|
|
180
|
+
},
|
|
181
|
+
v: line.vertical !== void 0 ? {
|
|
182
|
+
x: 0,
|
|
183
|
+
y: 1
|
|
184
|
+
} : {
|
|
185
|
+
x: 1,
|
|
186
|
+
y: line.m
|
|
187
|
+
}
|
|
188
|
+
}),
|
|
189
|
+
cross && /* @__PURE__ */ jsx(Dot, {
|
|
190
|
+
x: cross.x,
|
|
191
|
+
y: cross.y,
|
|
192
|
+
r: 4,
|
|
193
|
+
color: "var(--stage-muted)"
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
196
|
+
value: P,
|
|
197
|
+
onMove: (p) => setP(snapP(p)),
|
|
198
|
+
snap,
|
|
199
|
+
color: C_A,
|
|
200
|
+
ariaLabel: "point P, drag it"
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ jsx(Label, {
|
|
203
|
+
x: P.x,
|
|
204
|
+
y: P.y,
|
|
205
|
+
text: `P (${num(P.x)}, ${num(P.y)})`,
|
|
206
|
+
color: C_A,
|
|
207
|
+
size: 12,
|
|
208
|
+
weight: 700,
|
|
209
|
+
dx: 12,
|
|
210
|
+
dy: -8,
|
|
211
|
+
anchor: "start"
|
|
212
|
+
})
|
|
213
|
+
] });
|
|
214
|
+
} else if (mode === "intercept-form") {
|
|
215
|
+
const a = A.x, b = B.y;
|
|
216
|
+
line = lineThrough(A, B);
|
|
217
|
+
readouts.push({
|
|
218
|
+
label: "x-intercept a",
|
|
219
|
+
value: num(a)
|
|
220
|
+
});
|
|
221
|
+
readouts.push({
|
|
222
|
+
label: "y-intercept b",
|
|
223
|
+
value: num(b)
|
|
224
|
+
});
|
|
225
|
+
readouts.push({
|
|
226
|
+
label: "intercept form",
|
|
227
|
+
value: interceptTex(a, b)
|
|
228
|
+
});
|
|
229
|
+
readouts.push({
|
|
230
|
+
label: "gradient form",
|
|
231
|
+
value: lineTex(line)
|
|
232
|
+
});
|
|
233
|
+
scene = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Line, {
|
|
235
|
+
from: A,
|
|
236
|
+
to: B,
|
|
237
|
+
color: C_LINE,
|
|
238
|
+
weight: 3
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ jsx(Label, {
|
|
241
|
+
x: a,
|
|
242
|
+
y: 0,
|
|
243
|
+
text: `a = ${num(a)}`,
|
|
244
|
+
color: C_A,
|
|
245
|
+
size: 12,
|
|
246
|
+
weight: 700,
|
|
247
|
+
dy: a >= 0 ? 16 : 16,
|
|
248
|
+
dx: a >= 0 ? 6 : -6,
|
|
249
|
+
anchor: a >= 0 ? "start" : "end"
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsx(Label, {
|
|
252
|
+
x: 0,
|
|
253
|
+
y: b,
|
|
254
|
+
text: `b = ${num(b)}`,
|
|
255
|
+
color: C_B,
|
|
256
|
+
size: 12,
|
|
257
|
+
weight: 700,
|
|
258
|
+
dx: 10,
|
|
259
|
+
anchor: "start"
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
262
|
+
value: A,
|
|
263
|
+
onMove: (p) => setA({
|
|
264
|
+
x: snapPoint(p, snap).x || .001,
|
|
265
|
+
y: 0
|
|
266
|
+
}),
|
|
267
|
+
snap,
|
|
268
|
+
constrain: "horizontal",
|
|
269
|
+
color: C_A,
|
|
270
|
+
ariaLabel: "x-intercept a, drag along the x-axis"
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
273
|
+
value: B,
|
|
274
|
+
onMove: (p) => setB({
|
|
275
|
+
x: 0,
|
|
276
|
+
y: snapPoint(p, snap).y || .001
|
|
277
|
+
}),
|
|
278
|
+
snap,
|
|
279
|
+
constrain: "vertical",
|
|
280
|
+
color: C_B,
|
|
281
|
+
ariaLabel: "y-intercept b, drag along the y-axis"
|
|
282
|
+
})
|
|
283
|
+
] });
|
|
284
|
+
} else {
|
|
285
|
+
const pinA = mode === "gradient-intercept";
|
|
286
|
+
line = lineThrough(A, B);
|
|
287
|
+
readouts.push({
|
|
288
|
+
label: "gradient m",
|
|
289
|
+
value: num(line.m)
|
|
290
|
+
});
|
|
291
|
+
readouts.push({
|
|
292
|
+
label: "y-intercept c",
|
|
293
|
+
value: num(line.c)
|
|
294
|
+
});
|
|
295
|
+
readouts.push({
|
|
296
|
+
label: "equation",
|
|
297
|
+
value: lineTex(line)
|
|
298
|
+
});
|
|
299
|
+
if (showDistance && mode === "two-point") {
|
|
300
|
+
readouts.push({
|
|
301
|
+
label: "|AB|",
|
|
302
|
+
value: num(distance(A, B))
|
|
303
|
+
});
|
|
304
|
+
const mid = midpoint(A, B);
|
|
305
|
+
readouts.push({
|
|
306
|
+
label: "midpoint",
|
|
307
|
+
value: `(${num(mid.x)}, ${num(mid.y)})`
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
scene = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
311
|
+
/* @__PURE__ */ jsx(Line, {
|
|
312
|
+
from: A,
|
|
313
|
+
to: B,
|
|
314
|
+
color: C_LINE,
|
|
315
|
+
weight: 3
|
|
316
|
+
}),
|
|
317
|
+
/* @__PURE__ */ jsx(GradientTriangle, {
|
|
318
|
+
a: A.x <= B.x ? A : B,
|
|
319
|
+
b: A.x <= B.x ? B : A
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
322
|
+
value: A,
|
|
323
|
+
onMove: (p) => setA(pinA ? {
|
|
324
|
+
x: 0,
|
|
325
|
+
y: snapPoint(p, snap).y
|
|
326
|
+
} : snapP(p)),
|
|
327
|
+
snap,
|
|
328
|
+
color: C_A,
|
|
329
|
+
ariaLabel: pinA ? "y-intercept, drag up the y-axis" : "point A, drag it"
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
332
|
+
value: B,
|
|
333
|
+
onMove: (p) => setB(snapP(p)),
|
|
334
|
+
snap,
|
|
335
|
+
color: C_B,
|
|
336
|
+
ariaLabel: "point B, drag it"
|
|
337
|
+
})
|
|
338
|
+
] });
|
|
339
|
+
}
|
|
340
|
+
const figure = /* @__PURE__ */ jsx(CoordPlane, {
|
|
341
|
+
view,
|
|
342
|
+
height,
|
|
343
|
+
ariaLabel: `${title}: ${lineTex(line)}`,
|
|
344
|
+
children: scene
|
|
345
|
+
});
|
|
346
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
347
|
+
title,
|
|
348
|
+
prompt,
|
|
349
|
+
aside: /* @__PURE__ */ jsx(Callout, {
|
|
350
|
+
tone: "result",
|
|
351
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
352
|
+
style: {
|
|
353
|
+
display: "grid",
|
|
354
|
+
gap: 6,
|
|
355
|
+
fontVariantNumeric: "tabular-nums",
|
|
356
|
+
fontSize: 13
|
|
357
|
+
},
|
|
358
|
+
children: readouts.map((r, i) => /* @__PURE__ */ jsxs("span", { children: [
|
|
359
|
+
r.label,
|
|
360
|
+
": ",
|
|
361
|
+
/* @__PURE__ */ jsx("strong", { children: r.value })
|
|
362
|
+
] }, i))
|
|
363
|
+
})
|
|
364
|
+
}),
|
|
365
|
+
footer: ask ? /* @__PURE__ */ jsx(LabAsk, {
|
|
366
|
+
ask,
|
|
367
|
+
activity
|
|
368
|
+
}) : void 0,
|
|
369
|
+
children: figure
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
//#endregion
|
|
374
|
+
export { StraightLineLab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { SystemSolveLab, SystemSolveProps } from "./preset.mjs";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Clue, Unknown } from "../../kit/clue-scene.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/math/system-solve/preset.d.ts
|
|
5
|
+
interface SystemSolveProps {
|
|
6
|
+
unknowns?: Unknown[];
|
|
7
|
+
clues?: Clue[];
|
|
8
|
+
/** Clue representation (registry name): 'receipt' | 'balance' | 'tiles' | 'bar' | 'coins' | … */
|
|
9
|
+
scene?: string;
|
|
10
|
+
currency?: string;
|
|
11
|
+
unit?: string;
|
|
12
|
+
store?: string;
|
|
13
|
+
/** Extra wrong tiles for the answer tray. */
|
|
14
|
+
distractors?: number[];
|
|
15
|
+
title?: string;
|
|
16
|
+
prompt?: string;
|
|
17
|
+
activity?: string;
|
|
18
|
+
}
|
|
19
|
+
declare function SystemSolveLab(props?: SystemSolveProps): ReactNode;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { SystemSolveLab, SystemSolveProps };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Callout, LabFrame } from "../../kit/frame.mjs";
|
|
4
|
+
import { RevealSolution } from "../../kit/pedagogy.mjs";
|
|
5
|
+
import { Blank, SlotTray, useSlotFill } from "../../kit/slot-fill.mjs";
|
|
6
|
+
import { ClueScene, UnknownChip, clueTotal } from "../../kit/clue-scene.mjs";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/math/system-solve/preset.tsx
|
|
11
|
+
/**
|
|
12
|
+
* SystemSolveLab, two unknowns, two clues, solved by ELIMINATION, not just "drag to the
|
|
13
|
+
* crossing point". The existing linear-system lab only shows the graph; this teaches the
|
|
14
|
+
* method: line the clues up, cancel the matching column, read one unknown, back-substitute.
|
|
15
|
+
*
|
|
16
|
+
* The point the brief asked for: it's CONCRETE and SWAPPABLE. The maths is data (each clue
|
|
17
|
+
* is coefficients over the unknowns), and the scene that renders a clue is pluggable, a
|
|
18
|
+
* shop receipt, a bucket balance, or bare tiles, all from one config. A creator sets the
|
|
19
|
+
* unknowns (with their hidden values), the clue coefficients, and picks a scene, no code; the
|
|
20
|
+
* totals are computed so the puzzle is always consistent, and the worked method is generated.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_UNKNOWNS = [{
|
|
23
|
+
sym: "🍍",
|
|
24
|
+
label: "Pineapple",
|
|
25
|
+
color: "var(--stage-warn)",
|
|
26
|
+
answer: 5
|
|
27
|
+
}, {
|
|
28
|
+
sym: "🥭",
|
|
29
|
+
label: "Mango",
|
|
30
|
+
color: "var(--stage-good)",
|
|
31
|
+
answer: 2
|
|
32
|
+
}];
|
|
33
|
+
const DEFAULT_CLUES = [{ coeffs: [2, 1] }, { coeffs: [1, 1] }];
|
|
34
|
+
/** Generate a concrete elimination walkthrough for the 2×2 case (else a generic hint). */
|
|
35
|
+
function eliminationSteps(unknowns, clues) {
|
|
36
|
+
if (unknowns.length !== 2 || clues.length !== 2) return ["Line the clues up, scale one so a column matches, then subtract to cancel an unknown and back-substitute."];
|
|
37
|
+
const [c0, c1] = clues;
|
|
38
|
+
const t0 = clueTotal(c0, unknowns), t1 = clueTotal(c1, unknowns);
|
|
39
|
+
const keep = c0.coeffs[0] === c1.coeffs[0] ? 1 : c0.coeffs[1] === c1.coeffs[1] ? 0 : -1;
|
|
40
|
+
if (keep < 0) return ["Scale one clue so a column matches the other, then subtract to cancel that unknown and back-substitute."];
|
|
41
|
+
const cancel = keep === 0 ? 1 : 0;
|
|
42
|
+
const kU = unknowns[keep], cU = unknowns[cancel];
|
|
43
|
+
const diffCoeff = c0.coeffs[keep] - c1.coeffs[keep];
|
|
44
|
+
const diffTotal = t0 - t1;
|
|
45
|
+
const kVal = diffTotal / diffCoeff;
|
|
46
|
+
return [
|
|
47
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
48
|
+
"Both clues have the same number of ",
|
|
49
|
+
cU.sym,
|
|
50
|
+
", so subtract them: ",
|
|
51
|
+
t0,
|
|
52
|
+
" − ",
|
|
53
|
+
t1,
|
|
54
|
+
" = ",
|
|
55
|
+
diffTotal,
|
|
56
|
+
", and the ",
|
|
57
|
+
cU.sym,
|
|
58
|
+
" cancels."
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
61
|
+
"That leaves ",
|
|
62
|
+
diffCoeff === 1 ? "" : diffCoeff,
|
|
63
|
+
kU.sym,
|
|
64
|
+
" = ",
|
|
65
|
+
diffTotal,
|
|
66
|
+
", so ",
|
|
67
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
68
|
+
kU.sym,
|
|
69
|
+
" = ",
|
|
70
|
+
kVal
|
|
71
|
+
] }),
|
|
72
|
+
"."
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
75
|
+
"Put ",
|
|
76
|
+
kU.sym,
|
|
77
|
+
" = ",
|
|
78
|
+
kVal,
|
|
79
|
+
" back into a clue to get ",
|
|
80
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
81
|
+
cU.sym,
|
|
82
|
+
" = ",
|
|
83
|
+
cU.answer
|
|
84
|
+
] }),
|
|
85
|
+
"."
|
|
86
|
+
] })
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
function SystemSolveLab(props = {}) {
|
|
90
|
+
const { unknowns = DEFAULT_UNKNOWNS, clues = DEFAULT_CLUES, scene = "receipt", currency, unit, store, distractors = [], title = "Two clues, two unknowns", prompt = "Each clue gives a total. Use both to find the value of each item.", activity = "system-solve" } = props;
|
|
91
|
+
const slots = unknowns.map((u, i) => ({
|
|
92
|
+
id: `u${i}`,
|
|
93
|
+
answer: u.answer,
|
|
94
|
+
label: /* @__PURE__ */ jsx(UnknownChip, {
|
|
95
|
+
u,
|
|
96
|
+
size: 22
|
|
97
|
+
})
|
|
98
|
+
}));
|
|
99
|
+
const pool = new Set(distractors);
|
|
100
|
+
unknowns.forEach((u) => {
|
|
101
|
+
pool.add(u.answer);
|
|
102
|
+
pool.add(u.answer + 1);
|
|
103
|
+
pool.add(Math.max(0, u.answer - 1));
|
|
104
|
+
pool.add(u.answer + 2);
|
|
105
|
+
});
|
|
106
|
+
clues.forEach((c) => pool.add(clueTotal(c, unknowns)));
|
|
107
|
+
const tiles = [...pool].filter((v) => v >= 0).sort((a, b) => a - b);
|
|
108
|
+
const [revealed, setRevealed] = useState(false);
|
|
109
|
+
const fill = useSlotFill(slots, tiles, activity, () => setRevealed(true));
|
|
110
|
+
const figure = /* @__PURE__ */ jsx("div", {
|
|
111
|
+
style: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
gap: 16,
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
flexWrap: "wrap",
|
|
116
|
+
alignItems: "center"
|
|
117
|
+
},
|
|
118
|
+
children: clues.map((clue, i) => /* @__PURE__ */ jsxs("div", {
|
|
119
|
+
style: {
|
|
120
|
+
display: "grid",
|
|
121
|
+
gap: 4,
|
|
122
|
+
justifyItems: "center"
|
|
123
|
+
},
|
|
124
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
125
|
+
style: {
|
|
126
|
+
fontSize: 11,
|
|
127
|
+
fontWeight: 700,
|
|
128
|
+
color: "var(--stage-muted)"
|
|
129
|
+
},
|
|
130
|
+
children: ["Clue ", i + 1]
|
|
131
|
+
}), /* @__PURE__ */ jsx(ClueScene, {
|
|
132
|
+
kind: scene,
|
|
133
|
+
clue,
|
|
134
|
+
unknowns,
|
|
135
|
+
currency,
|
|
136
|
+
unit,
|
|
137
|
+
store
|
|
138
|
+
})]
|
|
139
|
+
}, i))
|
|
140
|
+
});
|
|
141
|
+
const steps = eliminationSteps(unknowns, clues);
|
|
142
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
143
|
+
title,
|
|
144
|
+
prompt,
|
|
145
|
+
footer: /* @__PURE__ */ jsxs("div", {
|
|
146
|
+
style: {
|
|
147
|
+
display: "grid",
|
|
148
|
+
gap: 14,
|
|
149
|
+
justifyItems: "center",
|
|
150
|
+
marginTop: 4
|
|
151
|
+
},
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ jsx("div", {
|
|
154
|
+
style: {
|
|
155
|
+
display: "flex",
|
|
156
|
+
gap: 18,
|
|
157
|
+
flexWrap: "wrap",
|
|
158
|
+
justifyContent: "center",
|
|
159
|
+
fontSize: 17,
|
|
160
|
+
fontWeight: 700
|
|
161
|
+
},
|
|
162
|
+
children: unknowns.map((u, i) => /* @__PURE__ */ jsxs("span", {
|
|
163
|
+
style: {
|
|
164
|
+
display: "inline-flex",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
gap: 6
|
|
167
|
+
},
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsx(UnknownChip, {
|
|
170
|
+
u,
|
|
171
|
+
size: 26
|
|
172
|
+
}),
|
|
173
|
+
" = ",
|
|
174
|
+
/* @__PURE__ */ jsx(Blank, {
|
|
175
|
+
fill,
|
|
176
|
+
id: `u${i}`
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}, i))
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ jsx(SlotTray, { fill }),
|
|
182
|
+
fill.solved ? /* @__PURE__ */ jsx("p", {
|
|
183
|
+
role: "status",
|
|
184
|
+
style: {
|
|
185
|
+
margin: 0,
|
|
186
|
+
color: "var(--stage-good)",
|
|
187
|
+
fontWeight: 700
|
|
188
|
+
},
|
|
189
|
+
children: "✓ Both clues check out."
|
|
190
|
+
}) : /* @__PURE__ */ jsx(RevealSolution, {
|
|
191
|
+
buttonLabel: "How do I solve it?",
|
|
192
|
+
note: "A worked method, try the elimination yourself first.",
|
|
193
|
+
solution: /* @__PURE__ */ jsx("ol", {
|
|
194
|
+
style: {
|
|
195
|
+
margin: 0,
|
|
196
|
+
paddingLeft: 18,
|
|
197
|
+
display: "grid",
|
|
198
|
+
gap: 6,
|
|
199
|
+
fontSize: 14
|
|
200
|
+
},
|
|
201
|
+
children: steps.map((s, i) => /* @__PURE__ */ jsx("li", { children: s }, i))
|
|
202
|
+
})
|
|
203
|
+
}),
|
|
204
|
+
revealed && /* @__PURE__ */ jsx(Callout, {
|
|
205
|
+
tone: "result",
|
|
206
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
207
|
+
style: { fontSize: 13 },
|
|
208
|
+
children: [
|
|
209
|
+
"Solved: ",
|
|
210
|
+
unknowns.map((u, i) => /* @__PURE__ */ jsxs("span", { children: [
|
|
211
|
+
i > 0 ? ", " : "",
|
|
212
|
+
u.sym,
|
|
213
|
+
" = ",
|
|
214
|
+
/* @__PURE__ */ jsx("strong", { children: u.answer })
|
|
215
|
+
] }, i)),
|
|
216
|
+
"."
|
|
217
|
+
]
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}),
|
|
222
|
+
children: figure
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
export { SystemSolveLab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ReflectAxis, Transform, TransformKind, TransformLab, TransformProps, applyTf } from "./preset.mjs";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Vec2 } from "@classytic/stage";
|
|
3
|
+
|
|
4
|
+
//#region src/math/transform/preset.d.ts
|
|
5
|
+
type TransformKind = 'translate' | 'reflect' | 'rotate' | 'enlarge';
|
|
6
|
+
type ReflectAxis = 'x' | 'y' | 'y=x' | 'y=-x';
|
|
7
|
+
interface Transform {
|
|
8
|
+
kind: TransformKind;
|
|
9
|
+
/** translate */
|
|
10
|
+
by?: Vec2;
|
|
11
|
+
/** reflect */
|
|
12
|
+
axis?: ReflectAxis;
|
|
13
|
+
/** rotate (deg, anticlockwise) */
|
|
14
|
+
deg?: number;
|
|
15
|
+
/** enlarge (scale factor) */
|
|
16
|
+
k?: number;
|
|
17
|
+
/** rotate/enlarge centre (default origin). */
|
|
18
|
+
about?: Vec2;
|
|
19
|
+
}
|
|
20
|
+
interface TransformProps {
|
|
21
|
+
/** The shape to transform (≥3 pts → filled polygon; else just points). */
|
|
22
|
+
shape?: Vec2[];
|
|
23
|
+
transform?: Transform;
|
|
24
|
+
view?: {
|
|
25
|
+
xMin: number;
|
|
26
|
+
xMax: number;
|
|
27
|
+
yMin: number;
|
|
28
|
+
yMax: number;
|
|
29
|
+
};
|
|
30
|
+
height?: number;
|
|
31
|
+
/** Extra wrong tiles for the tray (translate). */
|
|
32
|
+
distractors?: number[];
|
|
33
|
+
title?: string;
|
|
34
|
+
prompt?: string;
|
|
35
|
+
activity?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Apply a transform to a point. Pure, all from stage core math. */
|
|
38
|
+
declare function applyTf(p: Vec2, t: Transform): Vec2;
|
|
39
|
+
declare function TransformLab(props?: TransformProps): ReactNode;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ReflectAxis, Transform, TransformKind, TransformLab, TransformProps, applyTf };
|