{"id":19479209,"url":"https://github.com/asgerb/stimulus-durable-values","last_synced_at":"2026-01-11T03:30:03.064Z","repository":{"id":257574748,"uuid":"858745031","full_name":"asgerb/stimulus-durable-values","owner":"asgerb","description":"Easily make your Stimulus controller values persist through morphs","archived":false,"fork":false,"pushed_at":"2024-09-19T08:57:32.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T22:16:54.453Z","etag":null,"topics":["hotwire","stimulus","stimulus-controller","stimulus-js","stimulusjs","turbo"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"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/asgerb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-17T13:13:03.000Z","updated_at":"2024-09-19T09:00:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a808093-dbf3-4540-ac14-4ec0af13af54","html_url":"https://github.com/asgerb/stimulus-durable-values","commit_stats":null,"previous_names":["asgerb/stimulus-durable-values"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asgerb%2Fstimulus-durable-values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asgerb%2Fstimulus-durable-values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asgerb%2Fstimulus-durable-values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asgerb%2Fstimulus-durable-values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asgerb","download_url":"https://codeload.github.com/asgerb/stimulus-durable-values/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250844242,"owners_count":21496530,"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":["hotwire","stimulus","stimulus-controller","stimulus-js","stimulusjs","turbo"],"created_at":"2024-11-10T19:53:20.946Z","updated_at":"2026-01-11T03:30:03.036Z","avatar_url":"https://github.com/asgerb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stimulus Durable Values\n\nEasily make your Stimulus controller values persist through morphs.\n\n## Installing the package\n\nInstall the package using your package handler of choice\n\n### Using npm\n```bash\nnpm i stimulus-durable-values\n```\n\n### Using yarn\n```bash\nyarn add stimulus-durable-values\n```\n\n## Usage\n\n### Setting up the API\n\nImport the `DurableValuePropertiesBlessing` and add it to the `blessings` array on the `Controller` class:\n\n```js\nimport { Controller } from \"@hotwired/stimulus\"\nimport { DurableValuePropertiesBlessing } from \"stimulus-durable-values\"\n\nController.blessings.push(DurableValuePropertiesBlessing)\n```\n\nIn rails apps this would typically be done in the `app/javascript/controllers/application.js` file.\n\n### Implementing in a Controller\n\nNow you can mark values as durable in your controller:\n\n```js\nimport { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n  static values = { open: Boolean }\n  static durableValues = [\"open\"]\n\n  // Your controller logic\n}\n```\n\nWhenever you change a durable value in the controller, it will be saved. If the DOM is updated (via a morph), the value will automatically revert to the saved state, ensuring consistent behavior across interactions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasgerb%2Fstimulus-durable-values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasgerb%2Fstimulus-durable-values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasgerb%2Fstimulus-durable-values/lists"}