Files
Learn_System/frontend/js/labs/_sim_deps.js
T
Maxim Dolgolyov fc1139f51d feat(lab-content-engine): phase 3 - ленивая загрузка кода симуляций
Старт /lab грузит только каркас (~530KB) вместо ~2.9MB + three.js(~600KB):
- _loader.js — LabLoader.ensure(id): грузит файлы симуляции по манифесту +
  three.js при необходимости; кеш по URL; САМОВОССТАНОВЛЕНИЕ (если open-функция
  не определена после загрузки — грузит все ленивые файлы -> корректность
  гарантирована независимо от точности манифеста)
- _sim_deps.js — сгенерированный манифест SIM_DEPS{id:{open,files,three}} +
  LAB_LAZY_FILES; three:true только для crystal/orbitals/stereo/periodic
- _register-all.js — open-обёртка: LabLoader.ensure(id).then(rawOpen)
- lab-init.js openSim — обработка Promise от open() (lucide после init)
- lab.html — убраны 45 ленивых <script> + three.js из eager; каркас: registry,
  loader, sim_deps, fx-движки, общие визуалы, graph.js (GRID для 15 сим)

Проверка: vm-harness (per-sim load, three only 3D, кеш, self-heal) ALL PASS;
инвариант owner-in-files для всех 40; нет утечки ленивых в eager; node --check OK.
В БРАУЗЕРЕ НЕ ПРОВЕРЕНО.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 15:02:29 +03:00

301 lines
6.2 KiB
JavaScript

'use strict';
/* Контент-движок, Фаза 3 — манифест зависимостей симуляций (СГЕНЕРИРОВАН).
id -> { open: имя глобальной _openX, files: [ленивые файлы], three: нужен ли three.js }.
Файлы загружаются лениво по клику (см. _loader.js). three.js — только для 3D-симуляций.
Самовосстановление в _loader: если после загрузки open-функция не определена,
грузятся ВСЕ ленивые файлы -> корректность не зависит от точности манифеста.
Регенерация: node tools/gen-sim-deps.js (см. CONTEXT). НЕ редактировать вручную. */
window.SIM_DEPS = {
"graph": {
"open": "_openGraph",
"files": [],
"three": false
},
"projectile": {
"open": "_openProjectile",
"files": [
"projectile.js"
],
"three": false
},
"collision": {
"open": "_openCollision",
"files": [
"collision.js"
],
"three": false
},
"triangle": {
"open": "_openTriangle",
"files": [
"triangle.js"
],
"three": false
},
"trigcircle": {
"open": "_openTrigCircle",
"files": [
"trigcircle.js"
],
"three": false
},
"emfield": {
"open": "_openEMField",
"files": [
"emfield.js",
"logic.js"
],
"three": false
},
"molphys": {
"open": "_openMolPhys",
"files": [
"brownian.js",
"diffusion.js",
"gas.js",
"states.js"
],
"three": false
},
"circuit": {
"open": "_openCircuit",
"files": [
"circuit.js"
],
"three": false
},
"chemistry": {
"open": "_openChemistry",
"files": [
"circuit.js",
"flask.js",
"ionexchange.js",
"reactions.js",
"redox.js"
],
"three": false
},
"dynamics": {
"open": "_openDynamics",
"files": [
"forcesandbox.js",
"newton.js"
],
"three": false
},
"crystal": {
"open": "_openCrystal",
"files": [
"crystal.js"
],
"three": true
},
"orbitals": {
"open": "_openOrbitals",
"files": [
"orbitals.js"
],
"three": true
},
"stereo": {
"open": "_openStereo",
"files": [
"stereo.js"
],
"three": true
},
"chemsandbox": {
"open": "_openChemSandbox",
"files": [
"chemsandbox.js",
"collision.js"
],
"three": false
},
"celldivision": {
"open": "_openCellDivision",
"files": [
"celldivision.js"
],
"three": false
},
"photosynthesis": {
"open": "_openPhotosynthesis",
"files": [
"photosynthesis.js"
],
"three": false
},
"angrybirds": {
"open": "_openAngryBirds",
"files": [
"angrybirds.js"
],
"three": false
},
"quadratic": {
"open": "_openQuadratic",
"files": [
"quadratic.js"
],
"three": false
},
"normaldist": {
"open": "_openNormalDist",
"files": [
"normaldist.js"
],
"three": false
},
"graphtransform": {
"open": "_openGraphTransform",
"files": [
"graphtransform.js"
],
"three": false
},
"pendulum": {
"open": "_openPendulum",
"files": [
"pendulum.js"
],
"three": false
},
"equilibrium": {
"open": "_openEquilibrium",
"files": [
"equilibrium.js"
],
"three": false
},
"opticsbench": {
"open": "_openOpticsBench",
"files": [
"opticsbench.js"
],
"three": false
},
"isoprocess": {
"open": "_openIsoprocess",
"files": [
"isoprocess.js"
],
"three": false
},
"titration": {
"open": "_openTitration",
"files": [
"titration.js"
],
"three": false
},
"probability": {
"open": "_openProbability",
"files": [
"probability.js"
],
"three": false
},
"bohratom": {
"open": "_openBohrAtom",
"files": [
"bohratom.js"
],
"three": false
},
"electrolysis": {
"open": "_openElectrolysis",
"files": [
"electrolysis.js"
],
"three": false
},
"race": {
"open": "_openRace",
"files": [
"race.js"
],
"three": false
},
"waves": {
"open": "_openWaves",
"files": [
"waves.js"
],
"three": false
},
"hydrostatics": {
"open": "_openHydro",
"files": [
"hydrostatics.js"
],
"three": false
},
"radioactive": {
"open": "_openRadioactive",
"files": [
"radioactive.js"
],
"three": false
},
"geometry": {
"open": "_openGeometry",
"files": [
"geometry.js",
"triangle.js"
],
"three": false
},
"logic": {
"open": "_openLogic",
"files": [
"logic.js"
],
"three": false
},
"heatengine": {
"open": "_openHeatEngine",
"files": [
"heatengine.js"
],
"three": false
},
"stoichiometry": {
"open": "_openStoich",
"files": [
"stoichiometry.js"
],
"three": false
},
"qualanalysis": {
"open": "_openQualAnalysis",
"files": [
"qualanalysis.js"
],
"three": false
},
"periodic": {
"open": "_openPeriodic",
"files": [
"_periodic_data.js",
"periodic.js"
],
"three": true
},
"organic": {
"open": "_openOrganic",
"files": [
"organic.js"
],
"three": false
},
"solutions": {
"open": "_openSolutions",
"files": [
"solutions.js"
],
"three": false
}
};
window.LAB_LAZY_FILES = ["angrybirds.js","bohratom.js","brownian.js","celldivision.js","chemsandbox.js","circuit.js","collision.js","crystal.js","diffusion.js","electrolysis.js","emfield.js","equilibrium.js","flask.js","forcesandbox.js","gas.js","geometry.js","graphtransform.js","heatengine.js","hydrostatics.js","ionexchange.js","isoprocess.js","logic.js","newton.js","normaldist.js","opticsbench.js","orbitals.js","organic.js","pendulum.js","periodic.js","photosynthesis.js","probability.js","projectile.js","quadratic.js","qualanalysis.js","race.js","radioactive.js","reactions.js","redox.js","solutions.js","states.js","stereo.js","stoichiometry.js","titration.js","triangle.js","trigcircle.js","waves.js","_periodic_data.js"];