{"name":"dommatrix","version":"0.0.22","description":"ES6+ shim for DOMMatrix","main":"dist/dommatrix.js","module":"dist/dommatrix.esm.js","types":"types/index.d.ts","jsnext":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run fix:js && npm-run-all --parallel build-*","custom-build":"rollup -c --environment","fix:js":"eslint src/*.js --config .eslintrc --fix","lint:js":"eslint src/*.js --config .eslintrc","build:ts":"tsc -d","build-js":"rollup --environment FORMAT:umd,MIN:false -c","build-test":"rollup --environment FORMAT:iife,MIN:false,OUTPUTFILE:test/dommatrix.js -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://thednp.github.io/DOMMatrix/","dependencies":{},"devDependencies":{"@rollup/plugin-node-resolve":"^7.1.3","@rollup/plugin-buble":"^0.21.3","@rollup/plugin-json":"^4.1.0","rollup-plugin-terser":"^5.3.0","eslint":"^7.22.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.22.1","eslint-plugin-vue":"^7.7.0","npm-run-all":"^4.1.5","rollup":"^2.28.1","typescript":"^4.5.2"},"gitHead":"4f7968e2ebfb9f4d0210e333485fa4222c9a5b7e","_id":"dommatrix@0.0.22","_nodeVersion":"14.4.0","_npmVersion":"7.24.1","dist":{"integrity":"sha512-287kPpaO3XEpwQlqPD0o1OEPZgw6J/IG1ZjcbkLuCtjvwkzRBvXP9bhVpPYpF04Q0e1vC0iPhGQpgCQYWSu3Ow==","shasum":"4a330ae6a81a41c82d79bbfcfe787b771b7a01a3","tarball":"http://registry-npm.ywwl.com/dommatrix/download/dommatrix-0.0.22.tgz","fileCount":12,"unpackedSize":103406,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpsrFCRA9TVsSAnZWagAAIswP/jiLUflL6WGX1LN+ym8k\nvpPt906BAeXVRJKXCeLiorXWIpXSglYEfIZJ+U0YTyst0/c4EF0J1jWtIRMG\nRHKWLdyF/spon2y4CoIS1o5TzBQ7XcaUzZx3XcW9MFxn09WzeLJbgZUKKM7d\nzqbCNhwOhRjuw/oAHt38XT5G3yCnYa9l/OhX/Ts1g5IB0+Cc4LdHETTeKeYB\nhl++Gm7bjPEGlZhV/iSs4YOwrB4cfRZoTNyfUPWyyqyyO1UEH8YV4qz+2eoI\nlzCOHQzPYVA0Ie3CUi/2H+iBey/Ou1iYj2E6ZV3i0m0tpCqPoH7mTcNauLOh\nD7MYOJSGzIBJLpzxicKUx0a18ej25hiMwGn+ffFI4DFM/9gz9FoVUAV5w0G4\nmUBEm91dHMMlkIEiqxlIfmWu4VR0sp+kXcdmBtQaklP5HKVZ1s22AKjmPk9h\na4ttTclfy0rETkZ20aVVkrEI4GKVphw6BQOF2AUtb5Fhms+UbrG0T4wAJffP\n2lCnb5Ui9RIf//u3Q9mTDLpPZX5/jPfWDWV8ZF/LhBcmojP3HLbQFiwp9fDS\nuTChJ/F7exS5Lr4raNSub4H592c+RBfhY+jN5LeXyB6iLEFxbOMIsa6gOoft\nNohI39XPZ43JUE3+LHBXTc6ZLuyKJIhZlTdt91c7jvJOkFI0sh0XN8T/L3Xt\nfTRy\r\n=4RHu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA5iSxdQDfdGenfCH5tjp+0sGNNw1vFirpw/XBUwK7QbAiAl6qzlZd8Zxc8sZOdgvid9HCAnph8NHQtQfhIoTAEwAQ=="}],"size":23735,"noattachment":false,"key":"/dommatrix/-/dommatrix-0.0.22.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_0.0.22_1638320837457_0.48092308517671034"},"_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":1638320837796,"_cnpm_publish_time":1638320837796,"dist-tags":{"latest":"1.0.3"}}