{"name":"dommatrix","version":"0.0.2","description":"ES6/ES7 shim for DOMMatrix","main":"dist/dommatrix.min.js","module":"dist/dommatrix.esm.js","jsnext":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm-run-all --parallel build-*","custom-build":"rollup -c --environment","build-js":"rollup --environment FORMAT:umd,MIN:false -c","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":["dom matrix","css matrix","css transform","javascript"],"author":{"name":"thednp"},"license":"MIT","bugs":{"url":"https://github.com/thednp/dommatrix/issues"},"homepage":"https://github.com/thednp/dommatrix","devDependencies":{"@rollup/plugin-buble":"^0.21.3","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^7.1.3","npm-run-all":"^4.1.5","rollup":"^2.26.3","rollup-plugin-cleanup":"^3.1.1","rollup-plugin-terser":"^5.3.0"},"dependencies":{},"_id":"dommatrix@0.0.2","_nodeVersion":"14.4.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-+iW5dPBGn15j6bdXn2DujRV9QAh/Vs2xchMlmsI1NmLGke4ygHasrUld3RwazgZBj/Lf2ZuwuLPzpIC3TUIDdw==","shasum":"5430f205223fe2e9b7bdbb8f407bcde4ca7f4a9c","tarball":"http://registry-npm.ywwl.com/dommatrix/download/dommatrix-0.0.2.tgz","fileCount":9,"unpackedSize":41255,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWw06CRA9TVsSAnZWagAA+/IP/3LEjT4zv9VqdBPAUhTu\nD5fdKDzY5cLahtWn1aeiGRTqDE+6Sn/2NXJadscj0gYXxfUkJsPIrnpSi50Y\nH3iSoIRJXd16M634ptkfwt5/Zj3bGFma97fmRWqzRBoC8Rylq1qrGZNTP/tt\nEQT4lxS3PdBxU9wjG6EtgOafiw+1Cg/Xf71jKabYK9MX6FvFgqF34WzVk/KX\nNcM1+N7lFQ5QfEP6Ne2q5SjDYvB9H45eRprjCE4Reqf3WTcAhqO7r2aC2GG4\n+fNUoJ7qSz65UPNQDodmi8ptMCfdvKNS1UFVBSWbdh7Hz1ofMS2sqOnzTEvA\n+GeLH8aBzyIOjFyl4yZKfRPvAQqJcbA9rJ4HujDQQrSgD25TLLMssROzsos0\nq4aTHackw6aZkK5bDl7Ht2+Kl4nkLag3QrnPgZ8+LGItvMnJMbJjWArOSyIq\nPrED5RfcVHNlRLEg/22f93m+aJ/PlJzoiyyWGKQeCnDN4+0FuOZgtjeepgKd\nuqBq8TKtzZ/AFvJD4WLhNP3VUwgPtHXZoRqVsruxC/L6jUJpjdNM1ahwPp8t\npoLlOmOPoMSUNaZWi/scVqXK30VdBpz+Eoc/8LvKJyWVpS5e/lWMvCJTJ+X6\naySbYMASEMGVs4Vqw+jF+Zew8D3nWgmOnsoN3uhFt+PEm8kSc1dZBTbTko2/\nYsRB\r\n=rAiu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDMuv4uJcUaEbR92jxJIK7f3RIZGqLMgNL0/AJ/y540FAiEA3RIYvwUOhxyQRrNP8Ew7sEt97CNMwpAWTiSQuChL1QM="}],"size":9249,"noattachment":false,"key":"/dommatrix/-/dommatrix-0.0.2.tgz"},"maintainers":[{"name":"thednp","email":"dnp.digital@gmail.com"}],"_npmUser":{"name":"thednp","email":"dnp.digital@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dommatrix_0.0.2_1599802681472_0.2251663595000455"},"_hasShrinkwrap":false,"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":1599802681683,"_cnpm_publish_time":1599802681683,"dist-tags":{"latest":"1.0.3"}}