├── .eslintignore ├── .eslintrc.json ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── npmpublish.yml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── __test__ ├── browser.html ├── browser.js ├── test.js └── theorem.js ├── dist ├── theorem.js └── theorem.min.js ├── docs ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .htaccess ├── 404.html ├── CNAME ├── LICENSE.txt ├── browserconfig.xml ├── css │ ├── main.css │ └── normalize.css ├── desc │ ├── .editorconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .htaccess │ ├── 404.html │ ├── LICENSE.txt │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── config.json │ ├── css │ │ ├── main.css │ │ └── normalize.css │ ├── doc │ │ ├── TOC.md │ │ ├── css.md │ │ ├── extend.md │ │ ├── faq.md │ │ ├── html.md │ │ ├── js.md │ │ ├── misc.md │ │ └── usage.md │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── humans.txt │ ├── icon.png │ ├── img │ │ ├── .gitignore │ │ ├── load.svg │ │ ├── logo.png │ │ └── logo.svg │ ├── index.html │ ├── js │ │ ├── main.js │ │ ├── plugins.js │ │ └── vendor │ │ │ ├── jquery-3.2.1.min-min.js │ │ │ └── modernizr-3.5.0.min.js │ ├── mstile-150x150.png │ ├── robots.txt │ ├── safari-pinned-tab.svg │ ├── site.webmanifest │ ├── tile-wide.png │ └── tile.png ├── doc │ ├── TOC.md │ ├── css.md │ ├── extend.md │ ├── faq.md │ ├── html.md │ ├── js.md │ ├── misc.md │ └── usage.md ├── docs │ ├── .editorconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .htaccess │ ├── 404.html │ ├── LICENSE.txt │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── config.json │ ├── css │ │ ├── main.css │ │ └── normalize.css │ ├── doc │ │ ├── TOC.md │ │ ├── css.md │ │ ├── extend.md │ │ ├── faq.md │ │ ├── html.md │ │ ├── js.md │ │ ├── misc.md │ │ └── usage.md │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── humans.txt │ ├── icon.png │ ├── img │ │ ├── .gitignore │ │ ├── load.svg │ │ ├── logo.png │ │ └── logo.svg │ ├── index.html │ ├── js │ │ ├── main.js │ │ ├── plugins.js │ │ └── vendor │ │ │ ├── jquery-3.2.1.min-min.js │ │ │ └── modernizr-3.5.0.min.js │ ├── mstile-150x150.png │ ├── robots.txt │ ├── safari-pinned-tab.svg │ ├── site.webmanifest │ ├── tile-wide.png │ └── tile.png ├── favicon.ico ├── humans.txt ├── icon.png ├── img │ ├── .gitignore │ ├── TheoremJS.png │ ├── TheoremJS.svg │ └── marketing.jpg ├── index.html ├── js │ ├── main.js │ ├── plugins.js │ └── vendor │ │ ├── jquery-3.2.1.min.js │ │ └── modernizr-3.5.0.min.js ├── robots.txt ├── site.webmanifest ├── tile-wide.png └── tile.png ├── gulpfile.js ├── package-lock.json ├── package.json └── src ├── base.js └── includes ├── functions ├── array │ ├── flatten.js │ ├── linspace.js │ ├── range.js │ ├── reshape.js │ └── reverse.js ├── constructor.js ├── cryptography │ ├── bin2str.js │ ├── huffman.js │ ├── md5.js │ ├── sha256.js │ └── str2bin.js ├── includes.js ├── math │ ├── algebra │ │ ├── derivate.js │ │ ├── f.js │ │ ├── findRoots.js │ │ ├── gaussElimination.js │ │ ├── gradient.js │ │ ├── graph.js │ │ ├── integrate.js │ │ ├── numeralSolve.js │ │ ├── polynomial.js │ │ ├── run.js │ │ ├── slope.js │ │ └── y-intercept.js │ ├── complex │ │ ├── complex.js │ │ ├── i.js │ │ └── src │ │ │ ├── abs.js │ │ │ ├── arg.js │ │ │ ├── clone.js │ │ │ ├── conjugate.js │ │ │ ├── constructor.js │ │ │ ├── div.js │ │ │ ├── equal.js │ │ │ ├── exp.js │ │ │ ├── isComplex.js │ │ │ ├── ln.js │ │ │ ├── log.js │ │ │ ├── minus.js │ │ │ ├── negated.js │ │ │ ├── plus.js │ │ │ ├── pow.js │ │ │ ├── times.js │ │ │ └── toString.js │ ├── fractions │ │ ├── toDec.js │ │ └── toFraction.js │ ├── generators │ │ ├── collatz.js │ │ ├── fibonacci.js │ │ └── sieve.js │ ├── math │ │ ├── exp.js │ │ ├── factorial.js │ │ ├── gamma.js │ │ ├── ln.js │ │ ├── lngamma.js │ │ ├── log.js │ │ ├── pow.js │ │ ├── root.js │ │ ├── sigmoid.js │ │ └── sqrt.js │ ├── numbers │ │ ├── abs.js │ │ ├── c.js │ │ ├── ceil.js │ │ ├── e.js │ │ ├── floor.js │ │ ├── goldenRatio.js │ │ ├── isPrime.js │ │ ├── leastFactor.js │ │ ├── n.js │ │ ├── nPrime.js │ │ ├── pi.js │ │ ├── primeFactors.js │ │ ├── primePi.js │ │ └── round.js │ ├── other │ │ ├── apply.js │ │ ├── max.js │ │ ├── min.js │ │ ├── product.js │ │ ├── sort.js │ │ └── sum.js │ ├── random │ │ └── rand.js │ ├── stats │ │ ├── average.js │ │ ├── correlation.js │ │ ├── mean.js │ │ ├── median.js │ │ ├── quantile.js │ │ ├── regression.js │ │ ├── std.js │ │ └── variance.js │ ├── trig │ │ ├── acos.js │ │ ├── acosh.js │ │ ├── angle2Vec.js │ │ ├── asin.js │ │ ├── asinh.js │ │ ├── atan.js │ │ ├── atan2.js │ │ ├── atanh.js │ │ ├── cos.js │ │ ├── cosh.js │ │ ├── deg2rad.js │ │ ├── drawCircularPoints.js │ │ ├── rad2deg.js │ │ ├── sin.js │ │ ├── sinh.js │ │ ├── tan.js │ │ └── tanh.js │ └── units │ │ ├── convert.js │ │ ├── src │ │ ├── area.js │ │ ├── distance.js │ │ ├── length.js │ │ ├── mass.js │ │ ├── speed.js │ │ ├── temperature.js │ │ ├── time.js │ │ └── volume.js │ │ └── units.js └── other │ ├── config.js │ ├── convertToBase.js │ ├── fn.js │ └── toBase10.js └── other └── export.js /.eslintignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/.eslintignore -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "es6": true, 6 | "amd": true 7 | }, 8 | "parser": "babel-eslint", 9 | "extends": "eslint:recommended", 10 | "rules": { 11 | "linebreak-style": [ 12 | "error", 13 | "unix" 14 | ], 15 | "quotes": [ 16 | "error", 17 | "double" 18 | ], 19 | "semi": [ 20 | "error", 21 | "always" 22 | ], 23 | "no-console": [ 24 | "error", 25 | { 26 | "allow": [ 27 | "warn", 28 | "error" 29 | ] 30 | } 31 | ], 32 | "no-unused-vars": "off", 33 | "no-cond-assign": "off", 34 | "no-inner-declaration": "off" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [arguiot] 4 | patreon: arguiot 5 | custom: ['https://paypal.me/arguiot'] 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots / Output** 21 | If applicable, add screenshots or the logs of your program to help explain your problem. 22 | 23 | **NodeJS (please complete the following information):** 24 | - OS: [e.g. macOS 10.14] 25 | - Node version [e.g. v8.11.3] 26 | - Version [e.g. v1.0] 27 | 28 | **Browser (please complete the following information):** 29 | - OS: [e.g. Ubuntu 16.04] 30 | - Browser [e.g. chrome, safari] 31 | - Browser version [e.g. 63] 32 | - Version [e.g. v1.0] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/workflows/npmpublish.yml: -------------------------------------------------------------------------------- 1 | name: Node.js Package 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | push: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v1 16 | - uses: actions/setup-node@v1 17 | with: 18 | node-version: 12 19 | - run: npm ci 20 | - run: npm test 21 | 22 | publish-npm: 23 | needs: build 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v1 27 | - uses: actions/setup-node@v1 28 | with: 29 | node-version: 12 30 | registry-url: https://registry.npmjs.org/ 31 | - run: npm publish 32 | env: 33 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 34 | 35 | publish-gpr: 36 | needs: build 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@v1 40 | - uses: actions/setup-node@v1 41 | with: 42 | node-version: 12 43 | registry-url: https://npm.pkg.github.com/ 44 | scope: '@arguiot' 45 | - run: npm publish 46 | env: 47 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,macos,bower,jekyll,windows 3 | 4 | ### Bower ### 5 | bower_components 6 | .bower-cache 7 | .bower-registry 8 | .bower-tmp 9 | 10 | ### Jekyll ### 11 | _site/ 12 | .sass-cache/ 13 | .jekyll-metadata 14 | 15 | ### macOS ### 16 | *.DS_Store 17 | .AppleDouble 18 | .LSOverride 19 | *.config 20 | # Icon must end with two \r 21 | Icon 22 | 23 | # Thumbnails 24 | ._* 25 | 26 | # Files that might appear in the root of a volume 27 | .DocumentRevisions-V100 28 | .fseventsd 29 | .Spotlight-V100 30 | .TemporaryItems 31 | .Trashes 32 | .VolumeIcon.icns 33 | .com.apple.timemachine.donotpresent 34 | 35 | # Directories potentially created on remote AFP share 36 | .AppleDB 37 | .AppleDesktop 38 | Network Trash Folder 39 | Temporary Items 40 | .apdisk 41 | 42 | ### Node ### 43 | # Logs 44 | logs 45 | *.log 46 | npm-debug.log* 47 | yarn-debug.log* 48 | yarn-error.log* 49 | 50 | # Runtime data 51 | pids 52 | *.pid 53 | *.seed 54 | *.pid.lock 55 | 56 | # Directory for instrumented libs generated by jscoverage/JSCover 57 | lib-cov 58 | 59 | # Coverage directory used by tools like istanbul 60 | coverage 61 | 62 | # nyc test coverage 63 | .nyc_output 64 | 65 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 66 | .grunt 67 | 68 | # Bower dependency directory (https://bower.io/) 69 | 70 | # node-waf configuration 71 | .lock-wscript 72 | 73 | # Compiled binary addons (http://nodejs.org/api/addons.html) 74 | build/Release 75 | 76 | # Dependency directories 77 | node_modules/ 78 | jspm_packages/ 79 | 80 | # Typescript v1 declaration files 81 | typings/ 82 | 83 | # Optional npm cache directory 84 | .npm 85 | 86 | # Optional eslint cache 87 | .eslintcache 88 | 89 | # Optional REPL history 90 | .node_repl_history 91 | 92 | # Output of 'npm pack' 93 | *.tgz 94 | 95 | # Yarn Integrity file 96 | .yarn-integrity 97 | 98 | # dotenv environment variables file 99 | .env 100 | 101 | 102 | ### Windows ### 103 | # Windows thumbnail cache files 104 | Thumbs.db 105 | ehthumbs.db 106 | ehthumbs_vista.db 107 | 108 | # Folder config file 109 | Desktop.ini 110 | 111 | # Recycle Bin used on file shares 112 | $RECYCLE.BIN/ 113 | 114 | # Windows Installer files 115 | *.cab 116 | *.msi 117 | *.msm 118 | *.msp 119 | 120 | # Windows shortcuts 121 | *.lnk 122 | 123 | # End of https://www.gitignore.io/api/node,macos,bower,jekyll,windows 124 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | @arguiot:registry=https://npm.pkg.github.com/ 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/**/*.min.js 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "lts/*" 4 | - "8" 5 | env: 6 | - ENV=CI 7 | 8 | before_install: 9 | - npm install -g npm@latest 10 | 11 | install: 12 | - npm install 13 | 14 | script: 15 | - npm run test 16 | 17 | notifications: 18 | email: false 19 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2018 Arthur Guiot 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Logo

TheoremJS

2 | A Math framework for computation in JavaScript 3 | 4 | [![GitHub release](https://img.shields.io/github/release/arguiot/TheoremJS.svg)](https://github.com/arguiot/TheoremJS/releases) 5 | [![cdnjs release](https://img.shields.io/cdnjs/v/TheoremJS.svg)](https://cdnjs.com/libraries/TheoremJS/) 6 | [![Build Status](https://travis-ci.org/arguiot/TheoremJS.svg?branch=master)](https://travis-ci.org/arguiot/TheoremJS) 7 | [![Github All Releases](https://img.shields.io/github/downloads/arguiot/TheoremJS/total.svg)](https://github.com/arguiot/TheoremJS/) 8 | [![npm](https://img.shields.io/npm/dt/theorem.js.svg)](https://www.npmjs.com/package/theorem.js) 9 | [![License](https://img.shields.io/github/license/arguiot/TheoremJS.svg)](LICENSE) 10 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Farguiot%2FTheoremJS.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Farguiot%2FTheoremJS?ref=badge_shield) 11 |
12 | 13 | 14 | TheoremJS is a mathematical framework that is packed up with tons of useful mathematical functions. It is composed of functions in most mathematical fields such as algebra, number theory, statistics, etc... It was designed to fit your need, whatever you are trying to do. 15 | 16 | # Getting Started 17 | 18 | Type the following command in a terminal 19 | 20 | ```bash 21 | [sudo] npm i theorem.js 22 | ``` 23 | 24 | Then open your favorite code editor: 25 | 26 | ```javascript 27 | const t = require("theorem.js"); 28 | /* Start coding here */ 29 | ``` 30 | 31 | # Documentation 32 | The documentation can be found [here](https://github.com/arguiot/TheoremJS/wiki) 33 | 34 | # Project using TheoremJS 35 | - [Descartes](https://github.com/arguiot/Descartes) 36 | 37 | # Versioning 38 | 39 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/arguiot/TheoremJS/tags). 40 | 41 | # Authors 42 | 43 | - **Arthur Guiot** - _Initial work_ - [@arguiot](https://github.com/arguiot) 44 | 45 | Also look at the list of [contributors](https://github.com/arguiot/TheoremJS/contributors) who participated in this project. If you don't code but you have great ideas, don't hesitate to write your idea in the issue part. If your idea is accepted, I will add you to this list 😊. 46 | 47 | # License 48 | 49 | This project is licensed under the MIT License - see the file for details 50 | 51 | Copyright © 2017 - 2018 Arthur Guiot All Rights Reserved. 52 | 53 | 54 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Farguiot%2FTheoremJS.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Farguiot%2FTheoremJS?ref=badge_large) -------------------------------------------------------------------------------- /__test__/browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

TheoremJS - Tests

9 | 10 | 11 | 12 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /__test__/browser.js: -------------------------------------------------------------------------------- 1 | eye.test("Browser", "browser", path.join(__testDir, "browser.html")) 2 | -------------------------------------------------------------------------------- /docs/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_size = 4 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /docs/.gitattributes: -------------------------------------------------------------------------------- 1 | ## GITATTRIBUTES FOR WEB PROJECTS 2 | # 3 | # These settings are for any web project. 4 | # 5 | # Details per file setting: 6 | # text These files should be normalized (i.e. convert CRLF to LF). 7 | # binary These files are binary and should be left untouched. 8 | # 9 | # Note that binary is a macro for -text -diff. 10 | ###################################################################### 11 | 12 | ## AUTO-DETECT 13 | ## Handle line endings automatically for files detected as 14 | ## text and leave all files detected as binary untouched. 15 | ## This will handle all files NOT defined below. 16 | * text=auto 17 | 18 | ## SOURCE CODE 19 | *.bat text eol=crlf 20 | *.coffee text 21 | *.css text 22 | *.htm text 23 | *.html text 24 | *.inc text 25 | *.ini text 26 | *.js text 27 | *.json text 28 | *.jsx text 29 | *.less text 30 | *.od text 31 | *.onlydata text 32 | *.php text 33 | *.pl text 34 | *.py text 35 | *.rb text 36 | *.sass text 37 | *.scm text 38 | *.scss text 39 | *.sh text eol=lf 40 | *.sql text 41 | *.styl text 42 | *.tag text 43 | *.ts text 44 | *.tsx text 45 | *.xml text 46 | *.xhtml text 47 | 48 | ## DOCKER 49 | *.dockerignore text 50 | Dockerfile text 51 | 52 | ## DOCUMENTATION 53 | *.markdown text 54 | *.md text 55 | *.mdwn text 56 | *.mdown text 57 | *.mkd text 58 | *.mkdn text 59 | *.mdtxt text 60 | *.mdtext text 61 | *.txt text 62 | AUTHORS text 63 | CHANGELOG text 64 | CHANGES text 65 | CONTRIBUTING text 66 | COPYING text 67 | copyright text 68 | *COPYRIGHT* text 69 | INSTALL text 70 | license text 71 | LICENSE text 72 | NEWS text 73 | readme text 74 | *README* text 75 | TODO text 76 | 77 | ## TEMPLATES 78 | *.dot text 79 | *.ejs text 80 | *.haml text 81 | *.handlebars text 82 | *.hbs text 83 | *.hbt text 84 | *.jade text 85 | *.latte text 86 | *.mustache text 87 | *.njk text 88 | *.phtml text 89 | *.tmpl text 90 | *.tpl text 91 | *.twig text 92 | 93 | ## LINTERS 94 | .csslintrc text 95 | .eslintrc text 96 | .htmlhintrc text 97 | .jscsrc text 98 | .jshintrc text 99 | .jshintignore text 100 | .stylelintrc text 101 | 102 | ## CONFIGS 103 | *.bowerrc text 104 | *.cnf text 105 | *.conf text 106 | *.config text 107 | .browserslistrc text 108 | .editorconfig text 109 | .gitattributes text 110 | .gitconfig text 111 | .gitignore text 112 | .htaccess text 113 | *.npmignore text 114 | *.yaml text 115 | *.yml text 116 | browserslist text 117 | Makefile text 118 | makefile text 119 | 120 | ## HEROKU 121 | Procfile text 122 | .slugignore text 123 | 124 | ## GRAPHICS 125 | *.ai binary 126 | *.bmp binary 127 | *.eps binary 128 | *.gif binary 129 | *.ico binary 130 | *.jng binary 131 | *.jp2 binary 132 | *.jpg binary 133 | *.jpeg binary 134 | *.jpx binary 135 | *.jxr binary 136 | *.pdf binary 137 | *.png binary 138 | *.psb binary 139 | *.psd binary 140 | *.svg text 141 | *.svgz binary 142 | *.tif binary 143 | *.tiff binary 144 | *.wbmp binary 145 | *.webp binary 146 | 147 | ## AUDIO 148 | *.kar binary 149 | *.m4a binary 150 | *.mid binary 151 | *.midi binary 152 | *.mp3 binary 153 | *.ogg binary 154 | *.ra binary 155 | 156 | ## VIDEO 157 | *.3gpp binary 158 | *.3gp binary 159 | *.as binary 160 | *.asf binary 161 | *.asx binary 162 | *.fla binary 163 | *.flv binary 164 | *.m4v binary 165 | *.mng binary 166 | *.mov binary 167 | *.mp4 binary 168 | *.mpeg binary 169 | *.mpg binary 170 | *.ogv binary 171 | *.swc binary 172 | *.swf binary 173 | *.webm binary 174 | 175 | ## ARCHIVES 176 | *.7z binary 177 | *.gz binary 178 | *.jar binary 179 | *.rar binary 180 | *.tar binary 181 | *.zip binary 182 | 183 | ## FONTS 184 | *.ttf binary 185 | *.eot binary 186 | *.otf binary 187 | *.woff binary 188 | *.woff2 binary 189 | 190 | ## EXECUTABLES 191 | *.exe binary 192 | *.pyc binary 193 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Include your project-specific ignores in this file 2 | # Read about how to use .gitignore: https://help.github.com/articles/ignoring-files 3 | # Useful .gitignore templates: https://github.com/github/gitignore 4 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page Not Found 6 | 7 | 54 | 55 | 56 |

Page Not Found

57 |

Sorry, but the page you were trying to view does not exist.

58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | theorem.js.org -------------------------------------------------------------------------------- /docs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) HTML5 Boilerplate 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /docs/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/desc/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_size = 4 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /docs/desc/.gitattributes: -------------------------------------------------------------------------------- 1 | ## GITATTRIBUTES FOR WEB PROJECTS 2 | # 3 | # These settings are for any web project. 4 | # 5 | # Details per file setting: 6 | # text These files should be normalized (i.e. convert CRLF to LF). 7 | # binary These files are binary and should be left untouched. 8 | # 9 | # Note that binary is a macro for -text -diff. 10 | ###################################################################### 11 | 12 | ## AUTO-DETECT 13 | ## Handle line endings automatically for files detected as 14 | ## text and leave all files detected as binary untouched. 15 | ## This will handle all files NOT defined below. 16 | * text=auto 17 | 18 | ## SOURCE CODE 19 | *.bat text eol=crlf 20 | *.coffee text 21 | *.css text 22 | *.htm text 23 | *.html text 24 | *.inc text 25 | *.ini text 26 | *.js text 27 | *.json text 28 | *.jsx text 29 | *.less text 30 | *.od text 31 | *.onlydata text 32 | *.php text 33 | *.pl text 34 | *.py text 35 | *.rb text 36 | *.sass text 37 | *.scm text 38 | *.scss text 39 | *.sh text eol=lf 40 | *.sql text 41 | *.styl text 42 | *.tag text 43 | *.ts text 44 | *.tsx text 45 | *.xml text 46 | *.xhtml text 47 | 48 | ## DOCKER 49 | *.dockerignore text 50 | Dockerfile text 51 | 52 | ## DOCUMENTATION 53 | *.markdown text 54 | *.md text 55 | *.mdwn text 56 | *.mdown text 57 | *.mkd text 58 | *.mkdn text 59 | *.mdtxt text 60 | *.mdtext text 61 | *.txt text 62 | AUTHORS text 63 | CHANGELOG text 64 | CHANGES text 65 | CONTRIBUTING text 66 | COPYING text 67 | copyright text 68 | *COPYRIGHT* text 69 | INSTALL text 70 | license text 71 | LICENSE text 72 | NEWS text 73 | readme text 74 | *README* text 75 | TODO text 76 | 77 | ## TEMPLATES 78 | *.dot text 79 | *.ejs text 80 | *.haml text 81 | *.handlebars text 82 | *.hbs text 83 | *.hbt text 84 | *.jade text 85 | *.latte text 86 | *.mustache text 87 | *.njk text 88 | *.phtml text 89 | *.tmpl text 90 | *.tpl text 91 | *.twig text 92 | 93 | ## LINTERS 94 | .csslintrc text 95 | .eslintrc text 96 | .htmlhintrc text 97 | .jscsrc text 98 | .jshintrc text 99 | .jshintignore text 100 | .stylelintrc text 101 | 102 | ## CONFIGS 103 | *.bowerrc text 104 | *.cnf text 105 | *.conf text 106 | *.config text 107 | .browserslistrc text 108 | .editorconfig text 109 | .gitattributes text 110 | .gitconfig text 111 | .gitignore text 112 | .htaccess text 113 | *.npmignore text 114 | *.yaml text 115 | *.yml text 116 | browserslist text 117 | Makefile text 118 | makefile text 119 | 120 | ## HEROKU 121 | Procfile text 122 | .slugignore text 123 | 124 | ## GRAPHICS 125 | *.ai binary 126 | *.bmp binary 127 | *.eps binary 128 | *.gif binary 129 | *.ico binary 130 | *.jng binary 131 | *.jp2 binary 132 | *.jpg binary 133 | *.jpeg binary 134 | *.jpx binary 135 | *.jxr binary 136 | *.pdf binary 137 | *.png binary 138 | *.psb binary 139 | *.psd binary 140 | *.svg text 141 | *.svgz binary 142 | *.tif binary 143 | *.tiff binary 144 | *.wbmp binary 145 | *.webp binary 146 | 147 | ## AUDIO 148 | *.kar binary 149 | *.m4a binary 150 | *.mid binary 151 | *.midi binary 152 | *.mp3 binary 153 | *.ogg binary 154 | *.ra binary 155 | 156 | ## VIDEO 157 | *.3gpp binary 158 | *.3gp binary 159 | *.as binary 160 | *.asf binary 161 | *.asx binary 162 | *.fla binary 163 | *.flv binary 164 | *.m4v binary 165 | *.mng binary 166 | *.mov binary 167 | *.mp4 binary 168 | *.mpeg binary 169 | *.mpg binary 170 | *.ogv binary 171 | *.swc binary 172 | *.swf binary 173 | *.webm binary 174 | 175 | ## ARCHIVES 176 | *.7z binary 177 | *.gz binary 178 | *.jar binary 179 | *.rar binary 180 | *.tar binary 181 | *.zip binary 182 | 183 | ## FONTS 184 | *.ttf binary 185 | *.eot binary 186 | *.otf binary 187 | *.woff binary 188 | *.woff2 binary 189 | 190 | ## EXECUTABLES 191 | *.exe binary 192 | *.pyc binary 193 | -------------------------------------------------------------------------------- /docs/desc/.gitignore: -------------------------------------------------------------------------------- 1 | # Include your project-specific ignores in this file 2 | # Read about how to use .gitignore: https://help.github.com/articles/ignoring-files 3 | # Useful .gitignore templates: https://github.com/github/gitignore 4 | -------------------------------------------------------------------------------- /docs/desc/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page Not Found 6 | 7 | 54 | 55 | 56 |

Page Not Found

57 |

Sorry, but the page you were trying to view does not exist.

58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/desc/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) HTML5 Boilerplate 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /docs/desc/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/desc/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/desc/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/desc/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/desc/config.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "type": "github", 3 | "title": "Descartes", 4 | "url": "https://github.com/arguiot/Descartes/wiki", 5 | "logo": "https://arguiot.github.io/Descartes/assets/logo.svg", 6 | "copyright": "Arthur Guiot", 7 | "analytics": "UA-109503398-4" 8 | }] 9 | -------------------------------------------------------------------------------- /docs/desc/css/main.css: -------------------------------------------------------------------------------- 1 | /*! HTML5 Boilerplate v6.0.1 | MIT License | https://html5boilerplate.com/ */html{color:#222;font-size:1em;line-height:1.4}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,iframe,img,svg,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.browserupgrade{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}body{overflow-x:hidden}.sidebar{position:fixed;top:0;left:-290px;width:300px;height:100vh;background:transparent;-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;overflow-x:hidden;overflow-y:hidden;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size:16px;line-height:1.5;word-wrap:break-word;padding:20px}@media (min-width: 500px){.sidebar:hover{position:fixed;left:0px;width:300px;background:#333;z-index:10;overflow-y:scroll}.sidebar:hover+.arrow{-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;left:300px;background:transparent}}.hovered{position:fixed;left:0px;width:300px;background:#333;z-index:10;overflow-y:scroll}.sidebar ul>li{color:white}.sidebar ul>li>a{color:white;text-decoration:none}.sidebar ul>li>a:hover{cursor:pointer;text-decoration:underline}.anchor{display:none}.arrow{width:50px;height:50px;background:#333;color:white;position:fixed;left:0;top:calc(50vh - 25px);z-index:-100;text-align:center;line-height:50px}.hovered+arrow{-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;left:300px;background:transparent}.copyright{font-family:'Roboto', sans-serif;width:100vw;text-align:center;color:#616161;margin-bottom:30px}.copyright:hover{text-decoration:underline;cursor:pointer}.copyright-side{font-family:'Roboto', sans-serif;color:#616161;margin-bottom:30px}.title{width:100vw;text-align:center;height:80px;position:fixed;top:0;font-weight:normal;font-size:32px;line-height:80px;word-wrap:break-word;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";background:#fff;border-bottom:1px solid #eee}.img{width:150px;max-height:150px}.content{width:calc(90vw - 100px);max-width:800px;margin:0 auto;margin-top:80px;padding:50px;word-wrap:break-word}.hidden{display:none !important}.visuallyhidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;-webkit-clip-path:none;clip-path:none;height:auto;margin:0;overflow:visible;position:static;width:auto;white-space:inherit}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}@media print{*,*:before,*:after{background:transparent !important;color:#000 !important;-webkit-box-shadow:none !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre{white-space:pre-wrap !important}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}} 2 | -------------------------------------------------------------------------------- /docs/desc/css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:0.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none} 2 | -------------------------------------------------------------------------------- /docs/desc/doc/TOC.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) 2 | 3 | ## Getting started 4 | 5 | * [Usage](usage.md) — Overview of the project contents. 6 | * [FAQ](faq.md) — Frequently asked questions along with their answers. 7 | 8 | ## HTML5 Boilerplate core 9 | 10 | * [HTML](html.md) — Guide to the default HTML. 11 | * [CSS](css.md) — Guide to the default CSS. 12 | * [JavaScript](js.md) — Guide to the default JavaScript. 13 | * [Everything else](misc.md). 14 | 15 | ## Development 16 | 17 | * [Extending and customizing HTML5 Boilerplate](extend.md) — Going further 18 | with the boilerplate. 19 | 20 | ## Related projects 21 | 22 | The [H5BP organization](https://github.com/h5bp) maintains several projects 23 | that complement HTML5 Boilerplate, projects that can help you improve different 24 | aspects of your website/web app (e.g.: the performance, security, etc.). 25 | 26 | * [Server Configs](https://github.com/h5bp/server-configs) — Fast and 27 | smart configurations for web servers such as Apache and Nginx. 28 | * [Apache](https://github.com/h5bp/server-configs-apache) 29 | * [Google App Engine (GAE)](https://github.com/h5bp/server-configs-gae) 30 | * [Internet Information Services (IIS)](https://github.com/h5bp/server-configs-iis) 31 | * [lighttpd](https://github.com/h5bp/server-configs-lighttpd) 32 | * [Nginx](https://github.com/h5bp/server-configs-nginx) 33 | * [Node.js](https://github.com/h5bp/server-configs-node) 34 | * [Ant Build Script](https://github.com/h5bp/ant-build-script) — Apache 35 | Ant based build script. 36 | -------------------------------------------------------------------------------- /docs/desc/doc/faq.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Frequently asked questions 5 | 6 | * [Why is the Google Analytics code at the bottom? Google recommends it be 7 | placed in the ``.](#why-is-the-google-analytics-code-at-the-bottom-google-recommends-it-be-placed-in-the-head) 8 | * [How can I integrate Bootstrap with HTML5 9 | Boilerplate?](#how-can-i-integrate-bootstrap-with-html5-boilerplate) 10 | * [Do I need to upgrade my site each time a new version of HTML5 Boilerplate is 11 | released?](#do-i-need-to-upgrade-my-site-each-time-a-new-version-of-html5-boilerplate-is-released) 12 | * [Where can I get help with support 13 | questions?](#where-can-i-get-help-with-support-questions) 14 | 15 | --- 16 | 17 | ### Why is the Google Analytics code at the bottom? Google recommends it be placed in the ``. 18 | 19 | The main advantage of placing it in the `` is that you will track the 20 | user's `pageview` even if they leave the page before it has been fully loaded. 21 | 22 | Here's a handy quote from [Mathias Bynens](https://mathiasbynens.be/notes/async-analytics-snippet#comment-50) about our placement choice. 23 | >I should point out that it’s Google — not me — recommending to place this 24 | script before all other scripts in the document. The only real advantage is to 25 | catch a pageView call if your page fails to load completely (for example, if 26 | the user aborts loading, or quickly closes the page, etc.). Personally, I 27 | wouldn’t count that as a page view, so I actually prefer to place this script 28 | at the bottom, after all other scripts. This keeps all the scripts together and 29 | reinforces that scripts at the bottom are the right move. (Usually I 30 | concatenate and minify all my scripts into one .js file — the GA snippet being 31 | the suffix.) 32 | 33 | ### How can I integrate [Bootstrap](https://getbootstrap.com/) with HTML5 Boilerplate? 34 | 35 | Here's Nicolas Gallagher writing about how [HTML5 Boilerplate and Bootstrap complement each 36 | other](https://www.quora.com/Is-Bootstrap-a-complement-or-an-alternative-to-HTML5-Boilerplate-or-viceversa/answer/Nicolas-Gallagher). 37 | 38 | ### Do I need to upgrade my site each time a new version of HTML5 Boilerplate is released? 39 | 40 | No, same as you don't normally replace the foundation of a house once it 41 | was built. However, there is nothing stopping you from trying to work in the 42 | latest changes, but you'll have to assess the costs/benefits of doing so. 43 | 44 | ### Where can I get help with support questions? 45 | 46 | Please ask for help on 47 | [StackOverflow](https://stackoverflow.com/questions/tagged/html5boilerplate). 48 | -------------------------------------------------------------------------------- /docs/desc/doc/js.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # The JavaScript 5 | 6 | Information about the default JavaScript included in the project. 7 | 8 | ## main.js 9 | 10 | This file can be used to contain or reference your site/app JavaScript code. 11 | If you're working on something more advanced you might replace this file 12 | entirely. That's cool. 13 | 14 | ## plugins.js 15 | 16 | This file can be used to contain all your plugins, such as jQuery plugins and 17 | other 3rd party scripts for a simple site. 18 | 19 | One approach is to put jQuery plugins inside of a `(function($){ ... 20 | })(jQuery);` closure to make sure they're in the jQuery namespace safety 21 | blanket. Read more about [jQuery plugin 22 | authoring](https://learn.jquery.com/plugins/#Getting_Started). 23 | 24 | By default the `plugins.js` file contains a small script to avoid `console` 25 | errors in browsers that lack a `console`. The script will make sure that, if 26 | a console method isn't available, that method will have the value of empty 27 | function, thus, preventing the browser from throwing an error. 28 | 29 | ## vendor 30 | 31 | This directory can be used to contain all 3rd party library code. 32 | 33 | Minified versions of the latest jQuery and Modernizr libraries are included by 34 | default. You may wish to create your own [custom Modernizr 35 | build with the online builder](https://www.modernizr.com/download/) or [command 36 | line tool](https://modernizr.com/docs#command-line-config). 37 | -------------------------------------------------------------------------------- /docs/desc/doc/usage.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Usage 5 | 6 | The most basic usage of HTML5 Boilerplate is to create a static site or simple 7 | app. Once you've downloaded or cloned the project, that process looks something 8 | like this: 9 | 10 | 1. Set up the basic structure of the site. 11 | 2. Add some content, style, and functionality. 12 | 3. Run your site locally to see how it looks. 13 | 4. Deploy your site. 14 | 15 | Cool, right? _It is_. That said, the smart defaults, baseline elements, default 16 | attribute values and various other utilities that HTML5 Boilerplate offers can 17 | serve as the foundation for whatever you're interested in building. 18 | 19 | Even the basic use-case of a simple static site can be enhanced by manipulating 20 | the code through an automated build process. Moving up in complexity HTML5 21 | Boilerplate can be be integrated with whatever front-end framework, CMS or 22 | e-commerce platform you're working with. Mix-and-match to your heart's content. 23 | Use what you need (toss it in a blender if you need to) and discard the rest. 24 | HTML5 Boilerplate is a starting point, not a destination. 25 | 26 | ## Basic structure 27 | 28 | A basic HTML5 Boilerplate site initially looks something like this: 29 | 30 | ``` 31 | . 32 | ├── css 33 | │ ├── main.css 34 | │ └── normalize.css 35 | ├── doc 36 | ├── img 37 | ├── js 38 | │ ├── main.js 39 | │ ├── plugins.js 40 | │ └── vendor 41 | │ ├── jquery.min.js 42 | │ └── modernizr.min.js 43 | ├── .editorconfig 44 | ├── .htaccess 45 | ├── 404.html 46 | ├── browserconfig.xml 47 | ├── favicon.ico 48 | ├── humans.txt 49 | ├── icon.png 50 | ├── index.html 51 | ├── robots.txt 52 | ├── site.webmanifest 53 | ├── tile.png 54 | └── tile-wide.png 55 | ``` 56 | 57 | What follows is a general overview of each major part and how to use them. 58 | 59 | ### css 60 | 61 | This directory should contain all your project's CSS files. It includes some 62 | initial CSS to help get you started from a solid foundation. [About the 63 | CSS](css.md). 64 | 65 | ### doc 66 | 67 | This directory contains all the HTML5 Boilerplate documentation. You can use it 68 | as the location and basis for your own project's documentation. 69 | 70 | ### js 71 | 72 | This directory should contain all your project's JS files. Libraries, plugins, 73 | and custom code can all be included here. It includes some initial JS to help 74 | get you started. [About the JavaScript](js.md). 75 | 76 | ### .htaccess 77 | 78 | The default web server configs are for Apache. For more information, please 79 | refer to the [Apache Server Configs 80 | repository](https://github.com/h5bp/server-configs-apache). 81 | 82 | Host your site on a server other than Apache? You're likely to find the 83 | corresponding server configs project listed in our [Server Configs 84 | ](https://github.com/h5bp/server-configs/blob/master/README.md) repository. 85 | 86 | ### 404.html 87 | 88 | A helpful custom 404 to get you started. 89 | 90 | ### browserconfig.xml 91 | 92 | This file contains all settings regarding custom tiles for IE11 and Edge. 93 | 94 | For more info on this topic, please refer to 95 | [MSDN](https://msdn.microsoft.com/library/dn455106.aspx). 96 | 97 | ### .editorconfig 98 | 99 | The `.editorconfig` file is provided in order to encourage and help you and 100 | your team to maintain consistent coding styles between different 101 | editors and IDEs. [Read more about the `.editorconfig` file](misc.md#editorconfig). 102 | 103 | ### index.html 104 | 105 | This is the default HTML skeleton that should form the basis of all pages on 106 | your site. If you are using a server-side templating framework, then you will 107 | need to integrate this starting HTML with your setup. 108 | 109 | Make sure that you update the URLs for the referenced CSS and JavaScript if you 110 | modify the directory structure at all. 111 | 112 | If you are using Google Universal Analytics, make sure that you edit the 113 | corresponding snippet at the bottom to include your analytics ID. 114 | 115 | ### humans.txt 116 | 117 | Edit this file to include the team that worked on your site/app, and the 118 | technology powering it. 119 | 120 | ### robots.txt 121 | 122 | Edit this file to include any pages you need hidden from search engines. 123 | 124 | ### Icons 125 | 126 | Replace the default `favicon.ico`, `tile.png`, `tile-wide.png` and Apple 127 | Touch Icon with your own. 128 | 129 | If you want to use different Apple Touch Icons for different resolutions please 130 | refer to the [according documentation](extend.md#apple-touch-icons). 131 | -------------------------------------------------------------------------------- /docs/desc/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/favicon-16x16.png -------------------------------------------------------------------------------- /docs/desc/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/favicon-32x32.png -------------------------------------------------------------------------------- /docs/desc/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/favicon.ico -------------------------------------------------------------------------------- /docs/desc/humans.txt: -------------------------------------------------------------------------------- 1 | # humanstxt.org/ 2 | # The humans responsible & technology colophon 3 | 4 | # TEAM 5 | 6 | -- -- 7 | 8 | # THANKS 9 | 10 | 11 | 12 | # TECHNOLOGY COLOPHON 13 | 14 | CSS3, HTML5 15 | Apache Server Configs, jQuery, Modernizr, Normalize.css 16 | -------------------------------------------------------------------------------- /docs/desc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/icon.png -------------------------------------------------------------------------------- /docs/desc/img/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/img/.gitignore -------------------------------------------------------------------------------- /docs/desc/img/load.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 10 | 11 | 12 | 18 | 19 | 20 | 26 | 27 | -------------------------------------------------------------------------------- /docs/desc/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/img/logo.png -------------------------------------------------------------------------------- /docs/desc/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | Final logo 3 | Created using Figma 4 | 5 | 6 | 7 | 8 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/desc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 35 |
36 | > 37 |
38 |
Loading...
39 |
40 |
Loading...
41 |
42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/desc/js/main.js: -------------------------------------------------------------------------------- 1 | "use strict";function load(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if($.html(".title","Loading..."),$.html(".content",'
Loading...
'),!1===configLoaded)fetch("config.json").then(function(e){return e.json()}).then(function(e){if(e=e[0],config=e,configLoaded=!0,$.html("head>title",e.title),"wiki"==e.type||"github"==e.type){var t=document.createElement("a");t.href=window.location,load(e.url+"/"+t.hash.split("#")[1]),side(e.logo,e.copyright)}else if($.html(".sidebar","
    "),e.hasOwnProperty("paths")){dataPaths=e.paths;var n=document.createElement("a");n.href=window.location,load(Object.values(e.paths)[parseInt(n.hash.split("#")[1])<0||isNaN(parseInt(n.hash.split("#")[1]))?0:parseInt(n.hash.split("#")[1])]),side(e.logo,e.copyright)}e.hasOwnProperty("analytics")&&(!function(e,t,n,i,a,o,r){e.GoogleAnalyticsObject=a,e[a]=e[a]||function(){(e[a].q=e[a].q||[]).push(arguments)},e[a].l=1*new Date,o=t.createElement(n),r=t.getElementsByTagName(n)[0],o.async=1,o.src=i,r.parentNode.insertBefore(o,r)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create",e.analytics,"auto"),ga("send","pageview")),listener()});else if(/github.com/.test(e))fetch("https://cors-anywhere.herokuapp.com/"+e,{header:new Headers({Accept:"*"})}).then(function(e){return e.text()}).then(function(e){var t=new DOMParser,n=t.parseFromString(e,"text/html"),i=n.querySelectorAll(".markdown-body");$.html(".title",n.querySelector(".gh-header-title").innerHTML),$.html(".sidebar",i[0].innerHTML),$.html(".content",i[1].innerHTML),side(config.logo,config.copyright)});else if($.html(".sidebar","
      "),config.hasOwnProperty("paths")){for(var t in config.paths)$.single(".sidebar>ul").innerHTML+='
    • '+t+"
    • ";$.html(".title",Object.keys(config.paths)[Object.values(config.paths).indexOf(e)]),render(e),side(config.logo,config.copyright)}listener()}function side(e,t){void 0!=e&&(console.log(),$.single(".sidebar").innerHTML='\n\t\t
      \n\t\t\tLogo\n\t\t
      \n\t\t'+$.single(".sidebar").innerHTML,$.single(".sidebar").innerHTML+='\n\t\t
      \n\t\t\t\n\t\t
      \n\t\t"),listener()}function listener(){$.all(".sidebar ul>li>a",function(e){$.on(e,"click",function(e){if(e.preventDefault(),config.hasOwnProperty("paths")){var t=Object.keys(dataPaths).indexOf(e.target.innerHTML);window.location="#"+t,load(Object.values(dataPaths)[t])}else window.location="#"+("a"!=e.target.tagName.toLowerCase()?e.target.parentNode.href.split("/").slice(-1)[0]:e.target.href.split("/").slice(-1)[0]),load("a"!=e.target.tagName.toLowerCase()?e.target.parentNode.href:e.target.href);listener()})})}function render(e){var t=new showdown.Converter;fetch(e).then(function(e){return e.text()}).then(function(e){var n=t.makeHtml(e);$.html(".content",n)})}var $=new DisplayJS(window);$.on(".copyright","click",function(){window.location="https://kiwidocs.js.org"}),$.on(".arrow","click",function(){$.toggleClass(".sidebar","hovered")}),$.on(".sidebar","click",function(){$.toggleClass(".sidebar","hovered")});var configLoaded=!1,config=[],dataPaths=[];load(),listener(); 2 | -------------------------------------------------------------------------------- /docs/desc/js/plugins.js: -------------------------------------------------------------------------------- 1 | !function(){for(var e,n=function(){},o=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeline","timelineEnd","timeStamp","trace","warn"],i=o.length,r=window.console=window.console||{};i--;)e=o[i],r[e]||(r[e]=n)}(); -------------------------------------------------------------------------------- /docs/desc/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/mstile-150x150.png -------------------------------------------------------------------------------- /docs/desc/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | 3 | # Allow crawling of all content 4 | User-agent: * 5 | Disallow: 6 | -------------------------------------------------------------------------------- /docs/desc/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 39 | 44 | 48 | 52 | 57 | 60 | 63 | 68 | 73 | 76 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/desc/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "icons": [{ 3 | "src": "icon.png", 4 | "sizes": "192x192", 5 | "type": "image/png" 6 | }], 7 | "start_url": "/" 8 | } 9 | -------------------------------------------------------------------------------- /docs/desc/tile-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/tile-wide.png -------------------------------------------------------------------------------- /docs/desc/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/desc/tile.png -------------------------------------------------------------------------------- /docs/doc/TOC.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) 2 | 3 | ## Getting started 4 | 5 | * [Usage](usage.md) — Overview of the project contents. 6 | * [FAQ](faq.md) — Frequently asked questions along with their answers. 7 | 8 | ## HTML5 Boilerplate core 9 | 10 | * [HTML](html.md) — Guide to the default HTML. 11 | * [CSS](css.md) — Guide to the default CSS. 12 | * [JavaScript](js.md) — Guide to the default JavaScript. 13 | * [Everything else](misc.md). 14 | 15 | ## Development 16 | 17 | * [Extending and customizing HTML5 Boilerplate](extend.md) — Going further 18 | with the boilerplate. 19 | 20 | ## Related projects 21 | 22 | The [H5BP organization](https://github.com/h5bp) maintains several projects 23 | that complement HTML5 Boilerplate, projects that can help you improve different 24 | aspects of your website/web app (e.g.: the performance, security, etc.). 25 | 26 | * [Server Configs](https://github.com/h5bp/server-configs) — Fast and 27 | smart configurations for web servers such as Apache and Nginx. 28 | * [Apache](https://github.com/h5bp/server-configs-apache) 29 | * [Google App Engine (GAE)](https://github.com/h5bp/server-configs-gae) 30 | * [Internet Information Services (IIS)](https://github.com/h5bp/server-configs-iis) 31 | * [lighttpd](https://github.com/h5bp/server-configs-lighttpd) 32 | * [Nginx](https://github.com/h5bp/server-configs-nginx) 33 | * [Node.js](https://github.com/h5bp/server-configs-node) 34 | * [Ant Build Script](https://github.com/h5bp/ant-build-script) — Apache 35 | Ant based build script. 36 | -------------------------------------------------------------------------------- /docs/doc/faq.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Frequently asked questions 5 | 6 | * [Why is the Google Analytics code at the bottom? Google recommends it be 7 | placed in the ``.](#why-is-the-google-analytics-code-at-the-bottom-google-recommends-it-be-placed-in-the-head) 8 | * [How can I integrate Bootstrap with HTML5 9 | Boilerplate?](#how-can-i-integrate-bootstrap-with-html5-boilerplate) 10 | * [Do I need to upgrade my site each time a new version of HTML5 Boilerplate is 11 | released?](#do-i-need-to-upgrade-my-site-each-time-a-new-version-of-html5-boilerplate-is-released) 12 | * [Where can I get help with support 13 | questions?](#where-can-i-get-help-with-support-questions) 14 | 15 | --- 16 | 17 | ### Why is the Google Analytics code at the bottom? Google recommends it be placed in the ``. 18 | 19 | The main advantage of placing it in the `` is that you will track the 20 | user's `pageview` even if they leave the page before it has been fully loaded. 21 | 22 | Here's a handy quote from [Mathias Bynens](https://mathiasbynens.be/notes/async-analytics-snippet#comment-50) about our placement choice. 23 | >I should point out that it’s Google — not me — recommending to place this 24 | script before all other scripts in the document. The only real advantage is to 25 | catch a pageView call if your page fails to load completely (for example, if 26 | the user aborts loading, or quickly closes the page, etc.). Personally, I 27 | wouldn’t count that as a page view, so I actually prefer to place this script 28 | at the bottom, after all other scripts. This keeps all the scripts together and 29 | reinforces that scripts at the bottom are the right move. (Usually I 30 | concatenate and minify all my scripts into one .js file — the GA snippet being 31 | the suffix.) 32 | 33 | ### How can I integrate [Bootstrap](https://getbootstrap.com/) with HTML5 Boilerplate? 34 | 35 | Here's Nicolas Gallagher writing about how [HTML5 Boilerplate and Bootstrap complement each 36 | other](https://www.quora.com/Is-Bootstrap-a-complement-or-an-alternative-to-HTML5-Boilerplate-or-viceversa/answer/Nicolas-Gallagher). 37 | 38 | ### Do I need to upgrade my site each time a new version of HTML5 Boilerplate is released? 39 | 40 | No, same as you don't normally replace the foundation of a house once it 41 | was built. However, there is nothing stopping you from trying to work in the 42 | latest changes, but you'll have to assess the costs/benefits of doing so. 43 | 44 | ### Where can I get help with support questions? 45 | 46 | Please ask for help on 47 | [StackOverflow](https://stackoverflow.com/questions/tagged/html5boilerplate). 48 | -------------------------------------------------------------------------------- /docs/doc/js.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # The JavaScript 5 | 6 | Information about the default JavaScript included in the project. 7 | 8 | ## main.js 9 | 10 | This file can be used to contain or reference your site/app JavaScript code. 11 | If you're working on something more advanced you might replace this file 12 | entirely. That's cool. 13 | 14 | ## plugins.js 15 | 16 | This file can be used to contain all your plugins, such as jQuery plugins and 17 | other 3rd party scripts for a simple site. 18 | 19 | One approach is to put jQuery plugins inside of a `(function($){ ... 20 | })(jQuery);` closure to make sure they're in the jQuery namespace safety 21 | blanket. Read more about [jQuery plugin 22 | authoring](https://learn.jquery.com/plugins/#Getting_Started). 23 | 24 | By default the `plugins.js` file contains a small script to avoid `console` 25 | errors in browsers that lack a `console`. The script will make sure that, if 26 | a console method isn't available, that method will have the value of empty 27 | function, thus, preventing the browser from throwing an error. 28 | 29 | ## vendor 30 | 31 | This directory can be used to contain all 3rd party library code. 32 | 33 | Minified versions of the latest jQuery and Modernizr libraries are included by 34 | default. You may wish to create your own [custom Modernizr 35 | build with the online builder](https://www.modernizr.com/download/) or [command 36 | line tool](https://modernizr.com/docs#command-line-config). 37 | -------------------------------------------------------------------------------- /docs/doc/misc.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Miscellaneous 5 | 6 | * [.gitignore](#gitignore) 7 | * [.editorconfig](#editorconfig) 8 | * [Server Configuration](#server-configuration) 9 | * [robots.txt](#robotstxt) 10 | * [browserconfig.xml](#browserconfigxml) 11 | 12 | -- 13 | 14 | ## .gitignore 15 | 16 | HTML5 Boilerplate includes a basic project-level `.gitignore`. This should 17 | primarily be used to avoid certain project-level files and directories from 18 | being kept under source control. Different development-environments will 19 | benefit from different collections of ignores. 20 | 21 | OS-specific and editor-specific files should be ignored using a "global 22 | ignore" that applies to all repositories on your system. 23 | 24 | For example, add the following to your `~/.gitconfig`, where the `.gitignore` 25 | in your HOME directory contains the files and directories you'd like to 26 | globally ignore: 27 | 28 | ```gitignore 29 | [core] 30 | excludesfile = ~/.gitignore 31 | ``` 32 | 33 | * More on global ignores: https://help.github.com/articles/ignoring-files/ 34 | * Comprehensive set of ignores on GitHub: https://github.com/github/gitignore 35 | 36 | 37 | ## .editorconfig 38 | 39 | The `.editorconfig` file is provided in order to encourage and help you and 40 | your team define and maintain consistent coding styles between different 41 | editors and IDEs. 42 | 43 | By default, `.editorconfig` includes some basic 44 | [properties](http://editorconfig.org/#supported-properties) that reflect the 45 | coding styles from the files provided by default, but you can easily change 46 | them to better suit your needs. 47 | 48 | In order for your editor/IDE to apply the 49 | [properties](http://editorconfig.org/#supported-properties) from the 50 | `.editorconfig` file, you may need to [install a 51 | plugin]( http://editorconfig.org/#download). 52 | 53 | __N.B.__ If you aren't using the server configurations provided by HTML5 54 | Boilerplate, we highly encourage you to configure your server to block 55 | access to `.editorconfig` files, as they can disclose sensitive information! 56 | 57 | For more details, please refer to the [EditorConfig 58 | project](http://editorconfig.org/). 59 | 60 | 61 | ## Server Configuration 62 | 63 | H5BP includes a [`.htaccess`](#htaccess) file for the [Apache HTTP 64 | server](https://httpd.apache.org/docs/). If you are not using Apache 65 | as your web server, then you are encouraged to download a 66 | [server configuration](https://github.com/h5bp/server-configs) that 67 | corresponds to your web server and environment. 68 | 69 | A `.htaccess` (hypertext access) file is an [Apache HTTP server 70 | configuration file](https://github.com/h5bp/server-configs-apache). 71 | The `.htaccess` file is mostly used for: 72 | 73 | * Rewriting URLs 74 | * Controlling cache 75 | * Authentication 76 | * Server-side includes 77 | * Redirects 78 | * Gzipping 79 | 80 | If you have access to the main server configuration file (usually called 81 | `httpd.conf`), you should add the logic from the `.htaccess` file in, for 82 | example, a section in the main configuration file. This is usually 83 | the recommended way, as using .htaccess files slows down Apache! 84 | 85 | To enable Apache modules locally, please see: 86 | https://github.com/h5bp/server-configs-apache/wiki/How-to-enable-Apache-modules. 87 | 88 | In the repo the `.htaccess` is used for: 89 | 90 | * Allowing cross-origin access to web fonts 91 | * CORS header for images when browsers request it 92 | * Enable `404.html` as 404 error document 93 | * Making the website experience better for IE users better 94 | * Media UTF-8 as character encoding for `text/html` and `text/plain` 95 | * Enabling the rewrite URLs engine 96 | * Forcing or removing the `www.` at the begin of a URL 97 | * It blocks access to directories without a default document 98 | * It blocks access to files that can expose sensitive information. 99 | * It reduces MIME type security risks 100 | * It forces compressing (gzipping) 101 | * It tells the browser whether they should request a specific file from the 102 | server or whether they should grab it from the browser's cache 103 | 104 | When using `.htaccess` we recommend reading all inline comments (the rules after 105 | a `#`) in the file once. There is a bunch of optional stuff in it. 106 | 107 | If you want to know more about the `.htaccess` file check out the 108 | [Apache HTTP server docs](https://httpd.apache.org/docs/) or more 109 | specifically the [htaccess 110 | section](https://httpd.apache.org/docs/current/howto/htaccess.html). 111 | 112 | Notice that the original repo for the `.htaccess` file is [this 113 | one](https://github.com/h5bp/server-configs-apache). 114 | 115 | 116 | ## robots.txt 117 | 118 | The `robots.txt` file is used to give instructions to web robots on what can 119 | be crawled from the website. 120 | 121 | By default, the file provided by this project includes the next two lines: 122 | 123 | * `User-agent: *` - the following rules apply to all web robots 124 | * `Disallow:` - everything on the website is allowed to be crawled 125 | 126 | If you want to disallow certain pages you will need to specify the path in a 127 | `Disallow` directive (e.g.: `Disallow: /path`) or, if you want to disallow 128 | crawling of all content, use `Disallow: /`. 129 | 130 | The `/robots.txt` file is not intended for access control, so don't try to 131 | use it as such. Think of it as a "No Entry" sign, rather than a locked door. 132 | URLs disallowed by the `robots.txt` file might still be indexed without being 133 | crawled, and the content from within the `robots.txt` file can be viewed by 134 | anyone, potentially disclosing the location of your private content! So, if 135 | you want to block access to private content, use proper authentication instead. 136 | 137 | For more information about `robots.txt`, please see: 138 | 139 | * [robotstxt.org](http://www.robotstxt.org/) 140 | * [How Google handles the `robots.txt` file](https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt) 141 | 142 | 143 | ## browserconfig.xml 144 | 145 | The `browserconfig.xml` file is used to customize the tile displayed when users 146 | pin your site to the Windows 8.1 start screen. In there you can define custom 147 | tile colors, custom images or even [live tiles](https://msdn.microsoft.com/library/dn455106.aspx#CreatingLiveTiles). 148 | 149 | By default, the file points to 2 placeholder tile images: 150 | 151 | * `tile.png` (558x558px): used for `Small`, `Medium` and `Large` tiles. 152 | This image resizes automatically when necessary. 153 | * `tile-wide.png` (558x270px): user for `Wide` tiles. 154 | 155 | Notice that IE11 uses the same images when adding a site to the `favorites`. 156 | 157 | For more in-depth information about the `browserconfig.xml` file, please 158 | see [MSDN](https://msdn.microsoft.com/library/dn320426.aspx). 159 | -------------------------------------------------------------------------------- /docs/doc/usage.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Usage 5 | 6 | The most basic usage of HTML5 Boilerplate is to create a static site or simple 7 | app. Once you've downloaded or cloned the project, that process looks something 8 | like this: 9 | 10 | 1. Set up the basic structure of the site. 11 | 2. Add some content, style, and functionality. 12 | 3. Run your site locally to see how it looks. 13 | 4. Deploy your site. 14 | 15 | Cool, right? _It is_. That said, the smart defaults, baseline elements, default 16 | attribute values and various other utilities that HTML5 Boilerplate offers can 17 | serve as the foundation for whatever you're interested in building. 18 | 19 | Even the basic use-case of a simple static site can be enhanced by manipulating 20 | the code through an automated build process. Moving up in complexity HTML5 21 | Boilerplate can be be integrated with whatever front-end framework, CMS or 22 | e-commerce platform you're working with. Mix-and-match to your heart's content. 23 | Use what you need (toss it in a blender if you need to) and discard the rest. 24 | HTML5 Boilerplate is a starting point, not a destination. 25 | 26 | ## Basic structure 27 | 28 | A basic HTML5 Boilerplate site initially looks something like this: 29 | 30 | ``` 31 | . 32 | ├── css 33 | │ ├── main.css 34 | │ └── normalize.css 35 | ├── doc 36 | ├── img 37 | ├── js 38 | │ ├── main.js 39 | │ ├── plugins.js 40 | │ └── vendor 41 | │ ├── jquery.min.js 42 | │ └── modernizr.min.js 43 | ├── .editorconfig 44 | ├── .htaccess 45 | ├── 404.html 46 | ├── browserconfig.xml 47 | ├── favicon.ico 48 | ├── humans.txt 49 | ├── icon.png 50 | ├── index.html 51 | ├── robots.txt 52 | ├── site.webmanifest 53 | ├── tile.png 54 | └── tile-wide.png 55 | ``` 56 | 57 | What follows is a general overview of each major part and how to use them. 58 | 59 | ### css 60 | 61 | This directory should contain all your project's CSS files. It includes some 62 | initial CSS to help get you started from a solid foundation. [About the 63 | CSS](css.md). 64 | 65 | ### doc 66 | 67 | This directory contains all the HTML5 Boilerplate documentation. You can use it 68 | as the location and basis for your own project's documentation. 69 | 70 | ### js 71 | 72 | This directory should contain all your project's JS files. Libraries, plugins, 73 | and custom code can all be included here. It includes some initial JS to help 74 | get you started. [About the JavaScript](js.md). 75 | 76 | ### .htaccess 77 | 78 | The default web server configs are for Apache. For more information, please 79 | refer to the [Apache Server Configs 80 | repository](https://github.com/h5bp/server-configs-apache). 81 | 82 | Host your site on a server other than Apache? You're likely to find the 83 | corresponding server configs project listed in our [Server Configs 84 | ](https://github.com/h5bp/server-configs/blob/master/README.md) repository. 85 | 86 | ### 404.html 87 | 88 | A helpful custom 404 to get you started. 89 | 90 | ### browserconfig.xml 91 | 92 | This file contains all settings regarding custom tiles for IE11 and Edge. 93 | 94 | For more info on this topic, please refer to 95 | [MSDN](https://msdn.microsoft.com/library/dn455106.aspx). 96 | 97 | ### .editorconfig 98 | 99 | The `.editorconfig` file is provided in order to encourage and help you and 100 | your team to maintain consistent coding styles between different 101 | editors and IDEs. [Read more about the `.editorconfig` file](misc.md#editorconfig). 102 | 103 | ### index.html 104 | 105 | This is the default HTML skeleton that should form the basis of all pages on 106 | your site. If you are using a server-side templating framework, then you will 107 | need to integrate this starting HTML with your setup. 108 | 109 | Make sure that you update the URLs for the referenced CSS and JavaScript if you 110 | modify the directory structure at all. 111 | 112 | If you are using Google Universal Analytics, make sure that you edit the 113 | corresponding snippet at the bottom to include your analytics ID. 114 | 115 | ### humans.txt 116 | 117 | Edit this file to include the team that worked on your site/app, and the 118 | technology powering it. 119 | 120 | ### robots.txt 121 | 122 | Edit this file to include any pages you need hidden from search engines. 123 | 124 | ### Icons 125 | 126 | Replace the default `favicon.ico`, `tile.png`, `tile-wide.png` and Apple 127 | Touch Icon with your own. 128 | 129 | If you want to use different Apple Touch Icons for different resolutions please 130 | refer to the [according documentation](extend.md#apple-touch-icons). 131 | -------------------------------------------------------------------------------- /docs/docs/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_size = 4 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /docs/docs/.gitattributes: -------------------------------------------------------------------------------- 1 | ## GITATTRIBUTES FOR WEB PROJECTS 2 | # 3 | # These settings are for any web project. 4 | # 5 | # Details per file setting: 6 | # text These files should be normalized (i.e. convert CRLF to LF). 7 | # binary These files are binary and should be left untouched. 8 | # 9 | # Note that binary is a macro for -text -diff. 10 | ###################################################################### 11 | 12 | ## AUTO-DETECT 13 | ## Handle line endings automatically for files detected as 14 | ## text and leave all files detected as binary untouched. 15 | ## This will handle all files NOT defined below. 16 | * text=auto 17 | 18 | ## SOURCE CODE 19 | *.bat text eol=crlf 20 | *.coffee text 21 | *.css text 22 | *.htm text 23 | *.html text 24 | *.inc text 25 | *.ini text 26 | *.js text 27 | *.json text 28 | *.jsx text 29 | *.less text 30 | *.od text 31 | *.onlydata text 32 | *.php text 33 | *.pl text 34 | *.py text 35 | *.rb text 36 | *.sass text 37 | *.scm text 38 | *.scss text 39 | *.sh text eol=lf 40 | *.sql text 41 | *.styl text 42 | *.tag text 43 | *.ts text 44 | *.tsx text 45 | *.xml text 46 | *.xhtml text 47 | 48 | ## DOCKER 49 | *.dockerignore text 50 | Dockerfile text 51 | 52 | ## DOCUMENTATION 53 | *.markdown text 54 | *.md text 55 | *.mdwn text 56 | *.mdown text 57 | *.mkd text 58 | *.mkdn text 59 | *.mdtxt text 60 | *.mdtext text 61 | *.txt text 62 | AUTHORS text 63 | CHANGELOG text 64 | CHANGES text 65 | CONTRIBUTING text 66 | COPYING text 67 | copyright text 68 | *COPYRIGHT* text 69 | INSTALL text 70 | license text 71 | LICENSE text 72 | NEWS text 73 | readme text 74 | *README* text 75 | TODO text 76 | 77 | ## TEMPLATES 78 | *.dot text 79 | *.ejs text 80 | *.haml text 81 | *.handlebars text 82 | *.hbs text 83 | *.hbt text 84 | *.jade text 85 | *.latte text 86 | *.mustache text 87 | *.njk text 88 | *.phtml text 89 | *.tmpl text 90 | *.tpl text 91 | *.twig text 92 | 93 | ## LINTERS 94 | .csslintrc text 95 | .eslintrc text 96 | .htmlhintrc text 97 | .jscsrc text 98 | .jshintrc text 99 | .jshintignore text 100 | .stylelintrc text 101 | 102 | ## CONFIGS 103 | *.bowerrc text 104 | *.cnf text 105 | *.conf text 106 | *.config text 107 | .browserslistrc text 108 | .editorconfig text 109 | .gitattributes text 110 | .gitconfig text 111 | .gitignore text 112 | .htaccess text 113 | *.npmignore text 114 | *.yaml text 115 | *.yml text 116 | browserslist text 117 | Makefile text 118 | makefile text 119 | 120 | ## HEROKU 121 | Procfile text 122 | .slugignore text 123 | 124 | ## GRAPHICS 125 | *.ai binary 126 | *.bmp binary 127 | *.eps binary 128 | *.gif binary 129 | *.ico binary 130 | *.jng binary 131 | *.jp2 binary 132 | *.jpg binary 133 | *.jpeg binary 134 | *.jpx binary 135 | *.jxr binary 136 | *.pdf binary 137 | *.png binary 138 | *.psb binary 139 | *.psd binary 140 | *.svg text 141 | *.svgz binary 142 | *.tif binary 143 | *.tiff binary 144 | *.wbmp binary 145 | *.webp binary 146 | 147 | ## AUDIO 148 | *.kar binary 149 | *.m4a binary 150 | *.mid binary 151 | *.midi binary 152 | *.mp3 binary 153 | *.ogg binary 154 | *.ra binary 155 | 156 | ## VIDEO 157 | *.3gpp binary 158 | *.3gp binary 159 | *.as binary 160 | *.asf binary 161 | *.asx binary 162 | *.fla binary 163 | *.flv binary 164 | *.m4v binary 165 | *.mng binary 166 | *.mov binary 167 | *.mp4 binary 168 | *.mpeg binary 169 | *.mpg binary 170 | *.ogv binary 171 | *.swc binary 172 | *.swf binary 173 | *.webm binary 174 | 175 | ## ARCHIVES 176 | *.7z binary 177 | *.gz binary 178 | *.jar binary 179 | *.rar binary 180 | *.tar binary 181 | *.zip binary 182 | 183 | ## FONTS 184 | *.ttf binary 185 | *.eot binary 186 | *.otf binary 187 | *.woff binary 188 | *.woff2 binary 189 | 190 | ## EXECUTABLES 191 | *.exe binary 192 | *.pyc binary 193 | -------------------------------------------------------------------------------- /docs/docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Include your project-specific ignores in this file 2 | # Read about how to use .gitignore: https://help.github.com/articles/ignoring-files 3 | # Useful .gitignore templates: https://github.com/github/gitignore 4 | -------------------------------------------------------------------------------- /docs/docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Page Not Found 6 | 7 | 54 | 55 | 56 |

      Page Not Found

      57 |

      Sorry, but the page you were trying to view does not exist.

      58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/docs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) HTML5 Boilerplate 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /docs/docs/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/docs/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/docs/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/docs/config.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "type": "github", 3 | "title": "TheoremJS", 4 | "url": "https://github.com/arguiot/TheoremJS/wiki", 5 | "logo": "https://theorem.js.org/img/TheoremJS.svg", 6 | "copyright": "Arthur Guiot", 7 | "analytics": "UA-109503398-4" 8 | }] 9 | -------------------------------------------------------------------------------- /docs/docs/css/main.css: -------------------------------------------------------------------------------- 1 | /*! HTML5 Boilerplate v6.0.1 | MIT License | https://html5boilerplate.com/ */html{color:#222;font-size:1em;line-height:1.4}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,iframe,img,svg,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.browserupgrade{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}body{overflow-x:hidden}.sidebar{position:fixed;top:0;left:-290px;width:300px;height:100vh;background:transparent;-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;overflow-x:hidden;overflow-y:hidden;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size:16px;line-height:1.5;word-wrap:break-word;padding:20px}@media (min-width: 500px){.sidebar:hover{position:fixed;left:0px;width:300px;background:#333;z-index:10;overflow-y:scroll}.sidebar:hover+.arrow{-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;left:300px;background:transparent}}.hovered{position:fixed;left:0px;width:300px;background:#333;z-index:10;overflow-y:scroll}.sidebar ul>li{color:white}.sidebar ul>li>a{color:white;text-decoration:none}.sidebar ul>li>a:hover{cursor:pointer;text-decoration:underline}.anchor{display:none}.arrow{width:50px;height:50px;background:#333;color:white;position:fixed;left:0;top:calc(50vh - 25px);z-index:-100;text-align:center;line-height:50px}.hovered+arrow{-webkit-transition:all 500ms ease-in-out;transition:all 500ms ease-in-out;left:300px;background:transparent}.copyright{font-family:'Roboto', sans-serif;width:100vw;text-align:center;color:#616161;margin-bottom:30px}.copyright:hover{text-decoration:underline;cursor:pointer}.copyright-side{font-family:'Roboto', sans-serif;color:#616161;margin-bottom:30px}.title{width:100vw;text-align:center;height:80px;position:fixed;top:0;font-weight:normal;font-size:32px;line-height:80px;word-wrap:break-word;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";background:#fff;border-bottom:1px solid #eee}.img{width:150px;max-height:150px}.content{width:calc(90vw - 100px);max-width:800px;margin:0 auto;margin-top:80px;padding:50px;word-wrap:break-word}.hidden{display:none !important}.visuallyhidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;-webkit-clip-path:none;clip-path:none;height:auto;margin:0;overflow:visible;position:static;width:auto;white-space:inherit}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}@media print{*,*:before,*:after{background:transparent !important;color:#000 !important;-webkit-box-shadow:none !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre{white-space:pre-wrap !important}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}} 2 | -------------------------------------------------------------------------------- /docs/docs/css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:0.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none} 2 | -------------------------------------------------------------------------------- /docs/docs/doc/TOC.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) 2 | 3 | ## Getting started 4 | 5 | * [Usage](usage.md) — Overview of the project contents. 6 | * [FAQ](faq.md) — Frequently asked questions along with their answers. 7 | 8 | ## HTML5 Boilerplate core 9 | 10 | * [HTML](html.md) — Guide to the default HTML. 11 | * [CSS](css.md) — Guide to the default CSS. 12 | * [JavaScript](js.md) — Guide to the default JavaScript. 13 | * [Everything else](misc.md). 14 | 15 | ## Development 16 | 17 | * [Extending and customizing HTML5 Boilerplate](extend.md) — Going further 18 | with the boilerplate. 19 | 20 | ## Related projects 21 | 22 | The [H5BP organization](https://github.com/h5bp) maintains several projects 23 | that complement HTML5 Boilerplate, projects that can help you improve different 24 | aspects of your website/web app (e.g.: the performance, security, etc.). 25 | 26 | * [Server Configs](https://github.com/h5bp/server-configs) — Fast and 27 | smart configurations for web servers such as Apache and Nginx. 28 | * [Apache](https://github.com/h5bp/server-configs-apache) 29 | * [Google App Engine (GAE)](https://github.com/h5bp/server-configs-gae) 30 | * [Internet Information Services (IIS)](https://github.com/h5bp/server-configs-iis) 31 | * [lighttpd](https://github.com/h5bp/server-configs-lighttpd) 32 | * [Nginx](https://github.com/h5bp/server-configs-nginx) 33 | * [Node.js](https://github.com/h5bp/server-configs-node) 34 | * [Ant Build Script](https://github.com/h5bp/ant-build-script) — Apache 35 | Ant based build script. 36 | -------------------------------------------------------------------------------- /docs/docs/doc/faq.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Frequently asked questions 5 | 6 | * [Why is the Google Analytics code at the bottom? Google recommends it be 7 | placed in the ``.](#why-is-the-google-analytics-code-at-the-bottom-google-recommends-it-be-placed-in-the-head) 8 | * [How can I integrate Bootstrap with HTML5 9 | Boilerplate?](#how-can-i-integrate-bootstrap-with-html5-boilerplate) 10 | * [Do I need to upgrade my site each time a new version of HTML5 Boilerplate is 11 | released?](#do-i-need-to-upgrade-my-site-each-time-a-new-version-of-html5-boilerplate-is-released) 12 | * [Where can I get help with support 13 | questions?](#where-can-i-get-help-with-support-questions) 14 | 15 | --- 16 | 17 | ### Why is the Google Analytics code at the bottom? Google recommends it be placed in the ``. 18 | 19 | The main advantage of placing it in the `` is that you will track the 20 | user's `pageview` even if they leave the page before it has been fully loaded. 21 | 22 | Here's a handy quote from [Mathias Bynens](https://mathiasbynens.be/notes/async-analytics-snippet#comment-50) about our placement choice. 23 | >I should point out that it’s Google — not me — recommending to place this 24 | script before all other scripts in the document. The only real advantage is to 25 | catch a pageView call if your page fails to load completely (for example, if 26 | the user aborts loading, or quickly closes the page, etc.). Personally, I 27 | wouldn’t count that as a page view, so I actually prefer to place this script 28 | at the bottom, after all other scripts. This keeps all the scripts together and 29 | reinforces that scripts at the bottom are the right move. (Usually I 30 | concatenate and minify all my scripts into one .js file — the GA snippet being 31 | the suffix.) 32 | 33 | ### How can I integrate [Bootstrap](https://getbootstrap.com/) with HTML5 Boilerplate? 34 | 35 | Here's Nicolas Gallagher writing about how [HTML5 Boilerplate and Bootstrap complement each 36 | other](https://www.quora.com/Is-Bootstrap-a-complement-or-an-alternative-to-HTML5-Boilerplate-or-viceversa/answer/Nicolas-Gallagher). 37 | 38 | ### Do I need to upgrade my site each time a new version of HTML5 Boilerplate is released? 39 | 40 | No, same as you don't normally replace the foundation of a house once it 41 | was built. However, there is nothing stopping you from trying to work in the 42 | latest changes, but you'll have to assess the costs/benefits of doing so. 43 | 44 | ### Where can I get help with support questions? 45 | 46 | Please ask for help on 47 | [StackOverflow](https://stackoverflow.com/questions/tagged/html5boilerplate). 48 | -------------------------------------------------------------------------------- /docs/docs/doc/js.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # The JavaScript 5 | 6 | Information about the default JavaScript included in the project. 7 | 8 | ## main.js 9 | 10 | This file can be used to contain or reference your site/app JavaScript code. 11 | If you're working on something more advanced you might replace this file 12 | entirely. That's cool. 13 | 14 | ## plugins.js 15 | 16 | This file can be used to contain all your plugins, such as jQuery plugins and 17 | other 3rd party scripts for a simple site. 18 | 19 | One approach is to put jQuery plugins inside of a `(function($){ ... 20 | })(jQuery);` closure to make sure they're in the jQuery namespace safety 21 | blanket. Read more about [jQuery plugin 22 | authoring](https://learn.jquery.com/plugins/#Getting_Started). 23 | 24 | By default the `plugins.js` file contains a small script to avoid `console` 25 | errors in browsers that lack a `console`. The script will make sure that, if 26 | a console method isn't available, that method will have the value of empty 27 | function, thus, preventing the browser from throwing an error. 28 | 29 | ## vendor 30 | 31 | This directory can be used to contain all 3rd party library code. 32 | 33 | Minified versions of the latest jQuery and Modernizr libraries are included by 34 | default. You may wish to create your own [custom Modernizr 35 | build with the online builder](https://www.modernizr.com/download/) or [command 36 | line tool](https://modernizr.com/docs#command-line-config). 37 | -------------------------------------------------------------------------------- /docs/docs/doc/usage.md: -------------------------------------------------------------------------------- 1 | [HTML5 Boilerplate homepage](https://html5boilerplate.com/) | [Documentation 2 | table of contents](TOC.md) 3 | 4 | # Usage 5 | 6 | The most basic usage of HTML5 Boilerplate is to create a static site or simple 7 | app. Once you've downloaded or cloned the project, that process looks something 8 | like this: 9 | 10 | 1. Set up the basic structure of the site. 11 | 2. Add some content, style, and functionality. 12 | 3. Run your site locally to see how it looks. 13 | 4. Deploy your site. 14 | 15 | Cool, right? _It is_. That said, the smart defaults, baseline elements, default 16 | attribute values and various other utilities that HTML5 Boilerplate offers can 17 | serve as the foundation for whatever you're interested in building. 18 | 19 | Even the basic use-case of a simple static site can be enhanced by manipulating 20 | the code through an automated build process. Moving up in complexity HTML5 21 | Boilerplate can be be integrated with whatever front-end framework, CMS or 22 | e-commerce platform you're working with. Mix-and-match to your heart's content. 23 | Use what you need (toss it in a blender if you need to) and discard the rest. 24 | HTML5 Boilerplate is a starting point, not a destination. 25 | 26 | ## Basic structure 27 | 28 | A basic HTML5 Boilerplate site initially looks something like this: 29 | 30 | ``` 31 | . 32 | ├── css 33 | │ ├── main.css 34 | │ └── normalize.css 35 | ├── doc 36 | ├── img 37 | ├── js 38 | │ ├── main.js 39 | │ ├── plugins.js 40 | │ └── vendor 41 | │ ├── jquery.min.js 42 | │ └── modernizr.min.js 43 | ├── .editorconfig 44 | ├── .htaccess 45 | ├── 404.html 46 | ├── browserconfig.xml 47 | ├── favicon.ico 48 | ├── humans.txt 49 | ├── icon.png 50 | ├── index.html 51 | ├── robots.txt 52 | ├── site.webmanifest 53 | ├── tile.png 54 | └── tile-wide.png 55 | ``` 56 | 57 | What follows is a general overview of each major part and how to use them. 58 | 59 | ### css 60 | 61 | This directory should contain all your project's CSS files. It includes some 62 | initial CSS to help get you started from a solid foundation. [About the 63 | CSS](css.md). 64 | 65 | ### doc 66 | 67 | This directory contains all the HTML5 Boilerplate documentation. You can use it 68 | as the location and basis for your own project's documentation. 69 | 70 | ### js 71 | 72 | This directory should contain all your project's JS files. Libraries, plugins, 73 | and custom code can all be included here. It includes some initial JS to help 74 | get you started. [About the JavaScript](js.md). 75 | 76 | ### .htaccess 77 | 78 | The default web server configs are for Apache. For more information, please 79 | refer to the [Apache Server Configs 80 | repository](https://github.com/h5bp/server-configs-apache). 81 | 82 | Host your site on a server other than Apache? You're likely to find the 83 | corresponding server configs project listed in our [Server Configs 84 | ](https://github.com/h5bp/server-configs/blob/master/README.md) repository. 85 | 86 | ### 404.html 87 | 88 | A helpful custom 404 to get you started. 89 | 90 | ### browserconfig.xml 91 | 92 | This file contains all settings regarding custom tiles for IE11 and Edge. 93 | 94 | For more info on this topic, please refer to 95 | [MSDN](https://msdn.microsoft.com/library/dn455106.aspx). 96 | 97 | ### .editorconfig 98 | 99 | The `.editorconfig` file is provided in order to encourage and help you and 100 | your team to maintain consistent coding styles between different 101 | editors and IDEs. [Read more about the `.editorconfig` file](misc.md#editorconfig). 102 | 103 | ### index.html 104 | 105 | This is the default HTML skeleton that should form the basis of all pages on 106 | your site. If you are using a server-side templating framework, then you will 107 | need to integrate this starting HTML with your setup. 108 | 109 | Make sure that you update the URLs for the referenced CSS and JavaScript if you 110 | modify the directory structure at all. 111 | 112 | If you are using Google Universal Analytics, make sure that you edit the 113 | corresponding snippet at the bottom to include your analytics ID. 114 | 115 | ### humans.txt 116 | 117 | Edit this file to include the team that worked on your site/app, and the 118 | technology powering it. 119 | 120 | ### robots.txt 121 | 122 | Edit this file to include any pages you need hidden from search engines. 123 | 124 | ### Icons 125 | 126 | Replace the default `favicon.ico`, `tile.png`, `tile-wide.png` and Apple 127 | Touch Icon with your own. 128 | 129 | If you want to use different Apple Touch Icons for different resolutions please 130 | refer to the [according documentation](extend.md#apple-touch-icons). 131 | -------------------------------------------------------------------------------- /docs/docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/favicon.ico -------------------------------------------------------------------------------- /docs/docs/humans.txt: -------------------------------------------------------------------------------- 1 | # humanstxt.org/ 2 | # The humans responsible & technology colophon 3 | 4 | # TEAM 5 | 6 | -- -- 7 | 8 | # THANKS 9 | 10 | 11 | 12 | # TECHNOLOGY COLOPHON 13 | 14 | CSS3, HTML5 15 | Apache Server Configs, jQuery, Modernizr, Normalize.css 16 | -------------------------------------------------------------------------------- /docs/docs/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/icon.png -------------------------------------------------------------------------------- /docs/docs/img/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/img/.gitignore -------------------------------------------------------------------------------- /docs/docs/img/load.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 10 | 11 | 12 | 18 | 19 | 20 | 26 | 27 | -------------------------------------------------------------------------------- /docs/docs/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/img/logo.png -------------------------------------------------------------------------------- /docs/docs/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | Final logo 3 | Created using Figma 4 | 5 | 6 | 7 | 8 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 35 |
      36 | > 37 |
      38 |
      Loading...
      39 |
      40 |
      Loading...
      41 |
      42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/docs/js/main.js: -------------------------------------------------------------------------------- 1 | "use strict";function load(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if($.html(".title","Loading..."),$.html(".content",'
      Loading...
      '),!1===configLoaded)fetch("config.json").then(function(e){return e.json()}).then(function(e){if(e=e[0],config=e,configLoaded=!0,$.html("head>title",e.title),"wiki"==e.type||"github"==e.type){var t=document.createElement("a");t.href=window.location,load(e.url+"/"+t.hash.split("#")[1]),side(e.logo,e.copyright)}else if($.html(".sidebar","
        "),e.hasOwnProperty("paths")){dataPaths=e.paths;var n=document.createElement("a");n.href=window.location,load(Object.values(e.paths)[parseInt(n.hash.split("#")[1])<0||isNaN(parseInt(n.hash.split("#")[1]))?0:parseInt(n.hash.split("#")[1])]),side(e.logo,e.copyright)}e.hasOwnProperty("analytics")&&(!function(e,t,n,i,a,o,r){e.GoogleAnalyticsObject=a,e[a]=e[a]||function(){(e[a].q=e[a].q||[]).push(arguments)},e[a].l=1*new Date,o=t.createElement(n),r=t.getElementsByTagName(n)[0],o.async=1,o.src=i,r.parentNode.insertBefore(o,r)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create",e.analytics,"auto"),ga("send","pageview")),listener()});else if(/github.com/.test(e))fetch("https://cors-anywhere.herokuapp.com/"+e,{header:new Headers({Accept:"*"})}).then(function(e){return e.text()}).then(function(e){var t=new DOMParser,n=t.parseFromString(e,"text/html"),i=n.querySelectorAll(".markdown-body");$.html(".title",n.querySelector(".gh-header-title").innerHTML),$.html(".sidebar",i[0].innerHTML),$.html(".content",i[1].innerHTML),side(config.logo,config.copyright)});else if($.html(".sidebar","
          "),config.hasOwnProperty("paths")){for(var t in config.paths)$.single(".sidebar>ul").innerHTML+='
        • '+t+"
        • ";$.html(".title",Object.keys(config.paths)[Object.values(config.paths).indexOf(e)]),render(e),side(config.logo,config.copyright)}listener()}function side(e,t){void 0!=e&&(console.log(),$.single(".sidebar").innerHTML='\n\t\t
          \n\t\t\tLogo\n\t\t
          \n\t\t'+$.single(".sidebar").innerHTML,$.single(".sidebar").innerHTML+='\n\t\t
          \n\t\t\t\n\t\t
          \n\t\t"),listener()}function listener(){$.all(".sidebar ul>li>a",function(e){$.on(e,"click",function(e){if(e.preventDefault(),config.hasOwnProperty("paths")){var t=Object.keys(dataPaths).indexOf(e.target.innerHTML);window.location="#"+t,load(Object.values(dataPaths)[t])}else window.location="#"+("a"!=e.target.tagName.toLowerCase()?e.target.parentNode.href.split("/").slice(-1)[0]:e.target.href.split("/").slice(-1)[0]),load("a"!=e.target.tagName.toLowerCase()?e.target.parentNode.href:e.target.href);listener()})})}function render(e){var t=new showdown.Converter;fetch(e).then(function(e){return e.text()}).then(function(e){var n=t.makeHtml(e);$.html(".content",n)})}var $=new DisplayJS(window);$.on(".copyright","click",function(){window.location="https://kiwidocs.js.org"}),$.on(".arrow","click",function(){$.toggleClass(".sidebar","hovered")}),$.on(".sidebar","click",function(){$.toggleClass(".sidebar","hovered")});var configLoaded=!1,config=[],dataPaths=[];load(),listener(); 2 | -------------------------------------------------------------------------------- /docs/docs/js/plugins.js: -------------------------------------------------------------------------------- 1 | !function(){for(var e,n=function(){},o=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeline","timelineEnd","timeStamp","trace","warn"],i=o.length,r=window.console=window.console||{};i--;)e=o[i],r[e]||(r[e]=n)}(); -------------------------------------------------------------------------------- /docs/docs/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/mstile-150x150.png -------------------------------------------------------------------------------- /docs/docs/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | 3 | # Allow crawling of all content 4 | User-agent: * 5 | Disallow: 6 | -------------------------------------------------------------------------------- /docs/docs/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 39 | 44 | 48 | 52 | 57 | 60 | 63 | 68 | 73 | 76 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/docs/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "icons": [{ 3 | "src": "icon.png", 4 | "sizes": "192x192", 5 | "type": "image/png" 6 | }], 7 | "start_url": "/" 8 | } 9 | -------------------------------------------------------------------------------- /docs/docs/tile-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/tile-wide.png -------------------------------------------------------------------------------- /docs/docs/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/docs/tile.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/favicon.ico -------------------------------------------------------------------------------- /docs/humans.txt: -------------------------------------------------------------------------------- 1 | # humanstxt.org/ 2 | # The humans responsible & technology colophon 3 | 4 | # TEAM 5 | 6 | -- -- 7 | 8 | # THANKS 9 | 10 | 11 | 12 | # TECHNOLOGY COLOPHON 13 | 14 | CSS3, HTML5 15 | Apache Server Configs, jQuery, Modernizr, Normalize.css 16 | -------------------------------------------------------------------------------- /docs/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/icon.png -------------------------------------------------------------------------------- /docs/img/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/img/.gitignore -------------------------------------------------------------------------------- /docs/img/TheoremJS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/img/TheoremJS.png -------------------------------------------------------------------------------- /docs/img/marketing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/img/marketing.jpg -------------------------------------------------------------------------------- /docs/js/main.js: -------------------------------------------------------------------------------- 1 | const $ = new DisplayJS(window); 2 | 3 | 4 | 5 | const scene = new THREE.Scene(); 6 | scene.background = new THREE.Color(0xffffff) 7 | 8 | let camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 8, 12); 9 | camera.lookAt(new THREE.Vector3(0, 0, 0)); 10 | const renderer = new THREE.WebGLRenderer({ 11 | antialias: true 12 | }); 13 | renderer.setSize(window.innerWidth * 2, window.innerHeight * 2) 14 | renderer.setPixelRatio(window.devicePixelRatio ? window.devicePixelRatio : 1); 15 | camera.updateProjectionMatrix() 16 | document.body.appendChild(renderer.domElement); 17 | 18 | window.addEventListener( 'resize', onWindowResize, false ); 19 | 20 | function onWindowResize(){ 21 | 22 | camera.aspect = window.innerWidth / window.innerHeight; 23 | camera.updateProjectionMatrix(); 24 | 25 | renderer.setSize( window.innerWidth, window.innerHeight ); 26 | 27 | } 28 | 29 | 30 | // Sphere 31 | const shape = new THREE.SphereGeometry(0.75, 16, 26, 0, Math.PI * 2, 0, Math.PI * 2); 32 | const geometry = new THREE.EdgesGeometry(shape); 33 | const material = new THREE.LineBasicMaterial({ 34 | color: 0x0000, 35 | linewidth: 1 36 | }); 37 | const sphere = new THREE.LineSegments(geometry, material) 38 | scene.add(sphere); 39 | sphere.position.x = -2; 40 | sphere.position.y = 1.2; 41 | 42 | // Triangle 43 | const triShape = new THREE.CylinderGeometry(0, 0.5, 1, 3); 44 | const triangle = new THREE.LineSegments(new THREE.EdgesGeometry(triShape), material); 45 | scene.add(triangle) 46 | triangle.position.x = 2 47 | triangle.position.y = -1.2 48 | 49 | // Line 1 50 | const l1Shape = new THREE.EdgesGeometry(new THREE.BoxGeometry(0.01, 10, 0.01)); 51 | const line1 = new THREE.Mesh(l1Shape, material) 52 | scene.add(line1) 53 | line1.position.x = 2 54 | line1.position.y = 1 55 | line1.rotation.z = 1 56 | // Line 2 57 | const l2Shape = new THREE.EdgesGeometry(new THREE.BoxGeometry(0.01, 10, 0.01)); 58 | const line2 = new THREE.Mesh(l2Shape, material) 59 | scene.add(line2) 60 | line2.position.x = 2 61 | line2.position.y = 1 62 | line2.rotation.z = 1.2 63 | 64 | // Points 65 | const pointShape = new THREE.SphereGeometry(0.03, 4, 4); 66 | const pMaterial = new THREE.MeshBasicMaterial( {color: 0x0000} ) 67 | const point = new THREE.Mesh( pointShape, pMaterial ) 68 | scene.add(point) 69 | point.position.x = 2; 70 | point.position.y = 1; 71 | 72 | 73 | camera.position.z = 10; 74 | 75 | sphere.constRand = 0.4 76 | triangle.constRand = -0.3 77 | 78 | let moveBy = 0 79 | const render = () => { 80 | renderer.setSize(window.innerWidth, window.innerHeight) 81 | for (let i of [sphere, triangle]) { 82 | i.rotation.y += .01 * i.constRand; 83 | i.rotation.x += .01 * i.constRand; 84 | i.rotation.z += .01 * i.constRand; 85 | } 86 | sphere.position.x = -moveBy - 2 87 | triangle.position.x = moveBy + 2 88 | line1.position.y = moveBy / .9 + 1 89 | line2.position.y = moveBy + 1 90 | point.position.y = moveBy / 1.22 + 1 91 | point.position.x = (-moveBy / -2.25) + 2 92 | renderer.render(scene, camera); 93 | requestAnimationFrame(render) 94 | }; 95 | 96 | $.scroll(() => { 97 | if ($.scrollTop() < window.innerHeight) { 98 | moveBy = 2.5 * ($.scrollTop() / window.innerWidth) 99 | } 100 | }) 101 | 102 | var year = new Date().getFullYear() 103 | $.var() 104 | 105 | render() 106 | -------------------------------------------------------------------------------- /docs/js/plugins.js: -------------------------------------------------------------------------------- 1 | // Avoid `console` errors in browsers that lack a console. 2 | (function() { 3 | var method; 4 | var noop = function () {}; 5 | var methods = [ 6 | 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 7 | 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 8 | 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 9 | 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' 10 | ]; 11 | var length = methods.length; 12 | var console = (window.console = window.console || {}); 13 | 14 | while (length--) { 15 | method = methods[length]; 16 | 17 | // Only stub undefined methods. 18 | if (!console[method]) { 19 | console[method] = noop; 20 | } 21 | } 22 | }()); 23 | 24 | // Place any jQuery/helper plugins in here. 25 | -------------------------------------------------------------------------------- /docs/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | 3 | # Allow crawling of all content 4 | User-agent: * 5 | Disallow: 6 | -------------------------------------------------------------------------------- /docs/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "icons": [{ 3 | "src": "icon.png", 4 | "sizes": "192x192", 5 | "type": "image/png" 6 | }], 7 | "start_url": "/" 8 | } 9 | -------------------------------------------------------------------------------- /docs/tile-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/tile-wide.png -------------------------------------------------------------------------------- /docs/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arguiot/TheoremJS/94402cd770a4c9b55d79805ea7cb5ac090d9d3ca/docs/tile.png -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | const { src, dest, parallel } = require("gulp") 2 | const rename = require("gulp-concat"); 3 | // const uglify = require("gulp-uglify"); 4 | // const babel = require("gulp-babel"); 5 | // const babili = require("gulp-babili"); 6 | 7 | function modern() { 8 | return src("dist/rig.js") 9 | .pipe(rename("theorem.js")) 10 | .pipe(dest("dist")); 11 | } 12 | // gulp.task("minify", () => { 13 | // gulp.src("dist/rig.js") 14 | // .pipe(babili({ 15 | // mangle: { 16 | // keepClassName: true 17 | // } 18 | // })) 19 | // .pipe(rename({ 20 | // basename: "theorem", 21 | // suffix: ".min" 22 | // })) 23 | // .pipe(gulp.dest("dist")); 24 | // }) 25 | function tests() { 26 | return src("dist/rig.js") 27 | .pipe(rename("theorem.js")) 28 | .pipe(dest("__test__")); 29 | } 30 | 31 | exports.modern = modern 32 | exports.tests = tests 33 | exports.default = parallel(modern, tests); 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "theorem.js", 3 | "version": "1.2.0", 4 | "description": "A Math library for computation in JavaScript", 5 | "main": "dist/theorem.min.js", 6 | "scripts": { 7 | "run": "npm test", 8 | "build": "npm test", 9 | "test": "npm run gulp && npm run prettier && npm run lint && npm run eye && exit 0", 10 | "gulp": "rig src/base.js > dist/rig.js && gulp && rm dist/rig.js", 11 | "prettier": "prettier \"dist/**/*.js\" --write", 12 | "lint": "./node_modules/.bin/eslint dist/theorem.js --fix", 13 | "eye": "./node_modules/.bin/eye ./__test__/test.js -ci" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/arguiot/TheoremJS.git" 18 | }, 19 | "keywords": [ 20 | "theoremjs", 21 | "math", 22 | "computation", 23 | "algebra", 24 | "library" 25 | ], 26 | "author": "Arthur Guiot", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/arguiot/TheoremJS/issues" 30 | }, 31 | "homepage": "https://github.com/arguiot/TheoremJS#readme", 32 | "devDependencies": { 33 | "babel-core": "^6.26.3", 34 | "babel-eslint": "^10.0.1", 35 | "babel-helper-flip-expressions": "^0.4.3", 36 | "babel-loader": "^7.1.5", 37 | "babel-minify": "^0.5.0", 38 | "babel-plugin-minify-builtins": "^0.5.0", 39 | "babel-plugin-minify-constant-folding": "^0.5.0", 40 | "babel-plugin-minify-dead-code-elimination": "^0.4.3", 41 | "babel-plugin-minify-flip-comparisons": "^0.4.3", 42 | "babel-plugin-minify-guarded-expressions": "^0.4.3", 43 | "babel-plugin-minify-infinity": "^0.4.3", 44 | "babel-plugin-minify-mangle-names": "^0.4.3", 45 | "babel-plugin-minify-replace": "^0.4.3", 46 | "babel-plugin-minify-simplify": "^0.4.3", 47 | "babel-plugin-minify-type-constructors": "^0.4.3", 48 | "babel-plugin-transform-inline-consecutive-adds": "^0.4.3", 49 | "babel-plugin-transform-member-expression-literals": "^6.9.4", 50 | "babel-plugin-transform-merge-sibling-variables": "^6.9.4", 51 | "babel-plugin-transform-minify-booleans": "^6.9.4", 52 | "babel-plugin-transform-property-literals": "^6.9.4", 53 | "babel-plugin-transform-remove-console": "^6.9.4", 54 | "babel-plugin-transform-remove-debugger": "^6.9.4", 55 | "babel-plugin-transform-remove-undefined": "^0.4.3", 56 | "babel-plugin-transform-simplify-comparison-operators": "^6.9.4", 57 | "babel-plugin-transform-undefined-to-void": "^6.9.4", 58 | "babel-polyfill": "^6.26.0", 59 | "babel-preset-babili": "^0.1.4", 60 | "babel-preset-env": "^1.7.0", 61 | "babel-preset-es2015": "^6.24.1", 62 | "babel-preset-stage-0": "^6.24.1", 63 | "babili": "^0.1.4", 64 | "buffer-shims": "^1.0.0", 65 | "eslint": "^5.16.0", 66 | "eslint-config-airbnb-base": "^13.1.0", 67 | "eslint-plugin-import": "^2.17.3", 68 | "eye.js": "1.2.1", 69 | "gulp": "^4.0.2", 70 | "gulp-babel": "^7.0.1", 71 | "gulp-babili": "^0.1.4", 72 | "gulp-concat": "^2.6.1", 73 | "gulp-inject-version": "^1.0.1", 74 | "gulp-rename": "^1.4.0", 75 | "gulp-rigger": "^0.5.8", 76 | "gulp-uglify": "^3.0.2", 77 | "prettier": "1.16.4", 78 | "rigger": "^1.0.1" 79 | }, 80 | "dependencies": { 81 | "bignumber.js": "^7.2.1" 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/base.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** © Arthur Guiot 2017 - 2018 3 | ** TheoremJS 4 | */ 5 | 6 | if (!BigNumber) { 7 | var BigNumber = require('bignumber.js'); 8 | } 9 | class TheoremJS { 10 | //= includes/functions 11 | } 12 | //= includes/other/export.js 13 | -------------------------------------------------------------------------------- /src/includes/functions/array/flatten.js: -------------------------------------------------------------------------------- 1 | flatten(array) { 2 | return array.reduce((a, b) => a.concat(b), []); 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/array/linspace.js: -------------------------------------------------------------------------------- 1 | linspace(start, end, n) { 2 | const diff = end - start; 3 | const step = diff / n; 4 | return this.arange(start, end, step); 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/array/range.js: -------------------------------------------------------------------------------- 1 | arange(start, end, step, offset) { 2 | const len = (Math.abs(end - start) + ((offset || 0) * 2)) / (step || 1) + 1; 3 | const direction = start < end ? 1 : -1; 4 | const startingPoint = start - (direction * (offset || 0)); 5 | const stepSize = direction * (step || 1); 6 | 7 | return Array(len).fill(0).map((_, index) => startingPoint + (stepSize * index)); 8 | } 9 | range(n) { 10 | return this.arange(0, n, 1); 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/array/reshape.js: -------------------------------------------------------------------------------- 1 | reshape(array, part) { 2 | const tmp = []; 3 | for (let i = 0; i < array.length; i += part) { 4 | tmp.push(array.slice(i, i + part)); 5 | } 6 | return tmp; 7 | } 8 | -------------------------------------------------------------------------------- /src/includes/functions/array/reverse.js: -------------------------------------------------------------------------------- 1 | reverse(array) { 2 | return array.slice(0).reverse() // duplicate and reverse to duplicate the array 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/constructor.js: -------------------------------------------------------------------------------- 1 | constructor(precision=20) { 2 | BigNumber.set({ DECIMAL_PLACES: precision }) 3 | // code 4 | this.version = "v1.1.0" 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/cryptography/bin2str.js: -------------------------------------------------------------------------------- 1 | bin2str(txt) { 2 | return txt.replace(/\s*[01]{8}\s*/g, function(bin) { 3 | return String.fromCharCode(parseInt(bin, 2)) 4 | }) 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/cryptography/huffman.js: -------------------------------------------------------------------------------- 1 | huffmanEncode(str) { 2 | const tree = createTree(str); 3 | const codebook = createCodebook(tree); 4 | return { 5 | string: [...str].map(c => codebook[c]).join(""), 6 | tree, 7 | codebook 8 | }; 9 | 10 | function createTree(str) { 11 | const chars = [...str]; 12 | const charCounts = chars.reduce((counts, char) => { 13 | counts[char] = (counts[char] || 0) + 1; 14 | return counts; 15 | }, {}); 16 | 17 | const nodes = Object.entries(charCounts).map(([key, weight]) => ({ key, weight })); 18 | 19 | // This queue implementation is horribly inefficient, but a proper, heap-based implementation would 20 | // be longer that the algorithm itself 21 | function makeQueue(iterable) { 22 | return { 23 | data: [...iterable].sort((a, b) => a.weight - b.weight), 24 | enqueue(value) { 25 | const target = this.data.findIndex(x => x.weight > value.weight); 26 | if (target === -1) { 27 | this.data.push(value); 28 | } else { 29 | this.data = [...this.data.slice(0, target), value, ...this.data.slice(target)]; 30 | } 31 | }, 32 | dequeue() { 33 | return this.data.shift(); 34 | } 35 | }; 36 | } 37 | 38 | const priorityQueue = makeQueue(nodes); 39 | while (priorityQueue.data.length > 1) { 40 | const left = priorityQueue.dequeue(); 41 | const right = priorityQueue.dequeue(); 42 | priorityQueue.enqueue({ weight: left.weight + right.weight, left, right }); 43 | } 44 | return priorityQueue.dequeue(); 45 | } 46 | 47 | function createCodebook(tree) { 48 | return recurse(tree, "", {}); 49 | 50 | function recurse(node, bitstring, dict) { 51 | if (!node.left && !node.right) { 52 | dict[node.key] = bitstring; 53 | } else { 54 | if (node.left) { 55 | recurse(node.left, `${bitstring}0`, dict); 56 | } 57 | 58 | if (node.right) { 59 | recurse(node.right, `${bitstring}1`, dict); 60 | } 61 | } 62 | return dict; 63 | } 64 | } 65 | } 66 | 67 | huffmanDecode(bitstring, tree) { 68 | const result = []; 69 | let node = tree; 70 | 71 | for (const bit of [...bitstring]) { 72 | node = bit === "0" ? node.left : node.right; 73 | if (!node.left && !node.right) { 74 | result.push(node.key); 75 | node = tree; 76 | } 77 | } 78 | 79 | return result.join(""); 80 | } 81 | -------------------------------------------------------------------------------- /src/includes/functions/cryptography/sha256.js: -------------------------------------------------------------------------------- 1 | sha256(input) { 2 | let s = input; 3 | 4 | const chrsz = 8; 5 | const hexcase = 0; 6 | 7 | function safe_add(x, y) { 8 | const lsw = (x & 0xFFFF) + (y & 0xFFFF); 9 | const msw = (x >> 16) + (y >> 16) + (lsw >> 16); 10 | return (msw << 16) | (lsw & 0xFFFF); 11 | } 12 | 13 | function S(X, n) { 14 | return (X >>> n) | (X << (32 - n)); 15 | } 16 | 17 | function R(X, n) { 18 | return (X >>> n); 19 | } 20 | 21 | function Ch(x, y, z) { 22 | return ((x & y) ^ ((~x) & z)); 23 | } 24 | 25 | function Maj(x, y, z) { 26 | return ((x & y) ^ (x & z) ^ (y & z)); 27 | } 28 | 29 | function Sigma0256(x) { 30 | return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); 31 | } 32 | 33 | function Sigma1256(x) { 34 | return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); 35 | } 36 | 37 | function Gamma0256(x) { 38 | return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); 39 | } 40 | 41 | function Gamma1256(x) { 42 | return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); 43 | } 44 | 45 | function core_sha256(m, l) { 46 | const K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2); 47 | const HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); 48 | const W = new Array(64); 49 | let a; 50 | let b; 51 | let c; 52 | let d; 53 | let e; 54 | let f; 55 | let g; 56 | let h; 57 | var i; 58 | var j; 59 | let T1; 60 | let T2; 61 | m[l >> 5] |= 0x80 << (24 - l % 32); 62 | m[((l + 64 >> 9) << 4) + 15] = l; 63 | for (i = 0; i < m.length; i += 16) { 64 | a = HASH[0]; 65 | 66 | b = HASH[1]; 67 | 68 | c = HASH[2]; 69 | 70 | d = HASH[3]; 71 | 72 | e = HASH[4]; 73 | 74 | f = HASH[5]; 75 | 76 | g = HASH[6]; 77 | 78 | h = HASH[7]; 79 | for (j = 0; j < 64; j++) { 80 | if (j < 16) W[j] = m[j + i]; 81 | else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]); 82 | 83 | T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]); 84 | T2 = safe_add(Sigma0256(a), Maj(a, b, c)); 85 | h = g; 86 | g = f; 87 | f = e; 88 | e = safe_add(d, T1); 89 | d = c; 90 | c = b; 91 | b = a; 92 | a = safe_add(T1, T2); 93 | } 94 | HASH[0] = safe_add(a, HASH[0]); 95 | 96 | HASH[1] = safe_add(b, HASH[1]); 97 | 98 | HASH[2] = safe_add(c, HASH[2]); 99 | 100 | HASH[3] = safe_add(d, HASH[3]); 101 | 102 | HASH[4] = safe_add(e, HASH[4]); 103 | 104 | HASH[5] = safe_add(f, HASH[5]); 105 | 106 | HASH[6] = safe_add(g, HASH[6]); 107 | 108 | HASH[7] = safe_add(h, HASH[7]); 109 | 110 | } 111 | return HASH; 112 | } 113 | 114 | function str2binb(str) { 115 | const bin = Array(); 116 | 117 | const mask = (1 << chrsz) - 1; 118 | 119 | for (let i = 0; i < str.length * chrsz; i += chrsz) { 120 | 121 | bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i % 32); 122 | 123 | } 124 | 125 | return bin; 126 | 127 | } 128 | 129 | 130 | function Utf8Encode(string) { 131 | 132 | string = string.replace(/\r\n/g, "\n"); 133 | 134 | let utftext = ""; 135 | for (let n = 0; n < string.length; n++) { 136 | const c = string.charCodeAt(n); 137 | if (c < 128) { 138 | 139 | utftext += String.fromCharCode(c); 140 | 141 | } else if ((c > 127) && (c < 2048)) { 142 | 143 | utftext += String.fromCharCode((c >> 6) | 192); 144 | 145 | utftext += String.fromCharCode((c & 63) | 128); 146 | 147 | } else { 148 | 149 | utftext += String.fromCharCode((c >> 12) | 224); 150 | 151 | utftext += String.fromCharCode(((c >> 6) & 63) | 128); 152 | 153 | utftext += String.fromCharCode((c & 63) | 128); 154 | 155 | } 156 | } 157 | return utftext; 158 | 159 | } 160 | 161 | function binb2hex(binarray) { 162 | 163 | const hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; 164 | 165 | let str = ""; 166 | 167 | for (let i = 0; i < binarray.length * 4; i++) { 168 | 169 | str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + 170 | 171 | hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF); 172 | 173 | } 174 | 175 | return str; 176 | 177 | } 178 | if (BigNumber.isBigNumber(s) || (!isNaN(parseFloat(s)) && isFinite(s))) { 179 | s = s.toString() 180 | } 181 | s = Utf8Encode(s); 182 | 183 | return binb2hex(core_sha256(str2binb(s), s.length * chrsz)); 184 | } 185 | -------------------------------------------------------------------------------- /src/includes/functions/cryptography/str2bin.js: -------------------------------------------------------------------------------- 1 | str2bin(txt, spaceSeparatedOctets) { 2 | function zeroPad(num) { 3 | return "00000000".slice(String(num).length) + num 4 | } 5 | return txt.replace(/[\s\S]/g, function(str) { 6 | str = zeroPad(str.charCodeAt().toString(2)); 7 | return !1 == spaceSeparatedOctets ? str : str + " " 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /src/includes/functions/includes.js: -------------------------------------------------------------------------------- 1 | //= math 2 | //= math/math 3 | //= math/other 4 | //= math/stats 5 | //= math/trig 6 | //= math/algebra 7 | //= math/fractions 8 | //= math/generators 9 | //= math/units 10 | //= math/numbers 11 | //= math/random 12 | //= other 13 | //= array 14 | //= cryptography 15 | //= math/complex 16 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/derivate.js: -------------------------------------------------------------------------------- 1 | derivate(poly) { 2 | if (poly.type != 'polynomial') { 3 | throw "TheoremJS: Derivative: Not a polynomial" 4 | } 5 | let values = [] 6 | const arr = poly.values.reverse() 7 | for (let i = 0; i < arr.length; i++) { 8 | values.push(i * arr[i]) 9 | } 10 | values.reverse() 11 | values.pop() 12 | const out = values.filter(a => !isNaN(a)) 13 | 14 | return this.polynomial(...out) 15 | } 16 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/f.js: -------------------------------------------------------------------------------- 1 | f(v, func) { 2 | if (typeof v == 'function') { 3 | return { 4 | type: "function", 5 | core: v 6 | } 7 | } 8 | return { 9 | type: "function", 10 | v: v, 11 | f: func, 12 | core: x => { 13 | let regex = new RegExp(v) 14 | let newStr = func.replace(regex, `(${x})`) 15 | return eval(newStr).toFixed(14) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/findRoots.js: -------------------------------------------------------------------------------- 1 | findRoots(f) { 2 | let exp = []; 3 | if (f.type == "polynomial") { 4 | switch (f.values.length - 1) { 5 | case 1: { 6 | exp.push(`${new BigNumber(f.values[1]).isNegative() ? '' : '-'}${f.values[1]} / ${f.values[0]}`) 7 | break; 8 | } 9 | case 2: { 10 | const delta = new BigNumber(f.values[1]).pow(2).minus(new BigNumber(4).times(f.values[0]).times(f.values[2])).toNumber() 11 | if (delta > 0) { 12 | exp.push(`(${new BigNumber(f.values[1]).isNegative() ? '' : '-'}${new BigNumber(f.values[1]).abs()} + Math.sqrt(${delta})) / ${new BigNumber(f.values[0]).times(2)}`) 13 | exp.push(`(${new BigNumber(f.values[1]).isNegative() ? '' : '-'}${new BigNumber(f.values[1]).abs()} - Math.sqrt(${delta})) / ${new BigNumber(f.values[0]).times(2)}`) 14 | } 15 | break; 16 | } 17 | case 3: { 18 | let a = new BigNumber(f.values[0]).toNumber() 19 | let b = new BigNumber(f.values[1]).toNumber() 20 | let c = new BigNumber(f.values[2]).toNumber() 21 | let d = new BigNumber(f.values[3]).toNumber() 22 | 23 | // Convert to depressed cubic t^3+pt+q = 0 (subst x = t - b/3a) 24 | var p = (3 * a * c - b * b) / (3 * a * a); 25 | var q = (2 * b * b * b - 9 * a * b * c + 27 * a * a * d) / (27 * a * a * a); 26 | var roots; 27 | 28 | if (Math.abs(p) < 1e-8) { // p = 0 -> t^3 = -q -> t = -q^1/3 29 | roots = [Math.cbrt(-q)]; 30 | } else if (Math.abs(q) < 1e-8) { // q = 0 -> t^3 + pt = 0 -> t(t^2+p)=0 31 | roots = [0].concat(p < 0 ? [Math.sqrt(-p), -Math.sqrt(-p)] : []); 32 | } else { 33 | var D = q * q / 4 + p * p * p / 27; 34 | 35 | var u; // no-redeclare 36 | if (Math.abs(D) < 1e-8) { // D = 0 -> two roots 37 | roots = [-1.5 * q / p, 3 * q / p]; 38 | } else if (D > 0) { // Only one real root 39 | u = Math.cbrt(-q / 2 - Math.sqrt(D)); 40 | roots = [u - p / (3 * u)]; 41 | } else { // D < 0, three roots, but needs to use complex numbers/trigonometric solution 42 | u = 2 * Math.sqrt(-p / 3); 43 | var t = Math.acos(3 * q / p / u) / 3; // D < 0 implies p < 0 and acos argument in [-1..1] 44 | var k = 2 * Math.PI / 3; 45 | roots = [u * Math.cos(t), u * Math.cos(t - k), u * Math.cos(t - 2 * k)]; 46 | } 47 | } 48 | 49 | // Convert back from depressed cubic 50 | for (var i = 0; i < roots.length; i++) 51 | roots[i] -= b / (3 * a); 52 | exp = roots; 53 | break; 54 | } 55 | default: { 56 | exp = [this.numeralSolve(f, 0)[0]] 57 | } 58 | } 59 | } else { 60 | exp = [this.numeralSolve(f, 0)[0]] 61 | } 62 | return exp 63 | } 64 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/gaussElimination.js: -------------------------------------------------------------------------------- 1 | gaussElimination(input, order) { 2 | const matrix = input; 3 | const n = input.length - 1; 4 | const coefficients = [order]; 5 | 6 | for (let i = 0; i < n; i++) { 7 | let maxrow = i; 8 | for (let j = i + 1; j < n; j++) { 9 | if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][maxrow])) { 10 | maxrow = j; 11 | } 12 | } 13 | 14 | for (let k = i; k < n + 1; k++) { 15 | const tmp = matrix[k][i]; 16 | matrix[k][i] = matrix[k][maxrow]; 17 | matrix[k][maxrow] = tmp; 18 | } 19 | 20 | for (let j = i + 1; j < n; j++) { 21 | for (let k = n; k >= i; k--) { 22 | matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i]; 23 | } 24 | } 25 | } 26 | 27 | for (let j = n - 1; j >= 0; j--) { 28 | let total = 0; 29 | for (let k = j + 1; k < n; k++) { 30 | total += matrix[k][j] * coefficients[k]; 31 | } 32 | 33 | coefficients[j] = (matrix[n][j] - total) / matrix[j][j]; 34 | } 35 | 36 | return coefficients; 37 | } 38 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/gradient.js: -------------------------------------------------------------------------------- 1 | gradient(p1, p2) { 2 | const x1 = Number(Object.keys(p1)[0]) 3 | const y1 = Number(Object.values(p1)[0]) 4 | const x2 = Number(Object.keys(p2)[0]) 5 | const y2 = Number(Object.values(p2)[0]) 6 | 7 | const slope = (y2 - y1) / (x2 - x1) 8 | 9 | return slope 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/graph.js: -------------------------------------------------------------------------------- 1 | graph(f, from=-100, to=100, step=0.1) { 2 | let array = {} 3 | for (var i = new BigNumber(from); i.lessThanOrEqualTo(new BigNumber(to)); i = i.plus(new BigNumber(step))) { 4 | array[i.toString()] = f.core(i).toFixed(15) 5 | } 6 | return array 7 | } 8 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/integrate.js: -------------------------------------------------------------------------------- 1 | integrate(poly) { 2 | if (poly.type != 'polynomial') { 3 | throw "TheoremJS: Integrate: Not a polynomial" 4 | } 5 | let values = [] 6 | for (let i in poly.values.reverse()) { 7 | values.push(poly.values[i] / (parseInt(i)+1)) 8 | } 9 | values.reverse() 10 | values.push(0) 11 | const out = values.filter(a => !isNaN(a)) 12 | 13 | return this.polynomial(...out) 14 | } 15 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/numeralSolve.js: -------------------------------------------------------------------------------- 1 | numeralSolve(f, end, from = -100, to = 100, step = 0.1) { 2 | let buffer = [] 3 | let index = [] 4 | for (let i = new BigNumber(from); i.lt(to); i = i.plus(step)) { 5 | buffer.push(this.run(f, i.toNumber())) 6 | index.push(i.toNumber()) 7 | } 8 | function closest(num, arr) { 9 | let curr = arr[0]; 10 | let diff = Math.abs(num - curr); 11 | for (let val = 0; val < arr.length; val++) { 12 | const newdiff = Math.abs(num - arr[val]); 13 | if (newdiff < diff) { 14 | diff = newdiff; 15 | curr = arr[val]; 16 | } 17 | } 18 | return curr; 19 | } 20 | const close = closest(end, buffer.filter(x => !isNaN(x))) 21 | return index[buffer.indexOf(close)] 22 | } 23 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/polynomial.js: -------------------------------------------------------------------------------- 1 | polynomial() { 2 | const arg = [...arguments] 3 | const args = this.reverse(arg) 4 | let buffer = ""; 5 | for (let i = 0; i < args.length; i++) { 6 | buffer += `${args[i]} * x**${i} ${i == args.length -1 ? '': '+ '}` 7 | } 8 | return { 9 | type: "polynomial", 10 | v: "x", 11 | f: buffer, 12 | values: arg, 13 | core: x => { 14 | let regex = new RegExp("x") 15 | let newStr = buffer.replace(regex, `(${x})`) 16 | return eval(newStr).toFixed(14) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/run.js: -------------------------------------------------------------------------------- 1 | run(f, x) { 2 | x = new BigNumber(x).toNumber() 3 | let out = 0 4 | try { 5 | out = f.core(x) 6 | } catch(e) { 7 | throw `[TheoremJS]: ${e}` 8 | } 9 | return out 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/slope.js: -------------------------------------------------------------------------------- 1 | slope(f, x=0, i=1E-10) { 2 | const f1 = f.core(x) 3 | const x1 = x 4 | const f2 = f.core(x + i) 5 | const x2 = x + i 6 | return new BigNumber(f2).minus(f1).div(new BigNumber(x2).minus(x1)) 7 | } 8 | -------------------------------------------------------------------------------- /src/includes/functions/math/algebra/y-intercept.js: -------------------------------------------------------------------------------- 1 | y_intercept(f) { 2 | return f.core(0) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/complex.js: -------------------------------------------------------------------------------- 1 | complex(a=0, b=0) { 2 | class complex { 3 | //= ./src 4 | } 5 | return new complex(a, b, this) 6 | } 7 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/i.js: -------------------------------------------------------------------------------- 1 | get i () { 2 | return this.complex(0, 1) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/abs.js: -------------------------------------------------------------------------------- 1 | abs() { 2 | return new BigNumber(this.a).times(this.a).plus(this.b.times(this.b)).sqrt() // sqrt(a^2 + b^2) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/arg.js: -------------------------------------------------------------------------------- 1 | arg() { 2 | return new BigNumber(this.t.atan2(this.b, this.a)) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/clone.js: -------------------------------------------------------------------------------- 1 | clone() { 2 | return Object.assign( Object.create( Object.getPrototypeOf(this)), this) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/conjugate.js: -------------------------------------------------------------------------------- 1 | conjugate() { 2 | this.b = this.b.negated() 3 | return this 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/constructor.js: -------------------------------------------------------------------------------- 1 | constructor(a, b, theoremjs) { 2 | this.a = new BigNumber(a) 3 | this.b = new BigNumber(b) 4 | this.t = theoremjs 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/div.js: -------------------------------------------------------------------------------- 1 | dividedBy() { 2 | return this.times(...arguments) 3 | } 4 | div(complex) { 5 | if (!complex.isComplex) { 6 | throw "[TheoremJS]: Complex operation require complex numbers" 7 | } 8 | 9 | const a = this.a 10 | const b = this.b 11 | const c = complex.a 12 | const d = complex.b 13 | 14 | const c2d2 = c.times(c).plus(d.times(d)) // c^2 + d^2 15 | 16 | const acbd = a.times(c).plus(b.times(d)) // a*c + b*d 17 | const bcad = b.times(c).minus(a.times(d)) // b*c - a*d 18 | 19 | const re = acbd.div(c2d2) 20 | const im = bcad.div(c2d2) 21 | 22 | this.a = re 23 | this.b = im 24 | 25 | return this 26 | } 27 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/equal.js: -------------------------------------------------------------------------------- 1 | equal() { 2 | return this.eq(...arguments) 3 | } 4 | eq(complex) { 5 | if (!complex.isComplex) { 6 | throw "[TheoremJS]: Complex operation require complex numbers" 7 | } 8 | return this.a.eq(complex.a) && this.b.eq(complex.b) 9 | } 10 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/exp.js: -------------------------------------------------------------------------------- 1 | exp() { 2 | const a = this.a 3 | const b = this.b 4 | 5 | const ea = this.t.exp(a) 6 | const cos = this.t.cos(b) 7 | const sin = this.t.sin(b) 8 | 9 | const re = ea.times(cos) 10 | const im = ea.times(sin) 11 | 12 | this.a = re 13 | this.b = im 14 | 15 | return this 16 | } 17 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/isComplex.js: -------------------------------------------------------------------------------- 1 | get isComplex() { 2 | return true 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/ln.js: -------------------------------------------------------------------------------- 1 | ln() { 2 | const a = this.a 3 | const b = this.b 4 | 5 | const asbs = a.times(a).plus(b.times(b)) 6 | const log = this.t.ln(asbs) 7 | const half = log.div(2) 8 | 9 | this.b = this.arg() 10 | this.a = half 11 | 12 | return this 13 | } 14 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/log.js: -------------------------------------------------------------------------------- 1 | log(base) { 2 | if (!base) { 3 | throw "[TheoremJS] Log: wrong base" 4 | } 5 | let a = this.a 6 | let b = this.b 7 | if (b.eq(0)) { 8 | this.a = this.t.log(a, base) 9 | 10 | return this 11 | } 12 | const asbs = a.times(a).plus(b.times(b)) 13 | const log = this.t.ln(asbs) 14 | const half = log.div(2) 15 | 16 | a = this.arg() 17 | b = half 18 | const c = this.t.ln(base) 19 | const d = new BigNumber(0) 20 | 21 | const c2d2 = c.times(c).plus(d.times(d)) // c^2 + d^2 22 | 23 | const acbd = a.times(c).plus(b.times(d)) // a*c + b*d 24 | const bcad = b.times(c).minus(a.times(d)) // b*c - a*d 25 | 26 | const re = acbd.div(c2d2) 27 | const im = bcad.div(c2d2) 28 | 29 | this.a = im 30 | this.b = re 31 | 32 | return this 33 | } 34 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/minus.js: -------------------------------------------------------------------------------- 1 | minus(complex) { 2 | if (!complex.isComplex) { 3 | throw "[TheoremJS]: Complex operation require complex numbers" 4 | } 5 | this.a = this.a.minus(complex.a) 6 | this.b = this.b.minus(complex.b) 7 | return this 8 | } 9 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/negated.js: -------------------------------------------------------------------------------- 1 | negated() { 2 | this.a = this.a.negated() 3 | this.b = this.b.negated() 4 | return this 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/plus.js: -------------------------------------------------------------------------------- 1 | plus(complex) { 2 | if (!complex.isComplex) { 3 | throw "[TheoremJS]: Complex operation require complex numbers" 4 | } 5 | this.a = this.a.plus(complex.a) 6 | this.b = this.b.plus(complex.b) 7 | return this 8 | } 9 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/pow.js: -------------------------------------------------------------------------------- 1 | pow(complex) { 2 | /* I couldn't find a good formula, so here is a derivation and optimization 3 | * 4 | * z_1^z_2 = (a + bi)^(c + di) 5 | * = exp((c + di) * log(a + bi) 6 | * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a)) 7 | * =>... 8 | * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) 9 | * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) 10 | * 11 | * =>... 12 | * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) 13 | * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) 14 | * 15 | * => 16 | * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1)) 17 | * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1)) 18 | * 19 | */ 20 | 21 | function logHypot(a, b) { 22 | a = new BigNumber(a).toNumber() 23 | b = new BigNumber(b).toNumber() 24 | 25 | const _a = Math.abs(a); 26 | const _b = Math.abs(b); 27 | 28 | if (a === 0) { 29 | return new BigNumber(Math.log(_b)); 30 | } 31 | 32 | if (b === 0) { 33 | return new BigNumber(Math.log(_a)); 34 | } 35 | 36 | if (_a < 3000 && _b < 3000) { 37 | return new BigNumber(Math.log(a * a + b * b) * 0.5); 38 | } 39 | 40 | /* I got 4 ideas to compute this property without overflow: 41 | * 42 | * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate 43 | * 44 | * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11) 45 | Math.log(a * a + b * b) / 2 46 | * 47 | * 48 | * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10) 49 | var fn = function(a, b) { 50 | a = Math.abs(a); 51 | b = Math.abs(b); 52 | var t = Math.min(a, b); 53 | a = Math.max(a, b); 54 | t = t / a; 55 | return Math.log(a) + Math.log(1 + t * t) / 2; 56 | }; 57 | * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10) 58 | Math.log(a / Math.cos(Math.atan2(b, a))) 59 | * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9) 60 | Math.log(a) - Math.log(Math.cos(Math.atan2(b, a))) 61 | */ 62 | 63 | return new BigNumber(Math.log(a / Math.cos(Math.atan2(b, a)))) 64 | } 65 | 66 | let c; 67 | let d; 68 | 69 | if (complex.isComplex) { 70 | c = complex.a; 71 | d = complex.b; 72 | } else if (typeof complex === 'number' || complex.isBigNumber) { 73 | c = new BigNumber(complex); 74 | d = new BigNumber(0); 75 | } else { 76 | throw "[TheoremJS]: Unsupported typeof power" 77 | } 78 | 79 | let a = this.a; 80 | let b = this.b; 81 | 82 | const arg = this.t.atan2(b, a); 83 | const loh = logHypot(a, b); 84 | 85 | a = this.t.exp( 86 | c.times(loh).minus(d.times(arg)) 87 | ) 88 | b = d.times(loh).plus(c.times(arg)) 89 | 90 | this.a = a.times(this.t.cos(b)) 91 | this.b = a.times(this.t.sin(b)) 92 | 93 | return this 94 | } 95 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/times.js: -------------------------------------------------------------------------------- 1 | multipliedBy() { 2 | return this.times(...arguments) 3 | } 4 | times(complex) { 5 | if (!complex.isComplex) { 6 | throw "[TheoremJS]: Complex operation require complex numbers" 7 | } 8 | const a = this.a 9 | const b = this.b 10 | this.a = a.times(complex.a).minus(b.times(complex.b)) 11 | this.b = a 12 | .plus(b) 13 | .times(complex.a.plus(complex.b)) 14 | .minus(a.times(complex.a)) 15 | .minus(b.times(complex.b)) // (a+b)(c+d)-ac-bd. 16 | return this 17 | } 18 | -------------------------------------------------------------------------------- /src/includes/functions/math/complex/src/toString.js: -------------------------------------------------------------------------------- 1 | toString() { 2 | return `${this.a.toString()} ${this.b.lt(0) ? "-" : "+"} ${this.b.abs().toString()}i` 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/fractions/toDec.js: -------------------------------------------------------------------------------- 1 | toDec() { 2 | const args = [...arguments] 3 | if (typeof args[0] == 'object') { 4 | if (args[0].length != 2) { 5 | throw "Require 2 numbers" 6 | } 7 | return new BigNumber(args[0][0]).div(args[0][1]) 8 | } 9 | if (args.length != 2) { 10 | throw "Require 2 numbers" 11 | } 12 | return new BigNumber(args[0]).div(args[1]) 13 | } 14 | -------------------------------------------------------------------------------- /src/includes/functions/math/fractions/toFraction.js: -------------------------------------------------------------------------------- 1 | toFraction(x, p=15) { 2 | const BN = BigNumber.clone({ DECIMAL_PLACES: 20 }) 3 | return new BN(x.toFixed(15)).toFraction(p) 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/math/generators/collatz.js: -------------------------------------------------------------------------------- 1 | * collatz(n) { 2 | while (n != 1) { 3 | if(n % 2 == 0) { 4 | n = n / 2 5 | } else { 6 | n = 3 * n + 1 7 | } 8 | yield n; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/generators/fibonacci.js: -------------------------------------------------------------------------------- 1 | * fibonacci() { 2 | let fn1 = 0; 3 | let fn2 = 1; 4 | while (true) { 5 | const current = fn1; 6 | fn1 = fn2; 7 | fn2 = fn1 + current; 8 | const reset = yield current; 9 | if (reset) { 10 | fn1 = 0; 11 | fn2 = 1; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/includes/functions/math/generators/sieve.js: -------------------------------------------------------------------------------- 1 | * sieve() { 2 | let n = 2; 3 | 4 | while (true) { 5 | if (this.isPrime(n)) yield n; 6 | n++; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/exp.js: -------------------------------------------------------------------------------- 1 | exp(n) { 2 | if (n.isComplex) { 3 | return n.exp() 4 | } 5 | return new BigNumber(Math.exp(new BigNumber(n).toNumber())) 6 | } 7 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/factorial.js: -------------------------------------------------------------------------------- 1 | factorial(n) { 2 | if (new BigNumber(n).eq(0)) { 3 | return new BigNumber(1); 4 | } 5 | return new BigNumber(n).times(this.factorial(new BigNumber(n).minus(1))) 6 | } 7 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/gamma.js: -------------------------------------------------------------------------------- 1 | gamma (z) { 2 | const g = 7; 3 | const p = [ 4 | 0.99999999999980993, 5 | 676.5203681218851, 6 | -1259.1392167224028, 7 | 771.32342877765313, 8 | -176.61502916214059, 9 | 12.507343278686905, 10 | -0.13857109526572012, 11 | 9.9843695780195716e-6, 12 | 1.5056327351493116e-7 13 | ]; 14 | if (z < 0.5) { 15 | return new BigNumber(Number(Math.PI / (Math.sin(Math.PI * z) * this.gamma(1 - z).toNumber())).toFixed(10)); 16 | } 17 | else if(z > 100) return Math.exp(this.lngamma(z)); 18 | else { 19 | z -= 1; 20 | let x = p[0]; 21 | for (var i = 1; i < g + 2; i++) { 22 | x += p[i] / (z + i); 23 | } 24 | const t = z + g + 0.5; 25 | 26 | return new BigNumber(Number(Math.sqrt(2 * Math.PI) 27 | * Math.pow(t, z + 0.5) 28 | * Math.exp(-t) 29 | * x 30 | ).toFixed(10)) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/ln.js: -------------------------------------------------------------------------------- 1 | ln(x, n = 15) { 2 | if (x.isComplex) { 3 | return x.ln() 4 | } 5 | let buffer = new BigNumber(0); 6 | for (let i = 0; i < Math.ceil(n + (3 / 2 * x)); i++) { 7 | const n = new BigNumber(1) 8 | .div(new BigNumber(i).times(2).plus(1)) 9 | .times( 10 | new BigNumber(x).minus(1) 11 | .div(new BigNumber(x).plus(1)) 12 | .pow(new BigNumber(i).times(2).plus(1)) 13 | ) 14 | buffer = buffer.plus(n) 15 | } 16 | return new BigNumber(buffer.times(2).toFixed(n - 1)) 17 | } 18 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/lngamma.js: -------------------------------------------------------------------------------- 1 | lngamma(z) { 2 | const g_ln = 607/128; 3 | const p_ln = [ 4 | 0.99999999999999709182, 5 | 57.156235665862923517, 6 | -59.597960355475491248, 7 | 14.136097974741747174, 8 | -0.49191381609762019978, 9 | 0.33994649984811888699e-4, 10 | 0.46523628927048575665e-4, 11 | -0.98374475304879564677e-4, 12 | 0.15808870322491248884e-3, 13 | -0.21026444172410488319e-3, 14 | 0.21743961811521264320e-3, 15 | -0.16431810653676389022e-3, 16 | 0.84418223983852743293e-4, 17 | -0.26190838401581408670e-4, 18 | 0.36899182659531622704e-5 19 | ]; 20 | if(z < 0) return Number('0/0'); 21 | let x = p_ln[0]; 22 | for(var i = p_ln.length - 1; i > 0; --i) x += p_ln[i] / (z + i); 23 | const t = z + g_ln + 0.5; 24 | return new BigNumber(Number(.5*Math.log(2*Math.PI)+(z+.5)*Math.log(t)-t+Math.log(x)-Math.log(z)).toFixed(10)); 25 | } 26 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/log.js: -------------------------------------------------------------------------------- 1 | log(x, base, n = 15) { 2 | if (x.isComplex) { 3 | return x.log(base) 4 | } 5 | return new BigNumber(this.ln(x, n).div(this.ln(base, n)).toFixed(n - 1)) 6 | } 7 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/pow.js: -------------------------------------------------------------------------------- 1 | pow(n, base) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = [n] 4 | } 5 | let result = [] 6 | for (var i = 0; i < n.length; i++) { 7 | result.push(new BigNumber(Math.pow(new BigNumber(n[i]).toNumber(), new BigNumber(base).toNumber()).toFixed(10))) 8 | } 9 | return result.length == 1 ? result[0] : new BigNumber(result) 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/root.js: -------------------------------------------------------------------------------- 1 | root(n, base) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = [n] 4 | } 5 | let result = [] 6 | for (var i = 0; i < n.length; i++) { 7 | result.push(new BigNumber(Math.pow(new BigNumber(n[i]).toNumber(), new BigNumber(1).div(base).toNumber()).toFixed(15))) 8 | } 9 | return result.length == 1 ? result[0] : result 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/sigmoid.js: -------------------------------------------------------------------------------- 1 | sigmoid(x, n = 15) { 2 | return new BigNumber(new BigNumber(1).div(this.pow(this.c("e", n), x).plus(1)).toFixed(n)) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/math/sqrt.js: -------------------------------------------------------------------------------- 1 | sqrt(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = [n] 4 | } 5 | let result = [] 6 | for (var i = 0; i < n.length; i++) { 7 | if (new BigNumber(n[i]).lt(0)) { 8 | result.push(this.complex(0, new BigNumber(n[i]).abs().sqrt())) 9 | } else { 10 | result.push(new BigNumber(new BigNumber(n[i]).sqrt())) 11 | } 12 | } 13 | return result.length == 1 ? result[0] : result 14 | } 15 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/abs.js: -------------------------------------------------------------------------------- 1 | abs(n) { 2 | return new BigNumber(n).abs() 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/c.js: -------------------------------------------------------------------------------- 1 | c(name, n = 15) { 2 | const numbers = { 3 | "alphaParticleMass": "6.64465675e-27", 4 | "atomicMass": "1.660538921e-27", 5 | "Avogadro": "6.02214129e23", 6 | "Boltzmann": "1.3806488e-23", 7 | "conductanceQuantum": "7.7480917346e-5", 8 | "e": "2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668", 9 | "earth-moon": "384401", 10 | "earth-sun": "1.496e8", 11 | "earthMass": "5.974e+24", 12 | "earthRadius": "6378", 13 | "electric": "8.854187e-12", 14 | "electronMass": "9.10938291e-31", 15 | "elementaryCharge": "1.602176565e-19", 16 | "EulerGamma": "0.5772156649015328606065120900824024310421593359399235988057672348848677267776646709369470632917467495146314472498070824809605040144865428362241739976449235362535003337429373377376739427925952582470949160087352039481656708532331517766115286211995015080", 17 | "Faraday": "96485.3365", 18 | "fineStructure": "7.2973525698e-3", 19 | "goldenRatio": "1.618033988749894848204586834365638117720309179805762862135448622705260462818902449707207204189391137484754088075386891752126633862223536931793180060766726354433389086595939582905638322661319928290267880675208766892501711696207032221043216269548626296", 20 | "gravity": "9.80665", 21 | "inverseFineStructure": "137.035999074", 22 | "magnetic": "12.566370614e-7", 23 | "magneticFluxQuantum": "2.067833758e-15", 24 | "molarGas": "8.3144621", 25 | "moonMass": "7.348e22", 26 | "moonRadius": "1738", 27 | "neutronMass": "1.674927351e-27", 28 | "NewtonGravitation": "6.67384e-11", 29 | "pi": "3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909", 30 | "Planck": "6.62606957e-34", 31 | "proton-electronMassRatio": "1836.15267245", 32 | "proton-neutronMassRatio": "0.99862347826", 33 | "protonMass": "1.672621777e-27", 34 | "Rydberg": "10973731.568539", 35 | "speedOfLight": "299792458", 36 | "speedOfSound": "340.27", 37 | "sqrt(2)": "1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846230912297024924836055850737212644121497099935831413222665927505592755799950501152782060571470109559971605970274534596862014728517418640889199", 38 | "Stefan-Boltzmann": "5.670373e-8", 39 | "sunMass": "1.989e30", 40 | "sunRadius": "695500", 41 | "TheRockMass": "124.73790175", 42 | "ThomsonCrossSection": "0.6652458734e-28", 43 | "UltimateAnswer": "42", 44 | "zeroKelvin": "-273.15" 45 | } 46 | const BN = BigNumber.clone({ 47 | DECIMAL_PLACES: n 48 | }) 49 | const num = numbers[name].split("e") 50 | if (num.length > 1) { 51 | return new BN(`${num[0].slice(0, n + 2)}e${num[1]}`) 52 | } 53 | return new BN(num[0].slice(0, n + 2)) 54 | } 55 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/ceil.js: -------------------------------------------------------------------------------- 1 | ceil(n) { 2 | return new BigNumber(n).integerValue(BigNumber.ROUND_CEIL) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/e.js: -------------------------------------------------------------------------------- 1 | get e() { 2 | const n = 15 3 | const BN = BigNumber.clone({ DECIMAL_PLACES: n }) 4 | let zero = new BN(0); 5 | let one = new BN(1); 6 | 7 | for (let i = 0; i <= n * 10; i++) { 8 | let fval = this.factorial(i); 9 | let invert = one.div(fval) 10 | zero = zero.plus(invert) 11 | } 12 | return new BN(zero); 13 | } 14 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/floor.js: -------------------------------------------------------------------------------- 1 | floor(n) { 2 | return new BigNumber(n).integerValue(BigNumber.ROUND_FLOOR) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/goldenRatio.js: -------------------------------------------------------------------------------- 1 | get goldenRatio() { 2 | const n = 15 3 | const BN = BigNumber.clone({ DECIMAL_PLACES: n + 1 }) 4 | return new BN(BN(1).plus(this.sqrt(5)).div(2).toFixed(n + 1)) 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/isPrime.js: -------------------------------------------------------------------------------- 1 | isPrime(n) { 2 | n = new BigNumber(n).abs() 3 | if (n.toNumber() * 0 !== 0) { 4 | return false; 5 | } 6 | if (n.lte(3)) return n.gt(1); 7 | if (n.mod(2).eq(0) || n.mod(3).eq(0)) return false; 8 | 9 | for (let i = 5; n.gte(i * i); i += 6) { 10 | if (n.mod(i).eq(0) || n.mod(i + 2).eq(0)) { 11 | return false 12 | } 13 | } 14 | 15 | return true; 16 | } 17 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/leastFactor.js: -------------------------------------------------------------------------------- 1 | leastFactor(n) { 2 | n = new BigNumber(n).abs().toNumber() 3 | if (Number.MAX_SAFE_INTEGER < n) throw `${n} is superior to ${Number.MAX_SAFE_INTEGER}` 4 | let out = false 5 | if (isNaN(n) || !isFinite(n)) out = NaN; 6 | if (n == 0) out = out !== false ? out : 0; 7 | if (n % 1 || n * n < 2) out = out !== false ? out : 1; 8 | if (n % 2 == 0) out = out !== false ? out : 2; 9 | if (n % 3 == 0) out = out !== false ? out : 3; 10 | if (n % 5 == 0) out = out !== false ? out : 5; 11 | const m = Math.sqrt(n); 12 | for (let i = 7; i <= m; i += 30) { 13 | if (n % i == 0) out = out !== false ? out : i; 14 | if (n % (i + 4) == 0) out = out !== false ? out : i + 4; 15 | if (n % (i + 6) == 0) out = out !== false ? out : i + 6; 16 | if (n % (i + 10) == 0) out = out !== false ? out : i + 10; 17 | if (n % (i + 12) == 0) out = out !== false ? out : i + 12; 18 | if (n % (i + 16) == 0) out = out !== false ? out : i + 16; 19 | if (n % (i + 22) == 0) out = out !== false ? out : i + 22; 20 | if (n % (i + 24) == 0) out = out !== false ? out : i + 24; 21 | } 22 | out = out !== false ? out : n 23 | 24 | return new BigNumber(out) 25 | } 26 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/n.js: -------------------------------------------------------------------------------- 1 | n(n, base=10) { 2 | return new BigNumber(n, base) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/nPrime.js: -------------------------------------------------------------------------------- 1 | nPrime(n) { 2 | n = new BigNumber(n).toNumber() 3 | if (n < 1) { 4 | throw "[TheoremJS]: n is less than 1" 5 | } 6 | if (n > Number.MAX_SAFE_INTEGER) { 7 | throw `[TheoremJS] Input was larger than ${Number.MAX_SAFE_INTEGER}` 8 | } 9 | const gen = this.sieve() 10 | let out = 0 11 | for (var i = 0; i < n; i++) { 12 | out = gen.next().value 13 | } 14 | return new BigNumber(out) 15 | } 16 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/pi.js: -------------------------------------------------------------------------------- 1 | get pi() { 2 | const digits = 15 3 | const Decimal = BigNumber.clone({ DECIMAL_PLACES: digits }) 4 | function arctan(x) { 5 | var y = x; 6 | var yPrev = NaN; 7 | var x2 = x.times(x); 8 | var num = x; 9 | var sign = -1; 10 | 11 | for (var k = 3; !y.eq(yPrev); k += 2) { 12 | num = num.times(x2); 13 | 14 | yPrev = y; 15 | y = (sign > 0) ? y.plus(num.div(k)) : y.minus(num.div(k)); 16 | sign = -sign; 17 | } 18 | 19 | return y; 20 | } 21 | 22 | // Machin: Pi / 4 = 4 * arctan(1 / 5) - arctan(1 / 239) 23 | // http://milan.milanovic.org/math/english/pi/machin.html 24 | 25 | // we calculate pi with a few decimal places extra to prevent round off issues 26 | var DecimalPlus = BigNumber.clone({ DECIMAL_PLACES: digits + 4 }) 27 | var pi4th = new DecimalPlus(4).times(arctan(new DecimalPlus(1).div(5))) 28 | .minus(arctan(new DecimalPlus(1).div(239))); 29 | 30 | // the final pi has the requested number of decimals 31 | return new Decimal(4).times(new Decimal(pi4th)) 32 | } 33 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/primeFactors.js: -------------------------------------------------------------------------------- 1 | primeFactors(n) { 2 | n = new BigNumber(n).toNumber() 3 | if (n < 2) { 4 | throw "[TheoremJS] Number should be greater or equal to 2" 5 | } 6 | if (n > Number.MAX_SAFE_INTEGER) { 7 | throw `[TheoremJS] Input was larger than ${Number.MAX_SAFE_INTEGER}` 8 | } 9 | let list = [] 10 | for (var i = 2; i <= n; i++) { 11 | if (n % i == 0) { 12 | if (this.isPrime(i)) { 13 | n /= i 14 | list.push(new BigNumber(i)) 15 | i = i - 1 // check for number twice (example 100 = 2*2*5*5) 16 | } 17 | } 18 | } 19 | return list 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/primePi.js: -------------------------------------------------------------------------------- 1 | primePi(n) { 2 | n = new BigNumber(n).toNumber() 3 | if (n < 2) { 4 | throw "[TheoremJS] Number should be greater or equal to 2" 5 | } 6 | if (n > Number.MAX_SAFE_INTEGER) { 7 | throw `[TheoremJS] Input was larger than ${Number.MAX_SAFE_INTEGER}` 8 | } 9 | const gen = this.sieve() 10 | let out = 0 11 | for (var i = 0; i < n; i = gen.next().value) { 12 | out += 1 13 | } 14 | return new BigNumber(out - 1) 15 | } 16 | -------------------------------------------------------------------------------- /src/includes/functions/math/numbers/round.js: -------------------------------------------------------------------------------- 1 | round(n, precision = 0) { 2 | const tenPow = this.pow(10, precision) 3 | return new BigNumber(n).times(tenPow).integerValue(BigNumber.ROUND_HALF_CEIL).div(tenPow) 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/apply.js: -------------------------------------------------------------------------------- 1 | apply(n, f) { 2 | if (typeof n != 'object') { 3 | n = [n] 4 | } 5 | let result = [] 6 | for (var i = 0; i < n.length; i++) { 7 | result.push(f(n[i])) 8 | } 9 | return result.length == 1 ? result[0] : result 10 | } 11 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/max.js: -------------------------------------------------------------------------------- 1 | max() { 2 | const sorted = this.sort(...arguments); 3 | return sorted[sorted.length - 1] 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/min.js: -------------------------------------------------------------------------------- 1 | min() { 2 | const sorted = this.sort(...arguments); 3 | return sorted[0] 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/product.js: -------------------------------------------------------------------------------- 1 | product() { 2 | return [...arguments].reduce((a, b) => new BigNumber(a).times(b)) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/sort.js: -------------------------------------------------------------------------------- 1 | sort() { 2 | // https://gist.github.com/jasondscott/7073857 3 | const t = this; 4 | Array.prototype.quickSort = function() { 5 | 6 | var r = this; 7 | if (this.length <= 1) { 8 | return this; 9 | } 10 | var less = [], 11 | greater = []; 12 | 13 | var pivot = r.splice(t.floor(new BigNumber(r.length).div(2)), 1); 14 | 15 | for (var i = r.length - 1; i >= 0; i--) { 16 | if (new BigNumber(r[i]).lte(new BigNumber(pivot))) { 17 | less.push(r[i]); 18 | } else { 19 | greater.push(r[i]); 20 | } 21 | } 22 | 23 | var c = []; 24 | 25 | return c.concat(less.quickSort(), pivot, greater.quickSort()); 26 | }; 27 | 28 | return [...arguments].quickSort() 29 | } 30 | -------------------------------------------------------------------------------- /src/includes/functions/math/other/sum.js: -------------------------------------------------------------------------------- 1 | sum() { 2 | return [...arguments].reduce((a, b) => new BigNumber(a).plus(b)) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/random/rand.js: -------------------------------------------------------------------------------- 1 | rand(n = 1, crypto = false) { 2 | const BN = BigNumber.clone({ CRYPTO: crypto }) 3 | let out = [] 4 | for (var i = 0; i < n; i++) { 5 | out.push(BN.random()) 6 | } 7 | return out.length == 1 ? out[0] : out 8 | } 9 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/average.js: -------------------------------------------------------------------------------- 1 | average() { 2 | const summed = this.sum(...arguments); 3 | const average = new BigNumber(summed).div(arguments.length); 4 | return average 5 | } 6 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/correlation.js: -------------------------------------------------------------------------------- 1 | correlation(array1, array2) { 2 | if (array1.length != array2.length) { 3 | throw "[TheoremJS]: Correlation error, arrays are not the same size" 4 | } 5 | const average1 = this.average(...array1).toNumber() 6 | const average2 = this.average(...array2).toNumber() 7 | let up = 0; 8 | let down1 = 0; 9 | let down2 = 0; 10 | for (var i = 0; i < array1.length; i++) { 11 | up += (array1[i] - average1)*(array2[i] - average2) 12 | down1 += Math.pow(array1[i] - average1, 2) 13 | down2 += Math.pow(array2[i] - average2, 2) 14 | } 15 | const result = up / Math.sqrt(down1 * down2) 16 | return new BigNumber(Math.round(result * 10 ** 10) / 10 ** 10) 17 | } 18 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/mean.js: -------------------------------------------------------------------------------- 1 | mean() { 2 | return this.average(...arguments) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/median.js: -------------------------------------------------------------------------------- 1 | median() { 2 | let array = [...arguments] 3 | if (typeof array[0] == 'object') { 4 | array = array[0] 5 | } 6 | array.sort( (a, b) => new BigNumber(a).minus(b).toNumber()); 7 | if (array.length == 0) return 0 8 | 9 | const half = Math.floor(array.length / 2) 10 | 11 | if (array.length % 2) { 12 | return new BigNumber(array[half]) 13 | } else { 14 | return new BigNumber((array[half - 1] + array[half]) / 2) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/quantile.js: -------------------------------------------------------------------------------- 1 | quantile() { 2 | let array = [...arguments] 3 | let n = array[0] 4 | array.shift() 5 | if (typeof array[0] == 'object') { 6 | array = array[0] 7 | } 8 | if (n > 1 || n < 0) { 9 | throw "[TheoremJS] n should be a Float between 0 and 1" 10 | } 11 | 12 | array.sort( (a, b) => a - b); 13 | if (array.length == 0) return 0 14 | 15 | const index = (array.length - 1) * n 16 | const floor = Math.floor(index) 17 | const diff = index - floor; 18 | if (array[index + 1] !== undefined) { 19 | const out = array[floor] + diff * (array[floor + 1] - array[floor]) 20 | return new BigNumber(out) 21 | } else { 22 | return array[floor] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/regression.js: -------------------------------------------------------------------------------- 1 | regression(data, deg) { 2 | if (deg == 1) { 3 | return this.linreg(data) 4 | } else { 5 | return this.polyreg(data, deg) 6 | } 7 | } 8 | linreg(array) { 9 | const x = Object.keys(array) 10 | const y = Object.values(array) 11 | const n = y.length; 12 | let sum_x = 0; 13 | let sum_y = 0; 14 | let sum_xy = 0; 15 | let sum_xx = 0; 16 | let sum_yy = 0; 17 | 18 | for (let i = 0; i < y.length; i++) { 19 | sum_x += parseFloat(x[i]); 20 | sum_y += parseFloat(y[i]); 21 | sum_xy += parseFloat(x[i] * y[i]); 22 | sum_xx += parseFloat(x[i] * x[i]); 23 | sum_yy += parseFloat(y[i] * y[i]); 24 | } 25 | 26 | const slope = (n * sum_xy - sum_x * sum_y) / (n * sum_xx - sum_x * sum_x); 27 | const intercept = (sum_y - slope * sum_x) / n; 28 | return this.polynomial(slope, intercept) 29 | } 30 | polyreg(data, deg) { 31 | const x = Object.keys(data) 32 | for (let i in x) { 33 | x[i] = parseFloat(x[i]) 34 | } 35 | const y = Object.values(data) 36 | for (let i in y) { 37 | y[i] = parseFloat(y[i]) 38 | } 39 | const lhs = []; 40 | const rhs = []; 41 | let a = 0; 42 | let b = 0; 43 | let c; 44 | let k; 45 | 46 | var i; 47 | let j; 48 | let l; 49 | const len = x.length; 50 | 51 | let results; 52 | let equation; 53 | let string; 54 | 55 | if (typeof deg === 'undefined') { 56 | k = 3; 57 | } else { 58 | k = deg + 1; 59 | } 60 | 61 | for (i = 0; i < k; i++) { 62 | for (l = 0; l < len; l++) { 63 | if (y[l] !== null) { 64 | a += x[l] ** i * y[l]; 65 | } 66 | } 67 | 68 | lhs.push(a); 69 | a = 0; 70 | 71 | c = []; 72 | for (j = 0; j < k; j++) { 73 | for (l = 0; l < len; l++) { 74 | if (y[l] !== null) { 75 | b += x[l] ** (i + j); 76 | } 77 | } 78 | c.push(b); 79 | b = 0; 80 | } 81 | rhs.push(c); 82 | } 83 | rhs.push(lhs); 84 | equation = this.gaussElimination(rhs, k); 85 | 86 | return this.polynomial(...equation.reverse()) 87 | } 88 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/std.js: -------------------------------------------------------------------------------- 1 | std() { 2 | const mean = this.mean(...arguments); 3 | const sum = this.sum(...[...arguments].map(e => {return (e - mean) ** 2})); 4 | const N = [...arguments].length; 5 | 6 | return new BigNumber(Math.sqrt(sum / (N - 1))) 7 | } 8 | -------------------------------------------------------------------------------- /src/includes/functions/math/stats/variance.js: -------------------------------------------------------------------------------- 1 | variance() { 2 | return new BigNumber(this.std(...arguments)).pow(2) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/acos.js: -------------------------------------------------------------------------------- 1 | acos(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.acos(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/acosh.js: -------------------------------------------------------------------------------- 1 | acosh(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.acosh(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/angle2Vec.js: -------------------------------------------------------------------------------- 1 | angle2Vec(rad) { 2 | return [this.cos(rad), this.sin(rad)]; 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/asin.js: -------------------------------------------------------------------------------- 1 | asin(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.asin(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/asinh.js: -------------------------------------------------------------------------------- 1 | asinh(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.asinh(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/atan.js: -------------------------------------------------------------------------------- 1 | atan(n) { 2 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.atan(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/atan2.js: -------------------------------------------------------------------------------- 1 | atan2(x, y) { 2 | x = [BigNumber(x).toNumber()] 3 | y = [BigNumber(y).toNumber()] 4 | let result = [] 5 | for (var i = 0; i < x.length; i++) { 6 | result.push(Math.atan2(x[i], y[i])) 7 | } 8 | return result.length == 1 ? result[0] : result 9 | } 10 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/atanh.js: -------------------------------------------------------------------------------- 1 | atanh(n) { 2 | if (typeof n != 'object') { 3 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 4 | n = [n] 5 | } 6 | let result = [] 7 | for (var i = 0; i < n.length; i++) { 8 | result.push(Math.atanh(n[i]).toFixed(15)) 9 | } 10 | return result.length == 1 ? result[0] : result 11 | } 12 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/cos.js: -------------------------------------------------------------------------------- 1 | cos(n) { 2 | if (n.isComplex) { 3 | const a = n.a.toNumber() 4 | const b = n.b.toNumber() 5 | 6 | const re = Math.cos(a) * Math.cosh(b) 7 | const im = Math.sin(a) * Math.sinh(b) 8 | 9 | return this.complex(re, -im) 10 | } 11 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 12 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 13 | n = [n] 14 | } 15 | let result = [] 16 | for (var i = 0; i < n.length; i++) { 17 | result.push(Math.cos(n[i]).toFixed(15)) 18 | } 19 | return result.length == 1 ? result[0] : result 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/cosh.js: -------------------------------------------------------------------------------- 1 | cosh(n) { 2 | if (n.isComplex) { 3 | const a = n.a.toNumber() 4 | const b = n.b.toNumber() 5 | 6 | const re = Math.cos(b) * Math.cosh(a) 7 | const im = Math.sin(b) * Math.sinh(a) 8 | 9 | return this.complex(re, im) 10 | } 11 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 12 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 13 | n = [n] 14 | } 15 | let result = [] 16 | for (var i = 0; i < n.length; i++) { 17 | result.push(Math.cosh(n[i]).toFixed(15)) 18 | } 19 | return result.length == 1 ? result[0] : result 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/deg2rad.js: -------------------------------------------------------------------------------- 1 | deg2rad(x) { 2 | return new BigNumber(x).times(this.pi).div(180) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/drawCircularPoints.js: -------------------------------------------------------------------------------- 1 | drawCircularPoints(n, r=1, start=[-r, 0], complex=false) { 2 | const angle = this.pi.times(2).div(n) 3 | let buffer = {} 4 | buffer[start[0]] = start[1] 5 | let angleState = this.atan2(...start.reverse()) + angle.toNumber() 6 | for (var i = 0; i < n - 1; i++) { 7 | const x = new BigNumber(r).times(this.cos(angleState)).toString() 8 | const y = new BigNumber(r).times(this.sin(angleState)).toNumber() 9 | if (complex === true) { 10 | buffer[i] = this.complex(x, y) 11 | } else { 12 | buffer[x] = y 13 | } 14 | angleState += angle.toNumber() 15 | } 16 | if (complex === true) { 17 | return Object.values(buffer) 18 | } 19 | return buffer 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/rad2deg.js: -------------------------------------------------------------------------------- 1 | rad2deg(x) { 2 | return new BigNumber(x).times(180).div(this.pi) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/sin.js: -------------------------------------------------------------------------------- 1 | sin(n) { 2 | if (n.isComplex) { 3 | const a = n.a.toNumber() 4 | const b = n.b.toNumber() 5 | 6 | const re = Math.cosh(b) * Math.sin(a) 7 | const im = Math.cos(a) * Math.sinh(b) 8 | 9 | return this.complex(re, im) 10 | } 11 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 12 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 13 | n = [n] 14 | } 15 | let result = [] 16 | for (var i = 0; i < n.length; i++) { 17 | result.push(Math.sin(n[i]).toFixed(15)) 18 | } 19 | return result.length == 1 ? result[0] : result 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/sinh.js: -------------------------------------------------------------------------------- 1 | sinh(n) { 2 | if (n.isComplex) { 3 | const a = n.a.toNumber() 4 | const b = n.b.toNumber() 5 | 6 | const re = Math.cos(b) * Math.sinh(a) 7 | const im = Math.cosh(a) * Math.sin(b) 8 | 9 | return this.complex(re, im) 10 | } 11 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 12 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 13 | n = [n] 14 | } 15 | let result = [] 16 | for (var i = 0; i < n.length; i++) { 17 | result.push(Math.sinh(n[i]).toFixed(15)) 18 | } 19 | return result.length == 1 ? result[0] : result 20 | } 21 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/tan.js: -------------------------------------------------------------------------------- 1 | tan(n) { 2 | if (n.isComplex) { 3 | const Ta = n.a.times(2).toNumber() 4 | const Tb = n.b.times(2).toNumber() 5 | 6 | const sin = Math.sin(Ta) 7 | const cos = Math.cos(Ta) 8 | const cosh = Math.cosh(Tb) 9 | const sinh = Math.sinh(Tb) 10 | 11 | const re = sin / (cos + cosh) 12 | const im = sinh / (cos + cosh) 13 | 14 | return this.complex(re, im) 15 | } 16 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 17 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 18 | n = [n] 19 | } 20 | let result = [] 21 | for (var i = 0; i < n.length; i++) { 22 | result.push(Math.tan(n[i]).toFixed(15)) 23 | } 24 | return result.length == 1 ? result[0] : result 25 | } 26 | -------------------------------------------------------------------------------- /src/includes/functions/math/trig/tanh.js: -------------------------------------------------------------------------------- 1 | tanh(n) { 2 | if (n.isComplex) { 3 | const Ta = n.a.times(2).toNumber() 4 | const Tb = n.b.times(2).toNumber() 5 | 6 | const sin = Math.sin(Tb) 7 | const cos = Math.cos(Tb) 8 | const cosh = Math.cosh(Ta) 9 | const sinh = Math.sinh(Ta) 10 | 11 | const re = sinh / (cos + cosh) 12 | const im = sin / (cos + cosh) 13 | 14 | return this.complex(re, im) 15 | } 16 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { 17 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n 18 | n = [n] 19 | } 20 | let result = [] 21 | for (var i = 0; i < n.length; i++) { 22 | result.push(Math.tanh(n[i]).toFixed(15)) 23 | } 24 | return result.length == 1 ? result[0] : result 25 | } 26 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/convert.js: -------------------------------------------------------------------------------- 1 | convert(value, type, a, b) { 2 | class Units { 3 | //= ./units/src/ 4 | } 5 | const u = new Units() 6 | return u[type](value, a, b) 7 | } 8 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/area.js: -------------------------------------------------------------------------------- 1 | area(v, a, b) { 2 | const authorized = [ 3 | "mm2", 4 | "cm2", 5 | "dm2", 6 | "m2", 7 | "dam2", 8 | "hm2", 9 | "ha", 10 | "km2", 11 | "in2", 12 | "ft2", 13 | "yd2", 14 | "mi2" 15 | ] 16 | if (!authorized.includes(a) || !authorized.includes(b)) { 17 | throw "[TheoremJS] Area: wrong units" 18 | } 19 | const ia = authorized.indexOf(a) 20 | const ib = authorized.indexOf(b) 21 | // to square meters 22 | const factor = [ 23 | new BigNumber(1).div(1000000), 24 | new BigNumber(1).div(10000), 25 | new BigNumber(1).div(100), 26 | 1, 27 | 100, 28 | 10000, 29 | 10000, 30 | 1000000, 31 | "0.00064516", 32 | "0.09290304", 33 | "0.83612736", 34 | "2589988.110336" 35 | ] 36 | const g = new BigNumber(v).times(factor[ia]) 37 | 38 | const out = g.div(factor[ib]) 39 | return out 40 | } 41 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/distance.js: -------------------------------------------------------------------------------- 1 | distance() { 2 | return this.length(...arguments) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/length.js: -------------------------------------------------------------------------------- 1 | length(v, a, b) { 2 | const authorized = ["mm", "cm", "dm", "m", "dam", "hm", "km", "yd", "ft", "mi", "in", "li", "au", "ly", "Nm"] 3 | if (!authorized.includes(a) || !authorized.includes(b)) { 4 | throw "[TheoremJS] Length: wrong units" 5 | } 6 | const ia = authorized.indexOf(a) 7 | const ib = authorized.indexOf(b) 8 | // to m 9 | const factor = [ 10 | 1 / 1000, 11 | 1 / 100, 12 | 1 / 10, 13 | 1, 14 | 10, 15 | 100, 16 | 1000, 17 | new BigNumber(0.9144), 18 | new BigNumber(0.3048), 19 | new BigNumber(1609.344), 20 | new BigNumber(25.4).div(1000), 21 | new BigNumber(6.35).times("0.0001"), 22 | new BigNumber("149597870700"), 23 | new BigNumber("9460730472580.8").times(1000), 24 | 1852 25 | ] 26 | const m = new BigNumber(v).times(factor[ia]) 27 | 28 | const out = m.div(factor[ib]) 29 | return out 30 | } 31 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/mass.js: -------------------------------------------------------------------------------- 1 | mass(v, a, b) { 2 | const authorized = [ 3 | "mg", 4 | "cg", 5 | "dg", 6 | "g", 7 | "dag", 8 | "hg", 9 | "kg", 10 | "t", 11 | "oz", 12 | "lb" 13 | ] 14 | if (!authorized.includes(a) || !authorized.includes(b)) { 15 | throw "[TheoremJS] Mass: wrong units" 16 | } 17 | const ia = authorized.indexOf(a) 18 | const ib = authorized.indexOf(b) 19 | // to gram 20 | const factor = [ 21 | 1000, 22 | 100, 23 | 10, 24 | 1, 25 | new BigNumber(1).div(10), 26 | new BigNumber(1).div(100), 27 | new BigNumber(1).div(1000), 28 | new BigNumber(1).div(1000000), 29 | new BigNumber(1).div("28.349523125"), 30 | new BigNumber(1).div("453.59237") 31 | ] 32 | const g = new BigNumber(v).div(factor[ia]) 33 | 34 | const out = new BigNumber(g).times(factor[ib]) 35 | return out 36 | } 37 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/speed.js: -------------------------------------------------------------------------------- 1 | speed(v, a, b) { 2 | const authorized = ["m/s", "km/h", "m/h", "knot", "ft/s"] 3 | if (!authorized.includes(a) || !authorized.includes(b)) { 4 | throw "[TheoremJS] Speed: wrong units" 5 | } 6 | const ia = authorized.indexOf(a) 7 | const ib = authorized.indexOf(b) 8 | // to ms 9 | const factor = [new BigNumber(1), new BigNumber(1).div(3.6), new BigNumber(0.44704), new BigNumber(0.514444), new BigNumber(0.3048)] 10 | const ms = new BigNumber(v).times(factor[ia]) 11 | 12 | const out = ms.div(factor[ib]) 13 | return out 14 | } 15 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/temperature.js: -------------------------------------------------------------------------------- 1 | temperature(v, a, b) { 2 | const authorized = [ 3 | "c", 4 | "f", 5 | "k" 6 | ] 7 | if (!authorized.includes(a) || !authorized.includes(b)) { 8 | throw "[TheoremJS] Temperature: wrong units" 9 | } 10 | const ia = authorized.indexOf(a) 11 | const ib = authorized.indexOf(b) 12 | // to celsius 13 | const add = [ 14 | 0, 15 | -32, 16 | -273.15 17 | ] 18 | const factor = [ 19 | 1, 20 | new BigNumber(5).div(9), 21 | 1 22 | ] 23 | const g = new BigNumber(v).plus(add[ia]).times(factor[ia]) 24 | 25 | const out = g.div(factor[ib]).minus(add[ib]) 26 | return out 27 | } 28 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/time.js: -------------------------------------------------------------------------------- 1 | time(v, a, b) { 2 | const authorized = [ 3 | "ms", 4 | "s", 5 | "m", 6 | "h", 7 | "d", 8 | "w", 9 | "mo", 10 | "y" 11 | ] 12 | if (!authorized.includes(a) || !authorized.includes(b)) { 13 | throw "[TheoremJS] Time: wrong units" 14 | } 15 | const ia = authorized.indexOf(a) 16 | const ib = authorized.indexOf(b) 17 | // to gram 18 | const factor = [ 19 | new BigNumber(1).div(1000), 20 | 1, 21 | 60, 22 | 3600, 23 | 86400, 24 | 604800, 25 | "2592000", 26 | new BigNumber("365.2421891").times(24).times(3600) 27 | ] 28 | const g = new BigNumber(v).times(factor[ia]) 29 | 30 | const out = g.div(factor[ib]) 31 | return out 32 | } 33 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/src/volume.js: -------------------------------------------------------------------------------- 1 | volume(v, a, b) { 2 | const authorized = [ 3 | "mm3", 4 | "ml", 5 | "cm3", 6 | "cl", 7 | "dl", 8 | "dm3", 9 | "l", 10 | "hl", 11 | "m3", 12 | "dam3", 13 | "hm3", 14 | "km3", 15 | "gal", 16 | "floz" 17 | ] 18 | if (!authorized.includes(a) || !authorized.includes(b)) { 19 | throw "[TheoremJS] Volume: wrong units" 20 | } 21 | const ia = authorized.indexOf(a) 22 | const ib = authorized.indexOf(b) 23 | // to cubic meters 24 | const factor = [ 25 | new BigNumber(1).div(1000000000), // mm3 26 | new BigNumber(1).div(1000000), // ml 27 | new BigNumber(1).div(1000000), // cm3 28 | new BigNumber(10).div(1000000), // cl 29 | "0.0001", // dl 30 | new BigNumber(1).div(1000), // dm3 31 | new BigNumber(1).div(1000), // l 32 | 0.1, // hl 33 | 1, // m3 34 | 1000, // dam3 35 | 1000000, // hm3 36 | 1000000000, //km3 37 | "0.003785411784", // gal, 38 | "2.95735295625e-5" // floz 39 | ] 40 | const g = new BigNumber(v).times(factor[ia]) 41 | 42 | const out = g.div(factor[ib]) 43 | return out 44 | } 45 | -------------------------------------------------------------------------------- /src/includes/functions/math/units/units.js: -------------------------------------------------------------------------------- 1 | units() { 2 | return this.convert(...arguments) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/other/config.js: -------------------------------------------------------------------------------- 1 | config(obj) { 2 | BigNumber.set(obj) 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/other/convertToBase.js: -------------------------------------------------------------------------------- 1 | convertToBase(x, n) { 2 | const BN = BigNumber.clone({ ALPHABET: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/" }) 3 | return new BN(x).toString(n) 4 | } 5 | -------------------------------------------------------------------------------- /src/includes/functions/other/fn.js: -------------------------------------------------------------------------------- 1 | get fn() { 2 | return this.prototype 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/functions/other/toBase10.js: -------------------------------------------------------------------------------- 1 | toBase10(n, base) { 2 | return new BigNumber(n, base); 3 | } 4 | -------------------------------------------------------------------------------- /src/includes/other/export.js: -------------------------------------------------------------------------------- 1 | // Browserify / Node.js 2 | if (typeof define === "function" && define.amd) { 3 | define(() => new TheoremJS()); 4 | // CommonJS and Node.js module support. 5 | } else if (typeof exports !== "undefined") { 6 | // Support Node.js specific `module.exports` (which can be a function) 7 | if (typeof module !== "undefined" && module.exports) { 8 | exports = module.exports = new TheoremJS(); 9 | } 10 | // But always support CommonJS module 1.1.1 spec (`exports` cannot be a function) 11 | exports.TheoremJS = new TheoremJS(); 12 | } else if (typeof global !== "undefined") { 13 | global.TheoremJS = new TheoremJS(); 14 | } 15 | --------------------------------------------------------------------------------