{"id":16789657,"url":"https://github.com/ryangjchandler/alpine-parent","last_synced_at":"2025-03-22T00:33:04.426Z","repository":{"id":65714828,"uuid":"462395751","full_name":"ryangjchandler/alpine-parent","owner":"ryangjchandler","description":"Adds a handy $parent magic property to your Alpine components.","archived":true,"fork":false,"pushed_at":"2022-02-22T17:14:44.000Z","size":113,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T07:16:25.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryangjchandler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["ryangjchandler"]}},"created_at":"2022-02-22T17:05:52.000Z","updated_at":"2024-10-29T16:39:13.000Z","dependencies_parsed_at":"2023-02-06T09:25:12.297Z","dependency_job_id":null,"html_url":"https://github.com/ryangjchandler/alpine-parent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryangjchandler%2Falpine-parent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryangjchandler%2Falpine-parent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryangjchandler%2Falpine-parent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryangjchandler%2Falpine-parent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryangjchandler","download_url":"https://codeload.github.com/ryangjchandler/alpine-parent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890102,"owners_count":20527030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T08:27:57.454Z","updated_at":"2025-03-22T00:33:04.117Z","avatar_url":"https://github.com/ryangjchandler.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ryangjchandler"],"categories":[],"sub_categories":[],"readme":"\u003e ✨ Help support the maintenance of this package by [sponsoring me](https://github.com/sponsors/ryangjchandler).\n\n# Alpine `$parent`\n\nAccess parent components using a handy `$parent` magic variable.\n\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/ryangjchandler/alpine-parent?label=version\u0026style=flat-square)\n![Build size Brotli](https://img.badgesize.io/ryangjchandler/alpine-parent/main/dist/cdn.min.js.svg?compression=gzip\u0026style=flat-square\u0026color=green)\n[![Monthly downloads via CDN](https://data.jsdelivr.com/v1/package/npm/@ryangjchandler/alpine-parent/badge)](https://www.jsdelivr.com/package/npm/@ryangjchandler/alpine-parent)\n\n\u003e This package only supports Alpine v3.x.\n\n## About\n\nThis plugin provides a new `$parent` magic property that allows you to interact with a parent component's data object directly. This is useful when you have nested components and conflicting property names but would still like to access the parent properties / methods directly.\n\n## Installation\n\n### CDN\n\nInclude the following `\u003cscript\u003e` tag in the `\u003chead\u003e` of your document, just before Alpine.\n\n```html\n\u003cscript\n    src=\"https://cdn.jsdelivr.net/npm/@ryangjchandler/alpine-parent@1.x.x/dist/cdn.min.js\"\n    defer\n\u003e\u003c/script\u003e\n```\n\n### NPM\n\n```bash\nnpm install @ryangjchandler/alpine-parent\n```\n\nAdd the `$parent` directive to your project by registering the plugin with Alpine.\n\n```js\nimport Alpine from \"alpinejs\";\nimport Parent from \"@ryangjchandler/alpine-parent\";\n\nAlpine.plugin(Parent);\n\nwindow.Alpine = Alpine;\nwindow.Alpine.start();\n```\n\n## Usage\n\nAccess the `$parent` property in your component:\n\n```html\n\u003cdiv x-data=\"{ value: 'foo }\"\u003e\n    \u003cdiv x-data=\"{ value: 'bar' }\"\u003e\n        My value is \u003cspan x-text=\"value\"\u003e\u003c/span\u003e and my parent's value is \u003cspan x-text=\"$parent.value\"\u003e\u003c/span\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\nThe `$parent` property returns a `Proxy`, so any updates to the properties should be reactive. This means you'll be able to use it inside of `x-model`, etc.\n\n## Versioning\n\nThis projects follow the [Semantic Versioning](https://semver.org/) guidelines.\n\n## License\n\nCopyright (c) 2021 Ryan Chandler and contributors\n\nLicensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryangjchandler%2Falpine-parent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryangjchandler%2Falpine-parent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryangjchandler%2Falpine-parent/lists"}