{"_id":"@amarajs/plugin-dom","_rev":"2-db24f88c9a840bdd86d9ab9845b781c5","name":"@amarajs/plugin-dom","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amarajs/plugin-dom","amdName":"AmaraDOM","version":"0.1.0","description":"Provides virtual DOM for AmaraJS web applications.","jsnext:main":"src/index.js","main":"dist/amara-plugin-dom.js","umd:main":"dist/amara-plugin-dom.umd.js","scripts":{"bump":"standard-version","testonly":"mocha --compilers js:babel-register test/**/*.js","lint":"eslint src test","test":"flow && npm run lint && npm run testonly","build":"npm-run-all clean -p rollup:* -p minify:* -s size","clean":"rimraf dist && mkdirp dist","rollup:cjs":"rollup -c rollup.config.js -f cjs -n AmaraDOM src/index.js -o dist/amara-plugin-dom.js","rollup:umd":"rollup -c rollup.config.js -f umd -n AmaraDOM src/index.js -o dist/amara-plugin-dom.umd.js","minify:cjs":"uglifyjs dist/amara-plugin-dom.js -cm toplevel -o dist/amara-plugin-dom.min.js -p relative --source-map dist/amara-plugin-dom.min.js.map","minify:umd":"uglifyjs dist/amara-plugin-dom.umd.js -cm -o dist/amara-plugin-dom.umd.min.js -p relative --source-map dist/amara-plugin-dom.umd.min.js.map","size":"strip-json-comments --no-whitespace dist/amara-plugin-dom.min.js | gzip-size | pretty-bytes","release":"npm run build -s && npm run bump && git push --follow-tags origin master && npm publish"},"keywords":["amara","amarajs","core"],"authors":["Dan Barnes <amarajs.framework@gmail.com>"],"repository":{"type":"git","url":"git+https://github.com/amarajs/plugin-dom.git"},"license":"MIT","files":["src","dist"],"eslintConfig":{"parser":"babel-eslint","extends":"eslint:recommended","env":{"browser":true,"mocha":true,"node":true,"es6":true},"globals":{"expect":true},"rules":{"no-cond-assign":0}},"devDependencies":{"babel-core":"^6.9.1","babel-eslint":"^7.1.1","babel-plugin-transform-flow-strip-types":"^6.21.0","babel-preset-es2015":"^6.9.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.9.0","chai":"^3.5.0","eslint":"^3.13.1","flow-bin":"^0.38.0","gzip-size-cli":"^1.0.0","mkdirp":"^0.5.1","mocha":"^3.2.0","npm-run-all":"^2.1.1","pretty-bytes-cli":"^2.0.0","rimraf":"^2.5.2","rollup":"^0.41.4","rollup-plugin-buble":"^0.15.0","rollup-plugin-commonjs":"^8.1.0","rollup-plugin-flow":"^1.1.1","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"^1.2.0","rollup-plugin-node-resolve":"^3.0.0","sinon":"^1.17.4","sinon-chai":"^2.8.0","standard-version":"^4.0.0","strip-json-comments-cli":"^1.0.1","virtual-dom":"^2.1.1","uglify-js":"^2.6.2"},"gitHead":"ebbd042a2d53655b3e31ad4ae1045ba972a2afcc","bugs":{"url":"https://github.com/amarajs/plugin-dom/issues"},"homepage":"https://github.com/amarajs/plugin-dom#readme","bundleDependencies":["vdom-parser"],"dependencies":{"vdom-parser":"*"},"_id":"@amarajs/plugin-dom@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"},"dist":{"integrity":"sha512-eHzgZ2L0zi870qBpXxw5NIhbyVmySyA4dxO0EJ7DI09wVY1kBt4sh4KBXbCdfw7LoxrDslToeN8Vh8TBcnkx1Q==","shasum":"38e683d03361317d4d73fc389eb745581d4c6d9c","tarball":"https://registry.npmjs.org/@amarajs/plugin-dom/-/plugin-dom-0.1.0.tgz","fileCount":23,"unpackedSize":186620,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlcYpdGWgDKldXhFgUqAHboCC4WsrgCIoBU7grLEyJFQIgdQxEEZSc/brFQ4b6tQuwaYv+/0HQdz7IaMtxUVYNo7E="}]},"maintainers":[{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-dom_0.1.0_1522618239884_0.1272264471665705"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-01T21:30:39.831Z","0.1.0":"2018-04-01T21:30:40.045Z","modified":"2022-04-04T13:43:42.840Z"},"maintainers":[{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"}],"description":"Provides virtual DOM for AmaraJS web applications.","homepage":"https://github.com/amarajs/plugin-dom#readme","keywords":["amara","amarajs","core"],"repository":{"type":"git","url":"git+https://github.com/amarajs/plugin-dom.git"},"bugs":{"url":"https://github.com/amarajs/plugin-dom/issues"},"license":"MIT","readme":"## @amarajs/plugin-dom\n\nPlugin middleware for AmaraJS to add HTML to DOM nodes dynamically.\n\n### Installation\n\n`npm install --save @amarajs/plugin-dom`\n\n### Usage\n\n```javascript\n// https://github.com/Matt-Esch/virtual-dom\nimport virtualDom from 'virtual-dom';\n\nimport Amara from '@amarajs/core';\nimport AmaraDOM from '@amarajs/plugin-dom';\nimport AmaraBrowser from '@amarajs/plugin-engine-browser';\nconst amara = new Amara([\n    AmaraDOM(virtualDom),\n    AmaraBrowser()\n]);\n```\n\n### Feature Type\n\nThe `@amarajs/plugin-dom` middleware allows you to create features of type `\"dom\"`.\n\n#### Return Values\n\nFor `{type: \"dom\"}` features, your apply function should return either an array of virtual DOM nodes or a single root DOM node with optional children.\n\n```javascript\nimport h from 'virtual-dom/h';\n\namara.add({\n    type: 'dom',\n    targets: ['main'],\n    apply: () => [\n        h('div', [\n            h('p', 'some text'),\n            h('p', 'some more text')\n        ])\n    ]\n});\n\namara.add({\n    type: 'dom',\n    targets: ['main > div'],\n    apply: () => h('p', '... and even more text')\n});\n```\n\n### Using JSX\n\nYou can use JSX instead of creating virtual DOM directly. Simply add the `@jsx` pragma to the top of your file and use the appropriate configuration for your build process.\n\nFor example, the following `index.js` and `rollup.config.js` will produce a simple hello world application:\n\n```javascript\n// index.js\n/** @jsx h */\n\nimport vDOM from 'virtual-dom';\nimport Amara from '@amarajs/core';\nimport AmaraDOM from '@amarajs/plugin-dom';\nimport AmaraBrowser from '@amarajs/plugin-engine-browser';\n\nconst h = vDOM.h;\n\nnew Amara([\n    AmaraBrowser(),\n    AmaraDOM(vDOM)\n])\n    .add({\n        type: 'dom',\n        targets: ['main'],\n        apply: () => (<p>Hello, world!</p>)\n    })\n    .bootstrap(document.querySelector('body'));\n```\n\n```javascript\n// rollup.config.js\nimport buble from 'rollup-plugin-buble';\nimport resolve from 'rollup-plugin-node-resolve';\n\nexport default {\n    entry: 'index.js',\n\tuseStrict: false,\n\tplugins: [\n        resolve({\n            jsnext: true,\n            main: true,\n            browser: true\n        }),\n        buble()\n    ]\n};\n```\n\n### Applying Multiple Results to the Same Target\n\nIf multiple `{type: \"dom\"}` features target the same DOM, the DOM will be appended to the target node in the order the features were applied.\n\n### Customization\n\nConstruct the `@amarajs/plugin-dom` instance by providing an instance of VirtualDOM. See https://github.com/Matt-Esch/virtual-dom for details.\n\n### Bundled Dependencies\n\n`@amarajs/plugin-dom` comes bundled with the excellent [vdom-parser](https://www.npmjs.com/package/vdom-parser) library to ensure HTML isn't overwritten when applying `\"dom\"` features to existing DOM targets.\n\n### Contributing\n\nIf you have a feature request, please create a new issue so the community can discuss it.\n\nIf you find a defect, please submit a bug report that includes a working link to reproduce the problem (for example, using [jsBin](https://jsbin.com)). Of course, pull requests to fix open issues are always welcome!\n\n### License\n\nThe MIT License (MIT)\n\nCopyright (c) Dan Barnes\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n","readmeFilename":"README.md"}