{"_id":"@barneycarroll/life-cycle","_rev":"1-b668ce4254cbc446caa9d7d49ad9254d","name":"@barneycarroll/life-cycle","dist-tags":{"latest":"1.0.0-rc.1"},"versions":{"1.0.0-rc.1":{"name":"@barneycarroll/life-cycle","version":"1.0.0-rc.1","description":"A no-op custom element which exposes lifecycle hooks to consuming view frameworks","main":"life-cycle.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/barneycarroll/life-cycle.git"},"keywords":["dom","view","lifecycle","hooks","custom-element","web-component"],"author":{"name":"Barney Carroll","email":"barney.carroll@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/barneycarroll/life-cycle/issues"},"homepage":"https://github.com/barneycarroll/life-cycle#readme","gitHead":"f5951f15580cf1ef6f5a7e9f4bb012ff0a858843","_id":"@barneycarroll/life-cycle@1.0.0-rc.1","_nodeVersion":"14.15.4","_npmVersion":"7.6.0","dist":{"integrity":"sha512-rgsloJ5ZAJ4LDSVr6jIuSWXMSQcymxcPMSjSqSM8u0W7x4VnyHzD0UX3mbEl197d/LdAh0ahJE1+6Oz96MoGjw==","shasum":"0efcc6c192368da43269f4f211310f749f631425","tarball":"https://registry.npmjs.org/@barneycarroll/life-cycle/-/life-cycle-1.0.0-rc.1.tgz","fileCount":4,"unpackedSize":4353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgToOMCRA9TVsSAnZWagAAWMIP+gMMr7Lm85pZIBSVbyAB\n2TL58E5VcGFJcfDPytVHtBorJXIAg87z/b5Ukd5ztBpoPV89dBgGU0rKBtBR\nsSA6m1pO9OUeyIHJpYHwpY+CjwSldKc7HN2pPcJN4DpEuxYz4sJUUT1sZhjs\nhMfMxUc3x09+lg5EZw2Sluf89Y2pNewUZJkA7t6O4/9MoeH2356av3DOh1WG\ntZ+DGpGKsMxCi3NTdVeMTKw4oTzdIpAwSIrdGvwXEyqQBcCCr9k1g8YNeYra\nCo6nV7tK0IKDq6+f2JUgKEsbQmzX9Osx63u6VPDnMguRsXnKmM+MF7kG9X7h\nOeHpWGfZqhVdFWqZpRHdx4isHzxnhGTaG5RuKZkLTBmj/goimCkCd1B6HpMh\n4gquV4ld6hSlABqBCW/VUTSvdFh+BYYqymb8xo+6E8uPtxaY60ar2Vd0zSfz\nJp7kVAMq7SZlM5dJJ5g5m/CwMizRItjAiV7p7fKflLK33YCPzdlC6fzz2Q7O\n3lIMGDiNklPyaCKIz5nJpYk3mIAUCebx6x81jsPEbf1ocAHr2mksZt+EQjrs\nfW63Har8KYh/V46rAu2OMk6YXH5hj+QqI3DTQ+645t+7FM/z+tXTxut520cw\naC+4b7ms9FeluyfzdVLwEXhrOvbRK8mulV47c8Vmgvj/l/O9OsJMA68navMb\nE5ve\r\n=OM8q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCeeW1dFyVxDlPwiQq4AAmgfXUYRFilvYvTvSCIUtZvLwIgRf/8lZztPA8wU+fwIJLfqT+wxwQFra43MaKMozhVh68="}]},"_npmUser":{"name":"barneycarroll","email":"barney.carroll@gmail.com"},"directories":{},"maintainers":[{"name":"barneycarroll","email":"barney.carroll@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/life-cycle_1.0.0-rc.1_1615758219922_0.6087336198725006"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-14T21:43:39.885Z","1.0.0-rc.1":"2021-03-14T21:43:40.075Z","modified":"2022-04-04T17:44:27.159Z"},"maintainers":[{"name":"barneycarroll","email":"barney.carroll@gmail.com"}],"description":"A no-op custom element which exposes lifecycle hooks to consuming view frameworks","homepage":"https://github.com/barneycarroll/life-cycle#readme","keywords":["dom","view","lifecycle","hooks","custom-element","web-component"],"repository":{"type":"git","url":"git+https://github.com/barneycarroll/life-cycle.git"},"author":{"name":"Barney Carroll","email":"barney.carroll@gmail.com"},"bugs":{"url":"https://github.com/barneycarroll/life-cycle/issues"},"license":"MIT","readme":"# `<life-cycle/>`\n\n`<life-cycle/>` is a [custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for framework-agnostic lifecycle hooks. \n\n## What?\n\nThe various view frameworks of the world have different APIs of exposing the underlying DOM nodes & fundamental entity lifecycle (create, update, destroy) - some don't expose any at all. `<life-cycle/>` forwards each of the DOM [lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks_) to corresponding property methods declared on instantiation, allowing CRUD directives and access to local DOM objects. Meanwhile, it applies a style of `display:contents` so as not to affect rendering. \n\n## How?\n\nEach lifecycle method on the custom element prototype will call corresponding properties on any `<life-cycle/>` index, with the same signature:\n\n| Custom element method | `<life-cycle>` property   \n|-|-\n|`connectedCallback`        |`connected`       \n|`disconnectedCallback`     |`disconnected`    \n|`adoptedCallback`          |`adopted`         \n|`attributeChangedCallback` |`attributeChanged`\n\nBecause `attributeChanged` requires that observed attributes be determined ahead of time, we reserve an attribute called simply `attribute` to trigger its execution.\n\n## Why?\n\nAs an example, [Hyperapp](https://github.com/jorgebucaran/hyperapp) - a minimal virtual DOM library with a strong remit on functional purity - doesn't expose any API for interfacing with generated DOM; meanwhile, an application written with [`seview`](https://github.com/foxdonut/seview#seview-s-expression-view) would want to avoid library-specific APIs as far as possible in order to allow the same application view code to run with interchangeable rendering engines. With the `<life-cycle/>` element, either - or both - of these can be used in a way that allows setup & teardown logic per node, conditional updates, and DOM node exposure.","readmeFilename":"README.md"}