{"name":"dommatrix","version":"0.1.1","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 --include=src/*.js --reporter=lcov --reporter=json --reporter=text --reporter=json-summary","coverage:copy":"ncp coverage/lcov-report docs/lcov","build":"npm run lint:js && npm-run-all --parallel build-*","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","build-umd-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.0","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":"9b5e06e243db5b94ca071411686ecf3ba1df7aae","_id":"dommatrix@0.1.1","_nodeVersion":"16.14.2","_npmVersion":"7.24.1","dist":{"integrity":"sha512-45CQT2bjnN9DXF07PXgG7hfQ2r8a6trrupNuTizRzfLHWWujdebAx8Xry0CB5uVBQlQY/m0TE/Whe5nrua+lsQ==","shasum":"8a59d79b468c22cd667e5db4d6ca1960c0ebbece","tarball":"http://registry-npm.ywwl.com/dommatrix/download/dommatrix-0.1.1.tgz","fileCount":14,"unpackedSize":122167,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIErU8p65DAF3U9LkyJP7iSit8XIcTj4mnZ/xEqxHaVOTAiArW/txJNhNdBEO4qDofCzgfXgjM3LZAMVmXI1aTwyEvA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiaOfyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo3QxAAmPn6KmmWBWygA4NS4RP4DSVEGRpZseOCMq1EJm2faY3Vy2mV\r\nBoLuKfGwdm3o4FpG80wGTIrpIyyBGvYo0KDWbv/KuWAAa/J2rgz05sHPV2sG\r\n0jr+AGY9ITAT00A4UDKA6wDzbko3uT6i9cuHp6XzLV3RFxppIpOh3jcxYpRi\r\nHQ8J3+7Uq2qcr9aQirsLE91T5V16O/FxPt40kRIWEtCt7+0Zdcw55C3BZNJv\r\nAB8klYlX6SKaQOpKuzZiu3JolFIUKBXkE455CV45C/B6cirqpf67CG5fbH+U\r\nj15heRWJ4/FHntKlbPAkqrEYvJhu3PcOFtIVjr4jzLkvPEsdG943pk75i6i0\r\nT1Nnd8KxipYT8K6sgt8TRbIMfXrIRAEiXmOukHJsVnlKuFYIivSVpcUrQB1F\r\nCeWQ7s329tVvQI+duTd2en7TZUkOtZF4ayOYlVG3m4IkIJI/oENOz7wSLlH8\r\nHjqpL0jpwcRlaCKa+Jj3hDkbvbqY6bXKucNWgmj8dtofPFM//O4EVQ/bsfno\r\n0gSJMx3ZwJ8a7b4tfV5M1sirUjCOYOk1sNQjgDAtldkAXiE7r5y1dAUFQlQV\r\ncNw87QBFi/z0l+4y3CT4hj39InRkoHhOPso5l5HClAhJd0c0g/6I8fQKDk9l\r\nz9JcjYTkUBvxMmv3YvdYWdnVN87APZq5+Uw=\r\n=BtDA\r\n-----END PGP SIGNATURE-----\r\n","size":26370,"noattachment":false,"key":"/dommatrix/-/dommatrix-0.1.1.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.1.1_1651042289798_0.560036943147219"},"_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":1651042290140,"_cnpm_publish_time":1651042290140,"dist-tags":{"latest":"1.0.3"}}