{"_id":"@alexlafroscia/ember-context","_rev":"4-8ff30e923c1c57ce089159b0d3290244","name":"@alexlafroscia/ember-context","dist-tags":{"prerelease":"1.0.0-1","latest":"1.0.1"},"versions":{"1.0.0-0":{"name":"@alexlafroscia/ember-context","version":"1.0.0-0","description":"The default blueprint for ember-cli addons.","keywords":["ember-addon"],"repository":"","license":"MIT","author":"","directories":{"doc":"doc","test":"tests"},"scripts":{"build":"ember build --environment=production","lint":"npm-run-all --aggregate-output --continue-on-error --parallel lint:*","lint:hbs":"ember-template-lint .","lint:js":"eslint .","start":"ember serve","test":"npm-run-all lint:* test:*","test:ember":"ember test","test:ember-compatibility":"ember try:each","release":"standard-version"},"dependencies":{"@glimmer/tracking":"^1.0.1","ember-cli-babel":"^7.22.1"},"devDependencies":{"@ember/optional-features":"^2.0.0","@glimmer/component":"^1.0.1","@movable/eslint-config":"^0.6.7","@movable/eslint-config-ember":"^0.6.1","@movable/prettier-config":"^0.3.3","babel-eslint":"^10.1.0","broccoli-asset-rev":"^3.0.0","ember-auto-import":"^1.6.0","ember-cli":"~3.21.2","ember-cli-dependency-checker":"^3.2.0","ember-cli-htmlbars":"^5.3.1","ember-cli-inject-live-reload":"^2.0.2","ember-cli-sri":"^2.1.1","ember-cli-uglify":"^3.0.0","ember-disable-prototype-extensions":"^1.1.3","ember-export-application-global":"^2.0.1","ember-load-initializers":"^2.1.1","ember-maybe-import-regenerator":"^0.1.6","ember-qunit":"^4.6.0","ember-resolver":"^8.0.2","ember-source":"~3.21.1","ember-source-channel-url":"^3.0.0","ember-template-lint":"^2.12.1","ember-template-lint-plugin-prettier":"^2.0.0","ember-try":"^1.4.0","eslint":"^7.9.0","eslint-plugin-ember":"^9.0.0","eslint-plugin-node":"^11.1.0","husky":"^4.3.0","lint-staged":"^10.4.0","loader.js":"^4.7.0","npm-run-all":"^4.1.5","qunit-dom":"^1.5.0","standard-version":"^9.0.0"},"engines":{"node":"10.* || >= 12"},"ember":{"edition":"octane"},"ember-addon":{"configPath":"tests/dummy/config"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":"eslint --fix","*.hbs":"ember-template-lint --fix","*.{html,json,md,yml}":"prettier --write"},"volta":{"node":"12.18.3","yarn":"1.22.5"},"gitHead":"6b8dc2db1f5f0f8d35757d0d51a2c5503aedf645","_id":"@alexlafroscia/ember-context@1.0.0-0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-XpQbPAroFZ3nvXtGEpV5xoRaLaHnkOzCIo621XrMPf+CyKgB3eAgsMkaolZAEIV4u/mBJt6ObAS0+u0cVtXpcg==","shasum":"33b97eb92a57f2428f79c49e9d10d6fec9374cf4","tarball":"https://registry.npmjs.org/@alexlafroscia/ember-context/-/ember-context-1.0.0-0.tgz","fileCount":16,"unpackedSize":14088,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZRDQCRA9TVsSAnZWagAA5DkP/iilyl0RSqjzBpC+Kgz2\nfJGVObF24frCy2fJUGdxivt+yRdl9Espfml6z4dfBpdF4rjPg3ob/YrvUnoS\nniKZZ2TongUI29BrToVnczD7LXlpA9KRDK3YzPfXz3IzjOQw7siKUcW4uGLy\ng1vu5B7D3FozFZaG51eFEarRwzo0KeksYfdisdWAO64Ly1Xq3a0E3iGv1m1a\nTtu+yfyAXCbCzcVgG8STPEWGyiW39ULlflf5uHluT8WzBxyUVjUXDir4c+pW\n4Nioo98XaqsChbfyKyIHkDe8QllAcUUA5TPywxCs34h4kuf1YfQFe1m38tJw\nyqJi522IjLosRfF2yyrj124yIUooSnuu4R0+MV0Kr8rsH8vgQ+c5x4lMHdhD\nGkdfOva1CvDQ6njLiHua+mMzvaFZHj4Sb+IDzei+a42qXYnSxUsbGRxqkV2l\np5HHzaKVEm9+bvDgaRBj7hXDMfMffnyNC+cFDSNZD8jw+SmjtktZlI5w987A\n3WgwxPyG4TbHphBpmLzjyOdDkUNa8is6ktl6tZ3WjX+BExHWae3sGZE5qj0K\nGy7syiO01H7oLS/RXstbk87bL0gOsrOzY3tiGV2GTlbP72VC1VQeorDow2xp\ny/HYg7W+/uIK0Z98jPo1QHPSc2wsTRh/Zh5aArKWT9DPAq1Gaan70Os//vn7\nakCf\r\n=ZKjL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEoVCxsoMDcQOxv+bLhXBFOulFMFdCK/9TtcK0lLiCayAiATnjuyIjA0KyOLLEbyfyLWAKKg0IgeHRLGNzZC2EYADw=="}]},"maintainers":[{"name":"alexlafroscia","email":"alex@lafroscia.com"}],"_npmUser":{"name":"alexlafroscia","email":"alex@lafroscia.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ember-context_1.0.0-0_1600458960057_0.7335150597910327"},"_hasShrinkwrap":false},"1.0.0-1":{"name":"@alexlafroscia/ember-context","version":"1.0.0-1","description":"Consume values from elsewhere in your Ember application","keywords":["ember-addon"],"repository":"","license":"MIT","author":"","directories":{"doc":"doc","test":"tests"},"scripts":{"build":"ember build --environment=production","lint":"npm-run-all --aggregate-output --continue-on-error --parallel lint:*","lint:hbs":"ember-template-lint .","lint:js":"eslint .","start":"ember serve","test":"npm-run-all lint:* test:*","test:ember":"ember test","test:ember-compatibility":"ember try:each","release":"standard-version"},"dependencies":{"@glimmer/tracking":"^1.0.1","ember-cli-babel":"^7.22.1"},"devDependencies":{"@ember/optional-features":"^2.0.0","@glimmer/component":"^1.0.1","@movable/eslint-config":"^0.6.7","@movable/eslint-config-ember":"^0.6.1","@movable/prettier-config":"^0.3.3","babel-eslint":"^10.1.0","broccoli-asset-rev":"^3.0.0","ember-auto-import":"^1.6.0","ember-cli":"~3.21.2","ember-cli-dependency-checker":"^3.2.0","ember-cli-htmlbars":"^5.3.1","ember-cli-inject-live-reload":"^2.0.2","ember-cli-sri":"^2.1.1","ember-cli-uglify":"^3.0.0","ember-disable-prototype-extensions":"^1.1.3","ember-export-application-global":"^2.0.1","ember-load-initializers":"^2.1.1","ember-maybe-import-regenerator":"^0.1.6","ember-qunit":"^4.6.0","ember-resolver":"^8.0.2","ember-source":"~3.21.1","ember-source-channel-url":"^3.0.0","ember-template-lint":"^2.12.1","ember-template-lint-plugin-prettier":"^2.0.0","ember-try":"^1.4.0","eslint":"^7.9.0","eslint-plugin-ember":"^9.0.0","eslint-plugin-node":"^11.1.0","husky":"^4.3.0","lint-staged":"^10.4.0","loader.js":"^4.7.0","npm-run-all":"^4.1.5","qunit-dom":"^1.5.0","standard-version":"^9.0.0"},"engines":{"node":"10.* || >= 12"},"ember":{"edition":"octane"},"ember-addon":{"configPath":"tests/dummy/config"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":"eslint --fix","*.hbs":"ember-template-lint --fix","*.{html,json,md,yml}":"prettier --write"},"standard-version":{"scripts":{"postchangelog":"prettier --write CHANGELOG.md"}},"volta":{"node":"12.18.3","yarn":"1.22.5"},"readme":"# @alexlafroscia/ember-context\n\nConsume values from elsewhere in your Ember application\n\n## Compatibility\n\n- Ember.js v3.12 or above\n- Ember CLI v2.13 or above\n- Node.js v10 or above\n\n## Installation\n\n```\nember install @alexlafroscia/ember-context\n```\n\n## Usage\n\nEmber Services are excellent for sharing global state across your application. However, there are many times where some state needs to be shared _without_ it being considered global; it should be shared within a sub-tree of your application but thrown away once that sub-tree is no longer rendered.\n\nTo fill this gap, enter `ember-context`!\n\nThis addon is based on two related roles for a given value; a \"Provider\" and a \"Consumer\".\n\nThis \"Provider\" is always an instance of the `ContextProvider` component, which can be used like so:\n\n```handlebars\n<ContextProvider @key=\"shared-key\" @value={{valueForSharedKey}}>\n  {{! Consumer somewhere in here }}\n</ContextProvider>\n```\n\nA \"Consumer\" can be either a usage of the `consume-context` helper _or_ a component that injects the value as a property.\n\n### `consume-context`\n\nThe most basic -- and recommended -- usage is to consume a value using the `consume-context` helper. Using it might look like this:\n\n```handlebars\n{{consume-context \"shared-key\"}}\n```\n\nIf placed beneath the `ContextProvider` in the example above, the helper will return `valueForSharedKey`. The beauty of this addon is that the helper can be _anywhere_ in your template, as long as there is a `ContextProvider` with a key of `shared-key` somewhere above it, even across component boundaries.\n\n### `inject` Decorator\n\nAdditionally, for an experience closer to that of working with Ember services, you can add the `inject` decorator to your own components to consume a contextual value.\n\n```javascript\n// app/components/my-component.js\nimport Component from '@glimmer/component';\nimport { inject as context } from '@alexlafroscia/ember-context';\n\nexport default class MyComponent extends Component {\n  @context('shared-key') sharedKeyValue;\n}\n```\n\nSimilar to the `consume-context` helper, if `MyComponent` is rendered somewhere within `ContextProvider` with a `@key` of `shared-key`, the value of the `sharedKeyValue` on `MyComponent` will be `valueForSharedKey`. This allows you to avoid using the helper if it is not appropriate for your use-case.\n\n## Caveats\n\nThere are some potential issues around looking up the correct `ContextProvider` in certain circumstances that you should be aware of. Specifically, problems can arise if you use the same \"key\" for multiple providers and consume the value for that key within a conditional.\n\nFor your own safety, I recommend not rendering multiple providers for the same \"key\" simultaneously; if you can avoid that, things should work out okay!\n\nIf you do run into problems, please open an issue!.\n\n## Contributing\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n## Prior Art\n\n- [`ember-provider`](https://github.com/alexlafroscia/ember-provider): My first attempt at scoping state to a sub-tree of an application. It relied on actually walking up the component tree which, while more reliable, it not really possible with public Ember APIs. `ember-context` does not use any private APIs.\n- [React Context](https://reactjs.org/docs/context.html): The original inspiration for the ability to set a value in one place in the tree and receive it elsewhere.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","readmeFilename":"README.md","gitHead":"6b3668e0651b1bb1b5ab74f9c807734dde8f711c","_id":"@alexlafroscia/ember-context@1.0.0-1","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-IALUNt+hQBv73Ka9oLZ7/5koqwC21EGvcAO2xNB42pJV3yrQF7FGHawzfbLAQXXa2UHehfhVSUs6bTGuncb9lQ==","shasum":"ad69bfd22ff74496fca7699af03bddd99ee43718","tarball":"https://registry.npmjs.org/@alexlafroscia/ember-context/-/ember-context-1.0.0-1.tgz","fileCount":17,"unpackedSize":14652,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZRUyCRA9TVsSAnZWagAAjGYP/2oz5UayWenTitj0ezua\nPFsBeFeRfYSEHdkvsyAlhtpmoPB5f4xkcyaX6CFbUU1KnEuGwkylS3E/OEd8\nlHSYRTM/8fUreA2E/JSrz98KdqyC1FYiAQa1nE9EO9VGGw6267XTI/Nowq8V\npe5OH6SQVFD5AOWkBQunv3TAtstWQZpS2n/vgdDnOESxXy6yYl0+7xBb542v\neDSStrGQS2L8ii6hTWz/hVWwkIX+mAmQsg6DtR4vBMqxZcK+6VoIOPw+LRBZ\n/ZrWiMvWIiouutBkwffN5qtFY6sCxkuHcFuXqo8tt2wRxM4/UiV+ayvZqhba\nu8BIX+d5byL7ge3WWm1gRf9RIWIBvnUM4P02UzYOgdGhHFMtp3yl7UjHSwi/\nqzjoUagy2cjUhRZAVkX1ZFzFn6IT1yydHNiqaPCxQniOmVbeiM9A5Qzdi8Rk\noKFxqHHm//44KcUelx3syaoN9UvD9i0S8gvlY9e7K6xtAno3AzCSHlYFuTzy\nDm+orv8gs8EdGaEWqmmSw5sOC9aKCgDK4fSnB8wAJyXEI683/sJR/QD32MjM\ndy5LiQL9GCpfBLpMGQLr+2eZUIE0r7gpBC0fY93m8X4qXUt9T28XDtnhTXVn\nKPMvgCeqXUBLP4SxxZLo8EmpATegJ/IRDhfyLZw+18JugOtvAWY7a5NJdNbr\n1n3n\r\n=ENfX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/u9iDK1zWu5xU1jkyZUj/wjVWY8RKr2Y6T7yQ0F1XaQIgT5Qr5pGfBx0GDlHIN0QPkBa1xcCHF8GakrimlggFFrs="}]},"maintainers":[{"name":"alexlafroscia","email":"alex@lafroscia.com"}],"_npmUser":{"name":"alexlafroscia","email":"alex@lafroscia.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ember-context_1.0.0-1_1600460074424_0.6497112504139413"},"_hasShrinkwrap":false},"1.0.0":{"name":"@alexlafroscia/ember-context","version":"1.0.0","description":"Consume values from elsewhere in your Ember application","keywords":["ember-addon"],"repository":{"type":"git","url":"git://github.com/alexlafroscia/ember-context.git"},"license":"MIT","author":"","directories":{"doc":"doc","test":"tests"},"scripts":{"build":"ember build --environment=production","lint":"npm-run-all --aggregate-output --continue-on-error --parallel lint:*","lint:hbs":"ember-template-lint .","lint:js":"eslint .","start":"ember serve","test":"npm-run-all lint:* test:*","test:ember":"ember test","test:ember-compatibility":"ember try:each","release":"standard-version"},"dependencies":{"@glimmer/tracking":"^1.0.1","ember-cli-babel":"^7.22.1"},"devDependencies":{"@ember/optional-features":"^2.0.0","@glimmer/component":"^1.0.1","@movable/eslint-config":"^0.6.7","@movable/eslint-config-ember":"^0.6.1","@movable/prettier-config":"^0.3.3","babel-eslint":"^10.1.0","broccoli-asset-rev":"^3.0.0","ember-auto-import":"^1.6.0","ember-cli":"~3.23.0","ember-cli-dependency-checker":"^3.2.0","ember-cli-htmlbars":"^5.3.1","ember-cli-inject-live-reload":"^2.0.2","ember-cli-sri":"^2.1.1","ember-cli-uglify":"^3.0.0","ember-disable-prototype-extensions":"^1.1.3","ember-export-application-global":"^2.0.1","ember-load-initializers":"^2.1.1","ember-maybe-import-regenerator":"^0.1.6","ember-qunit":"^4.6.0","ember-resolver":"^8.0.2","ember-source":"~3.23.0","ember-source-channel-url":"^3.0.0","ember-template-lint":"^2.12.1","ember-template-lint-plugin-prettier":"^2.0.0","ember-try":"^1.4.0","eslint":"^7.9.0","eslint-plugin-ember":"^10.0.0","eslint-plugin-node":"^11.1.0","husky":"^4.3.0","lint-staged":"^10.4.0","loader.js":"^4.7.0","npm-run-all":"^4.1.5","qunit-dom":"^1.5.0","standard-version":"^9.0.0"},"engines":{"node":"10.* || >= 12"},"ember":{"edition":"octane"},"ember-addon":{"configPath":"tests/dummy/config"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":"eslint --fix","*.hbs":"ember-template-lint --fix","*.{html,json,md,yml}":"prettier --write"},"standard-version":{"scripts":{"postchangelog":"prettier --write CHANGELOG.md"}},"volta":{"node":"12.18.3","yarn":"1.22.5"},"gitHead":"514985862e017dca85a355a8e68971d9d648cfe1","bugs":{"url":"https://github.com/alexlafroscia/ember-context/issues"},"homepage":"https://github.com/alexlafroscia/ember-context#readme","_id":"@alexlafroscia/ember-context@1.0.0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-K/kwIa+zvqC/TBzCQe0E3aSWUuHOs33dOZeOpB7B2llhWVYLQTgPNXbvcv44veV/m44CFojmz7FQMuwAGyC7Yw==","shasum":"d78b1942bad933e4310f679e72a89207b364bdce","tarball":"https://registry.npmjs.org/@alexlafroscia/ember-context/-/ember-context-1.0.0.tgz","fileCount":17,"unpackedSize":15404,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2PAWCRA9TVsSAnZWagAASv0P/RDBTViNqy0+IZfBi/LO\nM3SY/4ivSVPMlkbkazjqiIV5YuipRrss9eWAuQ9TN6Pr1nL0jczq3cwk0iMX\nj8Uyv7Dh6G75pJ2SBaM58OBQ51brqOkve5jG7N56HPUgi2dKNbd48f8K6isw\nO/MuW+v1HFHTjjeRi2wrwlIkxwHFUlO/J1t9PsXIhvM2hVV36Yx7458IHv//\n23D7HZbl/BaBKxHl3N9Wk80H0BBwhFHzOXONUXFJhhU6GnpEjKLO0F2Z1QGa\nPIvzU1RiGDlpQCRLxVGqOGFHM7gvSvzI4ido0NKbMiqZ8LWBM7hzkAHtQ13c\nmqAA3lHT3rrNBbE2+yuSu2SE9jTnExKsQx++N2N5tLnEz3Vdb2jSsdDY0V0M\ntUxa+pdAauBbqpS4zzfFmhq+jCfX6i7m0Pcu+R5S3JJjdFUbbXY+VYir87k8\nodHNNthhCTFdhmAqiBZDe3PFEy6LA4Dtn5Z8pb1KyNq/0gMSd5LWmY2kQyZO\n0AGMm2DfL82UejrGGIqdEFYNXXXGWSp/wQzATMUW51psLJJOE5tXIafu2VAe\nBz9JbVuighKdCiHM3SxUlmDHVD3UoOoFo5nexFRtpECfUKtlMkUF62487aD7\nFNOEGU9KCNV01UJpIn6+5QCfWQmO0CWHq2YDd3khISBScIUf8OAUre9YbPHt\n1GmM\r\n=Gw+J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtt6vHcqDJTGazekocGMTMu0ms6sISuAjXTaY4mZQ6hwIgSLiP92ydSi8Qmm20kKmsdLXet5iUD0OcHN2iGVvzfbo="}]},"_npmUser":{"name":"alexlafroscia","email":"alex@lafroscia.com"},"maintainers":[{"name":"alexlafroscia","email":"alex@lafroscia.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ember-context_1.0.0_1608052758009_0.39674539723011626"},"_hasShrinkwrap":false},"1.0.1":{"name":"@alexlafroscia/ember-context","version":"1.0.1","description":"Consume values from elsewhere in your Ember application","keywords":["ember-addon"],"repository":{"type":"git","url":"git://github.com/alexlafroscia/ember-context.git"},"license":"MIT","author":"","directories":{"doc":"doc","test":"tests"},"scripts":{"build":"ember build --environment=production","lint":"npm-run-all --aggregate-output --continue-on-error --parallel lint:*","lint:hbs":"ember-template-lint .","lint:js":"eslint .","start":"ember serve","test":"npm-run-all lint:* test:*","test:ember":"ember test","test:ember-compatibility":"ember try:each","release":"standard-version","prepare":"husky install"},"dependencies":{"@glimmer/tracking":"^1.0.1","ember-cli-babel":"^7.22.1"},"devDependencies":{"@ember/optional-features":"^2.0.0","@embroider/test-setup":"^0.43.2","@glimmer/component":"^1.0.1","@movable/eslint-config":"^0.6.7","@movable/eslint-config-ember":"^0.6.1","@movable/prettier-config":"^0.3.3","babel-eslint":"^10.1.0","broccoli-asset-rev":"^3.0.0","ember-auto-import":"^1.6.0","ember-cli":"~3.26.0","ember-cli-dependency-checker":"^3.2.0","ember-cli-htmlbars":"^5.3.1","ember-cli-inject-live-reload":"^2.0.2","ember-cli-sri":"^2.1.1","ember-cli-uglify":"^3.0.0","ember-disable-prototype-extensions":"^1.1.3","ember-export-application-global":"^2.0.1","ember-load-initializers":"^2.1.1","ember-maybe-import-regenerator":"^0.1.6","ember-qunit":"^4.6.0","ember-resolver":"^8.0.2","ember-source":"~3.26.0","ember-source-channel-url":"^3.0.0","ember-template-lint":"^2.12.1","ember-template-lint-plugin-prettier":"^2.0.0","ember-try":"^1.4.0","eslint":"^7.9.0","eslint-plugin-ember":"^10.0.0","eslint-plugin-node":"^11.1.0","husky":"^7.0.1","lint-staged":"^10.4.0","loader.js":"^4.7.0","npm-run-all":"^4.1.5","qunit-dom":"^1.5.0","standard-version":"^9.0.0"},"engines":{"node":"10.* || >= 12"},"ember":{"edition":"octane"},"ember-addon":{"configPath":"tests/dummy/config"},"lint-staged":{"*.js":"eslint --fix","*.hbs":"ember-template-lint --fix","*.{html,json,md,yml}":"prettier --write"},"standard-version":{"scripts":{"postchangelog":"prettier --write CHANGELOG.md"}},"volta":{"node":"12.18.3","yarn":"1.22.5"},"gitHead":"4cc13a20719ccc17c1542f7600179c626e2a59db","bugs":{"url":"https://github.com/alexlafroscia/ember-context/issues"},"homepage":"https://github.com/alexlafroscia/ember-context#readme","_id":"@alexlafroscia/ember-context@1.0.1","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-/yzk7Lj8JM+AT+1Abozxlcw7rt/J8Bz/fn5BJw0k3dIWSqT4ivvUTFCed1LoCXUIYhNtRPKDcUmlfyxjP/yXFA==","shasum":"51c7665a07775ad46a0f00196f907ec7aea09704","tarball":"https://registry.npmjs.org/@alexlafroscia/ember-context/-/ember-context-1.0.1.tgz","fileCount":20,"unpackedSize":16037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBBsoCRA9TVsSAnZWagAALCYP+gJKE7YVnaPGGGo5tOuo\nm1nYZXRTGTemSxCEI4nUuFbPMxgf8o1ayuGD1ukkLGYCcPgbTuZ6Z3LkZCFl\n3OdsW/4NmMkQ9lqrSL0vHtF1Q4SGuJTHZx2Q6bdruygJaz4tgMNiL6y0C44c\neUD+HD1YqGsPxmlYCrTmK9lI4C43DCn9Qc7JtPySQHyHNrP44vF4TcVPfzEW\nDpHN3jiVF60FCUALIFlET/gd8EAD2w7K7VX+VcmzIzAr8UPl8pqrhg9pFuc1\nVRSxCndpnT4hxMPKudvbKujnMwrX0ki/sv5kprrWj8a98p6oeS5+aht8lmPv\noN73GzmIsCLFGtjA5k7F0N0YM5j6HV0ke8OSBffO31g/TFb3Y4uxC/Aaoa0o\ncKA0P2GEcR9pc2rJL5zwyYLwG4uXNPtOTBarUtRgnpa/BpljQsfJUeyObDYq\n7EsXjZkrsBEqS5FET+aecqUgjkPYMarf0zt3wUSFIkAyDWKt/elhT+cNmWB9\nZFh3cyU5qoHB0WsW0hu2RONAfKOUFEgIvVJMddc6LB/EQOy1yBglJdx4zDMY\nAsLYkQJvwlieX7Parnif4It9eX8/GuhCKEV/7Z9yGHNs35TQH+gfRJtGs0vx\nFs/+sv+8QMCgiiMpfJKbBACbqfnKBy84YwoB2KWxLkP+LQdx0ooS87a3u1eO\nACOU\r\n=lD6D\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQa7IYT/E63DJG4cIiMfW+Y/6FbFaemcxTBWZsHWJjZwIhAOVUnseARE239hLkAzHfckFLjzgMLr2QOapnp0PbslRa"}]},"_npmUser":{"name":"alexlafroscia","email":"alex@lafroscia.com"},"maintainers":[{"name":"alexlafroscia","email":"alex@lafroscia.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ember-context_1.0.1_1627659048440_0.4866267109737046"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-18T19:55:59.995Z","1.0.0-0":"2020-09-18T19:56:00.151Z","modified":"2022-04-04T12:41:03.101Z","1.0.0-1":"2020-09-18T20:14:41.790Z","1.0.0":"2020-12-15T17:19:18.169Z","1.0.1":"2021-07-30T15:30:48.744Z"},"maintainers":[{"name":"alexlafroscia","email":"alex@lafroscia.com"}],"description":"Consume values from elsewhere in your Ember application","keywords":["ember-addon"],"license":"MIT","readme":"# @alexlafroscia/ember-context\n\nConsume values from elsewhere in your Ember application\n\n## Compatibility\n\n- Ember.js v3.12 or above\n- Ember CLI v2.13 or above\n- Node.js v10 or above\n\n## Installation\n\n```\nember install @alexlafroscia/ember-context\n```\n\n## Usage\n\nEmber Services are excellent for sharing global state across your application. However, there are many times where some state needs to be shared _without_ it being considered global; it should be shared within a sub-tree of your application but thrown away once that sub-tree is no longer rendered.\n\nTo fill this gap, enter `ember-context`!\n\nThis addon is based on two related roles for a given value; a \"Provider\" and a \"Consumer\".\n\nThis \"Provider\" is always an instance of the `ContextProvider` component, which can be used like so:\n\n```handlebars\n<ContextProvider @key=\"shared-key\" @value={{valueForSharedKey}}>\n  {{! Consumer somewhere in here }}\n</ContextProvider>\n```\n\nA \"Consumer\" can be either a usage of the `consume-context` helper _or_ a component that injects the value as a property.\n\n### `consume-context`\n\nThe most basic -- and recommended -- usage is to consume a value using the `consume-context` helper. Using it might look like this:\n\n```handlebars\n{{consume-context \"shared-key\"}}\n```\n\nIf placed beneath the `ContextProvider` in the example above, the helper will return `valueForSharedKey`. The beauty of this addon is that the helper can be _anywhere_ in your template, as long as there is a `ContextProvider` with a key of `shared-key` somewhere above it, even across component boundaries.\n\n### `inject` Decorator\n\nAdditionally, for an experience closer to that of working with Ember services, you can add the `inject` decorator to your own components to consume a contextual value.\n\n```javascript\n// app/components/my-component.js\nimport Component from '@glimmer/component';\nimport { inject as context } from '@alexlafroscia/ember-context';\n\nexport default class MyComponent extends Component {\n  @context('shared-key') sharedKeyValue;\n}\n```\n\nSimilar to the `consume-context` helper, if `MyComponent` is rendered somewhere within `ContextProvider` with a `@key` of `shared-key`, the value of the `sharedKeyValue` on `MyComponent` will be `valueForSharedKey`. This allows you to avoid using the helper if it is not appropriate for your use-case.\n\n## Caveats\n\nThere are some potential issues around looking up the correct `ContextProvider` in certain circumstances that you should be aware of. Specifically, problems can arise if you use the same \"key\" for multiple providers and consume the value for that key within a conditional.\n\nFor your own safety, I recommend not rendering multiple providers for the same \"key\" simultaneously; if you can avoid that, things should work out okay!\n\nIf you do run into problems, please open an issue!.\n\n## Contributing\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n## Prior Art\n\n- [`ember-provider`](https://github.com/alexlafroscia/ember-provider): My first attempt at scoping state to a sub-tree of an application. It relied on actually walking up the component tree which, while more reliable, it not really possible with public Ember APIs. `ember-context` does not use any private APIs.\n- [React Context](https://reactjs.org/docs/context.html): The original inspiration for the ability to set a value in one place in the tree and receive it elsewhere.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","readmeFilename":"README.md","homepage":"https://github.com/alexlafroscia/ember-context#readme","repository":{"type":"git","url":"git://github.com/alexlafroscia/ember-context.git"},"bugs":{"url":"https://github.com/alexlafroscia/ember-context/issues"}}