diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 943744f..d672f1b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -141,7 +141,7 @@ module.exports = { "indent": "off", "jsdoc/check-alignment": "error", "jsdoc/check-indentation": "error", - "jsdoc/newline-after-description": "error", + // "jsdoc/newline-after-description": "error", "linebreak-style": "off", "max-classes-per-file": [ "error", diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml index 63c42d5..5233a35 100644 --- a/.github/codeql/codeql-config.yml +++ b/.github/codeql/codeql-config.yml @@ -1,2 +1,2 @@ -paths: +paths: - src \ No newline at end of file diff --git a/.github/workflows/badges.yml b/.github/workflows/badges.yml index 25a8932..707f659 100644 --- a/.github/workflows/badges.yml +++ b/.github/workflows/badges.yml @@ -1,29 +1,29 @@ -name: badges -on: - push: - # update README badge only if the README file changes - # or if the package.json file changes, or this file changes - # IMPORTANT: branches must match - branches: - - master - paths: - - README.md - - package.json - - .github/workflows/badges.yml - -jobs: - badges: - runs-on: ubuntu-20.04 - steps: - - name: Checkout ๐ - uses: actions/checkout@v3 - - - name: Update version badges ๐ท - run: npx -p dependency-version-badge update-badge typescript cypress eslint prettier vite - - - name: Commit any changed files ๐พ - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: master - file_pattern: README.md - commit_message: Updated badges +name: badges +on: + push: + # update README badge only if the README file changes + # or if the package.json file changes, or this file changes + # IMPORTANT: branches must match + branches: + - master + paths: + - README.md + - package.json + - .github/workflows/badges.yml + +jobs: + badges: + runs-on: ubuntu-20.04 + steps: + - name: Checkout ๐ + uses: actions/checkout@v3 + + - name: Update version badges ๐ท + run: npx -p dependency-version-badge update-badge typescript cypress eslint prettier vite + + - name: Commit any changed files ๐พ + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: master + file_pattern: README.md + commit_message: Updated badges diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 613991a..bbed28d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,23 +1,23 @@ -name: ci -on: push -jobs: - test: - runs-on: ubuntu-20.04 - name: Test on Node v16 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: bahmutov/npm-install@v1 - - run: npm run build - - run: npm run test - - - name: Upload coverage report on Node v16 to coveralls.io... - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - +name: ci +on: push +jobs: + test: + runs-on: ubuntu-20.04 + name: Test on Node v16 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: bahmutov/npm-install@v1 + - run: npm run build + - run: npm run test + + - name: Upload coverage report on Node v16 to coveralls.io... + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 004c6d8..c72b0df 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,69 +1,69 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - config-file: ./.github/codeql/codeql-config.yml - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # โน๏ธ Command-line programs to run using the OS shell. - # ๐ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + config-file: ./.github/codeql/codeql-config.yml + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # โน๏ธ Command-line programs to run using the OS shell. + # ๐ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.gitignore b/.gitignore index 340a0b1..1a522bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ -.npmignore -.nyc_output -node_modules -experiments -coverage -cypress/videos -cypress/screenshots -cypress/coverage -cypress/instrumented +.npmignore +.nyc_output +node_modules +experiments +coverage +cypress/videos +cypress/screenshots +cypress/coverage +cypress/instrumented diff --git a/.lgtm.yml b/.lgtm.yml index c429baa..090d52a 100644 --- a/.lgtm.yml +++ b/.lgtm.yml @@ -1,9 +1,9 @@ -extraction: - javascript: - index: - exclude: - - coverage - - cypress - - docs - - experiments - - node_modules +extraction: + javascript: + index: + exclude: + - coverage + - cypress + - docs + - experiments + - node_modules diff --git a/.prettierrc.json b/.prettierrc.json index 68cd4bc..e35ec7e 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,15 +1,15 @@ -{ - "arrowParens": "avoid", - "bracketSpacing": true, - "endOfLine": "lf", - "bracketSameLine": false, - "jsxSingleQuote": false, - "printWidth": 120, - "proseWrap": "preserve", - "quoteProps": "as-needed", - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "endOfLine": "lf", + "bracketSameLine": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false } \ No newline at end of file diff --git a/LICENSE b/LICENSE index 1ff1e51..eb7dabc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2020 thednp - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2020 thednp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 5770298..28e91b7 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,99 @@ -# DOMMatrix -[![Coverage Status](https://coveralls.io/repos/github/thednp/dommatrix/badge.svg)](https://coveralls.io/github/thednp/dommatrix) -[![NPM Version](https://img.shields.io/npm/v/@thednp/dommatrix.svg?style=flat-square)](https://www.npmjs.com/package/@thednp/dommatrix) -[![NPM Downloads](https://img.shields.io/npm/dm/@thednp/dommatrix.svg?style=flat-square)](http://npm-stat.com/charts.html?@thednp/dommatrix) -[![ci](https://github.com/thednp/dommatrix/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/dommatrix/actions/workflows/ci.yml) -[![jsDeliver](https://data.jsdelivr.com/v1/package/npm/@thednp/dommatrix/badge)](https://www.jsdelivr.com/package/npm/@thednp/dommatrix) -[![typescript version](https://img.shields.io/badge/typescript-5.0.2-brightgreen)](https://www.typescriptlang.org/) -[![cypress version](https://img.shields.io/badge/cypress-12.8.1-brightgreen)](https://www.cypress.io/) -[![eslint version](https://img.shields.io/badge/eslint-8.36.0-brightgreen)](https://github.com/eslint) -[![vite version](https://img.shields.io/badge/vite-4.2.0-brightgreen)](https://vitejs.dev/) -[![prettier version](https://img.shields.io/badge/prettier-2.8.4-brightgreen)](https://prettier.io/) - -A TypeScript sourced [DOMMatrix](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix) shim for **Node.js** apps and legacy browsers. Since this source is modernized, legacy browsers might need some additional shims. - -The constructor is close to the **DOMMatrix Interface** in many respects, but tries to keep a sense of simplicity. In that note, we haven't implemented [DOMMatrixReadOnly](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly) methods like `flipX()` or `inverse()` or aliases for the main methods like `translateSelf` or the old `rotate3d`. - -DOMMatrix shim is meant to be a light pocket tool for [many things](http://thednp.github.io/svg-path-commander), for a complete polyfill you might want to also consider more [geometry-interfaces](https://github.com/trusktr/geometry-interfaces) -and [geometry-polyfill](https://github.com/jarek-foksa/geometry-polyfill). - -This library implements a full transform string parsing via the static method `.fromString()`, which produce results inline with the DOMMatrix Interface as well as a very [elegant method](https://github.com/jsidea/jsidea/blob/2b4486c131d5cca2334293936fa13454b34fcdef/ts/jsidea/geom/Matrix3D.ts#L788) to determine `is2D`. Before moving to the [technical details](#More-info) of this script, have a look at the demo. - - -# Demo -See DOMMatrix shim in action, [click me](https://thednp.github.io/dommatrix) and start transforming. - - -# Installation -```js -npm install @thednp/dommatrix -``` -Download the latest version and copy the `dist/dommatrix.js` file to your project assets folder, then load the file in your front-end: -```html - - - - -
+- + + +
+ + + +
+ + + + + + +
+