@classytic/labs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/biology/enzyme-rate/index.d.mts +1 -0
- package/dist/biology/enzyme-rate/preset.d.mts +25 -0
- package/dist/biology/enzyme-rate/preset.mjs +256 -0
- package/dist/biology/genetic-cross/core.d.mts +64 -0
- package/dist/biology/genetic-cross/core.mjs +147 -0
- package/dist/biology/genetic-cross/grid.mjs +239 -0
- package/dist/biology/genetic-cross/index.d.mts +3 -0
- package/dist/biology/genetic-cross/preset.d.mts +26 -0
- package/dist/biology/genetic-cross/preset.mjs +184 -0
- package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
- package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
- package/dist/biology/index.d.mts +11 -0
- package/dist/biology/index.mjs +12 -0
- package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
- package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
- package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
- package/dist/biology/punnett-cross/index.d.mts +1 -0
- package/dist/biology/punnett-cross/preset.d.mts +27 -0
- package/dist/biology/punnett-cross/preset.mjs +21 -0
- package/dist/biology/respiration/index.d.mts +1 -0
- package/dist/biology/respiration/preset.d.mts +17 -0
- package/dist/biology/respiration/preset.mjs +179 -0
- package/dist/biology/sequence/central-dogma.d.mts +17 -0
- package/dist/biology/sequence/central-dogma.mjs +339 -0
- package/dist/biology/sequence/core.d.mts +38 -0
- package/dist/biology/sequence/core.mjs +178 -0
- package/dist/biology/sequence/index.d.mts +3 -0
- package/dist/biology/sequence/preset.d.mts +20 -0
- package/dist/biology/sequence/preset.mjs +235 -0
- package/dist/blocks/accounting.d.mts +142 -0
- package/dist/blocks/accounting.mjs +446 -0
- package/dist/blocks/authoring.d.mts +12 -0
- package/dist/blocks/authoring.mjs +705 -0
- package/dist/blocks/biology.d.mts +197 -0
- package/dist/blocks/biology.mjs +513 -0
- package/dist/blocks/chem.d.mts +128 -0
- package/dist/blocks/chem.mjs +486 -0
- package/dist/blocks/circuits.d.mts +86 -0
- package/dist/blocks/circuits.mjs +348 -0
- package/dist/blocks/discrete.d.mts +62 -0
- package/dist/blocks/discrete.mjs +314 -0
- package/dist/blocks/economics.d.mts +56 -0
- package/dist/blocks/economics.mjs +203 -0
- package/dist/blocks/geography.d.mts +58 -0
- package/dist/blocks/geography.mjs +115 -0
- package/dist/blocks/geometry.d.mts +28 -0
- package/dist/blocks/geometry.mjs +160 -0
- package/dist/blocks/ict.d.mts +65 -0
- package/dist/blocks/ict.mjs +197 -0
- package/dist/blocks/index.d.mts +4555 -0
- package/dist/blocks/index.mjs +120 -0
- package/dist/blocks/lab-block.d.mts +16 -0
- package/dist/blocks/lab-block.mjs +74 -0
- package/dist/blocks/lab-config.d.mts +23 -0
- package/dist/blocks/lab-config.mjs +200 -0
- package/dist/blocks/lab-gallery.d.mts +30 -0
- package/dist/blocks/lab-gallery.mjs +208 -0
- package/dist/blocks/language.d.mts +349 -0
- package/dist/blocks/language.mjs +750 -0
- package/dist/blocks/lesson.d.mts +43 -0
- package/dist/blocks/lesson.mjs +140 -0
- package/dist/blocks/math.d.mts +411 -0
- package/dist/blocks/math.mjs +1536 -0
- package/dist/blocks/ml.d.mts +84 -0
- package/dist/blocks/ml.mjs +146 -0
- package/dist/blocks/physics.d.mts +259 -0
- package/dist/blocks/physics.mjs +868 -0
- package/dist/blocks/statistics.d.mts +29 -0
- package/dist/blocks/statistics.mjs +123 -0
- package/dist/catalog/index.d.mts +3 -0
- package/dist/catalog/index.mjs +8 -0
- package/dist/catalog/registry.d.mts +46 -0
- package/dist/catalog/registry.mjs +56 -0
- package/dist/catalog/templates.d.mts +11 -0
- package/dist/catalog/templates.mjs +141 -0
- package/dist/chem/battery.d.mts +16 -0
- package/dist/chem/battery.mjs +311 -0
- package/dist/chem/bohr-atom.d.mts +16 -0
- package/dist/chem/bohr-atom.mjs +212 -0
- package/dist/chem/diffusion/asset.mjs +76 -0
- package/dist/chem/diffusion/index.d.mts +1 -0
- package/dist/chem/diffusion/preset.d.mts +15 -0
- package/dist/chem/diffusion/preset.mjs +188 -0
- package/dist/chem/electrochem/index.d.mts +1 -0
- package/dist/chem/electrochem/preset.d.mts +23 -0
- package/dist/chem/electrochem/preset.mjs +402 -0
- package/dist/chem/equilibrium/index.d.mts +1 -0
- package/dist/chem/equilibrium/preset.d.mts +36 -0
- package/dist/chem/equilibrium/preset.mjs +416 -0
- package/dist/chem/gas-box/index.d.mts +1 -0
- package/dist/chem/gas-box/preset.d.mts +27 -0
- package/dist/chem/gas-box/preset.mjs +395 -0
- package/dist/chem/index.d.mts +16 -0
- package/dist/chem/index.mjs +17 -0
- package/dist/chem/kinetics/index.d.mts +1 -0
- package/dist/chem/kinetics/preset.d.mts +31 -0
- package/dist/chem/kinetics/preset.mjs +478 -0
- package/dist/chem/periodic-trends/index.d.mts +1 -0
- package/dist/chem/periodic-trends/preset.d.mts +21 -0
- package/dist/chem/periodic-trends/preset.mjs +831 -0
- package/dist/chem/reaction-lab.d.mts +18 -0
- package/dist/chem/reaction-lab.mjs +165 -0
- package/dist/chem/reaction-profile.d.mts +21 -0
- package/dist/chem/reaction-profile.mjs +287 -0
- package/dist/chem/solution/dilution.d.mts +27 -0
- package/dist/chem/solution/dilution.mjs +199 -0
- package/dist/chem/solution/field.d.mts +30 -0
- package/dist/chem/solution/field.mjs +145 -0
- package/dist/chem/solution/index.d.mts +3 -0
- package/dist/chem/solution/solution-box.d.mts +28 -0
- package/dist/chem/solution/solution-box.mjs +140 -0
- package/dist/chem/stoichiometry/index.d.mts +1 -0
- package/dist/chem/stoichiometry/preset.d.mts +29 -0
- package/dist/chem/stoichiometry/preset.mjs +392 -0
- package/dist/chem/titration/index.d.mts +1 -0
- package/dist/chem/titration/preset.d.mts +29 -0
- package/dist/chem/titration/preset.mjs +436 -0
- package/dist/circuits/ac-dc/asset.mjs +295 -0
- package/dist/circuits/ac-dc/index.d.mts +1 -0
- package/dist/circuits/ac-dc/preset.d.mts +16 -0
- package/dist/circuits/ac-dc/preset.mjs +134 -0
- package/dist/circuits/capacitor-leak/index.d.mts +1 -0
- package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
- package/dist/circuits/capacitor-leak/preset.mjs +271 -0
- package/dist/circuits/circuit/asset.d.mts +6 -0
- package/dist/circuits/circuit/asset.mjs +367 -0
- package/dist/circuits/circuit/index.d.mts +2 -0
- package/dist/circuits/circuit/preset.d.mts +46 -0
- package/dist/circuits/circuit/preset.mjs +235 -0
- package/dist/circuits/circuit-builder.d.mts +30 -0
- package/dist/circuits/circuit-builder.mjs +412 -0
- package/dist/circuits/circuit-lab.d.mts +20 -0
- package/dist/circuits/circuit-lab.mjs +400 -0
- package/dist/circuits/index.d.mts +7 -0
- package/dist/circuits/index.mjs +8 -0
- package/dist/commerce/accounting/core.d.mts +48 -0
- package/dist/commerce/accounting/core.mjs +57 -0
- package/dist/commerce/accounting/equation-balance.d.mts +35 -0
- package/dist/commerce/accounting/equation-balance.mjs +292 -0
- package/dist/commerce/accounting/index.d.mts +4 -0
- package/dist/commerce/accounting/journal-poster.d.mts +29 -0
- package/dist/commerce/accounting/journal-poster.mjs +472 -0
- package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
- package/dist/commerce/accounting/statement-sorter.mjs +304 -0
- package/dist/commerce/economics/core.d.mts +33 -0
- package/dist/commerce/economics/core.mjs +26 -0
- package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
- package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
- package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
- package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
- package/dist/commerce/economics/index.d.mts +4 -0
- package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
- package/dist/commerce/economics/market-equilibrium.mjs +340 -0
- package/dist/commerce/index.d.mts +9 -0
- package/dist/commerce/index.mjs +10 -0
- package/dist/core/easing.d.mts +28 -0
- package/dist/core/easing.mjs +66 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.mjs +11 -0
- package/dist/core/numeric.d.mts +37 -0
- package/dist/core/numeric.mjs +75 -0
- package/dist/core/reactive.d.mts +24 -0
- package/dist/core/reactive.mjs +51 -0
- package/dist/core/rng.d.mts +21 -0
- package/dist/core/rng.mjs +39 -0
- package/dist/core/tex.d.mts +14 -0
- package/dist/core/tex.mjs +44 -0
- package/dist/core/timeline.d.mts +34 -0
- package/dist/core/timeline.mjs +77 -0
- package/dist/core/util.d.mts +19 -0
- package/dist/core/util.mjs +31 -0
- package/dist/discrete/arrangements/preset.d.mts +28 -0
- package/dist/discrete/arrangements/preset.mjs +304 -0
- package/dist/discrete/bayes/preset.d.mts +33 -0
- package/dist/discrete/bayes/preset.mjs +476 -0
- package/dist/discrete/binomial/preset.d.mts +25 -0
- package/dist/discrete/binomial/preset.mjs +333 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -0
- package/dist/discrete/core/combinatorics.mjs +57 -0
- package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
- package/dist/discrete/core/inclusionExclusion.mjs +30 -0
- package/dist/discrete/core/pigeonhole.d.mts +15 -0
- package/dist/discrete/core/pigeonhole.mjs +24 -0
- package/dist/discrete/core/probability.d.mts +29 -0
- package/dist/discrete/core/probability.mjs +43 -0
- package/dist/discrete/core/sets.d.mts +21 -0
- package/dist/discrete/core/sets.mjs +45 -0
- package/dist/discrete/counting-slots/preset.d.mts +30 -0
- package/dist/discrete/counting-slots/preset.mjs +553 -0
- package/dist/discrete/counting-tree/index.d.mts +1 -0
- package/dist/discrete/counting-tree/preset.d.mts +44 -0
- package/dist/discrete/counting-tree/preset.mjs +364 -0
- package/dist/discrete/expected-value/preset.d.mts +28 -0
- package/dist/discrete/expected-value/preset.mjs +352 -0
- package/dist/discrete/hypergeometric/preset.d.mts +25 -0
- package/dist/discrete/hypergeometric/preset.mjs +330 -0
- package/dist/discrete/index.d.mts +26 -0
- package/dist/discrete/index.mjs +27 -0
- package/dist/discrete/karnaugh/index.d.mts +1 -0
- package/dist/discrete/karnaugh/preset.d.mts +30 -0
- package/dist/discrete/karnaugh/preset.mjs +452 -0
- package/dist/discrete/lln/asset.mjs +206 -0
- package/dist/discrete/lln/index.d.mts +1 -0
- package/dist/discrete/lln/preset.d.mts +17 -0
- package/dist/discrete/lln/preset.mjs +152 -0
- package/dist/discrete/logic-circuit/index.d.mts +1 -0
- package/dist/discrete/logic-circuit/preset.d.mts +47 -0
- package/dist/discrete/logic-circuit/preset.mjs +307 -0
- package/dist/discrete/monte-carlo/index.d.mts +1 -0
- package/dist/discrete/monte-carlo/preset.d.mts +64 -0
- package/dist/discrete/monte-carlo/preset.mjs +446 -0
- package/dist/discrete/monty-hall/index.d.mts +1 -0
- package/dist/discrete/monty-hall/preset.d.mts +23 -0
- package/dist/discrete/monty-hall/preset.mjs +491 -0
- package/dist/discrete/outcome-builder/preset.d.mts +24 -0
- package/dist/discrete/outcome-builder/preset.mjs +283 -0
- package/dist/discrete/pascal/preset.d.mts +24 -0
- package/dist/discrete/pascal/preset.mjs +372 -0
- package/dist/discrete/sample-space/index.d.mts +1 -0
- package/dist/discrete/sample-space/preset.d.mts +42 -0
- package/dist/discrete/sample-space/preset.mjs +395 -0
- package/dist/discrete/selection/preset.d.mts +33 -0
- package/dist/discrete/selection/preset.mjs +406 -0
- package/dist/discrete/truth-table/index.d.mts +1 -0
- package/dist/discrete/truth-table/preset.d.mts +30 -0
- package/dist/discrete/truth-table/preset.mjs +456 -0
- package/dist/discrete/venn/index.d.mts +1 -0
- package/dist/discrete/venn/preset.d.mts +32 -0
- package/dist/discrete/venn/preset.mjs +461 -0
- package/dist/geography/cycle-lab/index.d.mts +1 -0
- package/dist/geography/cycle-lab/preset.d.mts +25 -0
- package/dist/geography/cycle-lab/preset.mjs +254 -0
- package/dist/geography/cycles.d.mts +21 -0
- package/dist/geography/cycles.mjs +205 -0
- package/dist/geography/index.d.mts +4 -0
- package/dist/geography/index.mjs +5 -0
- package/dist/geometry/board/index.d.mts +1 -0
- package/dist/geometry/board/preset.d.mts +71 -0
- package/dist/geometry/board/preset.mjs +148 -0
- package/dist/geometry/builder.d.mts +18 -0
- package/dist/geometry/builder.mjs +332 -0
- package/dist/geometry/index.d.mts +4 -0
- package/dist/geometry/index.mjs +5 -0
- package/dist/geometry/intersecting-circles.d.mts +17 -0
- package/dist/geometry/intersecting-circles.mjs +104 -0
- package/dist/ict/index.d.mts +5 -0
- package/dist/ict/index.mjs +6 -0
- package/dist/ict/number-systems/base-odometer.d.mts +34 -0
- package/dist/ict/number-systems/base-odometer.mjs +160 -0
- package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
- package/dist/ict/number-systems/bit-grouper.mjs +190 -0
- package/dist/ict/number-systems/index.d.mts +4 -0
- package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
- package/dist/ict/number-systems/place-value-dial.mjs +153 -0
- package/dist/ict/number-systems/wheel.d.mts +73 -0
- package/dist/ict/number-systems/wheel.mjs +279 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/kit/anim.mjs +52 -0
- package/dist/kit/annotate.mjs +116 -0
- package/dist/kit/answer-check.d.mts +38 -0
- package/dist/kit/answer-check.mjs +65 -0
- package/dist/kit/asset-util.mjs +15 -0
- package/dist/kit/controls.mjs +77 -0
- package/dist/kit/cycle.d.mts +44 -0
- package/dist/kit/cycle.mjs +188 -0
- package/dist/kit/diagram.mjs +176 -0
- package/dist/kit/electronics.mjs +357 -0
- package/dist/kit/expr-analysis.d.mts +37 -0
- package/dist/kit/expr-analysis.mjs +111 -0
- package/dist/kit/frame.d.mts +70 -0
- package/dist/kit/frame.mjs +205 -0
- package/dist/kit/freq-tree.mjs +99 -0
- package/dist/kit/gameshow.mjs +315 -0
- package/dist/kit/index.d.mts +5 -0
- package/dist/kit/index.mjs +6 -0
- package/dist/kit/logic-gates.d.mts +6 -0
- package/dist/kit/logic-gates.mjs +210 -0
- package/dist/kit/molecules.mjs +178 -0
- package/dist/kit/pedagogy.d.mts +126 -0
- package/dist/kit/pedagogy.mjs +331 -0
- package/dist/kit/play.d.mts +21 -0
- package/dist/kit/play.mjs +52 -0
- package/dist/kit/probability.mjs +141 -0
- package/dist/kit/proportion.mjs +112 -0
- package/dist/kit/reaction.mjs +102 -0
- package/dist/kit/rich.d.mts +10 -0
- package/dist/kit/rich.mjs +21 -0
- package/dist/kit/scale.mjs +230 -0
- package/dist/kit/space.mjs +326 -0
- package/dist/kit/steps.d.mts +24 -0
- package/dist/kit/steps.mjs +57 -0
- package/dist/kit/thermal.mjs +289 -0
- package/dist/language/agreement/index.d.mts +1 -0
- package/dist/language/agreement/preset.d.mts +27 -0
- package/dist/language/agreement/preset.mjs +113 -0
- package/dist/language/article-lens/index.d.mts +1 -0
- package/dist/language/article-lens/preset.d.mts +31 -0
- package/dist/language/article-lens/preset.mjs +125 -0
- package/dist/language/deck.d.mts +45 -0
- package/dist/language/deck.mjs +61 -0
- package/dist/language/icon.d.mts +40 -0
- package/dist/language/icon.mjs +73 -0
- package/dist/language/index.d.mts +10 -0
- package/dist/language/index.mjs +11 -0
- package/dist/language/preposition-scene/index.d.mts +1 -0
- package/dist/language/preposition-scene/preset.d.mts +34 -0
- package/dist/language/preposition-scene/preset.mjs +234 -0
- package/dist/language/sentence-builder/index.d.mts +1 -0
- package/dist/language/sentence-builder/preset.d.mts +32 -0
- package/dist/language/sentence-builder/preset.mjs +122 -0
- package/dist/language/transform/index.d.mts +1 -0
- package/dist/language/transform/preset.d.mts +31 -0
- package/dist/language/transform/preset.mjs +137 -0
- package/dist/language/ui.d.mts +53 -0
- package/dist/language/ui.mjs +88 -0
- package/dist/language/word-match/index.d.mts +1 -0
- package/dist/language/word-match/preset.d.mts +22 -0
- package/dist/language/word-match/preset.mjs +148 -0
- package/dist/math/area-model/asset.d.mts +6 -0
- package/dist/math/area-model/asset.mjs +270 -0
- package/dist/math/area-model/index.d.mts +2 -0
- package/dist/math/area-model/preset.d.mts +29 -0
- package/dist/math/area-model/preset.mjs +243 -0
- package/dist/math/balance-algebra/asset.d.mts +6 -0
- package/dist/math/balance-algebra/asset.mjs +150 -0
- package/dist/math/balance-algebra/index.d.mts +2 -0
- package/dist/math/balance-algebra/preset.d.mts +30 -0
- package/dist/math/balance-algebra/preset.mjs +228 -0
- package/dist/math/derivation.d.mts +22 -0
- package/dist/math/derivation.mjs +113 -0
- package/dist/math/derivative-explorer/index.d.mts +1 -0
- package/dist/math/derivative-explorer/preset.d.mts +19 -0
- package/dist/math/derivative-explorer/preset.mjs +227 -0
- package/dist/math/function-machine/index.d.mts +1 -0
- package/dist/math/function-machine/preset.d.mts +21 -0
- package/dist/math/function-machine/preset.mjs +177 -0
- package/dist/math/gradient-descent.d.mts +23 -0
- package/dist/math/gradient-descent.mjs +473 -0
- package/dist/math/grapher/index.d.mts +1 -0
- package/dist/math/grapher/preset.d.mts +40 -0
- package/dist/math/grapher/preset.mjs +313 -0
- package/dist/math/harmonic-form/index.d.mts +1 -0
- package/dist/math/harmonic-form/preset.d.mts +21 -0
- package/dist/math/harmonic-form/preset.mjs +387 -0
- package/dist/math/index.d.mts +25 -0
- package/dist/math/index.mjs +26 -0
- package/dist/math/integral-explorer/index.d.mts +1 -0
- package/dist/math/integral-explorer/preset.d.mts +23 -0
- package/dist/math/integral-explorer/preset.mjs +217 -0
- package/dist/math/interactive/index.d.mts +1 -0
- package/dist/math/interactive/preset.d.mts +72 -0
- package/dist/math/interactive/preset.mjs +202 -0
- package/dist/math/limit-explorer/index.d.mts +1 -0
- package/dist/math/limit-explorer/preset.d.mts +19 -0
- package/dist/math/limit-explorer/preset.mjs +216 -0
- package/dist/math/linear-system/index.d.mts +1 -0
- package/dist/math/linear-system/preset.d.mts +28 -0
- package/dist/math/linear-system/preset.mjs +164 -0
- package/dist/math/mystery-bucket/asset.d.mts +6 -0
- package/dist/math/mystery-bucket/asset.mjs +145 -0
- package/dist/math/mystery-bucket/index.d.mts +2 -0
- package/dist/math/mystery-bucket/preset.d.mts +36 -0
- package/dist/math/mystery-bucket/preset.mjs +116 -0
- package/dist/math/number-line/index.d.mts +1 -0
- package/dist/math/number-line/preset.d.mts +24 -0
- package/dist/math/number-line/preset.mjs +142 -0
- package/dist/math/parabola/index.d.mts +1 -0
- package/dist/math/parabola/preset.d.mts +13 -0
- package/dist/math/parabola/preset.mjs +79 -0
- package/dist/math/pattern/asset.d.mts +6 -0
- package/dist/math/pattern/asset.mjs +102 -0
- package/dist/math/pattern/index.d.mts +2 -0
- package/dist/math/pattern/preset.d.mts +32 -0
- package/dist/math/pattern/preset.mjs +294 -0
- package/dist/math/triangle-trig/index.d.mts +1 -0
- package/dist/math/triangle-trig/preset.d.mts +47 -0
- package/dist/math/triangle-trig/preset.mjs +245 -0
- package/dist/math/trig-explorer.d.mts +18 -0
- package/dist/math/trig-explorer.mjs +209 -0
- package/dist/ml/boundary/index.d.mts +1 -0
- package/dist/ml/boundary/preset.d.mts +24 -0
- package/dist/ml/boundary/preset.mjs +385 -0
- package/dist/ml/classifier/index.d.mts +1 -0
- package/dist/ml/classifier/preset.d.mts +25 -0
- package/dist/ml/classifier/preset.mjs +315 -0
- package/dist/ml/index.d.mts +6 -0
- package/dist/ml/index.mjs +7 -0
- package/dist/ml/kmeans/index.d.mts +1 -0
- package/dist/ml/kmeans/preset.d.mts +33 -0
- package/dist/ml/kmeans/preset.mjs +236 -0
- package/dist/ml/knn/index.d.mts +1 -0
- package/dist/ml/knn/preset.d.mts +28 -0
- package/dist/ml/knn/preset.mjs +279 -0
- package/dist/ml/regression/index.d.mts +1 -0
- package/dist/ml/regression/preset.d.mts +32 -0
- package/dist/ml/regression/preset.mjs +394 -0
- package/dist/physics/atwood/index.d.mts +1 -0
- package/dist/physics/atwood/preset.d.mts +23 -0
- package/dist/physics/atwood/preset.mjs +312 -0
- package/dist/physics/bullet-walls/index.d.mts +1 -0
- package/dist/physics/bullet-walls/preset.d.mts +28 -0
- package/dist/physics/bullet-walls/preset.mjs +373 -0
- package/dist/physics/carnot/index.d.mts +1 -0
- package/dist/physics/carnot/preset.d.mts +27 -0
- package/dist/physics/carnot/preset.mjs +427 -0
- package/dist/physics/circular-motion/index.d.mts +1 -0
- package/dist/physics/circular-motion/preset.d.mts +25 -0
- package/dist/physics/circular-motion/preset.mjs +293 -0
- package/dist/physics/collision-track/index.d.mts +1 -0
- package/dist/physics/collision-track/preset.d.mts +27 -0
- package/dist/physics/collision-track/preset.mjs +352 -0
- package/dist/physics/efficiency/index.d.mts +1 -0
- package/dist/physics/efficiency/preset.d.mts +33 -0
- package/dist/physics/efficiency/preset.mjs +343 -0
- package/dist/physics/electric-field/index.d.mts +1 -0
- package/dist/physics/electric-field/preset.d.mts +15 -0
- package/dist/physics/electric-field/preset.mjs +306 -0
- package/dist/physics/energy-skate/index.d.mts +1 -0
- package/dist/physics/energy-skate/preset.d.mts +25 -0
- package/dist/physics/energy-skate/preset.mjs +254 -0
- package/dist/physics/entropy/index.d.mts +1 -0
- package/dist/physics/entropy/preset.d.mts +18 -0
- package/dist/physics/entropy/preset.mjs +416 -0
- package/dist/physics/expansion/index.d.mts +1 -0
- package/dist/physics/expansion/preset.d.mts +26 -0
- package/dist/physics/expansion/preset.mjs +609 -0
- package/dist/physics/exponential/asset.mjs +221 -0
- package/dist/physics/exponential/index.d.mts +1 -0
- package/dist/physics/exponential/preset.d.mts +17 -0
- package/dist/physics/exponential/preset.mjs +182 -0
- package/dist/physics/gas-process/index.d.mts +1 -0
- package/dist/physics/gas-process/preset.d.mts +30 -0
- package/dist/physics/gas-process/preset.mjs +384 -0
- package/dist/physics/gravitation/index.d.mts +1 -0
- package/dist/physics/gravitation/preset.d.mts +24 -0
- package/dist/physics/gravitation/preset.mjs +345 -0
- package/dist/physics/gravity-drop.d.mts +9 -0
- package/dist/physics/gravity-drop.mjs +187 -0
- package/dist/physics/heat-transfer/index.d.mts +1 -0
- package/dist/physics/heat-transfer/preset.d.mts +27 -0
- package/dist/physics/heat-transfer/preset.mjs +626 -0
- package/dist/physics/impulse/index.d.mts +1 -0
- package/dist/physics/impulse/preset.d.mts +29 -0
- package/dist/physics/impulse/preset.mjs +453 -0
- package/dist/physics/index.d.mts +43 -0
- package/dist/physics/index.mjs +44 -0
- package/dist/physics/kepler/index.d.mts +1 -0
- package/dist/physics/kepler/preset.d.mts +27 -0
- package/dist/physics/kepler/preset.mjs +257 -0
- package/dist/physics/lever/asset.d.mts +6 -0
- package/dist/physics/lever/asset.mjs +220 -0
- package/dist/physics/lever/index.d.mts +2 -0
- package/dist/physics/lever/preset.d.mts +31 -0
- package/dist/physics/lever/preset.mjs +261 -0
- package/dist/physics/lorentz/index.d.mts +1 -0
- package/dist/physics/lorentz/preset.d.mts +29 -0
- package/dist/physics/lorentz/preset.mjs +367 -0
- package/dist/physics/magnetism/index.d.mts +1 -0
- package/dist/physics/magnetism/preset.d.mts +15 -0
- package/dist/physics/magnetism/preset.mjs +334 -0
- package/dist/physics/optics/asset.d.mts +6 -0
- package/dist/physics/optics/asset.mjs +234 -0
- package/dist/physics/optics/index.d.mts +2 -0
- package/dist/physics/optics/preset.d.mts +14 -0
- package/dist/physics/optics/preset.mjs +202 -0
- package/dist/physics/orbit-lab.d.mts +6 -0
- package/dist/physics/orbit-lab.mjs +222 -0
- package/dist/physics/projectile-lab.d.mts +10 -0
- package/dist/physics/projectile-lab.mjs +354 -0
- package/dist/physics/rain-relative/index.d.mts +1 -0
- package/dist/physics/rain-relative/preset.d.mts +19 -0
- package/dist/physics/rain-relative/preset.mjs +358 -0
- package/dist/physics/ramp-forces/index.d.mts +1 -0
- package/dist/physics/ramp-forces/preset.d.mts +36 -0
- package/dist/physics/ramp-forces/preset.mjs +550 -0
- package/dist/physics/river-boat.d.mts +22 -0
- package/dist/physics/river-boat.mjs +498 -0
- package/dist/physics/shm/index.d.mts +1 -0
- package/dist/physics/shm/preset.d.mts +33 -0
- package/dist/physics/shm/preset.mjs +554 -0
- package/dist/physics/stopping-distance/index.d.mts +1 -0
- package/dist/physics/stopping-distance/preset.d.mts +29 -0
- package/dist/physics/stopping-distance/preset.mjs +662 -0
- package/dist/physics/temperature-scales/index.d.mts +1 -0
- package/dist/physics/temperature-scales/preset.d.mts +15 -0
- package/dist/physics/temperature-scales/preset.mjs +353 -0
- package/dist/physics/terminal-velocity/index.d.mts +1 -0
- package/dist/physics/terminal-velocity/preset.d.mts +26 -0
- package/dist/physics/terminal-velocity/preset.mjs +404 -0
- package/dist/physics/thermal/index.d.mts +1 -0
- package/dist/physics/thermal/preset.d.mts +44 -0
- package/dist/physics/thermal/preset.mjs +373 -0
- package/dist/physics/vector-board/index.d.mts +1 -0
- package/dist/physics/vector-board/preset.d.mts +65 -0
- package/dist/physics/vector-board/preset.mjs +273 -0
- package/dist/physics/vector-board/view.d.mts +49 -0
- package/dist/physics/vector-board/view.mjs +58 -0
- package/dist/physics/vector-scene.d.mts +41 -0
- package/dist/physics/vector-scene.mjs +211 -0
- package/dist/physics/vector-types/index.d.mts +1 -0
- package/dist/physics/vector-types/preset.d.mts +27 -0
- package/dist/physics/vector-types/preset.mjs +192 -0
- package/dist/physics/water-density/index.d.mts +1 -0
- package/dist/physics/water-density/preset.d.mts +18 -0
- package/dist/physics/water-density/preset.mjs +439 -0
- package/dist/physics/waves/core.mjs +33 -0
- package/dist/physics/waves/doppler.d.mts +23 -0
- package/dist/physics/waves/doppler.mjs +260 -0
- package/dist/physics/waves/index.d.mts +4 -0
- package/dist/physics/waves/preset.d.mts +30 -0
- package/dist/physics/waves/preset.mjs +488 -0
- package/dist/physics/waves/ripple.d.mts +26 -0
- package/dist/physics/waves/ripple.mjs +234 -0
- package/dist/physics/waves/string.d.mts +29 -0
- package/dist/physics/waves/string.mjs +289 -0
- package/dist/physics/work-energy/index.d.mts +1 -0
- package/dist/physics/work-energy/preset.d.mts +17 -0
- package/dist/physics/work-energy/preset.mjs +341 -0
- package/dist/schemas/index.d.mts +235 -0
- package/dist/schemas/index.mjs +145 -0
- package/dist/statistics/center-spread/preset.d.mts +34 -0
- package/dist/statistics/center-spread/preset.mjs +323 -0
- package/dist/statistics/core/descriptive.d.mts +35 -0
- package/dist/statistics/core/descriptive.mjs +64 -0
- package/dist/statistics/core/normal.d.mts +21 -0
- package/dist/statistics/core/normal.mjs +37 -0
- package/dist/statistics/core/sequences.d.mts +27 -0
- package/dist/statistics/core/sequences.mjs +35 -0
- package/dist/statistics/galton/preset.d.mts +27 -0
- package/dist/statistics/galton/preset.mjs +331 -0
- package/dist/statistics/histogram/preset.d.mts +27 -0
- package/dist/statistics/histogram/preset.mjs +385 -0
- package/dist/statistics/index.d.mts +11 -0
- package/dist/statistics/index.mjs +12 -0
- package/dist/statistics/normal/preset.d.mts +30 -0
- package/dist/statistics/normal/preset.mjs +400 -0
- package/dist/statistics/sampling/preset.d.mts +32 -0
- package/dist/statistics/sampling/preset.mjs +406 -0
- package/dist/statistics/sequence/preset.d.mts +28 -0
- package/dist/statistics/sequence/preset.mjs +302 -0
- package/dist/statistics/z-table/preset.d.mts +28 -0
- package/dist/statistics/z-table/preset.mjs +348 -0
- package/package.json +266 -0
- package/styles.css +267 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/kit/cycle.d.ts
|
|
4
|
+
interface CycleNode {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
tone?: string;
|
|
8
|
+
}
|
|
9
|
+
interface CycleEdge {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const edgeKey: (e: {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
}) => string;
|
|
18
|
+
interface CycleDiagramProps {
|
|
19
|
+
nodes: CycleNode[];
|
|
20
|
+
edges: CycleEdge[];
|
|
21
|
+
size?: number;
|
|
22
|
+
activeId?: string | null;
|
|
23
|
+
/** edge keys to render highlighted; defaults to the active node's outgoing edges. */
|
|
24
|
+
litEdges?: ReadonlySet<string> | null;
|
|
25
|
+
/** render this in place of each edge's default process-label pill (challenge slots). */
|
|
26
|
+
edgeSlot?: (edge: CycleEdge, key: string, mid: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}) => ReactNode;
|
|
30
|
+
onNodeClick?: (id: string) => void;
|
|
31
|
+
ariaLabel?: string;
|
|
32
|
+
}
|
|
33
|
+
declare function CycleDiagram({
|
|
34
|
+
nodes,
|
|
35
|
+
edges,
|
|
36
|
+
size,
|
|
37
|
+
activeId,
|
|
38
|
+
litEdges,
|
|
39
|
+
edgeSlot,
|
|
40
|
+
onNodeClick,
|
|
41
|
+
ariaLabel
|
|
42
|
+
}: CycleDiagramProps): ReactNode;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { CycleDiagram, CycleEdge, CycleNode, edgeKey };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { toRad } from "../core/util.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/kit/cycle.tsx
|
|
7
|
+
const edgeKey = (e) => `${e.from}->${e.to}`;
|
|
8
|
+
const TONES = [
|
|
9
|
+
"var(--stage-accent)",
|
|
10
|
+
"var(--stage-accent-2)",
|
|
11
|
+
"var(--stage-good)",
|
|
12
|
+
"var(--stage-warn)",
|
|
13
|
+
"var(--stage-danger)",
|
|
14
|
+
"var(--stage-muted)"
|
|
15
|
+
];
|
|
16
|
+
const r2 = (n) => Math.round(n * 100) / 100;
|
|
17
|
+
function CycleDiagram({ nodes, edges, size = 340, activeId = null, litEdges = null, edgeSlot, onNodeClick, ariaLabel }) {
|
|
18
|
+
const c = size / 2;
|
|
19
|
+
const R = size * .33;
|
|
20
|
+
const nodeR = Math.max(16, Math.min(26, size * .075));
|
|
21
|
+
const PAD = 46;
|
|
22
|
+
const n = nodes.length || 1;
|
|
23
|
+
const pos = /* @__PURE__ */ new Map();
|
|
24
|
+
nodes.forEach((nd, i) => {
|
|
25
|
+
const a = toRad(-90 + 360 * i / n);
|
|
26
|
+
pos.set(nd.id, {
|
|
27
|
+
x: r2(c + R * Math.cos(a)),
|
|
28
|
+
y: r2(c + R * Math.sin(a)),
|
|
29
|
+
tone: nd.tone ?? TONES[i % TONES.length],
|
|
30
|
+
label: nd.label
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const idx = new Map(nodes.map((nd, i) => [nd.id, i]));
|
|
34
|
+
const interactive = !!onNodeClick;
|
|
35
|
+
const lit = litEdges ?? (activeId ? new Set(edges.filter((e) => e.from === activeId).map(edgeKey)) : null);
|
|
36
|
+
const edgePaths = [];
|
|
37
|
+
const slots = [];
|
|
38
|
+
edges.forEach((e) => {
|
|
39
|
+
const A = pos.get(e.from), B = pos.get(e.to);
|
|
40
|
+
if (!A || !B) return;
|
|
41
|
+
const key = edgeKey(e);
|
|
42
|
+
const dx = B.x - A.x, dy = B.y - A.y;
|
|
43
|
+
const L = Math.hypot(dx, dy) || 1;
|
|
44
|
+
const ux = dx / L, uy = dy / L;
|
|
45
|
+
const start = {
|
|
46
|
+
x: r2(A.x + ux * nodeR),
|
|
47
|
+
y: r2(A.y + uy * nodeR)
|
|
48
|
+
};
|
|
49
|
+
const end = {
|
|
50
|
+
x: r2(B.x - ux * (nodeR + 7)),
|
|
51
|
+
y: r2(B.y - uy * (nodeR + 7))
|
|
52
|
+
};
|
|
53
|
+
const mx = (A.x + B.x) / 2, my = (A.y + B.y) / 2;
|
|
54
|
+
const ai = idx.get(e.from), bi = idx.get(e.to);
|
|
55
|
+
const adjacent = (ai + 1) % n === bi || (bi + 1) % n === ai;
|
|
56
|
+
let ctrl;
|
|
57
|
+
if (adjacent) {
|
|
58
|
+
const ox = mx - c, oy = my - c, ol = Math.hypot(ox, oy) || 1;
|
|
59
|
+
const bow = R * .18;
|
|
60
|
+
ctrl = {
|
|
61
|
+
x: r2(mx + ox / ol * bow),
|
|
62
|
+
y: r2(my + oy / ol * bow)
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
const bow = L * .18;
|
|
66
|
+
ctrl = {
|
|
67
|
+
x: r2(mx - uy * bow),
|
|
68
|
+
y: r2(my + ux * bow)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const on = lit ? lit.has(key) : true;
|
|
72
|
+
const dim = lit ? !on : false;
|
|
73
|
+
const hot = on && !!lit;
|
|
74
|
+
const col = hot ? "var(--stage-accent)" : "var(--stage-fg)";
|
|
75
|
+
const adx = end.x - ctrl.x, ady = end.y - ctrl.y, al = Math.hypot(adx, ady) || 1;
|
|
76
|
+
const hx = adx / al, hy = ady / al, px = -hy, py = hx, ah = 7;
|
|
77
|
+
const b1 = {
|
|
78
|
+
x: r2(end.x - hx * ah + px * ah * .6),
|
|
79
|
+
y: r2(end.y - hy * ah + py * ah * .6)
|
|
80
|
+
};
|
|
81
|
+
const b2 = {
|
|
82
|
+
x: r2(end.x - hx * ah - px * ah * .6),
|
|
83
|
+
y: r2(end.y - hy * ah - py * ah * .6)
|
|
84
|
+
};
|
|
85
|
+
edgePaths.push(/* @__PURE__ */ jsxs("g", {
|
|
86
|
+
opacity: dim ? .16 : .9,
|
|
87
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
88
|
+
d: `M ${start.x} ${start.y} Q ${ctrl.x} ${ctrl.y} ${end.x} ${end.y}`,
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: col,
|
|
91
|
+
strokeWidth: hot ? 2.6 : 1.8
|
|
92
|
+
}), /* @__PURE__ */ jsx("polygon", {
|
|
93
|
+
points: `${end.x},${end.y} ${b1.x},${b1.y} ${b2.x},${b2.y}`,
|
|
94
|
+
fill: col
|
|
95
|
+
})]
|
|
96
|
+
}, key));
|
|
97
|
+
const bm = {
|
|
98
|
+
x: r2(.25 * start.x + .5 * ctrl.x + .25 * end.x),
|
|
99
|
+
y: r2(.25 * start.y + .5 * ctrl.y + .25 * end.y)
|
|
100
|
+
};
|
|
101
|
+
if (edgeSlot) slots.push(/* @__PURE__ */ jsx("g", {
|
|
102
|
+
opacity: dim ? .25 : 1,
|
|
103
|
+
children: edgeSlot(e, key, bm)
|
|
104
|
+
}, `s-${key}`));
|
|
105
|
+
else if (e.label) {
|
|
106
|
+
const w = e.label.length * 5.7 + 14;
|
|
107
|
+
slots.push(/* @__PURE__ */ jsxs("g", {
|
|
108
|
+
opacity: dim ? .3 : 1,
|
|
109
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
110
|
+
x: r2(bm.x - w / 2),
|
|
111
|
+
y: bm.y - 9,
|
|
112
|
+
width: r2(w),
|
|
113
|
+
height: 18,
|
|
114
|
+
rx: 9,
|
|
115
|
+
fill: "var(--stage-bg)",
|
|
116
|
+
stroke: hot ? "var(--stage-accent)" : "var(--stage-grid)",
|
|
117
|
+
strokeWidth: 1
|
|
118
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
119
|
+
x: bm.x,
|
|
120
|
+
y: bm.y,
|
|
121
|
+
fill: hot ? "var(--stage-accent)" : "var(--stage-muted)",
|
|
122
|
+
fontSize: 10.5,
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
textAnchor: "middle",
|
|
125
|
+
dominantBaseline: "central",
|
|
126
|
+
children: e.label
|
|
127
|
+
})]
|
|
128
|
+
}, `l-${key}`));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const nodeEls = nodes.map((nd) => {
|
|
132
|
+
const p = pos.get(nd.id);
|
|
133
|
+
const active = nd.id === activeId;
|
|
134
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
135
|
+
opacity: (activeId ? !active : false) ? .45 : 1,
|
|
136
|
+
style: { cursor: interactive ? "pointer" : "default" },
|
|
137
|
+
onClick: interactive ? () => onNodeClick(nd.id) : void 0,
|
|
138
|
+
role: interactive ? "button" : void 0,
|
|
139
|
+
"aria-label": interactive ? nd.label : void 0,
|
|
140
|
+
children: [
|
|
141
|
+
active && /* @__PURE__ */ jsx("circle", {
|
|
142
|
+
cx: p.x,
|
|
143
|
+
cy: p.y,
|
|
144
|
+
r: nodeR + 5,
|
|
145
|
+
fill: "none",
|
|
146
|
+
stroke: p.tone,
|
|
147
|
+
strokeWidth: 2,
|
|
148
|
+
opacity: .5
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx("circle", {
|
|
151
|
+
cx: p.x,
|
|
152
|
+
cy: p.y,
|
|
153
|
+
r: nodeR,
|
|
154
|
+
fill: p.tone,
|
|
155
|
+
stroke: "var(--stage-bg)",
|
|
156
|
+
strokeWidth: 2
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx("text", {
|
|
159
|
+
x: p.x,
|
|
160
|
+
y: r2(p.y + nodeR + 12),
|
|
161
|
+
fill: "var(--stage-fg)",
|
|
162
|
+
fontSize: 11,
|
|
163
|
+
fontWeight: 700,
|
|
164
|
+
textAnchor: "middle",
|
|
165
|
+
children: p.label
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
}, nd.id);
|
|
169
|
+
});
|
|
170
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
171
|
+
viewBox: `-46 -46 ${size + 2 * PAD} ${size + 2 * PAD}`,
|
|
172
|
+
width: "100%",
|
|
173
|
+
role: "img",
|
|
174
|
+
"aria-label": ariaLabel,
|
|
175
|
+
style: {
|
|
176
|
+
display: "block",
|
|
177
|
+
maxHeight: size + 2 * PAD
|
|
178
|
+
},
|
|
179
|
+
children: [
|
|
180
|
+
edgePaths,
|
|
181
|
+
nodeEls,
|
|
182
|
+
slots
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
export { CycleDiagram, edgeKey };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Label, Polygon, Segment, Vector, useCoords } from "@classytic/stage";
|
|
6
|
+
|
|
7
|
+
//#region src/kit/diagram.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Small composite helpers built on @classytic/stage primitives, shared by the
|
|
10
|
+
* physics/vector labs. Render these INSIDE a `<Stage>` (they use the coordinate
|
|
11
|
+
* context via the underlying primitives).
|
|
12
|
+
*/
|
|
13
|
+
function AngleArc({ at, from, to, rPx = 26, color = "var(--stage-fg)", label }) {
|
|
14
|
+
const c = useCoords();
|
|
15
|
+
const o = c.toPx(at.x, at.y);
|
|
16
|
+
const p1 = c.toPx(at.x + from.x, at.y + from.y);
|
|
17
|
+
const p2 = c.toPx(at.x + to.x, at.y + to.y);
|
|
18
|
+
const a1 = Math.atan2(p1[1] - o[1], p1[0] - o[0]);
|
|
19
|
+
const a2 = Math.atan2(p2[1] - o[1], p2[0] - o[0]);
|
|
20
|
+
let da = a2 - a1;
|
|
21
|
+
while (da <= -Math.PI) da += 2 * Math.PI;
|
|
22
|
+
while (da > Math.PI) da -= 2 * Math.PI;
|
|
23
|
+
const sweep = da > 0 ? 1 : 0;
|
|
24
|
+
const sx = o[0] + rPx * Math.cos(a1), sy = o[1] + rPx * Math.sin(a1);
|
|
25
|
+
const ex = o[0] + rPx * Math.cos(a2), ey = o[1] + rPx * Math.sin(a2);
|
|
26
|
+
const am = a1 + da / 2;
|
|
27
|
+
const lx = o[0] + (rPx + 13) * Math.cos(am), ly = o[1] + (rPx + 13) * Math.sin(am);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
29
|
+
d: `M ${sx} ${sy} A ${rPx} ${rPx} 0 0 ${sweep} ${ex} ${ey}`,
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: color,
|
|
32
|
+
strokeWidth: 1.6,
|
|
33
|
+
opacity: .85
|
|
34
|
+
}), label && /* @__PURE__ */ jsx("text", {
|
|
35
|
+
x: lx,
|
|
36
|
+
y: ly,
|
|
37
|
+
fill: color,
|
|
38
|
+
fontSize: 13,
|
|
39
|
+
fontWeight: 600,
|
|
40
|
+
textAnchor: "middle",
|
|
41
|
+
dominantBaseline: "middle",
|
|
42
|
+
children: label
|
|
43
|
+
})] });
|
|
44
|
+
}
|
|
45
|
+
/** A small right-angle square at `at`, between unit-ish directions `u` and `v`. */
|
|
46
|
+
function RightAngleMark({ at, u, v, sizePx = 12, color = "var(--stage-muted)" }) {
|
|
47
|
+
const c = useCoords();
|
|
48
|
+
const o = c.toPx(at.x, at.y);
|
|
49
|
+
const dir = (d) => {
|
|
50
|
+
const p = c.toPx(at.x + d.x, at.y + d.y);
|
|
51
|
+
const dx = p[0] - o[0], dy = p[1] - o[1];
|
|
52
|
+
const m = Math.hypot(dx, dy) || 1;
|
|
53
|
+
return [dx / m, dy / m];
|
|
54
|
+
};
|
|
55
|
+
const [ux, uy] = dir(u);
|
|
56
|
+
const [vx, vy] = dir(v);
|
|
57
|
+
const a = [o[0] + ux * sizePx, o[1] + uy * sizePx];
|
|
58
|
+
const b = [o[0] + (ux + vx) * sizePx, o[1] + (uy + vy) * sizePx];
|
|
59
|
+
const d = [o[0] + vx * sizePx, o[1] + vy * sizePx];
|
|
60
|
+
return /* @__PURE__ */ jsx("path", {
|
|
61
|
+
d: `M ${a[0]} ${a[1]} L ${b[0]} ${b[1]} L ${d[0]} ${d[1]}`,
|
|
62
|
+
fill: "none",
|
|
63
|
+
stroke: color,
|
|
64
|
+
strokeWidth: 1.4,
|
|
65
|
+
opacity: .8
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An arrow (tail → tail+comp) with an optional tip label and optional dashed
|
|
70
|
+
* x/y component decomposition — the SVG equivalent of the old canvas
|
|
71
|
+
* `drawVector(..., { label, components })`.
|
|
72
|
+
*/
|
|
73
|
+
function LabeledVector({ tail = {
|
|
74
|
+
x: 0,
|
|
75
|
+
y: 0
|
|
76
|
+
}, comp, color = "var(--stage-accent)", weight = 2.5, label, components = false }) {
|
|
77
|
+
const tip = {
|
|
78
|
+
x: tail.x + comp.x,
|
|
79
|
+
y: tail.y + comp.y
|
|
80
|
+
};
|
|
81
|
+
const corner = {
|
|
82
|
+
x: tip.x,
|
|
83
|
+
y: tail.y
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
components && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Segment, {
|
|
87
|
+
from: tail,
|
|
88
|
+
to: corner,
|
|
89
|
+
color,
|
|
90
|
+
opacity: .4,
|
|
91
|
+
weight: 1,
|
|
92
|
+
dashed: true
|
|
93
|
+
}), /* @__PURE__ */ jsx(Segment, {
|
|
94
|
+
from: corner,
|
|
95
|
+
to: tip,
|
|
96
|
+
color,
|
|
97
|
+
opacity: .4,
|
|
98
|
+
weight: 1,
|
|
99
|
+
dashed: true
|
|
100
|
+
})] }),
|
|
101
|
+
/* @__PURE__ */ jsx(Vector, {
|
|
102
|
+
tail,
|
|
103
|
+
tip,
|
|
104
|
+
color,
|
|
105
|
+
weight
|
|
106
|
+
}),
|
|
107
|
+
label && (() => {
|
|
108
|
+
const len = Math.hypot(comp.x, comp.y) || 1;
|
|
109
|
+
const ux = comp.x / len, uy = -comp.y / len;
|
|
110
|
+
const off = 15;
|
|
111
|
+
const anchor = ux < -.35 ? "end" : ux > .35 ? "start" : "middle";
|
|
112
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
113
|
+
x: tip.x,
|
|
114
|
+
y: tip.y,
|
|
115
|
+
text: label,
|
|
116
|
+
color,
|
|
117
|
+
dx: ux * off,
|
|
118
|
+
dy: uy * off,
|
|
119
|
+
size: 13,
|
|
120
|
+
anchor
|
|
121
|
+
});
|
|
122
|
+
})()
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
/** A schematic resistor: an outlined box (filled with the canvas bg) + a label
|
|
126
|
+
* above and an optional reading below. The SVG equivalent of the old canvas
|
|
127
|
+
* `drawResistor`. */
|
|
128
|
+
function ResistorBox({ center, w, h, color = "var(--stage-accent)", label, reading }) {
|
|
129
|
+
const x0 = center.x - w / 2, x1 = center.x + w / 2;
|
|
130
|
+
const y0 = center.y - h / 2, y1 = center.y + h / 2;
|
|
131
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(Polygon, {
|
|
133
|
+
points: [
|
|
134
|
+
{
|
|
135
|
+
x: x0,
|
|
136
|
+
y: y0
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
x: x1,
|
|
140
|
+
y: y0
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
x: x1,
|
|
144
|
+
y: y1
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
x: x0,
|
|
148
|
+
y: y1
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
color,
|
|
152
|
+
fill: "var(--stage-bg)",
|
|
153
|
+
fillOpacity: 1,
|
|
154
|
+
weight: 2
|
|
155
|
+
}),
|
|
156
|
+
label && /* @__PURE__ */ jsx(Label, {
|
|
157
|
+
x: center.x,
|
|
158
|
+
y: y1,
|
|
159
|
+
text: label,
|
|
160
|
+
color: "var(--stage-fg)",
|
|
161
|
+
size: 11,
|
|
162
|
+
dy: -12
|
|
163
|
+
}),
|
|
164
|
+
reading && /* @__PURE__ */ jsx(Label, {
|
|
165
|
+
x: center.x,
|
|
166
|
+
y: y0,
|
|
167
|
+
text: reading,
|
|
168
|
+
color,
|
|
169
|
+
size: 11,
|
|
170
|
+
dy: 16
|
|
171
|
+
})
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
export { AngleArc, LabeledVector, ResistorBox, RightAngleMark };
|