From b0891051021513f6f5e266456f7329b0bed6286f Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 3 Jan 2022 17:14:54 -0600 Subject: [PATCH] Initial --- .gitignore | 1 + .prettierignore | 1 + .prettierrc.json5 | 7 + bundle.js | 112 +++++ bundle.js.map | 7 + index.html | 15 + package-lock.json | 940 ++++++++++++++++++++++++++++++++++++++ package.json | 17 + src/animation/creation.ts | 3 + src/animation/index.ts | 14 + src/constants.ts | 4 + src/index.ts | 41 ++ src/mobject/geometry.ts | 28 ++ src/mobject/index.ts | 17 + src/mobject/primitive.ts | 5 + src/renderer/index.ts | 46 ++ src/scene/index.ts | 22 + src/utils/tex.ts | 12 + tsconfig.json | 14 + 19 files changed, 1306 insertions(+) create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 .prettierrc.json5 create mode 100644 bundle.js create mode 100644 bundle.js.map create mode 100644 index.html create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/animation/creation.ts create mode 100644 src/animation/index.ts create mode 100644 src/constants.ts create mode 100644 src/index.ts create mode 100644 src/mobject/geometry.ts create mode 100644 src/mobject/index.ts create mode 100644 src/mobject/primitive.ts create mode 100644 src/renderer/index.ts create mode 100644 src/scene/index.ts create mode 100644 src/utils/tex.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0e804e3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +bundle.js diff --git a/.prettierrc.json5 b/.prettierrc.json5 new file mode 100644 index 0000000..85ca632 --- /dev/null +++ b/.prettierrc.json5 @@ -0,0 +1,7 @@ +{ + useTabs: false, + tabWidth: 2, + singleQuote: false, + trailingComma: "all", + printWidth: 100, +} diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..ecfced4 --- /dev/null +++ b/bundle.js @@ -0,0 +1,112 @@ +(() => { + // src/constants.ts + var PI = Math.PI; + var TAU = 2 * PI; + var DEFAULT_DOT_RADIUS = 0.08; + + // src/mobject/geometry.ts + var Arc = class { + constructor(radius, startAngle, angle) { + this.radius = radius; + this.startAngle = startAngle; + this.angle = angle; + } + }; + var Circle = class extends Arc { + constructor(radius) { + super(radius, 0, TAU); + } + }; + var Dot = class extends Circle { + constructor(radius) { + super(radius != null ? radius : DEFAULT_DOT_RADIUS); + } + }; + + // src/renderer/index.ts + var Canvas2DRenderer = class { + constructor(context) { + this.context = context; + this.skipAnimations = false; + this.animationStartTime = new Date(); + this.animationElapsedTime = 0; + } + init_scene(scene) { + } + render(scene) { + this.updateFrame(scene); + if (this.skipAnimations) + return; + for (let mobject of scene.mobjects) { + if (!mobject.shouldRender) + continue; + this.renderMobject(mobject); + } + } + renderMobject(mobject) { + } + updateFrame(scene) { + for (let mobject of scene.mobjects) { + if (!mobject.shouldRender) + continue; + this.renderMobject(mobject); + } + this.animationElapsedTime = +new Date() - +this.animationStartTime; + } + }; + + // src/scene/index.ts + var Scene = class { + constructor() { + this.animations = []; + this.mobjects = []; + } + construct() { + } + add(...mobjects) { + this.mobjects.push(...mobjects); + } + }; + + // src/utils/tex.ts + function texToSvg(expression) { + let el2 = MathJax.tex2svg(expression); + let child = el2.children[0]; + return child.innerHTML; + } + + // src/index.ts + function init(scene, el2) { + let canvasEl = document.createElement("canvas"); + canvasEl.width = 640; + canvasEl.height = 480; + let contextOrNull = canvasEl.getContext("2d"); + if (contextOrNull == null) + return; + let context = contextOrNull; + let renderer = new Canvas2DRenderer(context); + let lastTime; + let step = function(time) { + let timeDelta = time - (lastTime != null ? lastTime : 0); + renderer.render(scene); + requestAnimationFrame(step); + lastTime = time; + }; + requestAnimationFrame(step); + el2.appendChild(canvasEl); + } + var ExampleScene = class extends Scene { + construct() { + let dot = new Dot([-2, -1, 0]); + let dot2 = new Dot([2, 1, 0]); + let line = new Line(dot.getCenter(), dot2.getCenter()); + let b1 = new Brace(line); + this.add(line, dot, dot2); + } + }; + texToSvg("x + 1"); + var el = document.getElementById("manim"); + if (el) + init(new ExampleScene(), el); +})(); +//# sourceMappingURL=bundle.js.map diff --git a/bundle.js.map b/bundle.js.map new file mode 100644 index 0000000..bee6f8c --- /dev/null +++ b/bundle.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["src/constants.ts", "src/mobject/geometry.ts", "src/renderer/index.ts", "src/scene/index.ts", "src/utils/tex.ts", "src/index.ts"], + "sourcesContent": ["export const PI = Math.PI;\nexport const TAU = 2 * PI;\n\nexport const DEFAULT_DOT_RADIUS = 0.08;\n", "import { DEFAULT_DOT_RADIUS, TAU } from \"../constants\";\n\nexport class Arc {\n constructor(public radius: number, public startAngle: number, public angle: number) {}\n}\n\nexport class Circle extends Arc {\n constructor(radius: number) {\n super(radius, 0, TAU);\n }\n}\n\nexport class Dot extends Circle {\n constructor(radius?: number) {\n super(radius ?? DEFAULT_DOT_RADIUS);\n }\n}\n", "import { Mobject } from \"../mobject\";\nimport { Scene } from \"../scene\";\n\nexport class Canvas2DRenderer {\n context: CanvasRenderingContext2D;\n\n skipAnimations: boolean;\n animationStartTime: Date;\n animationElapsedTime: number;\n\n constructor(context: CanvasRenderingContext2D) {\n this.context = context;\n\n this.skipAnimations = false;\n this.animationStartTime = new Date();\n this.animationElapsedTime = 0;\n }\n\n init_scene(scene: Scene) {}\n\n public render(scene: Scene) {\n this.updateFrame(scene);\n if (this.skipAnimations) return;\n\n for (let mobject of scene.mobjects) {\n if (!mobject.shouldRender) continue;\n this.renderMobject(mobject);\n }\n }\n\n renderMobject(mobject: Mobject) {\n // for (let shaderWrapper of mobject.getShaderWrapperList()) {\n // let mesh = new Mesh();\n // }\n }\n\n updateFrame(scene: Scene) {\n for (let mobject of scene.mobjects) {\n if (!mobject.shouldRender) continue;\n this.renderMobject(mobject);\n }\n\n this.animationElapsedTime = +new Date() - +this.animationStartTime;\n }\n}\n", "import { Animation } from \"../animation\";\nimport { Mobject } from \"../mobject\";\n\nexport class Scene {\n animations: Animation[];\n mobjects: Mobject[];\n\n constructor() {\n this.animations = [];\n this.mobjects = [];\n }\n\n public construct() {}\n\n /**\n * Add Mobjects to this scene, from background to foreground in the order\n * they're added.\n */\n public add(...mobjects: Mobject[]) {\n this.mobjects.push(...mobjects);\n }\n}\n", "declare namespace MathJax {\n function tex2svg(expression: string): HTMLElement;\n};\n\n/**\n * Convert TeX expression to an SVG string.\n */\nexport function texToSvg(expression: string): string {\n let el = MathJax.tex2svg(expression);\n let child = el.children[0];\n return child.innerHTML;\n}\n", "import { Dot } from \"./mobject/geometry\";\nimport { Canvas2DRenderer } from \"./renderer\";\nimport { Scene } from \"./scene\";\nimport { texToSvg } from \"./utils/tex\";\n\nexport function init(scene: Scene, el: HTMLElement) {\n let canvasEl = document.createElement(\"canvas\");\n canvasEl.width = 640;\n canvasEl.height = 480;\n\n let contextOrNull = canvasEl.getContext(\"2d\");\n if (contextOrNull == null) return;\n let context = contextOrNull;\n\n let renderer = new Canvas2DRenderer(context);\n\n let lastTime: DOMHighResTimeStamp | null;\n let step = function (time: DOMHighResTimeStamp): void {\n let timeDelta = time - (lastTime ?? 0);\n renderer.render(scene);\n requestAnimationFrame(step);\n lastTime = time;\n };\n requestAnimationFrame(step);\n\n el.appendChild(canvasEl);\n}\n\nclass ExampleScene extends Scene {\n override construct() {\n let dot = new Dot([-2, -1, 0]);\n let dot2 = new Dot([2, 1, 0]);\n let line = new Line(dot.getCenter(), dot2.getCenter());\n let b1 = new Brace(line);\n this.add(line, dot, dot2);\n }\n}\n\ntexToSvg(\"x + 1\");\n\nlet el = document.getElementById(\"manim\");\nif (el) init(new ExampleScene(), el);\n"], + "mappings": ";;AAAO,MAAM,KAAK,KAAK;AAChB,MAAM,MAAM,IAAI;AAEhB,MAAM,qBAAqB;;;ACD3B,kBAAU;AAAA,IACf,YAAmB,QAAuB,YAA2B,OAAe;AAAjE;AAAuB;AAA2B;AAAA;AAAA;AAGhE,6BAAqB,IAAI;AAAA,IAC9B,YAAY,QAAgB;AAC1B,YAAM,QAAQ,GAAG;AAAA;AAAA;AAId,0BAAkB,OAAO;AAAA,IAC9B,YAAY,QAAiB;AAC3B,YAAM,0BAAU;AAAA;AAAA;;;ACXb,+BAAuB;AAAA,IAO5B,YAAY,SAAmC;AAC7C,WAAK,UAAU;AAEf,WAAK,iBAAiB;AACtB,WAAK,qBAAqB,IAAI;AAC9B,WAAK,uBAAuB;AAAA;AAAA,IAG9B,WAAW,OAAc;AAAA;AAAA,IAElB,OAAO,OAAc;AAC1B,WAAK,YAAY;AACjB,UAAI,KAAK;AAAgB;AAEzB,eAAS,WAAW,MAAM,UAAU;AAClC,YAAI,CAAC,QAAQ;AAAc;AAC3B,aAAK,cAAc;AAAA;AAAA;AAAA,IAIvB,cAAc,SAAkB;AAAA;AAAA,IAMhC,YAAY,OAAc;AACxB,eAAS,WAAW,MAAM,UAAU;AAClC,YAAI,CAAC,QAAQ;AAAc;AAC3B,aAAK,cAAc;AAAA;AAGrB,WAAK,uBAAuB,CAAC,IAAI,SAAS,CAAC,KAAK;AAAA;AAAA;;;ACvC7C,oBAAY;AAAA,IAIjB,cAAc;AACZ,WAAK,aAAa;AAClB,WAAK,WAAW;AAAA;AAAA,IAGX,YAAY;AAAA;AAAA,IAMZ,OAAO,UAAqB;AACjC,WAAK,SAAS,KAAK,GAAG;AAAA;AAAA;;;ACZnB,oBAAkB,YAA4B;AACnD,QAAI,MAAkB,QAAQ,QAAQ;AACtC,QAAI,QAAoB,IAAG,SAAS;AACpC,WAAO,MAAM;AAAA;;;ACLR,gBAAc,OAAc,KAAiB;AAClD,QAAI,WAAW,SAAS,cAAc;AACtC,aAAS,QAAQ;AACjB,aAAS,SAAS;AAElB,QAAI,gBAAgB,SAAS,WAAW;AACxC,QAAI,iBAAiB;AAAM;AAC3B,QAAI,UAAU;AAEd,QAAI,WAAW,IAAI,iBAAiB;AAEpC,QAAI;AACJ,QAAI,OAAO,SAAU,MAAiC;AACpD,UAAI,YAAY,OAAQ,+BAAY;AACpC,eAAS,OAAO;AAChB,4BAAsB;AACtB,iBAAW;AAAA;AAEb,0BAAsB;AAEtB,QAAG,YAAY;AAAA;AAGjB,mCAA2B,MAAM;AAAA,IACtB,YAAY;AACnB,UAAI,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI;AAC3B,UAAI,OAAO,IAAI,IAAI,CAAC,GAAG,GAAG;AAC1B,UAAI,OAAO,IAAI,KAAK,IAAI,aAAa,KAAK;AAC1C,UAAI,KAAK,IAAI,MAAM;AACnB,WAAK,IAAI,MAAM,KAAK;AAAA;AAAA;AAIxB,WAAS;AAET,MAAI,KAAK,SAAS,eAAe;AACjC,MAAI;AAAI,SAAK,IAAI,gBAAgB;", + "names": [] +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..af6d0c3 --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + + +
+ + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f18638b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,940 @@ +{ + "name": "manim", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "mathjax-full": "^3.2.0", + "rollup": "^2.62.0" + }, + "devDependencies": { + "@rollup/plugin-node-resolve": "^13.1.2", + "@rollup/plugin-typescript": "^8.3.0", + "esbuild": "^0.14.10", + "prettier": "^2.5.1", + "typescript": "^4.5.4" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.2.tgz", + "integrity": "sha512-xyqbuf1vyOPC60jEKhx3DBHunymnCJswzjNTKfX4Jz7zCPar1UqbRZCNY1u5QaXh97beaFTWdoUUWiV4qX8o/g==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^2.42.0" + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz", + "integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0", + "tslib": "*", + "typescript": ">=3.7.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "node_modules/@types/node": { + "version": "17.0.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.6.tgz", + "integrity": "sha512-+XBAjfZmmivILUzO0HwBJoYkAyyySSLg5KCGBDFLomJo0sV6szvVLAf4ANZZ0pfWzgEds5KmGLG9D5hfEqOhaA==", + "dev": true + }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/esbuild": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.10.tgz", + "integrity": "sha512-ibZb+NwFqBwHHJlpnFMtg4aNmVK+LUtYMFC9CuKs6lDCBEvCHpqCFZFEirpqt1jOugwKGx8gALNGvX56lQyfew==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "esbuild-android-arm64": "0.14.10", + "esbuild-darwin-64": "0.14.10", + "esbuild-darwin-arm64": "0.14.10", + "esbuild-freebsd-64": "0.14.10", + "esbuild-freebsd-arm64": "0.14.10", + "esbuild-linux-32": "0.14.10", + "esbuild-linux-64": "0.14.10", + "esbuild-linux-arm": "0.14.10", + "esbuild-linux-arm64": "0.14.10", + "esbuild-linux-mips64le": "0.14.10", + "esbuild-linux-ppc64le": "0.14.10", + "esbuild-linux-s390x": "0.14.10", + "esbuild-netbsd-64": "0.14.10", + "esbuild-openbsd-64": "0.14.10", + "esbuild-sunos-64": "0.14.10", + "esbuild-windows-32": "0.14.10", + "esbuild-windows-64": "0.14.10", + "esbuild-windows-arm64": "0.14.10" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.10.tgz", + "integrity": "sha512-vzkTafHKoiMX4uIN1kBnE/HXYLpNT95EgGanVk6DHGeYgDolU0NBxjO7yZpq4ZGFPOx8384eAdDrBYhO11TAlQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.10.tgz", + "integrity": "sha512-DJwzFVB95ZV7C3PQbf052WqaUuuMFXJeZJ0LKdnP1w+QOU0rlbKfX0tzuhoS//rOXUj1TFIwRuRsd0FX6skR7A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.10.tgz", + "integrity": "sha512-RNaaoZDg3nsqs5z56vYCjk/VJ76npf752W0rOaCl5lO5TsgV9zecfdYgt7dtUrIx8b7APhVaNYud+tGsDOVC9g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.10.tgz", + "integrity": "sha512-10B3AzW894u6bGZZhWiJOHw1uEHb4AFbUuBdyml1Ht0vIqd+KqWW+iY/yMwQAzILr2WJZqEhbOXRkJtY8aRqOw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.10.tgz", + "integrity": "sha512-mSQrKB7UaWvuryBTCo9leOfY2uEUSimAvcKIaUWbk5Hth9Sg+Try+qNA/NibPgs/vHkX0KFo/Rce6RPea+P15g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.10.tgz", + "integrity": "sha512-lktF09JgJLZ63ANYHIPdYe339PDuVn19Q/FcGKkXWf+jSPkn5xkYzAabboNGZNUgNqSJ/vY7VrOn6UrBbJjgYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.10.tgz", + "integrity": "sha512-K+gCQz2oLIIBI8ZM77e9sYD5/DwEpeYCrOQ2SYXx+R4OU2CT9QjJDi4/OpE7ko4AcYMlMW7qrOCuLSgAlEj4Wg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.10.tgz", + "integrity": "sha512-BYa60dZ/KPmNKYxtHa3LSEdfKWHcm/RzP0MjB4AeBPhjS0D6/okhaBesZIY9kVIGDyeenKsJNOmnVt4+dhNnvQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.10.tgz", + "integrity": "sha512-+qocQuQvcp5wo/V+OLXxqHPc+gxHttJEvbU/xrCGE03vIMqraL4wMua8JQx0SWEnJCWP+Nhf//v8OSwz1Xr5kA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.10.tgz", + "integrity": "sha512-nmUd2xoBXpGo4NJCEWoaBj+n4EtDoLEvEYc8Z3aSJrY0Oa6s04czD1flmhd0I/d6QEU8b7GQ9U0g/rtBfhtxBg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.10.tgz", + "integrity": "sha512-vsOWZjm0rZix7HSmqwPph9arRVCyPtUpcURdayQDuIhMG2/UxJxpbdRaa//w4zYqcJzAWwuyH2PAlyy0ZNuxqQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.10.tgz", + "integrity": "sha512-knArKKZm0ypIYWOWyOT7+accVwbVV1LZnl2FWWy05u9Tyv5oqJ2F5+X2Vqe/gqd61enJXQWqoufXopvG3zULOg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.10.tgz", + "integrity": "sha512-6Gg8neVcLeyq0yt9bZpReb8ntZ8LBEjthxrcYWVrBElcltnDjIy1hrzsujt0+sC2rL+TlSsE9dzgyuvlDdPp2w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ] + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.10.tgz", + "integrity": "sha512-9rkHZzp10zI90CfKbFrwmQjqZaeDmyQ6s9/hvCwRkbOCHuto6RvMYH9ghQpcr5cUxD5OQIA+sHXi0zokRNXjcg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.10.tgz", + "integrity": "sha512-mEU+pqkhkhbwpJj5DiN3vL0GUFR/yrL3qj8ER1amIVyRibKbj02VM1QaIuk1sy5DRVIKiFXXgCaHvH3RNWCHIw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ] + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.10.tgz", + "integrity": "sha512-Z5DieUL1N6s78dOSdL95KWf8Y89RtPGxIoMF+LEy8ChDsX+pZpz6uAVCn+YaWpqQXO+2TnrcbgBIoprq2Mco1g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.10.tgz", + "integrity": "sha512-LE5Mm62y0Bilu7RDryBhHIX8rK3at5VwJ6IGM3BsASidCfOBTzqcs7Yy0/Vkq39VKeTmy9/66BAfVoZRNznoDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.10.tgz", + "integrity": "sha512-OJOyxDtabvcUYTc+O4dR0JMzLBz6G9+gXIHA7Oc5d5Fv1xiYa0nUeo8+W5s2e6ZkPRdIwOseYoL70rZz80S5BA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "node_modules/mathjax-full": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mathjax-full/-/mathjax-full-3.2.0.tgz", + "integrity": "sha512-D2EBNvUG+mJyhn+M1C858k0f2Fc4KxXvbEX2WCMXroV10212JwfYqaBJ336ECBSz5X9L5LRoamxb7AJtg3KaJA==", + "dependencies": { + "esm": "^3.2.25", + "mhchemparser": "^4.1.0", + "mj-context-menu": "^0.6.1", + "speech-rule-engine": "^3.3.3" + } + }, + "node_modules/mhchemparser": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/mhchemparser/-/mhchemparser-4.1.1.tgz", + "integrity": "sha512-R75CUN6O6e1t8bgailrF1qPq+HhVeFTM3XQ0uzI+mXTybmphy3b6h4NbLOYhemViQ3lUs+6CKRkC3Ws1TlYREA==" + }, + "node_modules/mj-context-menu": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz", + "integrity": "sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==" + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.62.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.62.0.tgz", + "integrity": "sha512-cJEQq2gwB0GWMD3rYImefQTSjrPYaC6s4J9pYqnstVLJ1CHa/aZNVkD4Epuvg4iLeMA4KRiq7UM7awKK6j7jcw==", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/speech-rule-engine": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-3.3.3.tgz", + "integrity": "sha512-0exWw+0XauLjat+f/aFeo5T8SiDsO1JtwpY3qgJE4cWt+yL/Stl0WP4VNDWdh7lzGkubUD9lWP4J1ASnORXfyQ==", + "dependencies": { + "commander": ">=7.0.0", + "wicked-good-xpath": "^1.3.0", + "xmldom-sre": "^0.1.31" + }, + "bin": { + "sre": "bin/sre" + } + }, + "node_modules/tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", + "dev": true, + "peer": true + }, + "node_modules/typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/wicked-good-xpath": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/wicked-good-xpath/-/wicked-good-xpath-1.3.0.tgz", + "integrity": "sha1-gbDpXoZQ5JyUsiKY//hoa1VTz2w=" + }, + "node_modules/xmldom-sre": { + "version": "0.1.31", + "resolved": "https://registry.npmjs.org/xmldom-sre/-/xmldom-sre-0.1.31.tgz", + "integrity": "sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==", + "engines": { + "node": ">=0.1" + } + } + }, + "dependencies": { + "@rollup/plugin-node-resolve": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.2.tgz", + "integrity": "sha512-xyqbuf1vyOPC60jEKhx3DBHunymnCJswzjNTKfX4Jz7zCPar1UqbRZCNY1u5QaXh97beaFTWdoUUWiV4qX8o/g==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, + "@rollup/plugin-typescript": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz", + "integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "resolve": "^1.17.0" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/node": { + "version": "17.0.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.6.tgz", + "integrity": "sha512-+XBAjfZmmivILUzO0HwBJoYkAyyySSLg5KCGBDFLomJo0sV6szvVLAf4ANZZ0pfWzgEds5KmGLG9D5hfEqOhaA==", + "dev": true + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, + "esbuild": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.10.tgz", + "integrity": "sha512-ibZb+NwFqBwHHJlpnFMtg4aNmVK+LUtYMFC9CuKs6lDCBEvCHpqCFZFEirpqt1jOugwKGx8gALNGvX56lQyfew==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.14.10", + "esbuild-darwin-64": "0.14.10", + "esbuild-darwin-arm64": "0.14.10", + "esbuild-freebsd-64": "0.14.10", + "esbuild-freebsd-arm64": "0.14.10", + "esbuild-linux-32": "0.14.10", + "esbuild-linux-64": "0.14.10", + "esbuild-linux-arm": "0.14.10", + "esbuild-linux-arm64": "0.14.10", + "esbuild-linux-mips64le": "0.14.10", + "esbuild-linux-ppc64le": "0.14.10", + "esbuild-linux-s390x": "0.14.10", + "esbuild-netbsd-64": "0.14.10", + "esbuild-openbsd-64": "0.14.10", + "esbuild-sunos-64": "0.14.10", + "esbuild-windows-32": "0.14.10", + "esbuild-windows-64": "0.14.10", + "esbuild-windows-arm64": "0.14.10" + } + }, + "esbuild-android-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.10.tgz", + "integrity": "sha512-vzkTafHKoiMX4uIN1kBnE/HXYLpNT95EgGanVk6DHGeYgDolU0NBxjO7yZpq4ZGFPOx8384eAdDrBYhO11TAlQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.10.tgz", + "integrity": "sha512-DJwzFVB95ZV7C3PQbf052WqaUuuMFXJeZJ0LKdnP1w+QOU0rlbKfX0tzuhoS//rOXUj1TFIwRuRsd0FX6skR7A==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.10.tgz", + "integrity": "sha512-RNaaoZDg3nsqs5z56vYCjk/VJ76npf752W0rOaCl5lO5TsgV9zecfdYgt7dtUrIx8b7APhVaNYud+tGsDOVC9g==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.10.tgz", + "integrity": "sha512-10B3AzW894u6bGZZhWiJOHw1uEHb4AFbUuBdyml1Ht0vIqd+KqWW+iY/yMwQAzILr2WJZqEhbOXRkJtY8aRqOw==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.10.tgz", + "integrity": "sha512-mSQrKB7UaWvuryBTCo9leOfY2uEUSimAvcKIaUWbk5Hth9Sg+Try+qNA/NibPgs/vHkX0KFo/Rce6RPea+P15g==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.10.tgz", + "integrity": "sha512-lktF09JgJLZ63ANYHIPdYe339PDuVn19Q/FcGKkXWf+jSPkn5xkYzAabboNGZNUgNqSJ/vY7VrOn6UrBbJjgYA==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.10.tgz", + "integrity": "sha512-K+gCQz2oLIIBI8ZM77e9sYD5/DwEpeYCrOQ2SYXx+R4OU2CT9QjJDi4/OpE7ko4AcYMlMW7qrOCuLSgAlEj4Wg==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.10.tgz", + "integrity": "sha512-BYa60dZ/KPmNKYxtHa3LSEdfKWHcm/RzP0MjB4AeBPhjS0D6/okhaBesZIY9kVIGDyeenKsJNOmnVt4+dhNnvQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.10.tgz", + "integrity": "sha512-+qocQuQvcp5wo/V+OLXxqHPc+gxHttJEvbU/xrCGE03vIMqraL4wMua8JQx0SWEnJCWP+Nhf//v8OSwz1Xr5kA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.10.tgz", + "integrity": "sha512-nmUd2xoBXpGo4NJCEWoaBj+n4EtDoLEvEYc8Z3aSJrY0Oa6s04czD1flmhd0I/d6QEU8b7GQ9U0g/rtBfhtxBg==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.10.tgz", + "integrity": "sha512-vsOWZjm0rZix7HSmqwPph9arRVCyPtUpcURdayQDuIhMG2/UxJxpbdRaa//w4zYqcJzAWwuyH2PAlyy0ZNuxqQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.10.tgz", + "integrity": "sha512-knArKKZm0ypIYWOWyOT7+accVwbVV1LZnl2FWWy05u9Tyv5oqJ2F5+X2Vqe/gqd61enJXQWqoufXopvG3zULOg==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.10.tgz", + "integrity": "sha512-6Gg8neVcLeyq0yt9bZpReb8ntZ8LBEjthxrcYWVrBElcltnDjIy1hrzsujt0+sC2rL+TlSsE9dzgyuvlDdPp2w==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.10.tgz", + "integrity": "sha512-9rkHZzp10zI90CfKbFrwmQjqZaeDmyQ6s9/hvCwRkbOCHuto6RvMYH9ghQpcr5cUxD5OQIA+sHXi0zokRNXjcg==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.10.tgz", + "integrity": "sha512-mEU+pqkhkhbwpJj5DiN3vL0GUFR/yrL3qj8ER1amIVyRibKbj02VM1QaIuk1sy5DRVIKiFXXgCaHvH3RNWCHIw==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.10.tgz", + "integrity": "sha512-Z5DieUL1N6s78dOSdL95KWf8Y89RtPGxIoMF+LEy8ChDsX+pZpz6uAVCn+YaWpqQXO+2TnrcbgBIoprq2Mco1g==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.10.tgz", + "integrity": "sha512-LE5Mm62y0Bilu7RDryBhHIX8rK3at5VwJ6IGM3BsASidCfOBTzqcs7Yy0/Vkq39VKeTmy9/66BAfVoZRNznoDw==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.10.tgz", + "integrity": "sha512-OJOyxDtabvcUYTc+O4dR0JMzLBz6G9+gXIHA7Oc5d5Fv1xiYa0nUeo8+W5s2e6ZkPRdIwOseYoL70rZz80S5BA==", + "dev": true, + "optional": true + }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "mathjax-full": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mathjax-full/-/mathjax-full-3.2.0.tgz", + "integrity": "sha512-D2EBNvUG+mJyhn+M1C858k0f2Fc4KxXvbEX2WCMXroV10212JwfYqaBJ336ECBSz5X9L5LRoamxb7AJtg3KaJA==", + "requires": { + "esm": "^3.2.25", + "mhchemparser": "^4.1.0", + "mj-context-menu": "^0.6.1", + "speech-rule-engine": "^3.3.3" + } + }, + "mhchemparser": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/mhchemparser/-/mhchemparser-4.1.1.tgz", + "integrity": "sha512-R75CUN6O6e1t8bgailrF1qPq+HhVeFTM3XQ0uzI+mXTybmphy3b6h4NbLOYhemViQ3lUs+6CKRkC3Ws1TlYREA==" + }, + "mj-context-menu": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz", + "integrity": "sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true + }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.62.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.62.0.tgz", + "integrity": "sha512-cJEQq2gwB0GWMD3rYImefQTSjrPYaC6s4J9pYqnstVLJ1CHa/aZNVkD4Epuvg4iLeMA4KRiq7UM7awKK6j7jcw==", + "requires": { + "fsevents": "~2.3.2" + } + }, + "speech-rule-engine": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-3.3.3.tgz", + "integrity": "sha512-0exWw+0XauLjat+f/aFeo5T8SiDsO1JtwpY3qgJE4cWt+yL/Stl0WP4VNDWdh7lzGkubUD9lWP4J1ASnORXfyQ==", + "requires": { + "commander": ">=7.0.0", + "wicked-good-xpath": "^1.3.0", + "xmldom-sre": "^0.1.31" + } + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", + "dev": true, + "peer": true + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, + "wicked-good-xpath": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/wicked-good-xpath/-/wicked-good-xpath-1.3.0.tgz", + "integrity": "sha1-gbDpXoZQ5JyUsiKY//hoa1VTz2w=" + }, + "xmldom-sre": { + "version": "0.1.31", + "resolved": "https://registry.npmjs.org/xmldom-sre/-/xmldom-sre-0.1.31.tgz", + "integrity": "sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..e140229 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "scripts": { + "build": "esbuild src/index.ts --bundle --external:mathjax-full --sourcemap --outfile=bundle.js", + "pretty": "prettier --write --list-different ." + }, + "dependencies": { + "mathjax-full": "^3.2.0", + "rollup": "^2.62.0" + }, + "devDependencies": { + "@rollup/plugin-node-resolve": "^13.1.2", + "@rollup/plugin-typescript": "^8.3.0", + "esbuild": "^0.14.10", + "prettier": "^2.5.1", + "typescript": "^4.5.4" + } +} diff --git a/src/animation/creation.ts b/src/animation/creation.ts new file mode 100644 index 0000000..a59804e --- /dev/null +++ b/src/animation/creation.ts @@ -0,0 +1,3 @@ +import { Animation } from "."; + +export class DrawBorderThenFill extends Animation {} diff --git a/src/animation/index.ts b/src/animation/index.ts new file mode 100644 index 0000000..153ea8e --- /dev/null +++ b/src/animation/index.ts @@ -0,0 +1,14 @@ +import { Mobject } from "../mobject"; + +export const DEFAULT_ANIMATION_RUN_TIME = 1.0; +export const DEFAULT_ANIMATION_LAG_RATIO = 0.0; + +export class Animation { + mobject: Mobject | null; + runTime: number; + + constructor(runTime: number = DEFAULT_ANIMATION_RUN_TIME) { + this.mobject = null; + this.runTime = runTime; + } +} diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..e8d1703 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,4 @@ +export const PI = Math.PI; +export const TAU = 2 * PI; + +export const DEFAULT_DOT_RADIUS = 0.08; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..2f46855 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,41 @@ +import { Dot } from "./mobject/geometry"; +import { Point } from "./point"; +import { Canvas2DRenderer } from "./renderer"; +import { Scene } from "./scene"; +import { texToSvg } from "./utils/tex"; + +export function init(scene: Scene, el: HTMLElement) { + let canvasEl = document.createElement("canvas"); + canvasEl.width = 640; + canvasEl.height = 480; + + let contextOrNull = canvasEl.getContext("2d"); + if (contextOrNull == null) return; + let context = contextOrNull; + + let renderer = new Canvas2DRenderer(context); + + let lastTime: DOMHighResTimeStamp | null; + let step = function (time: DOMHighResTimeStamp): void { + let timeDelta = time - (lastTime ?? 0); + renderer.render(scene); + requestAnimationFrame(step); + lastTime = time; + }; + requestAnimationFrame(step); + + el.appendChild(canvasEl); +} + +class ExampleScene extends Scene { + override construct() { + let dot = new Dot(new Point(-2, -1)); + let dot2 = new Dot(new Point(2, 1)); + let line = new Line(dot.getCenter(), dot2.getCenter()); + let b1 = new Brace(line); + this.add(line, dot, dot2); + } +} + +let el = document.getElementById("manim"); +if (el) init(new ExampleScene(), el); diff --git a/src/mobject/geometry.ts b/src/mobject/geometry.ts new file mode 100644 index 0000000..03224fa --- /dev/null +++ b/src/mobject/geometry.ts @@ -0,0 +1,28 @@ +import { DEFAULT_DOT_RADIUS, TAU } from "../constants"; +import { Point } from "./primitive"; + +export class Arc { + constructor( + public center: Point, + public radius: number, + public startAngle: number, + public angle: number, + ) {} +} + +export class Circle extends Arc { + constructor(center: Point, radius: number) { + super(center, radius, 0, TAU); + } +} + +export class Dot extends Circle { + constructor(point: Point, radius?: number) { + super(point, radius ?? DEFAULT_DOT_RADIUS); + } +} + +export class Line { + constructor(a: Point, b: Point) { + } +} diff --git a/src/mobject/index.ts b/src/mobject/index.ts new file mode 100644 index 0000000..2d52f0a --- /dev/null +++ b/src/mobject/index.ts @@ -0,0 +1,17 @@ +import {Point} from "../point"; + +export class Path { + constructor(public points: Point[]) {} +} + +export class Mobject { + submobjects: Mobject[]; + shouldRender: boolean; + paths: Path[]; + + constructor(paths: Path[] = []) { + this.submobjects = []; + this.shouldRender = true; + this.paths = paths; + } +} diff --git a/src/mobject/primitive.ts b/src/mobject/primitive.ts new file mode 100644 index 0000000..709c021 --- /dev/null +++ b/src/mobject/primitive.ts @@ -0,0 +1,5 @@ +export abstract class Primitive {} + +export class Point extends Primitive { + constructor(public x: number, public y: number) { super(); } +} diff --git a/src/renderer/index.ts b/src/renderer/index.ts new file mode 100644 index 0000000..11c5d8f --- /dev/null +++ b/src/renderer/index.ts @@ -0,0 +1,46 @@ +import { Mobject } from "../mobject"; +import { Scene } from "../scene"; + +export class Canvas2DRenderer { + context: CanvasRenderingContext2D; + + skipAnimations: boolean; + animationStartTime: Date; + animationElapsedTime: number; + + constructor(context: CanvasRenderingContext2D) { + this.context = context; + + this.skipAnimations = false; + this.animationStartTime = new Date(); + this.animationElapsedTime = 0; + } + + init_scene(scene: Scene) {} + + public render(scene: Scene) { + this.updateFrame(scene); + if (this.skipAnimations) return; + + for (let mobject of scene.mobjects) { + if (!mobject.shouldRender) continue; + this.renderMobject(mobject); + } + } + + renderMobject(mobject: Mobject) { + for (let path of mobject.paths) { + this.context.beginPath(); + let first = true; + for (let point of path.points) { + if (first) this.context.moveTo(point.x, point.y); + else this.context.lineTo(point.x, point.y); + } + this.context.stroke(); + } + } + + updateFrame(scene: Scene) { + this.animationElapsedTime = +new Date() - +this.animationStartTime; + } +} diff --git a/src/scene/index.ts b/src/scene/index.ts new file mode 100644 index 0000000..cb65a0c --- /dev/null +++ b/src/scene/index.ts @@ -0,0 +1,22 @@ +import { Animation } from "../animation"; +import { Mobject } from "../mobject"; + +export abstract class Scene { + animations: Animation[]; + mobjects: Mobject[]; + + constructor() { + this.animations = []; + this.mobjects = []; + } + + public abstract construct(): void; + + /** + * Add Mobjects to this scene, from background to foreground in the order + * they're added. + */ + public add(...mobjects: Mobject[]) { + this.mobjects.push(...mobjects); + } +} diff --git a/src/utils/tex.ts b/src/utils/tex.ts new file mode 100644 index 0000000..e0a64a0 --- /dev/null +++ b/src/utils/tex.ts @@ -0,0 +1,12 @@ +declare namespace MathJax { + function tex2svg(expression: string): HTMLElement; +} + +/** + * Convert TeX expression to an SVG string. + */ +export function texToSvg(expression: string): string { + let el = MathJax.tex2svg(expression); + let child = el.children[0]; + return child.innerHTML; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..23a548f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es2018", + "module": "esnext", + "moduleResolution": "node", + "noEmitOnError": true, + "lib": ["es2017", "dom"], + "strict": true, + "esModuleInterop": false, + "outDir": "out-tsc", + "rootDir": "./" + }, + "include": ["./src/**/*.ts"] +}