├── makefile ├── .gitignore ├── declarative ├── .gitignore ├── blogcache.txt ├── makefile ├── mono.css ├── anim.hs ├── minanim.js ├── ANIMGENERATED.js └── anim.cpp ├── observablehq-stdlib ├── .eslintignore ├── .prettierrc ├── 1-COMMIT ├── src │ ├── that.js │ ├── dom │ │ ├── text.js │ │ ├── input.js │ │ ├── canvas.js │ │ ├── svg.js │ │ ├── select.js │ │ ├── uid.js │ │ ├── range.js │ │ ├── context2d.js │ │ ├── index.js │ │ ├── download.js │ │ └── element.js │ ├── constant.js │ ├── now.js │ ├── index.js │ ├── promises │ │ ├── tick.js │ │ ├── delay.js │ │ ├── index.js │ │ └── when.js │ ├── require.js │ ├── generators │ │ ├── map.js │ │ ├── filter.js │ │ ├── valueAt.js │ │ ├── range.js │ │ ├── worker.js │ │ ├── disposable.js │ │ ├── index.js │ │ ├── queue.js │ │ ├── observe.js │ │ └── input.js │ ├── files │ │ ├── index.js │ │ ├── text.js │ │ ├── url.js │ │ └── buffer.js │ ├── html.js │ ├── svg.js │ ├── resolve.js │ ├── mutable.js │ ├── width.js │ ├── tex.js │ ├── fileAttachment.js │ ├── md.js │ ├── library.js │ └── template.js ├── .gitignore ├── test │ ├── fileAttachments-test.js │ ├── DOM │ │ └── uid-test.js │ ├── index-test.js │ ├── generators │ │ ├── disposable-test.js │ │ └── generators-test.js │ └── promises │ │ └── delay-test.js ├── .eslintrc.json ├── stdlib.sublime-project ├── .github │ └── workflows │ │ └── nodejs.yml ├── rollup.config.js ├── LICENSE └── package.json ├── static ├── Symbola.ttf ├── Exo2-Bold.ttf ├── Exo2-Medium.ttf ├── Exo2-Regular.ttf ├── FiraMono-Bold.ttf ├── Bellefair-Regular.ttf ├── FiraMono-Medium.ttf ├── FiraMono-Regular.ttf ├── FiraSans-Regular.ttf ├── NotoSerif-Regular.ttf ├── SourceSerifPro-Bold.ttf ├── UbuntuMono-Regular.ttf ├── iosevka-etoile-thin.ttf ├── SourceSerifPro-Regular.ttf ├── iosevka-etoile-regular.ttf ├── iosevka-fixed-extended.ttf ├── SourceSerifPro-SemiBold.ttf └── iosevka-fixed-extendedmedium.ttf ├── mathemagic.sublime-project ├── jacobian ├── transform-terms.png ├── et-book │ ├── et-book-bold-line-figures │ │ ├── et-book-bold-line-figures.eot │ │ ├── et-book-bold-line-figures.ttf │ │ └── et-book-bold-line-figures.woff │ ├── et-book-roman-line-figures │ │ ├── et-book-roman-line-figures.eot │ │ ├── et-book-roman-line-figures.ttf │ │ └── et-book-roman-line-figures.woff │ ├── et-book-roman-old-style-figures │ │ ├── et-book-roman-old-style-figures.eot │ │ ├── et-book-roman-old-style-figures.ttf │ │ └── et-book-roman-old-style-figures.woff │ ├── et-book-semi-bold-old-style-figures │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ └── et-book-semi-bold-old-style-figures.woff │ └── et-book-display-italic-old-style-figures │ │ ├── et-book-display-italic-old-style-figures.eot │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ └── et-book-display-italic-old-style-figures.woff ├── tufte.css ├── index.html └── sketch.js ├── whalesong ├── whalesong-picture.jpg ├── makefile ├── index.md └── index.html ├── ddg-laplace-operator ├── fonts │ ├── KaTeX_AMS-Regular.ttf │ ├── KaTeX_Main-Bold.ttf │ ├── KaTeX_Main-Bold.woff │ ├── KaTeX_Main-Bold.woff2 │ ├── KaTeX_Main-Italic.ttf │ ├── KaTeX_Math-Italic.ttf │ ├── KaTeX_AMS-Regular.woff │ ├── KaTeX_AMS-Regular.woff2 │ ├── KaTeX_Fraktur-Bold.ttf │ ├── KaTeX_Fraktur-Bold.woff │ ├── KaTeX_Main-Italic.woff │ ├── KaTeX_Main-Italic.woff2 │ ├── KaTeX_Main-Regular.ttf │ ├── KaTeX_Main-Regular.woff │ ├── KaTeX_Math-Italic.woff │ ├── KaTeX_Math-Italic.woff2 │ ├── KaTeX_Size1-Regular.ttf │ ├── KaTeX_Size2-Regular.ttf │ ├── KaTeX_Size3-Regular.ttf │ ├── KaTeX_Size4-Regular.ttf │ ├── KaTeX_Caligraphic-Bold.ttf │ ├── KaTeX_Fraktur-Bold.woff2 │ ├── KaTeX_Fraktur-Regular.ttf │ ├── KaTeX_Fraktur-Regular.woff │ ├── KaTeX_Main-BoldItalic.ttf │ ├── KaTeX_Main-BoldItalic.woff │ ├── KaTeX_Main-Regular.woff2 │ ├── KaTeX_Math-BoldItalic.ttf │ ├── KaTeX_Math-BoldItalic.woff │ ├── KaTeX_SansSerif-Bold.ttf │ ├── KaTeX_SansSerif-Bold.woff │ ├── KaTeX_SansSerif-Bold.woff2 │ ├── KaTeX_SansSerif-Italic.ttf │ ├── KaTeX_Script-Regular.ttf │ ├── KaTeX_Script-Regular.woff │ ├── KaTeX_Script-Regular.woff2 │ ├── KaTeX_Size1-Regular.woff │ ├── KaTeX_Size1-Regular.woff2 │ ├── KaTeX_Size2-Regular.woff │ ├── KaTeX_Size2-Regular.woff2 │ ├── KaTeX_Size3-Regular.woff │ ├── KaTeX_Size3-Regular.woff2 │ ├── KaTeX_Size4-Regular.woff │ ├── KaTeX_Size4-Regular.woff2 │ ├── KaTeX_Caligraphic-Bold.woff │ ├── KaTeX_Caligraphic-Bold.woff2 │ ├── KaTeX_Fraktur-Regular.woff2 │ ├── KaTeX_Main-BoldItalic.woff2 │ ├── KaTeX_Math-BoldItalic.woff2 │ ├── KaTeX_SansSerif-Italic.woff │ ├── KaTeX_SansSerif-Italic.woff2 │ ├── KaTeX_SansSerif-Regular.ttf │ ├── KaTeX_SansSerif-Regular.woff │ ├── KaTeX_Typewriter-Regular.ttf │ ├── KaTeX_Caligraphic-Regular.ttf │ ├── KaTeX_Caligraphic-Regular.woff │ ├── KaTeX_Caligraphic-Regular.woff2 │ ├── KaTeX_SansSerif-Regular.woff2 │ ├── KaTeX_Typewriter-Regular.woff │ └── KaTeX_Typewriter-Regular.woff2 ├── auto-render.min.js └── index.html ├── README.md ├── three.html ├── index.html └── observablehq.html /makefile: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-workspace 2 | -------------------------------------------------------------------------------- /declarative/.gitignore: -------------------------------------------------------------------------------- 1 | anim.out 2 | -------------------------------------------------------------------------------- /observablehq-stdlib/.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /observablehq-stdlib/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSpacing": false 3 | } 4 | -------------------------------------------------------------------------------- /observablehq-stdlib/1-COMMIT: -------------------------------------------------------------------------------- 1 | e9e9a6f322002fdc55a145342e393a52f6811f54 2 | -------------------------------------------------------------------------------- /static/Symbola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/Symbola.ttf -------------------------------------------------------------------------------- /observablehq-stdlib/src/that.js: -------------------------------------------------------------------------------- 1 | export default function that() { 2 | return this; 3 | } 4 | -------------------------------------------------------------------------------- /static/Exo2-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/Exo2-Bold.ttf -------------------------------------------------------------------------------- /static/Exo2-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/Exo2-Medium.ttf -------------------------------------------------------------------------------- /static/Exo2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/Exo2-Regular.ttf -------------------------------------------------------------------------------- /declarative/blogcache.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/declarative/blogcache.txt -------------------------------------------------------------------------------- /mathemagic.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /static/FiraMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/FiraMono-Bold.ttf -------------------------------------------------------------------------------- /jacobian/transform-terms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/transform-terms.png -------------------------------------------------------------------------------- /static/Bellefair-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/Bellefair-Regular.ttf -------------------------------------------------------------------------------- /static/FiraMono-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/FiraMono-Medium.ttf -------------------------------------------------------------------------------- /static/FiraMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/FiraMono-Regular.ttf -------------------------------------------------------------------------------- /static/FiraSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/FiraSans-Regular.ttf -------------------------------------------------------------------------------- /static/NotoSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/NotoSerif-Regular.ttf -------------------------------------------------------------------------------- /static/SourceSerifPro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/SourceSerifPro-Bold.ttf -------------------------------------------------------------------------------- /static/UbuntuMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/UbuntuMono-Regular.ttf -------------------------------------------------------------------------------- /static/iosevka-etoile-thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/iosevka-etoile-thin.ttf -------------------------------------------------------------------------------- /static/SourceSerifPro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/SourceSerifPro-Regular.ttf -------------------------------------------------------------------------------- /static/iosevka-etoile-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/iosevka-etoile-regular.ttf -------------------------------------------------------------------------------- /static/iosevka-fixed-extended.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/iosevka-fixed-extended.ttf -------------------------------------------------------------------------------- /whalesong/whalesong-picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/whalesong/whalesong-picture.jpg -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/text.js: -------------------------------------------------------------------------------- 1 | export default function(value) { 2 | return document.createTextNode(value); 3 | } 4 | -------------------------------------------------------------------------------- /static/SourceSerifPro-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/SourceSerifPro-SemiBold.ttf -------------------------------------------------------------------------------- /observablehq-stdlib/src/constant.js: -------------------------------------------------------------------------------- 1 | export default function(x) { 2 | return function() { 3 | return x; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/now.js: -------------------------------------------------------------------------------- 1 | export default function*() { 2 | while (true) { 3 | yield Date.now(); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /static/iosevka-fixed-extendedmedium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/static/iosevka-fixed-extendedmedium.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /observablehq-stdlib/.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-workspace 2 | .DS_Store 3 | .esm-cache/ 4 | dist/ 5 | node_modules 6 | npm-debug.log 7 | .nyc_output 8 | -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /observablehq-stdlib/src/index.js: -------------------------------------------------------------------------------- 1 | export {default as FileAttachments} from "./fileAttachment.js"; 2 | export {default as Library} from "./library.js"; 3 | -------------------------------------------------------------------------------- /whalesong/makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | all: index.html 3 | 4 | index.html: index.md 5 | ASAN_OPTIONS="detect_leaks=0" builder index.md index.html 6 | -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/ddg-laplace-operator/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/input.js: -------------------------------------------------------------------------------- 1 | export default function(type) { 2 | var input = document.createElement("input"); 3 | if (type != null) input.type = type; 4 | return input; 5 | } 6 | -------------------------------------------------------------------------------- /jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot -------------------------------------------------------------------------------- /jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf -------------------------------------------------------------------------------- /jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff -------------------------------------------------------------------------------- /observablehq-stdlib/src/promises/tick.js: -------------------------------------------------------------------------------- 1 | import when from "./when.js"; 2 | 3 | export default function(duration, value) { 4 | return when(Math.ceil((Date.now() + 1) / duration) * duration, value); 5 | } 6 | -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf -------------------------------------------------------------------------------- /jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/canvas.js: -------------------------------------------------------------------------------- 1 | export default function(width, height) { 2 | var canvas = document.createElement("canvas"); 3 | canvas.width = width; 4 | canvas.height = height; 5 | return canvas; 6 | } 7 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/require.js: -------------------------------------------------------------------------------- 1 | import {require as requireDefault, requireFrom} from "d3-require"; 2 | 3 | export default function(resolve) { 4 | return resolve == null ? requireDefault : requireFrom(resolve); 5 | } 6 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/promises/delay.js: -------------------------------------------------------------------------------- 1 | export default function(duration, value) { 2 | return new Promise(function(resolve) { 3 | setTimeout(function() { 4 | resolve(value); 5 | }, duration); 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.eot -------------------------------------------------------------------------------- /jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.ttf -------------------------------------------------------------------------------- /jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-semi-bold-old-style-figures/et-book-semi-bold-old-style-figures.woff -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/map.js: -------------------------------------------------------------------------------- 1 | export default function*(iterator, transform) { 2 | var result, index = -1; 3 | while (!(result = iterator.next()).done) { 4 | yield transform(result.value, ++index); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/files/index.js: -------------------------------------------------------------------------------- 1 | import buffer from "./buffer.js"; 2 | import text from "./text.js"; 3 | import url from "./url.js"; 4 | 5 | export default { 6 | buffer: buffer, 7 | text: text, 8 | url: url 9 | }; 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/promises/index.js: -------------------------------------------------------------------------------- 1 | import delay from "./delay.js"; 2 | import tick from "./tick.js"; 3 | import when from "./when.js"; 4 | 5 | export default { 6 | delay: delay, 7 | tick: tick, 8 | when: when 9 | }; 10 | -------------------------------------------------------------------------------- /jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot -------------------------------------------------------------------------------- /jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf -------------------------------------------------------------------------------- /jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bollu/mathemagic/HEAD/jacobian/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/filter.js: -------------------------------------------------------------------------------- 1 | export default function*(iterator, test) { 2 | var result, index = -1; 3 | while (!(result = iterator.next()).done) { 4 | if (test(result.value, ++index)) { 5 | yield result.value; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/files/text.js: -------------------------------------------------------------------------------- 1 | export default function(file) { 2 | return new Promise(function(resolve, reject) { 3 | var reader = new FileReader; 4 | reader.onload = function() { resolve(reader.result); }; 5 | reader.onerror = reject; 6 | reader.readAsText(file); 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/files/url.js: -------------------------------------------------------------------------------- 1 | export default function(file) { 2 | return new Promise(function(resolve, reject) { 3 | var reader = new FileReader; 4 | reader.onload = function() { resolve(reader.result); }; 5 | reader.onerror = reject; 6 | reader.readAsDataURL(file); 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/files/buffer.js: -------------------------------------------------------------------------------- 1 | export default function(file) { 2 | return new Promise(function(resolve, reject) { 3 | var reader = new FileReader; 4 | reader.onload = function() { resolve(reader.result); }; 5 | reader.onerror = reject; 6 | reader.readAsArrayBuffer(file); 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/svg.js: -------------------------------------------------------------------------------- 1 | export default function(width, height) { 2 | var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 3 | svg.setAttribute("viewBox", [0, 0, width, height]); 4 | svg.setAttribute("width", width); 5 | svg.setAttribute("height", height); 6 | return svg; 7 | } 8 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/valueAt.js: -------------------------------------------------------------------------------- 1 | export default function(iterator, i) { 2 | if (!isFinite(i = +i) || i < 0 || i !== i | 0) return; 3 | var result, index = -1; 4 | while (!(result = iterator.next()).done) { 5 | if (++index === i) { 6 | return result.value; 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/fileAttachments-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import {FileAttachments} from "../src/index.js"; 3 | 4 | test("FileAttachments is exported by stdlib", t => { 5 | t.equal(typeof FileAttachments, "function"); 6 | t.equal(FileAttachments.name, "FileAttachments"); 7 | t.end(); 8 | }); 9 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/html.js: -------------------------------------------------------------------------------- 1 | import template from "./template.js"; 2 | 3 | export default template(function(string) { 4 | var template = document.createElement("template"); 5 | template.innerHTML = string.trim(); 6 | return document.importNode(template.content, true); 7 | }, function() { 8 | return document.createElement("span"); 9 | }); 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/svg.js: -------------------------------------------------------------------------------- 1 | import template from "./template.js"; 2 | 3 | export default template(function(string) { 4 | var root = document.createElementNS("http://www.w3.org/2000/svg", "g"); 5 | root.innerHTML = string.trim(); 6 | return root; 7 | }, function() { 8 | return document.createElementNS("http://www.w3.org/2000/svg", "g"); 9 | }); 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/select.js: -------------------------------------------------------------------------------- 1 | export default function(values) { 2 | var select = document.createElement("select"); 3 | Array.prototype.forEach.call(values, function(value) { 4 | var option = document.createElement("option"); 5 | option.value = option.textContent = value; 6 | select.appendChild(option); 7 | }); 8 | return select; 9 | } 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/range.js: -------------------------------------------------------------------------------- 1 | export default function*(start, stop, step) { 2 | start = +start; 3 | stop = +stop; 4 | step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; 5 | var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0; 6 | while (++i < n) { 7 | yield start + i * step; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/resolve.js: -------------------------------------------------------------------------------- 1 | export default function resolve(name, base) { 2 | if (/^(\w+:)|\/\//i.test(name)) return name; 3 | if (/^[.]{0,2}\//i.test(name)) return new URL(name, base == null ? location : base).href; 4 | if (!name.length || /^[\s._]/.test(name) || /\s$/.test(name)) throw new Error("illegal name"); 5 | return "https://unpkg.com/" + name; 6 | } 7 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/uid.js: -------------------------------------------------------------------------------- 1 | var count = 0; 2 | 3 | export default function(name) { 4 | return new Id("O-" + (name == null ? "" : name + "-") + ++count); 5 | } 6 | 7 | function Id(id) { 8 | this.id = id; 9 | this.href = new URL(`#${id}`, location) + ""; 10 | } 11 | 12 | Id.prototype.toString = function() { 13 | return "url(" + this.href + ")"; 14 | }; 15 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/mutable.js: -------------------------------------------------------------------------------- 1 | import observe from "./generators/observe.js"; 2 | 3 | export default function Mutable(value) { 4 | let change; 5 | Object.defineProperties(this, { 6 | generator: {value: observe(_ => void (change = _))}, 7 | value: {get: () => value, set: x => change(value = x)} 8 | }); 9 | if (value !== undefined) change(value); 10 | } 11 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/worker.js: -------------------------------------------------------------------------------- 1 | import disposable from "./disposable.js"; 2 | 3 | export default function worker(source) { 4 | const url = URL.createObjectURL(new Blob([source], {type: "text/javascript"})); 5 | const worker = new Worker(url); 6 | return disposable(worker, () => { 7 | worker.terminate(); 8 | URL.revokeObjectURL(url); 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/range.js: -------------------------------------------------------------------------------- 1 | export default function(min, max, step) { 2 | if (arguments.length === 1) max = min, min = null; 3 | var input = document.createElement("input"); 4 | input.min = min = min == null ? 0 : +min; 5 | input.max = max = max == null ? 1 : +max; 6 | input.step = step == null ? "any" : step = +step; 7 | input.type = "range"; 8 | return input; 9 | } 10 | -------------------------------------------------------------------------------- /observablehq-stdlib/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "parserOptions": { 4 | "sourceType": "module", 5 | "ecmaVersion": 8 6 | }, 7 | "env": { 8 | "browser": true, 9 | "es6": true, 10 | "node": true 11 | }, 12 | "rules": { 13 | "semi": 2, 14 | "no-process-env": 2, 15 | "no-cond-assign": 0, 16 | "no-redeclare": 0 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/context2d.js: -------------------------------------------------------------------------------- 1 | export default function(width, height, dpi) { 2 | if (dpi == null) dpi = devicePixelRatio; 3 | var canvas = document.createElement("canvas"); 4 | canvas.width = width * dpi; 5 | canvas.height = height * dpi; 6 | canvas.style.width = width + "px"; 7 | var context = canvas.getContext("2d"); 8 | context.scale(dpi, dpi); 9 | return context; 10 | } 11 | -------------------------------------------------------------------------------- /declarative/makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all server 2 | all: index.html server 3 | 4 | server: 5 | python3 -m http.server 6 | 7 | index.html: index.md anim.out minanim.js script.js 8 | ASAN_OPTIONS="detect_leaks=0" ./anim.out > ANIMGENERATED.js 9 | ASAN_OPTIONS="detect_leaks=0" builder index.md index.html 10 | 11 | anim.out: anim.cpp 12 | g++ -g -O1 -std=c++11 -fsanitize=address -fsanitize=undefined anim.cpp -o anim.out 13 | 14 | -------------------------------------------------------------------------------- /observablehq-stdlib/stdlib.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": ".", 5 | "file_exclude_patterns": ["*.sublime-workspace"], 6 | "folder_exclude_patterns": [".esm-cache", "dist"] 7 | } 8 | ], 9 | "build_systems": [ 10 | { 11 | "name": "yarn test", 12 | "cmd": ["yarn", "test"], 13 | "file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)", 14 | "working_dir": "$project_path" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/DOM/uid-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import UID from "../../src/dom/uid.js"; 3 | 4 | test("UID", t => { 5 | global.location = "https://test.com/"; 6 | const hi = UID("hi"); 7 | t.deepEqual(hi, { 8 | id: "O-hi-1", 9 | href: "https://test.com/#O-hi-1" 10 | }); 11 | t.equal(hi.toString(), "url(https://test.com/#O-hi-1)"); 12 | const anon = UID(); 13 | t.equal(anon.toString(), "url(https://test.com/#O-2)"); 14 | t.end(); 15 | }); 16 | -------------------------------------------------------------------------------- /declarative/mono.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-weight: normal; 3 | background-color: white; 4 | } 5 | 6 | .linenum { color: #000000; } 7 | 8 | .keyword { 9 | color: black; 10 | font-weight: bold; 11 | text-decoration: underline; 12 | } 13 | 14 | .type { 15 | color: black; 16 | font-weight: bold; 17 | } 18 | 19 | .string { 20 | color: gray; 21 | } 22 | 23 | .comment { 24 | color: #222222; 25 | font-style: italic; 26 | } 27 | 28 | .number { 29 | color: black; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/width.js: -------------------------------------------------------------------------------- 1 | import observe from "./generators/observe.js"; 2 | 3 | export default function() { 4 | return observe(function(change) { 5 | var width = change(document.body.clientWidth); 6 | function resized() { 7 | var w = document.body.clientWidth; 8 | if (w !== width) change(width = w); 9 | } 10 | window.addEventListener("resize", resized); 11 | return function() { 12 | window.removeEventListener("resize", resized); 13 | }; 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/disposable.js: -------------------------------------------------------------------------------- 1 | import that from "../that.js"; 2 | 3 | export default function disposable(value, dispose) { 4 | let done = false; 5 | if (typeof dispose !== "function") { 6 | throw new Error("dispose is not a function"); 7 | } 8 | return { 9 | [Symbol.iterator]: that, 10 | next: () => done ? {done: true} : (done = true, {done: false, value}), 11 | return: () => (done = true, dispose(value), {done: true}), 12 | throw: () => ({done: done = true}) 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/index-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import {Library} from "../src/index.js"; 3 | 4 | test("new Library returns a library with the expected keys", async t => { 5 | t.deepEqual(Object.keys(new Library()).sort(), [ 6 | "DOM", 7 | "FileAttachment", 8 | "Files", 9 | "Generators", 10 | "Mutable", 11 | "Promises", 12 | "html", 13 | "md", 14 | "now", 15 | "require", 16 | "resolve", 17 | "svg", 18 | "tex", 19 | "width" 20 | ]); 21 | t.end(); 22 | }); 23 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/index.js: -------------------------------------------------------------------------------- 1 | import disposable from "./disposable.js"; 2 | import filter from "./filter.js"; 3 | import input from "./input.js"; 4 | import map from "./map.js"; 5 | import observe from "./observe.js"; 6 | import queue from "./queue.js"; 7 | import range from "./range.js"; 8 | import valueAt from "./valueAt.js"; 9 | import worker from "./worker.js"; 10 | 11 | export default { 12 | disposable: disposable, 13 | filter: filter, 14 | input: input, 15 | map: map, 16 | observe: observe, 17 | queue: queue, 18 | range: range, 19 | valueAt: valueAt, 20 | worker: worker 21 | }; 22 | -------------------------------------------------------------------------------- /observablehq-stdlib/.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Node CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest] 11 | node-version: [10.x, 12.x] 12 | 13 | runs-on: ${{ matrix.os }} 14 | 15 | steps: 16 | - uses: actions/checkout@v1 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v1 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | - name: yarn install and test 22 | run: | 23 | yarn install --frozen-lockfile 24 | yarn test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/index.js: -------------------------------------------------------------------------------- 1 | import canvas from "./canvas.js"; 2 | import context2d from "./context2d.js"; 3 | import download from "./download.js"; 4 | import element from "./element.js"; 5 | import input from "./input.js"; 6 | import range from "./range.js"; 7 | import select from "./select.js"; 8 | import svg from "./svg.js"; 9 | import text from "./text.js"; 10 | import uid from "./uid.js"; 11 | 12 | export default { 13 | canvas: canvas, 14 | context2d: context2d, 15 | download: download, 16 | element: element, 17 | input: input, 18 | range: range, 19 | select: select, 20 | svg: svg, 21 | text: text, 22 | uid: uid 23 | }; 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Mathemagic](https://bollu.github.io/mathemagic/) 2 | - [Link to the website](https://bollu.github.io/mathemagic/) 3 | 4 | 5 | The goal of this side project is to create beautiful rendering of ideas 6 | in differential geometry which enchant me. So I hope to have renderings 7 | of homology, cohomology, exterior calculus, the laplace operator, the heat 8 | equation, the wave equation, curvature, and holonomy. 9 | 10 | While I'm at it, I plan to steal ideas and javascript from 11 | [observableHQ](https://observablehq.com/), whom I deeply admire. 12 | 13 | - [`selectAll` semantics of d3](https://github.com/d3/d3-selection/blob/v1.4.1/README.md#selectAll) 14 | -------------------------------------------------------------------------------- /observablehq-stdlib/rollup.config.js: -------------------------------------------------------------------------------- 1 | import node from "rollup-plugin-node-resolve"; 2 | import {terser} from "rollup-plugin-terser"; 3 | import * as meta from "./package.json"; 4 | 5 | const copyright = `// @observablehq/stdlib v${meta.version} Copyright ${(new Date).getFullYear()} Observable, Inc.`; 6 | 7 | export default [ 8 | { 9 | input: "src/index.js", 10 | plugins: [ 11 | node(), 12 | terser({ 13 | output: {preamble: copyright}, 14 | mangle: {reserved: ["RequireError"]} 15 | }) 16 | ], 17 | output: { 18 | format: "umd", 19 | extend: true, 20 | name: "observablehq", 21 | file: "dist/stdlib.js" 22 | } 23 | } 24 | ]; 25 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/promises/when.js: -------------------------------------------------------------------------------- 1 | import constant from "../constant.js"; 2 | 3 | var timeouts = new Map; 4 | 5 | function timeout(now, time) { 6 | var t = new Promise(function(resolve) { 7 | timeouts.delete(time); 8 | var delay = time - now; 9 | if (!(delay > 0)) throw new Error("invalid time"); 10 | if (delay > 0x7fffffff) throw new Error("too long to wait"); 11 | setTimeout(resolve, delay); 12 | }); 13 | timeouts.set(time, t); 14 | return t; 15 | } 16 | 17 | export default function when(time, value) { 18 | var now; 19 | return (now = timeouts.get(time = +time)) ? now.then(constant(value)) 20 | : (now = Date.now()) >= time ? Promise.resolve(value) 21 | : timeout(now, time).then(constant(value)); 22 | } 23 | -------------------------------------------------------------------------------- /observablehq-stdlib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 Observable, Inc. 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/queue.js: -------------------------------------------------------------------------------- 1 | import that from "../that.js"; 2 | 3 | export default function(initialize) { 4 | let resolve; 5 | const queue = []; 6 | const dispose = initialize(push); 7 | 8 | if (dispose != null && typeof dispose !== "function") { 9 | throw new Error(typeof dispose.then === "function" 10 | ? "async initializers are not supported" 11 | : "initializer returned something, but not a dispose function"); 12 | } 13 | 14 | function push(x) { 15 | queue.push(x); 16 | if (resolve) resolve(queue.shift()), resolve = null; 17 | return x; 18 | } 19 | 20 | function next() { 21 | return {done: false, value: queue.length 22 | ? Promise.resolve(queue.shift()) 23 | : new Promise(_ => (resolve = _))}; 24 | } 25 | 26 | return { 27 | [Symbol.iterator]: that, 28 | throw: () => ({done: true}), 29 | return: () => (dispose != null && dispose(), {done: true}), 30 | next 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/observe.js: -------------------------------------------------------------------------------- 1 | import that from "../that.js"; 2 | 3 | export default function(initialize) { 4 | let stale = false; 5 | let value; 6 | let resolve; 7 | const dispose = initialize(change); 8 | 9 | if (dispose != null && typeof dispose !== "function") { 10 | throw new Error(typeof dispose.then === "function" 11 | ? "async initializers are not supported" 12 | : "initializer returned something, but not a dispose function"); 13 | } 14 | 15 | function change(x) { 16 | if (resolve) resolve(x), resolve = null; 17 | else stale = true; 18 | return value = x; 19 | } 20 | 21 | function next() { 22 | return {done: false, value: stale 23 | ? (stale = false, Promise.resolve(value)) 24 | : new Promise(_ => (resolve = _))}; 25 | } 26 | 27 | return { 28 | [Symbol.iterator]: that, 29 | throw: () => ({done: true}), 30 | return: () => (dispose != null && dispose(), {done: true}), 31 | next 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/generators/disposable-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import disposable from "../../src/generators/disposable.js"; 3 | 4 | test("disposable(value, dispose) yields the specified value", async t => { 5 | const foo = {}; 6 | const generator = disposable(foo, () => {}); 7 | t.deepEqual(generator.next(), {done: false, value: foo}); 8 | t.deepEqual(generator.next(), {done: true}); 9 | t.end(); 10 | }); 11 | 12 | test("disposable(value, dispose) defines generator.return", async t => { 13 | let passedFoo; 14 | const foo = {}; 15 | const generator = disposable(foo, _ => (passedFoo = _)); 16 | t.deepEqual(generator.return(), {done: true}); 17 | t.equal(passedFoo, foo); 18 | t.deepEqual(generator.next(), {done: true}); 19 | t.end(); 20 | }); 21 | 22 | test("disposable(value, dispose) defines generator.throw", async t => { 23 | const generator = disposable(42, () => {}); 24 | t.deepEqual(generator.throw(new Error()), {done: true}); 25 | t.deepEqual(generator.next(), {done: true}); 26 | t.end(); 27 | }); 28 | -------------------------------------------------------------------------------- /observablehq-stdlib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@observablehq/stdlib", 3 | "version": "3.3.1", 4 | "license": "ISC", 5 | "main": "dist/stdlib.js", 6 | "module": "src/index.js", 7 | "author": { 8 | "name": "Observable, Inc.", 9 | "url": "https://observablehq.com" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/observablehq/stdlib.git" 14 | }, 15 | "scripts": { 16 | "test": "tap 'test/**/*-test.js'", 17 | "prepublishOnly": "rollup -c", 18 | "postpublish": "git push && git push --tags" 19 | }, 20 | "husky": { 21 | "hooks": { 22 | "pre-commit": "eslint . && yarn test" 23 | } 24 | }, 25 | "files": [ 26 | "src/**/*.js", 27 | "dist/**/*.js" 28 | ], 29 | "dependencies": { 30 | "d3-require": "^1.2.4" 31 | }, 32 | "devDependencies": { 33 | "eslint": "^6.7.2", 34 | "husky": "^3.1.0", 35 | "rollup": "^1.27.8", 36 | "rollup-plugin-node-resolve": "^5.0.0", 37 | "rollup-plugin-terser": "^5.2.0", 38 | "tap": "^14.10.2" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/download.js: -------------------------------------------------------------------------------- 1 | export default function(value, name = "untitled", label = "Save") { 2 | const a = document.createElement("a"); 3 | const b = a.appendChild(document.createElement("button")); 4 | b.textContent = label; 5 | a.download = name; 6 | 7 | async function reset() { 8 | await new Promise(requestAnimationFrame); 9 | URL.revokeObjectURL(a.href); 10 | a.removeAttribute("href"); 11 | b.textContent = label; 12 | b.disabled = false; 13 | } 14 | 15 | a.onclick = async event => { 16 | b.disabled = true; 17 | if (a.href) return reset(); // Already saved. 18 | b.textContent = "Saving…"; 19 | try { 20 | const object = await (typeof value === "function" ? value() : value); 21 | b.textContent = "Download"; 22 | a.href = URL.createObjectURL(object); // eslint-disable-line require-atomic-updates 23 | } catch (ignore) { 24 | b.textContent = label; 25 | } 26 | if (event.eventPhase) return reset(); // Already downloaded. 27 | b.disabled = false; 28 | }; 29 | 30 | return a; 31 | } 32 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/tex.js: -------------------------------------------------------------------------------- 1 | var raw = String.raw; 2 | 3 | function style(href) { 4 | return new Promise(function(resolve, reject) { 5 | var link = document.createElement("link"); 6 | link.rel = "stylesheet"; 7 | link.href = href; 8 | link.onerror = reject; 9 | link.onload = resolve; 10 | document.head.appendChild(link); 11 | }); 12 | } 13 | 14 | export default function(require) { 15 | return function() { 16 | return Promise.all([ 17 | require("@observablehq/katex@0.11.1/dist/katex.min.js"), 18 | require.resolve("@observablehq/katex@0.11.1/dist/katex.min.css").then(style) 19 | ]).then(function(values) { 20 | var katex = values[0], tex = renderer(); 21 | 22 | function renderer(options) { 23 | return function() { 24 | var root = document.createElement("div"); 25 | katex.render(raw.apply(String, arguments), root, options); 26 | return root.removeChild(root.firstChild); 27 | }; 28 | } 29 | 30 | tex.options = renderer; 31 | tex.block = renderer({displayMode: true}); 32 | return tex; 33 | }); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/generators/input.js: -------------------------------------------------------------------------------- 1 | import observe from "./observe.js"; 2 | 3 | export default function(input) { 4 | return observe(function(change) { 5 | var event = eventof(input), value = valueof(input); 6 | function inputted() { change(valueof(input)); } 7 | input.addEventListener(event, inputted); 8 | if (value !== undefined) change(value); 9 | return function() { input.removeEventListener(event, inputted); }; 10 | }); 11 | } 12 | 13 | function valueof(input) { 14 | switch (input.type) { 15 | case "range": 16 | case "number": return input.valueAsNumber; 17 | case "date": return input.valueAsDate; 18 | case "checkbox": return input.checked; 19 | case "file": return input.multiple ? input.files : input.files[0]; 20 | case "select-multiple": return Array.from(input.selectedOptions, o => o.value); 21 | default: return input.value; 22 | } 23 | } 24 | 25 | function eventof(input) { 26 | switch (input.type) { 27 | case "button": 28 | case "submit": 29 | case "checkbox": return "click"; 30 | case "file": return "change"; 31 | default: return "input"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/dom/element.js: -------------------------------------------------------------------------------- 1 | var namespaces = { 2 | math: "http://www.w3.org/1998/Math/MathML", 3 | svg: "http://www.w3.org/2000/svg", 4 | xhtml: "http://www.w3.org/1999/xhtml", 5 | xlink: "http://www.w3.org/1999/xlink", 6 | xml: "http://www.w3.org/XML/1998/namespace", 7 | xmlns: "http://www.w3.org/2000/xmlns/" 8 | }; 9 | 10 | export default function(name, attributes) { 11 | var prefix = name += "", i = prefix.indexOf(":"), value; 12 | if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); 13 | var element = namespaces.hasOwnProperty(prefix) // eslint-disable-line no-prototype-builtins 14 | ? document.createElementNS(namespaces[prefix], name) 15 | : document.createElement(name); 16 | if (attributes) for (var key in attributes) { 17 | prefix = key, i = prefix.indexOf(":"), value = attributes[key]; 18 | if (i >= 0 && (prefix = key.slice(0, i)) !== "xmlns") key = key.slice(i + 1); 19 | if (namespaces.hasOwnProperty(prefix)) element.setAttributeNS(namespaces[prefix], key, value); // eslint-disable-line no-prototype-builtins 20 | else element.setAttribute(key, value); 21 | } 22 | return element; 23 | } 24 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/promises/delay-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import delay from "../../src/promises/delay.js"; 3 | import tick from "../../src/promises/tick.js"; 4 | 5 | test("delay(duration) resolves with undefined", async t => { 6 | t.equal(await delay(50), undefined); 7 | t.end(); 8 | }); 9 | 10 | test("delay(duration) resolves after the specified duration", async t => { 11 | const then = Date.now(); 12 | await delay(150); 13 | const delta = Date.now() - then; 14 | t.ok(130 <= delta && delta <= 170); 15 | t.end(); 16 | }); 17 | 18 | test("delay(duration, value) resolves with the specified value", async t => { 19 | t.equal(await delay(50, "foo"), "foo"); 20 | t.end(); 21 | }); 22 | 23 | test("delay(duration, value) resolves with the specified value after the specified duration", async t => { 24 | const then = Date.now(); 25 | t.equal(await delay(150, "foo"), "foo"); 26 | const delta = Date.now() - then; 27 | t.ok(130 <= delta && delta <= 170); 28 | t.end(); 29 | }); 30 | 31 | test("tick(1000) resolves near the second boundary", async t => { 32 | await tick(1000); 33 | const now = Date.now(); 34 | t.ok(now % 1000 < 10, `${now % 1000} deviation from the second`); 35 | t.end(); 36 | }); 37 | -------------------------------------------------------------------------------- /observablehq-stdlib/test/generators/generators-test.js: -------------------------------------------------------------------------------- 1 | import {test} from "tap"; 2 | import filter from "../../src/generators/filter"; 3 | import map from "../../src/generators/map"; 4 | import range from "../../src/generators/range"; 5 | import valueAt from "../../src/generators/valueAt"; 6 | import observe from "../../src/generators/observe"; 7 | import queue from "../../src/generators/queue"; 8 | 9 | test("filter(value, fn) filters", t => { 10 | function* input() { 11 | yield* [1, 2, 3, 4]; 12 | } 13 | t.deepEqual(Array.from(filter(input(), i => i % 2 === 0)), [2, 4]); 14 | t.end(); 15 | }); 16 | 17 | test("map(value, fn) maps", t => { 18 | function* input() { 19 | yield* [1, 2, 3, 4]; 20 | } 21 | t.deepEqual(Array.from(map(input(), i => i * 2)), [2, 4, 6, 8]); 22 | t.end(); 23 | }); 24 | 25 | test("range(start, stop) generates a range", t => { 26 | t.deepEqual(Array.from(range(1, 4)), [1, 2, 3]); 27 | t.deepEqual(Array.from(range(1, 5, 2)), [1, 3]); 28 | t.deepEqual(Array.from(range(3)), [0, 1, 2]); 29 | t.end(); 30 | }); 31 | 32 | test("valueAt(generator, i) picks a value", t => { 33 | function* input() { 34 | yield* [1, 2, 3, 4]; 35 | } 36 | t.equal(valueAt(input(), 2), 3); 37 | t.equal(valueAt(input()), undefined); 38 | t.end(); 39 | }); 40 | 41 | test("observe only yields the most recent value", async t => { 42 | let o = observe(change => { 43 | change(1); 44 | change(2); 45 | }); 46 | t.equal(await o.next().value, 2); 47 | t.end(); 48 | }); 49 | 50 | test("queue yields all values", async t => { 51 | let q = queue(change => { 52 | change(1); 53 | change(2); 54 | }); 55 | t.equal(await q.next().value, 1); 56 | t.equal(await q.next().value, 2); 57 | t.end(); 58 | }); 59 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/fileAttachment.js: -------------------------------------------------------------------------------- 1 | async function remote_fetch(file) { 2 | const response = await fetch(await file.url()); 3 | if (!response.ok) throw new Error(`Unable to load file: ${file.name}`); 4 | return response; 5 | } 6 | 7 | class FileAttachment { 8 | constructor(url, name) { 9 | Object.defineProperties(this, { 10 | _url: {value: url}, 11 | name: {value: name, enumerable: true} 12 | }); 13 | } 14 | async url() { 15 | return this._url; 16 | } 17 | async blob() { 18 | return (await remote_fetch(this)).blob(); 19 | } 20 | async arrayBuffer() { 21 | return (await remote_fetch(this)).arrayBuffer(); 22 | } 23 | async text() { 24 | return (await remote_fetch(this)).text(); 25 | } 26 | async json() { 27 | return (await remote_fetch(this)).json(); 28 | } 29 | async stream() { 30 | return (await remote_fetch(this)).body; 31 | } 32 | async image() { 33 | const url = await this.url(); 34 | return new Promise((resolve, reject) => { 35 | const i = new Image; 36 | if (new URL(url, document.baseURI).origin !== new URL(location).origin) { 37 | i.crossOrigin = "anonymous"; 38 | } 39 | i.onload = () => resolve(i); 40 | i.onerror = () => reject(new Error(`Unable to load file: ${this.name}`)); 41 | i.src = url; 42 | }); 43 | } 44 | } 45 | 46 | export function NoFileAttachments(name) { 47 | throw new Error(`File not found: ${name}`); 48 | } 49 | 50 | export default function FileAttachments(resolve) { 51 | return name => { 52 | const url = resolve(name += ""); // Returns a Promise, string, or null. 53 | if (url == null) throw new Error(`File not found: ${name}`); 54 | return new FileAttachment(url, name); 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/md.js: -------------------------------------------------------------------------------- 1 | import template from "./template.js"; 2 | 3 | const HL_ROOT = 4 | "https://cdn.jsdelivr.net/npm/@observablehq/highlight.js@2.0.0/"; 5 | 6 | export default function(require) { 7 | return function() { 8 | return require("marked@0.3.12/marked.min.js").then(function(marked) { 9 | return template( 10 | function(string) { 11 | var root = document.createElement("div"); 12 | root.innerHTML = marked(string, {langPrefix: ""}).trim(); 13 | var code = root.querySelectorAll("pre code[class]"); 14 | if (code.length > 0) { 15 | require(HL_ROOT + "highlight.min.js").then(function(hl) { 16 | code.forEach(function(block) { 17 | function done() { 18 | hl.highlightBlock(block); 19 | block.parentNode.classList.add("observablehq--md-pre"); 20 | } 21 | if (hl.getLanguage(block.className)) { 22 | done(); 23 | } else { 24 | require(HL_ROOT + "async-languages/index.js") 25 | .then(index => { 26 | if (index.has(block.className)) { 27 | return require(HL_ROOT + 28 | "async-languages/" + 29 | index.get(block.className)).then(language => { 30 | hl.registerLanguage(block.className, language); 31 | }); 32 | } 33 | }) 34 | .then(done, done); 35 | } 36 | }); 37 | }); 38 | } 39 | return root; 40 | }, 41 | function() { 42 | return document.createElement("div"); 43 | } 44 | ); 45 | }); 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /observablehq-stdlib/src/library.js: -------------------------------------------------------------------------------- 1 | import {require as requireDefault} from "d3-require"; 2 | import constant from "./constant.js"; 3 | import DOM from "./dom/index.js"; 4 | import Files from "./files/index.js"; 5 | import {NoFileAttachments} from "./fileAttachment.js"; 6 | import Generators from "./generators/index.js"; 7 | import html from "./html.js"; 8 | import md from "./md.js"; 9 | import Mutable from "./mutable.js"; 10 | import now from "./now.js"; 11 | import Promises from "./promises/index.js"; 12 | import resolve from "./resolve.js"; 13 | import requirer from "./require.js"; 14 | import svg from "./svg.js"; 15 | import tex from "./tex.js"; 16 | import width from "./width.js"; 17 | 18 | export default Object.assign(function Library(resolver) { 19 | const require = requirer(resolver); 20 | Object.defineProperties(this, { 21 | DOM: {value: DOM, writable: true, enumerable: true}, 22 | FileAttachment: {value: constant(NoFileAttachments), writable: true, enumerable: true}, 23 | Files: {value: Files, writable: true, enumerable: true}, 24 | Generators: {value: Generators, writable: true, enumerable: true}, 25 | html: {value: constant(html), writable: true, enumerable: true}, 26 | md: {value: md(require), writable: true, enumerable: true}, 27 | Mutable: {value: constant(Mutable), writable: true, enumerable: true}, 28 | now: {value: now, writable: true, enumerable: true}, 29 | Promises: {value: Promises, writable: true, enumerable: true}, 30 | require: {value: constant(require), writable: true, enumerable: true}, 31 | resolve: {value: constant(resolve), writable: true, enumerable: true}, 32 | svg: {value: constant(svg), writable: true, enumerable: true}, 33 | tex: {value: tex(require), writable: true, enumerable: true}, 34 | width: {value: width, writable: true, enumerable: true} 35 | }); 36 | }, {resolve: requireDefault.resolve}); 37 | -------------------------------------------------------------------------------- /three.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |26 | The goal of this side project is to create beautiful rendering of ideas 27 | in differential geometry which enchant me. So I hope to have renderings 28 | of homology, cohomology, exterior calculus, the laplace operator, the heat 29 | equation, the wave equation, curvature, and holonomy. 30 |
31 | 32 |