@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,204 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { gcd, round } from "../../core/util.mjs";
|
|
4
|
+
import { StatusPill } from "../../kit/controls.mjs";
|
|
5
|
+
import { ControlBar, LabFrame } from "../../kit/frame.mjs";
|
|
6
|
+
import { useCheckpoint } from "../../kit/pedagogy.mjs";
|
|
7
|
+
import { getScene } from "../../kit/scenes.mjs";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Label, MovableDot, Segment, Stage } from "@classytic/stage";
|
|
11
|
+
|
|
12
|
+
//#region src/math/ratio-share/preset.tsx
|
|
13
|
+
/**
|
|
14
|
+
* RatioShareLab, the authorable "share in a ratio" manipulative: a quantity is a
|
|
15
|
+
* single bar, and the learner drags ONE divider to split it in the ratio a:b.
|
|
16
|
+
* The split reads back live as an amount AND as a ratio that simplifies, so
|
|
17
|
+
* "share £60 in 2:3" becomes a thing you slide until 24:36 clicks to 2:3. The
|
|
18
|
+
* target divider is shown faint; landing on any split whose simplified ratio is
|
|
19
|
+
* a:b solves it (so 40:60 and 2:3 are visibly the same share).
|
|
20
|
+
*
|
|
21
|
+
* One engine, many uses, all data: set the ratio a:b, the total, the unit and
|
|
22
|
+
* the two side labels. Built on the juiced <MovableDot>.
|
|
23
|
+
*/
|
|
24
|
+
function RatioShareLab(props = {}) {
|
|
25
|
+
const { a = 2, b = 3, total = 100, unit = "", labelA = "A", labelB = "B", step = 1, scene, height = 220, title = "Share in a ratio", prompt = `Share ${total}${unit ? " " + unit : ""} in the ratio ${a} : ${b}. Drag the divider.`, activity = "ratio-share" } = props;
|
|
26
|
+
const correct = total * a / (a + b);
|
|
27
|
+
const clamp = (v) => Math.max(0, Math.min(total, Math.round(v / step) * step));
|
|
28
|
+
const [split, setSplit] = useState(clamp(props.total != null ? 0 : 0));
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setSplit(0);
|
|
31
|
+
}, [
|
|
32
|
+
total,
|
|
33
|
+
a,
|
|
34
|
+
b,
|
|
35
|
+
step
|
|
36
|
+
]);
|
|
37
|
+
const rest = total - split;
|
|
38
|
+
const tg = gcd(a, b);
|
|
39
|
+
const sg = gcd(split, rest);
|
|
40
|
+
const solved = split > 0 && rest > 0 && split / sg === a / tg && rest / sg === b / tg;
|
|
41
|
+
const colA = solved ? "var(--stage-good)" : "var(--stage-accent)";
|
|
42
|
+
const colB = solved ? "#34c6c6" : "#e85aa6";
|
|
43
|
+
useCheckpoint({
|
|
44
|
+
solved,
|
|
45
|
+
activity,
|
|
46
|
+
response: `${split} : ${rest}`
|
|
47
|
+
});
|
|
48
|
+
const figure = /* @__PURE__ */ jsxs(Stage, {
|
|
49
|
+
view: {
|
|
50
|
+
xMin: -total * .04,
|
|
51
|
+
xMax: total * 1.12,
|
|
52
|
+
yMin: -1.7,
|
|
53
|
+
yMax: 1.5
|
|
54
|
+
},
|
|
55
|
+
height,
|
|
56
|
+
preserveAspect: false,
|
|
57
|
+
pad: 14,
|
|
58
|
+
ariaLabel: `A bar of ${total} split into ${split} and ${rest}`,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Segment, {
|
|
61
|
+
from: {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: 0
|
|
64
|
+
},
|
|
65
|
+
to: {
|
|
66
|
+
x: Math.max(1e-4, split),
|
|
67
|
+
y: 0
|
|
68
|
+
},
|
|
69
|
+
color: colA,
|
|
70
|
+
weight: 34
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(Segment, {
|
|
73
|
+
from: {
|
|
74
|
+
x: split,
|
|
75
|
+
y: 0
|
|
76
|
+
},
|
|
77
|
+
to: {
|
|
78
|
+
x: total,
|
|
79
|
+
y: 0
|
|
80
|
+
},
|
|
81
|
+
color: colB,
|
|
82
|
+
weight: 34,
|
|
83
|
+
opacity: .92
|
|
84
|
+
}),
|
|
85
|
+
split > total * .06 && /* @__PURE__ */ jsx(Label, {
|
|
86
|
+
x: split / 2,
|
|
87
|
+
y: 0,
|
|
88
|
+
text: `${round(split)}`,
|
|
89
|
+
color: "var(--stage-fg)",
|
|
90
|
+
size: 13,
|
|
91
|
+
weight: 700
|
|
92
|
+
}),
|
|
93
|
+
rest > total * .06 && /* @__PURE__ */ jsx(Label, {
|
|
94
|
+
x: (split + total) / 2,
|
|
95
|
+
y: 0,
|
|
96
|
+
text: `${round(rest)}`,
|
|
97
|
+
color: "var(--stage-fg)",
|
|
98
|
+
size: 13,
|
|
99
|
+
weight: 700
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(Label, {
|
|
102
|
+
x: 0,
|
|
103
|
+
y: 0,
|
|
104
|
+
text: labelA,
|
|
105
|
+
color: "var(--stage-muted)",
|
|
106
|
+
size: 12,
|
|
107
|
+
anchor: "start",
|
|
108
|
+
dy: 32
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx(Label, {
|
|
111
|
+
x: total,
|
|
112
|
+
y: 0,
|
|
113
|
+
text: labelB,
|
|
114
|
+
color: "var(--stage-muted)",
|
|
115
|
+
size: 12,
|
|
116
|
+
anchor: "end",
|
|
117
|
+
dy: 32
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ jsx(Segment, {
|
|
120
|
+
from: {
|
|
121
|
+
x: correct,
|
|
122
|
+
y: -.85
|
|
123
|
+
},
|
|
124
|
+
to: {
|
|
125
|
+
x: correct,
|
|
126
|
+
y: .85
|
|
127
|
+
},
|
|
128
|
+
color: "var(--stage-good)",
|
|
129
|
+
weight: 1.75,
|
|
130
|
+
opacity: solved ? .9 : .5,
|
|
131
|
+
dashed: true
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
134
|
+
value: {
|
|
135
|
+
x: split,
|
|
136
|
+
y: 0
|
|
137
|
+
},
|
|
138
|
+
onMove: (p) => setSplit(clamp(p.x)),
|
|
139
|
+
constrain: "horizontal",
|
|
140
|
+
range: {
|
|
141
|
+
min: 0,
|
|
142
|
+
max: total
|
|
143
|
+
},
|
|
144
|
+
snap: step,
|
|
145
|
+
step,
|
|
146
|
+
readout: () => `${round(split)} : ${round(rest)}`,
|
|
147
|
+
color: "var(--stage-fg)",
|
|
148
|
+
r: 9,
|
|
149
|
+
ariaLabel: "ratio divider"
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
});
|
|
153
|
+
const controls = /* @__PURE__ */ jsxs(ControlBar, { children: [
|
|
154
|
+
/* @__PURE__ */ jsxs("span", {
|
|
155
|
+
style: {
|
|
156
|
+
fontWeight: 700,
|
|
157
|
+
fontSize: 16,
|
|
158
|
+
fontVariantNumeric: "tabular-nums"
|
|
159
|
+
},
|
|
160
|
+
children: [
|
|
161
|
+
round(split),
|
|
162
|
+
" : ",
|
|
163
|
+
round(rest)
|
|
164
|
+
]
|
|
165
|
+
}),
|
|
166
|
+
split > 0 && rest > 0 && /* @__PURE__ */ jsxs("span", {
|
|
167
|
+
style: { opacity: .75 },
|
|
168
|
+
children: [
|
|
169
|
+
"= ",
|
|
170
|
+
round(split / sg),
|
|
171
|
+
" : ",
|
|
172
|
+
round(rest / sg)
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsx(StatusPill, {
|
|
176
|
+
ok: solved,
|
|
177
|
+
children: solved ? `✓ ${a} : ${b}` : `target ${a} : ${b}`
|
|
178
|
+
})
|
|
179
|
+
] });
|
|
180
|
+
const twin = scene && scene !== "none" ? getScene(scene)?.render({
|
|
181
|
+
frac: total > 0 ? split / total : 0,
|
|
182
|
+
guessTone: solved ? "ok" : "idle",
|
|
183
|
+
color: colA,
|
|
184
|
+
label: `${labelA}: ${round(split)}`,
|
|
185
|
+
width: 132,
|
|
186
|
+
height: 170
|
|
187
|
+
}) : null;
|
|
188
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
189
|
+
title,
|
|
190
|
+
prompt,
|
|
191
|
+
controls,
|
|
192
|
+
aside: twin ? /* @__PURE__ */ jsx("div", {
|
|
193
|
+
style: {
|
|
194
|
+
display: "grid",
|
|
195
|
+
placeItems: "center"
|
|
196
|
+
},
|
|
197
|
+
children: twin
|
|
198
|
+
}) : void 0,
|
|
199
|
+
children: figure
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
export { RatioShareLab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ReceiptLab, ReceiptProps } from "./preset.mjs";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReceiptItem } from "../../kit/receipt.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/math/receipt/preset.d.ts
|
|
5
|
+
interface ReceiptProps {
|
|
6
|
+
store?: string;
|
|
7
|
+
items?: ReceiptItem[];
|
|
8
|
+
currency?: string;
|
|
9
|
+
/** Which totals to ask for. Default both. */
|
|
10
|
+
ask?: {
|
|
11
|
+
items?: boolean;
|
|
12
|
+
cost?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Extra wrong tiles (numbers for items, e.g. 18; pass cost ones as "$16"). */
|
|
15
|
+
distractors?: (string | number)[];
|
|
16
|
+
title?: string;
|
|
17
|
+
prompt?: string;
|
|
18
|
+
activity?: string;
|
|
19
|
+
}
|
|
20
|
+
declare function ReceiptLab(props?: ReceiptProps): ReactNode;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ReceiptLab, ReceiptProps };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { LabFrame } from "../../kit/frame.mjs";
|
|
4
|
+
import { Blank, SlotTray, useSlotFill } from "../../kit/slot-fill.mjs";
|
|
5
|
+
import { ReceiptScene } from "../../kit/receipt.mjs";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/math/receipt/preset.tsx
|
|
10
|
+
/**
|
|
11
|
+
* ReceiptLab, "complete the receipt totals", multiplicative + additive reasoning grounded
|
|
12
|
+
* in a real bill. The learner reads qty × unit price per line and tap-fills the total items
|
|
13
|
+
* and total cost from a tile tray (with the classic "summed the prices, forgot the quantity"
|
|
14
|
+
* distractors); a correct fill reveals the totals on the receipt itself.
|
|
15
|
+
*
|
|
16
|
+
* Pure composition of existing primitives: <ReceiptScene> (the concrete twin) + the inline
|
|
17
|
+
* slot engine (`useSlotFill` + `Blank` + `SlotTray`). It is also the seed of the percentage
|
|
18
|
+
* family, swap the "total" question for "apply a 20% discount" on the same scene.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_ITEMS = [{
|
|
21
|
+
qty: 6,
|
|
22
|
+
name: "Pineapples",
|
|
23
|
+
unit: 5
|
|
24
|
+
}, {
|
|
25
|
+
qty: 3,
|
|
26
|
+
name: "Mangoes",
|
|
27
|
+
unit: 2
|
|
28
|
+
}];
|
|
29
|
+
function ReceiptLab(props = {}) {
|
|
30
|
+
const { store = "Half Foods", items = DEFAULT_ITEMS, currency = "$", ask = {
|
|
31
|
+
items: true,
|
|
32
|
+
cost: true
|
|
33
|
+
}, distractors = [], title = "Complete the receipt totals", prompt = "Each line is the quantity times the price each. Work out the totals.", activity = "receipt-totals" } = props;
|
|
34
|
+
const totalItems = items.reduce((s, it) => s + it.qty, 0);
|
|
35
|
+
const totalCost = items.reduce((s, it) => s + it.qty * it.unit, 0);
|
|
36
|
+
const sumUnit = items.reduce((s, it) => s + it.unit, 0);
|
|
37
|
+
const money = (n) => `${currency}${Math.round(n * 100) / 100}`;
|
|
38
|
+
const slots = [];
|
|
39
|
+
if (ask.items !== false) slots.push({
|
|
40
|
+
id: "items",
|
|
41
|
+
answer: totalItems
|
|
42
|
+
});
|
|
43
|
+
if (ask.cost !== false) slots.push({
|
|
44
|
+
id: "cost",
|
|
45
|
+
answer: money(totalCost)
|
|
46
|
+
});
|
|
47
|
+
const itemPool = new Set([
|
|
48
|
+
totalItems,
|
|
49
|
+
totalItems * 2,
|
|
50
|
+
totalCost
|
|
51
|
+
]);
|
|
52
|
+
const costPool = new Set([
|
|
53
|
+
money(totalCost),
|
|
54
|
+
money(sumUnit),
|
|
55
|
+
money(Math.round(totalCost * .5))
|
|
56
|
+
]);
|
|
57
|
+
const tiles = Array.from(new Set([
|
|
58
|
+
...ask.items !== false ? itemPool : [],
|
|
59
|
+
...ask.cost !== false ? costPool : [],
|
|
60
|
+
...distractors
|
|
61
|
+
]));
|
|
62
|
+
const [revealed, setRevealed] = useState({
|
|
63
|
+
items: false,
|
|
64
|
+
cost: false
|
|
65
|
+
});
|
|
66
|
+
const fill = useSlotFill(slots, tiles, activity, () => setRevealed({
|
|
67
|
+
items: true,
|
|
68
|
+
cost: true
|
|
69
|
+
}));
|
|
70
|
+
const figure = /* @__PURE__ */ jsx("div", {
|
|
71
|
+
style: {
|
|
72
|
+
display: "flex",
|
|
73
|
+
justifyContent: "center"
|
|
74
|
+
},
|
|
75
|
+
children: /* @__PURE__ */ jsx(ReceiptScene, {
|
|
76
|
+
store,
|
|
77
|
+
items,
|
|
78
|
+
currency,
|
|
79
|
+
revealItems: revealed.items || fill.filled.items != null,
|
|
80
|
+
revealCost: revealed.cost || fill.filled.cost != null
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
84
|
+
title,
|
|
85
|
+
prompt,
|
|
86
|
+
footer: /* @__PURE__ */ jsxs("div", {
|
|
87
|
+
style: {
|
|
88
|
+
display: "grid",
|
|
89
|
+
gap: 14,
|
|
90
|
+
justifyItems: "center",
|
|
91
|
+
marginTop: 4
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("p", {
|
|
95
|
+
style: {
|
|
96
|
+
margin: 0,
|
|
97
|
+
fontWeight: 700,
|
|
98
|
+
fontSize: 16,
|
|
99
|
+
lineHeight: 1.9,
|
|
100
|
+
textAlign: "center"
|
|
101
|
+
},
|
|
102
|
+
children: [ask.items !== false && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
103
|
+
"A total of ",
|
|
104
|
+
/* @__PURE__ */ jsx(Blank, {
|
|
105
|
+
fill,
|
|
106
|
+
id: "items"
|
|
107
|
+
}),
|
|
108
|
+
" items were purchased.",
|
|
109
|
+
" "
|
|
110
|
+
] }), ask.cost !== false && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
111
|
+
"The total cost was ",
|
|
112
|
+
/* @__PURE__ */ jsx(Blank, {
|
|
113
|
+
fill,
|
|
114
|
+
id: "cost",
|
|
115
|
+
width: 64
|
|
116
|
+
}),
|
|
117
|
+
"."
|
|
118
|
+
] })]
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ jsx(SlotTray, { fill }),
|
|
121
|
+
fill.solved && /* @__PURE__ */ jsx("p", {
|
|
122
|
+
role: "status",
|
|
123
|
+
style: {
|
|
124
|
+
margin: 0,
|
|
125
|
+
color: "var(--stage-good)",
|
|
126
|
+
fontWeight: 700
|
|
127
|
+
},
|
|
128
|
+
children: "✓ Receipt complete."
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}),
|
|
132
|
+
children: figure
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { ReceiptLab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { SequencePredict, SequencePredictProps, SequenceRule } from "./preset.mjs";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/math/sequence-predict/preset.d.ts
|
|
4
|
+
type SequenceRule = 'geometric' | 'arithmetic';
|
|
5
|
+
interface SequencePredictProps {
|
|
6
|
+
/** First term (index 0). */
|
|
7
|
+
start?: number;
|
|
8
|
+
rule?: SequenceRule;
|
|
9
|
+
/** ×ratio (geometric) or +difference (arithmetic). */
|
|
10
|
+
factor?: number;
|
|
11
|
+
/** How many leading terms show their value. */
|
|
12
|
+
shown?: number;
|
|
13
|
+
/** How many following terms the learner predicts. */
|
|
14
|
+
predict?: number;
|
|
15
|
+
/** Caption for each dish, e.g. "Day". */
|
|
16
|
+
stepLabel?: string;
|
|
17
|
+
/** Extra wrong-answer tiles in the tray. */
|
|
18
|
+
distractors?: number[];
|
|
19
|
+
/** Light up the items added at each step (the "it doubled" cue). */
|
|
20
|
+
highlightNew?: boolean;
|
|
21
|
+
/** Which COUNT scene represents each term: 'cluster' | 'grid' | 'coins' | 'blocks' | … */
|
|
22
|
+
scene?: string;
|
|
23
|
+
/** Tint for the items (default accent). */
|
|
24
|
+
color?: string;
|
|
25
|
+
/** Round dish values (keep integers for counts). */
|
|
26
|
+
integer?: boolean;
|
|
27
|
+
height?: number;
|
|
28
|
+
title?: string;
|
|
29
|
+
prompt?: string;
|
|
30
|
+
activity?: string;
|
|
31
|
+
}
|
|
32
|
+
declare function SequencePredict(props?: SequencePredictProps): ReactNode;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { SequencePredict, SequencePredictProps, SequenceRule };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { LabFrame } from "../../kit/frame.mjs";
|
|
4
|
+
import { getScene } from "../../kit/scenes.mjs";
|
|
5
|
+
import { SlotFill } from "../../kit/slot-fill.mjs";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/math/sequence-predict/preset.tsx
|
|
10
|
+
/**
|
|
11
|
+
* SequencePredict, the flagship "watch it grow, then predict the next term" lab, the
|
|
12
|
+
* joke-that-doubles lesson. A sequence is shown as a row of <DotCluster> dishes (you
|
|
13
|
+
* SEE 3 → 6 → 12 get denser, the new dots lit up), and the learner fills the hidden
|
|
14
|
+
* terms by tapping number tiles (<SlotFill>) instead of typing. It's the exponential/
|
|
15
|
+
* geometric counterpart to <LinearModelLab>: discover the multiplicative (or additive)
|
|
16
|
+
* rule from the picture, not from a formula handed to you.
|
|
17
|
+
*
|
|
18
|
+
* Authorable as one config: the start value, ×ratio or +difference, how many terms are
|
|
19
|
+
* shown vs predicted, the story sentence, and the distractor tiles. Same engine covers
|
|
20
|
+
* "doubles each day", "halves each hour", "+3 each step", compound interest, half-life.
|
|
21
|
+
*/
|
|
22
|
+
function buildTerms(start, rule, factor, n, integer) {
|
|
23
|
+
const out = [start];
|
|
24
|
+
for (let i = 1; i < n; i++) {
|
|
25
|
+
const v = rule === "geometric" ? out[i - 1] * factor : out[i - 1] + factor;
|
|
26
|
+
out.push(integer ? Math.round(v) : v);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
/** Plausible wrong tiles, the classic "added instead of multiplied" near-misses. */
|
|
31
|
+
function autoDistractors(answers, terms, factor) {
|
|
32
|
+
const real = new Set(terms);
|
|
33
|
+
const cand = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const a of answers) {
|
|
35
|
+
cand.add(a + factor);
|
|
36
|
+
cand.add(a - factor);
|
|
37
|
+
cand.add(Math.round(a * 1.5));
|
|
38
|
+
}
|
|
39
|
+
return [...cand].filter((v) => v > 0 && !real.has(v)).sort((x, y) => x - y).slice(0, 3);
|
|
40
|
+
}
|
|
41
|
+
function SequencePredict(props = {}) {
|
|
42
|
+
const { start = 3, rule = "geometric", factor = 2, shown = 1, predict = 2, stepLabel = "Day", distractors = [], highlightNew = true, scene = "cluster", color, integer = true, height, title = "How does it grow?", prompt = rule === "geometric" ? `Each ${stepLabel.toLowerCase()} it multiplies by ${factor}. Fill in the hidden counts.` : `Each ${stepLabel.toLowerCase()} it changes by ${factor}. Fill in the hidden counts.`, activity = "sequence-predict" } = props;
|
|
43
|
+
const nTerms = shown + predict;
|
|
44
|
+
const terms = buildTerms(start, rule, factor, nTerms, integer);
|
|
45
|
+
const [revealed, setRevealed] = useState(false);
|
|
46
|
+
const dish = Math.max(96, Math.min(140, (height ?? 150) - (nTerms > 4 ? (nTerms - 4) * 8 : 0)));
|
|
47
|
+
const slots = [];
|
|
48
|
+
for (let i = shown; i < nTerms; i++) slots.push({
|
|
49
|
+
id: `t${i}`,
|
|
50
|
+
answer: terms[i],
|
|
51
|
+
label: `${stepLabel} ${i}`
|
|
52
|
+
});
|
|
53
|
+
const answers = slots.map((s) => Number(s.answer));
|
|
54
|
+
const extras = distractors.length ? distractors : autoDistractors(answers, terms, factor);
|
|
55
|
+
const tilePool = Array.from(new Set([...answers, ...extras])).sort((a, b) => a - b);
|
|
56
|
+
const sceneMeta = getScene(scene) ?? getScene("cluster");
|
|
57
|
+
const figure = /* @__PURE__ */ jsx("div", {
|
|
58
|
+
style: {
|
|
59
|
+
display: "flex",
|
|
60
|
+
gap: 14,
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
flexWrap: "wrap",
|
|
63
|
+
alignItems: "flex-end"
|
|
64
|
+
},
|
|
65
|
+
children: terms.map((v, i) => {
|
|
66
|
+
const isPredicted = i >= shown;
|
|
67
|
+
const show = !isPredicted || revealed;
|
|
68
|
+
const added = i === 0 ? 0 : Math.max(0, terms[i] - terms[i - 1]);
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
style: {
|
|
71
|
+
display: "grid",
|
|
72
|
+
justifyItems: "center",
|
|
73
|
+
gap: 4,
|
|
74
|
+
padding: 6,
|
|
75
|
+
borderRadius: 12,
|
|
76
|
+
border: isPredicted && i === nTerms - 1 ? "2px solid var(--stage-accent)" : "2px solid transparent"
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsxs("span", {
|
|
80
|
+
style: {
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
fontWeight: 700,
|
|
83
|
+
color: "var(--stage-fg)"
|
|
84
|
+
},
|
|
85
|
+
children: [
|
|
86
|
+
stepLabel,
|
|
87
|
+
" ",
|
|
88
|
+
i
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
sceneMeta.render({
|
|
92
|
+
count: v,
|
|
93
|
+
highlight: highlightNew ? added : 0,
|
|
94
|
+
width: dish,
|
|
95
|
+
height: dish,
|
|
96
|
+
color
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx("span", {
|
|
99
|
+
style: {
|
|
100
|
+
minWidth: 32,
|
|
101
|
+
padding: "2px 8px",
|
|
102
|
+
borderRadius: 5,
|
|
103
|
+
fontSize: 14,
|
|
104
|
+
fontWeight: 800,
|
|
105
|
+
textAlign: "center",
|
|
106
|
+
background: "var(--stage-bg)",
|
|
107
|
+
border: "1.5px solid color-mix(in oklab, var(--stage-fg) 30%, transparent)",
|
|
108
|
+
fontVariantNumeric: "tabular-nums"
|
|
109
|
+
},
|
|
110
|
+
children: show ? v : "?"
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
}, i);
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
117
|
+
title,
|
|
118
|
+
prompt,
|
|
119
|
+
footer: /* @__PURE__ */ jsx(SlotFill, {
|
|
120
|
+
slots,
|
|
121
|
+
tiles: tilePool,
|
|
122
|
+
activity,
|
|
123
|
+
onSolved: () => setRevealed(true)
|
|
124
|
+
}),
|
|
125
|
+
children: figure
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
export { SequencePredict };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { StraightLineLab, StraightLineMode, StraightLineProps } from "./preset.mjs";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LabAskSpec } from "../../kit/ask.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { Vec2 } from "@classytic/stage";
|
|
4
|
+
|
|
5
|
+
//#region src/math/straight-line/preset.d.ts
|
|
6
|
+
type StraightLineMode = 'two-point' | 'gradient-intercept' | 'intercept-form' | 'parallel' | 'perpendicular';
|
|
7
|
+
interface StraightLineProps {
|
|
8
|
+
mode?: StraightLineMode;
|
|
9
|
+
/** Starting draggable points (two-point / gradient-intercept / intercept-form). */
|
|
10
|
+
pointA?: Vec2;
|
|
11
|
+
pointB?: Vec2;
|
|
12
|
+
/** The fixed line for parallel / perpendicular modes. */
|
|
13
|
+
given?: {
|
|
14
|
+
m: number;
|
|
15
|
+
c: number;
|
|
16
|
+
};
|
|
17
|
+
/** Starting position of the draggable point P (parallel / perpendicular). */
|
|
18
|
+
through?: Vec2;
|
|
19
|
+
view?: {
|
|
20
|
+
xMin: number;
|
|
21
|
+
xMax: number;
|
|
22
|
+
yMin: number;
|
|
23
|
+
yMax: number;
|
|
24
|
+
};
|
|
25
|
+
height?: number;
|
|
26
|
+
/** Drag snap step in units (0 = free). Default 1. */
|
|
27
|
+
snap?: number;
|
|
28
|
+
/** two-point: also show |AB| and the midpoint. */
|
|
29
|
+
showDistance?: boolean;
|
|
30
|
+
title?: string;
|
|
31
|
+
prompt?: string;
|
|
32
|
+
ask?: LabAskSpec;
|
|
33
|
+
activity?: string;
|
|
34
|
+
}
|
|
35
|
+
declare function StraightLineLab(props?: StraightLineProps): ReactNode;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { StraightLineLab, StraightLineMode, StraightLineProps };
|