{"_id":"@alexei/hashish","_rev":"3-154e2c96e8d72091243521ab8ccc33ba","name":"@alexei/hashish","description":"HyperScript for NodeJS and the browser","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@alexei/hashish","version":"1.0.0","description":"HyperScript for NodeJS and the browser","main":"index.js","scripts":{"build":"webpack --config webpack.config.js","lint":"eslint --config .eslintrc.js index.js src/**.js","test":"mocha"},"author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro"},"license":"BSD-3-Clause","devDependencies":{"babel-core":"^6.24.1","babel-loader":"^7.0.0","babel-preset-es2015":"^6.24.1","eslint":"^3.19.0","jsdom":"^10.1.0","mocha":"^3.2.0","unminified-webpack-plugin":"^1.2.0","webpack":"^2.5.1"},"repository":{"type":"git","url":"git+https://github.com/alexei/hashish-js.git","web":"https://github.com/alexei/hashish-js"},"gitHead":"41432ff09ea6bd7d3cde3389ac9f019319ce4722","bugs":{"url":"https://github.com/alexei/hashish-js/issues"},"homepage":"https://github.com/alexei/hashish-js#readme","_id":"@alexei/hashish@1.0.0","_shasum":"5055a183c69558299eafbc33442031b25cc53001","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"shasum":"5055a183c69558299eafbc33442031b25cc53001","tarball":"https://registry.npmjs.org/@alexei/hashish/-/hashish-1.0.0.tgz","integrity":"sha512-HhvEM2K40fFPvR+r233bWFN2vigKWhdd0bGotRnSuJTorWCt3lqHVmbqNjKKxLNt4WAp4rCn5UXbYQulJMG+Sw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBmmciEy9YXQ1/UXzGz/HPqGXa3ocu7QZJEM2xkdEUMKAiBME7v3XR4Zb8Ygy7ceyg6tCs9PMBbiNRly88v27uaNBA=="}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hashish-1.0.0.tgz_1495387939321_0.19839460076764226"}},"1.0.1":{"name":"@alexei/hashish","version":"1.0.1","description":"HyperScript for NodeJS and the browser","main":"index.js","scripts":{"build":"webpack --config webpack.config.js","lint":"eslint --config .eslintrc.js index.js src/**.js","test":"mocha"},"author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro"},"license":"BSD-3-Clause","devDependencies":{"babel-core":"^6.24.1","babel-loader":"^7.0.0","babel-preset-es2015":"^6.24.1","eslint":"^3.19.0","jsdom":"^10.1.0","mocha":"^3.2.0","unminified-webpack-plugin":"^1.2.0","webpack":"^2.5.1"},"repository":{"type":"git","url":"git+https://github.com/alexei/hashish-js.git","web":"https://github.com/alexei/hashish-js"},"gitHead":"5581bcd98a405503a2eb4dd7c50abc5bceced763","bugs":{"url":"https://github.com/alexei/hashish-js/issues"},"homepage":"https://github.com/alexei/hashish-js#readme","_id":"@alexei/hashish@1.0.1","_shasum":"8f03e3a5fff3a50ce468b2d9465949dc9ad9650f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"shasum":"8f03e3a5fff3a50ce468b2d9465949dc9ad9650f","tarball":"https://registry.npmjs.org/@alexei/hashish/-/hashish-1.0.1.tgz","integrity":"sha512-8+qgL9+6lzik2z0ZRXkIsXqdz1gZtjWz9rsbPs53lzMsDrUzUBMzJb8dXFRsqdA+S8D3dm0N0dXV+b5Q/Ua3Xw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE5vbCzBlzL5XBhafvxeWvnoAYO3gyrYB+amwZxlFltXAiBj9MbjVYvi7K6EQG046hpcwssIYcUxNft7oSTXcQ9Kiw=="}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hashish-1.0.1.tgz_1495388231678_0.4757298359181732"}}},"readme":"# Hashish\n\nHyperScript template language for JavaScript.\n\n## Example\n\n    const hashish = require('@alexei/hashish')(document)\n    const h = hashish.createElement\n\n    h('form', {action: '/auth', method: 'post'}, [\n      h('.form-group', [\n        h('label', {'for': 'auth-email'}, \"Email address\"),\n        h(':email.form-control#auth-email', {placeholder: \"Email\"})\n      ]),\n      h('.form-group', [\n        h('label', {'for': 'auth-password'}, \"Password\"),\n        h(':password.form-control#auth-password', {placeholder: \"Password\"})\n      ]),\n      h('.checkbox', [\n        h('label', [\n          h(':checkbox', {name: 'remember_me'}),\n          \"Keep me logged in\"\n        ])\n      ]),\n      h(':submit.btn btn-default', {value: \"Log in\"})\n    ])\n\nYields:\n\n    <form action=\"/auth\" method=\"post\">\n      <div class=\"form-group\">\n        <label for=\"auth-email\"></label>\n        <input id=\"auth-email\" class=\"form-control\" type=\"email\" placeholder=\"Email\">\n      </div>\n      <div class=\"form-group\">\n        <label for=\"auth-password\"></label>\n        <input id=\"auth-password\" class=\"form-control\" type=\"password\" placeholder=\"Password\">\n      </div>\n      <div class=\"checkbox\">\n        <label><input type=\"checkbox\" name=\"remember_me\">Keep me logged in</label>\n      </div>\n      <input class=\"btn btn-default\" type=\"submit\" value=\"Log in\">\n    </form>\n\nHashish should run in any environment where a DOM implementation is available. If you're on NodeJS, you might need a third party package like [tmpvar/jsdom](https://github.com/tmpvar/jsdom).\n\n## API\n\n### createElement(tag[, attrs[, children]])\n\nCreates a new `HTMLElement`.\n\nThe `tag` argument specifies the tag name, a list of class names, an ID and possibly a type if one intends to create input tags. If left empty, it defaults to `div`.\n\n    h('')\n    > <div></div>\n\n    h('.foo.bar#baz')\n    > <div class=\"foo bar\" id=\"baz\"></div>\n\n    h(':email')\n    > <input type=\"email\">\n\nThe `attrs` argument allows one to specify a dictionary of attributes the resulting node should have:\n\n    h('form', {method: 'post'})\n    > <form method=\"post\"></form>\n\nAny value that evaluates to `false` will be omitted:\n\n    h(':checkbox', {checked: false})\n    > <input type=\"checkbox\">\n\nThe `children` argument represents an array of children that should be appended to the resulting node. See explanation on [children](#children) below.\n\n#### Class names\n\nClass names can be specified alongside the `tag` name or in the `attrs` argument. The `class` (or `className`) attribute can either be string:\n\n    h('.foo', {class: 'bar baz'})\n    > <div class=\"foo bar baz\"></div>\n\nAn array:\n\n    var bazClass = 'baz'\n    h('div.foo', {class: ['bar', bazClass]})\n    > <div class=\"foo bar baz\"></div>\n\nOr an object:\n\n    var includeBaz = false\n    h('.foo.bar', {class: {baz: includeBaz})\n    > <div class=\"foo bar\"></div>\n\n#### Children\n\nA child can either be a string, an `HTMLElement`, or any other object that implements a `render` and returns a value of a similar type:\n\n    class List {\n      constructor(list) {\n        this.list = list\n      }\n\n      render() {\n        return h('ol', this.list.map((item) => new Item(item)))\n      }\n    }\n\n    class Item {\n      constructor(item) {\n        this.item = item\n      }\n\n      render() {\n        return this.item ? h('li', [this.item]): false\n      }\n    }\n\n    h('.listing', [new List(['Alpha', 'Beta', null, 'Gamma'])])\n\nYields:\n\n    <div class=\"listing\">\n      <ol>\n        <li>Alpha</li>\n        <li>Beta</li>\n        <li>Gamma</li>\n      </ol>\n    </div>\n\nChildren that evaluate to `false` will be omitted.\n\n### render(root, child1[, child2[, child3[, ...]]])\n\nHelper method to append each of `children` to `root`.\n\n### replace(oldNode, newNode)\n\nHelper method to replace `oldNode` with `newNode`.\n\n## Acknowledgements\n\nHashish was obviously inspired by [hyperhype/hyperscript](https://github.com/hyperhype/hyperscript) and [JedWatson/classnames](https://github.com/JedWatson/classnames).\n","maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"time":{"modified":"2022-06-12T14:28:30.854Z","created":"2017-05-21T17:32:20.157Z","1.0.0":"2017-05-21T17:32:20.157Z","1.0.1":"2017-05-21T17:37:12.640Z"},"homepage":"https://github.com/alexei/hashish-js#readme","repository":{"type":"git","url":"git+https://github.com/alexei/hashish-js.git","web":"https://github.com/alexei/hashish-js"},"author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro"},"bugs":{"url":"https://github.com/alexei/hashish-js/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md"}