{"name":"dommatrix","version":"1.0.3","description":"ES6+ shim for DOMMatrix","main":"dist/dommatrix.js","module":"dist/dommatrix.esm.js","types":"types/index.d.ts","jsnext":"src/index.js","scripts":{"test":"npx cypress run","cypress":"npx cypress open","coverage:report":"nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary","build":"npm run lint:js && npm-run-all --parallel build-* && npm run docs-copy","custom-build":"rollup -c --environment","fix:js":"eslint src --config .eslintrc --fix","lint:js":"eslint src --config .eslintrc","build:ts":"tsc -d","build-js":"rollup --environment FORMAT:umd,MIN:false -c","docs-copy":"ncp dist/dommatrix.js docs/dommatrix.js","build-js-min":"rollup --environment FORMAT:umd,MIN:true -c","build-esm":"rollup --environment FORMAT:esm,MIN:false -c","build-esm-min":"rollup --environment FORMAT:esm,MIN:true -c"},"repository":{"type":"git","url":"git+https://github.com/thednp/dommatrix.git"},"keywords":["dommatrix","cssmatrix","shim","polyfill","nodejs","dom","css","transform","javascript"],"author":{"name":"thednp"},"license":"MIT","bugs":{"url":"https://github.com/thednp/dommatrix/issues"},"homepage":"https://thednp.github.io/dommatrix/","devDependencies":{"@bahmutov/cypress-esbuild-preprocessor":"^2.1.3","@cypress/code-coverage":"^3.9.12","@rollup/plugin-buble":"^0.21.3","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^7.1.3","cypress":"^9.6.1","esbuild":"^0.14.30","eslint":"^7.22.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.22.1","eslint-plugin-vue":"^7.7.0","ncp":"^2.0.0","npm-run-all":"^4.1.5","rollup":"^2.28.1","rollup-plugin-terser":"^5.3.0","typescript":"^4.5.2"},"gitHead":"96029637b54264de452099dedbad684dc18bbc4e","_id":"dommatrix@1.0.3","_nodeVersion":"16.14.2","_npmVersion":"7.24.1","dist":{"integrity":"sha512-l32Xp/TLgWb8ReqbVJAFIvXmY7go4nTxxlWiAFyhoQw9RKEOHBZNnyGvJWqDVSPmq3Y9HlM4npqF/T6VMOXhww==","shasum":"e7c18e8d6f3abdd1fef3dd4aa74c4d2e620a0525","tarball":"http://registry-npm.ywwl.com/dommatrix/download/dommatrix-1.0.3.tgz","fileCount":14,"unpackedSize":122160,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSyiIXIg/RBKti8evDeE/aK8hH/hFyCoGTNcG+5EuOCAIgC5oH9ZbtJJjjzXAo7ja+RNz6Rar9eZ0oBYeWXeiCC0A="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJieljZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHKRAAjOk2WjrS9oEHTxoCxvXmHb0oQt2OjEgXcruIJiiV0iI7fGg2\r\nETheyJg1KNb4+73SodaN3ecS2c6wzYDdYa3kM33lSri2vrFdWxKZ+NNhS/39\r\nVRQ1d9H7MEAk3OQyeRCJ1+p4kWP4EqutoBWd5Yd0avdFjz+O+Zz97z5WSqNA\r\nnm2UYY4pZiTQB5RESRyzT+PD1GsBBmVAIQcdaGnNjtB6om5QQClpac12UdNt\r\nbMZyv3uuIq+gQRiOOxaG859rKWJKk6YcGMmOA9zH50uEFzokb8vugqupsO4t\r\ntvdzqQNp52RoBwEjAxZ50nHybP9D0tNAIJnTwft6NNzqNbH6IsybhGpLmNuF\r\n8Z5SF6P4+Q1UWEPWUUTyoSDlSqS8BXkxoNCWGZaiMh5TAkr2NGvE8roy+I76\r\nJzp0vG9Nbzi8NgGWc7PDTPwaox4oJCR26LwvXg+Y5BookPb0XB0gnr6uoLVK\r\nc/zTt+WJjfthyceXxQSEV0gTcuqNaIrcM6t7U2VGZG69O2nBu3QIe1J/8vZE\r\nW1VbXjdlZtw1oDXt2lAkr/kNrHDgiN6lZOSWWQEiUNdFqvOaUK1KE1bZVrg6\r\nOyeeHBi11dZBkmgg031MI3PTHHFMrzrn6Fejic1dofZy04OlqBzDOLh9g7UD\r\ngD9pHeQzhGiqlmS4hce33NsXiV7TWelBVvE=\r\n=YjcC\r\n-----END PGP SIGNATURE-----\r\n","size":26405,"noattachment":false,"key":"/dommatrix/-/dommatrix-1.0.3.tgz"},"_npmUser":{"name":"thednp","email":"dnp.digital@gmail.com"},"directories":{},"maintainers":[{"name":"thednp","email":"dnp.digital@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dommatrix_1.0.3_1652185305558_0.367686416524833"},"_hasShrinkwrap":false,"deprecated":"dommatrix is no longer maintained. Please use @thednp/dommatrix.","readme":"# DOMMatrix\r\n[![Coverage Status](https://coveralls.io/repos/github/thednp/dommatrix/badge.svg)](https://coveralls.io/github/thednp/dommatrix) \r\n![cypress version](https://img.shields.io/badge/cypress-9.6.0-brightgreen)\r\n![esbuild version](https://img.shields.io/badge/esbuild-0.14.30-brightgreen)\r\n[![ci](https://github.com/thednp/dommatrix/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/dommatrix/actions/workflows/ci.yml)\r\n\r\nAn ES6+ 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.\r\n\r\n[![NPM Version](https://img.shields.io/npm/v/dommatrix.svg?style=flat-square)](https://www.npmjs.com/package/dommatrix)\r\n[![NPM Downloads](https://img.shields.io/npm/dm/dommatrix.svg?style=flat-square)](http://npm-stat.com/charts.html?dommatrix)\r\n[![jsDeliver](https://data.jsdelivr.com/v1/package/npm/dommatrix/badge)](https://www.jsdelivr.com/package/npm/dommatrix)\r\n\r\nThe 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`.\r\n\r\nDOMMatrix 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)\r\nand [geometry-polyfill](https://github.com/jarek-foksa/geometry-polyfill).\r\n\r\nThis 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.\r\n\r\n\r\n# Demo\r\nSee DOMMatrix shim in action, [click me](https://thednp.github.io/dommatrix) and start transforming.\r\n\r\n\r\n# Installation\r\n```js\r\nnpm install dommatrix\r\n```\r\nDownload the latest version and copy the `dist/dommatrix.min.js` file to your project assets folder, then load the file in your front-end:\r\n```html\r\n<script src=\"./assets/js/dommatrix.min.js\">\r\n```\r\n\r\nAlternativelly you can load from CDN:\r\n```html\r\n<script src=\"https://cdn.jsdelivr.net/npm/dommatrix/dist/dommatrix.min.js\">\r\n```\r\n\r\n# Usage\r\nIn your regular day to day usage, you will find yourself writing something like this:\r\n```js\r\nimport CSSMatrix from 'dommatrix';\r\n\r\n// init\r\nlet myMatrix = new CSSMatrix('matrix(1,0.25,-0.25,1,0,0)');\r\n\r\n// apply methods\r\nmyMatrix.translate(15);\r\nmyMatrix.rotate(15);\r\n\r\n// apply to styling to target\r\nelement.style.transform = myMatrix.toString();\r\n```\r\nFor the complete JavaScript API, check the [JavaScript API](https://github.com/thednp/DOMMatrix/wiki/JavaScript-API) section in our wiki.\r\n\r\n# WIKI\r\nFor more indepth guides, head over to the [wiki pages](https://github.com/thednp/DOMMatrix/wiki) for developer guidelines.\r\n\r\n# More Info\r\nIn contrast with the [original source](https://github.com/arian/CSSMatrix/) there have been a series of changes to the prototype for consistency, performance as well as requirements to better accomodate the **DOMMatrix** interface:\r\n\r\n* **changed** how the constructor determines if the matrix is 2D, based on a [more accurate method](https://github.com/jsidea/jsidea/blob/2b4486c131d5cca2334293936fa13454b34fcdef/ts/jsidea/geom/Matrix3D.ts#L788) which is actually checking the designated values of the 3D space; in contrast, the old *CSSMatrix* constructor sets `afine` property at initialization only and based on the number of arguments or the type of the input CSS transform syntax; \r\n* **fixed** the `translate()`, `scale()` and `rotate()` instance methods to work with one axis transformation, also inline with **DOMMatrix**;\r\n* **changed** `toString()` instance method to utilize the new method `toArray()` described below;\r\n* **changed** `setMatrixValue()` instance method to do all the heavy duty work with parameters;\r\n* **added** `is2D` (*getter* and *setter*) property;\r\n* **added** `isIdentity` (*getter* and *setter*) property;\r\n* **added** `skew()` public method to work in line with native DOMMatrix;\r\n* **added** `Skew()` static method to work with the above `skew()` instance method;\r\n* **added** `fromMatrix` static method, not present in the constructor prototype;\r\n* **added** `fromString` static method, not present in the constructor prototype;\r\n* **added** `fromArray()` static method, not present in the constructor prototype, should also process *Float32Array* / *Float64Array* via `Array.from()`;\r\n* **added** `toFloat64Array()` and `toFloat32Array()` instance methods, the updated `toString()` method makes use of them alongside `toArray`;\r\n* **added** `toArray()` instance method, normalizes values and is used by the `toString()` instance method;\r\n* **added** `toJSON()` instance method will generate a standard *Object* which includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties and excludes `is2D` & `isIdentity` properties;\r\n* **added** `transformPoint()` instance method which works like the original.\r\n* *removed* `afine` property, it's a very old *WebKitCSSMatrix* defined property;\r\n* *removed* `inverse()` instance method, will be re-added later for other implementations (probably going to be accompanied by `determinant()`, `transpose()` and others);\r\n* *removed* `transform` instance method, not present in the native **DOMMatrix** prototype;\r\n* *removed* `setIdentity()` instance method due to code rework for enabling better TypeScript definitions;\r\n* *removed* `toFullString()` instance method, probably something also from *WebKitCSSMatrix*;\r\n* *removed* `feedFromArray` static method, not present in the constructor prototype, `fromArray()` will cover that;\r\n* *not supported* `fromFloat64Array()` and `fromFloat32Array()` static methods are not supported, our `fromArray()` should handle them just as well;\r\n* *not supported* `flipX()` or `flipY()` instance methods of the *DOMMatrixReadOnly* prototype are not supported,\r\n* *not supported* `translateSelf()` or `rotateSelf()` instance methods of the *DOMMatrix* prototype are not supported, instead we only implemented the most used *DOMMatrixReadOnly* instance methods.\r\n* *not supported* `scaleNonUniformSelf()` or `rotate3d()` with `{x, y, z}` transform origin parameters are not implemented.\r\n\r\n\r\n# Thanks\r\n* Joe Pea for his [geometry-interfaces](https://github.com/trusktr/geometry-interfaces)\r\n* Jarek Foksa for his [geometry-polyfill](https://github.com/jarek-foksa/geometry-polyfill)\r\n* Arian Stolwijk for his [CSSMatrix](https://github.com/arian/CSSMatrix/)\r\n\r\n# License\r\nDOMMatrix shim is [MIT Licensed](https://github.com/thednp/DOMMatrix/blob/master/LICENSE).\r\n","publish_time":1652185305772,"_cnpm_publish_time":1652185305772,"dist-tags":{"latest":"1.0.3"}}