{"_id":"@aaronbushnell/alpinejs-history","_rev":"3-f5ebe295ab9286a38b1a3478ac3ed85d","name":"@aaronbushnell/alpinejs-history","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@aaronbushnell/alpinejs-history","version":"1.0.0","keywords":["alpinejs","alpine","history","querystring","url","persist"],"author":{"name":"Aaron Bushnell"},"license":"MIT","_id":"@aaronbushnell/alpinejs-history@1.0.0","maintainers":[{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"}],"dist":{"shasum":"2c551e7ffbe73a252a28c77e593e55958a4e2d64","tarball":"https://registry.npmjs.org/@aaronbushnell/alpinejs-history/-/alpinejs-history-1.0.0.tgz","fileCount":4,"integrity":"sha512-blCt0JH451wFcYvliL6x8M0ZYGZnilnrtQwJql1KH6KQnBfir5kFZVsxC/Vuuj0zgA01gdtxxSR2J7luEdX5Fg==","signatures":[{"sig":"MEUCIQCr27khTNBHFsa0BvOaJheDZ/6ZjtwQbf3L9RPZE1LSxwIgKGhx1iS+fuKMXiTxzXPDdrLqNsMNVYVJFbg5k9dJpyI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13765},"main":"./index.js","type":"module","module":"./index.js","exports":{".":"./index.js"},"gitHead":"c5eecac1d4aa40b92ebfe83a8386d57ebb24b9d3","_npmUser":{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"},"_npmVersion":"11.6.3","description":"Alpine.js plugin to persist state in the URL query string with browser history traversal (supports objects via bracket params).","directories":{},"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"peerDependencies":{"alpinejs":">=3"},"_npmOperationalInternal":{"tmp":"tmp/alpinejs-history_1.0.0_1765590510946_0.10127371327110768","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@aaronbushnell/alpinejs-history","version":"1.0.2","keywords":["alpinejs","alpine","history","querystring","url","persist"],"author":{"name":"Aaron Bushnell"},"license":"MIT","_id":"@aaronbushnell/alpinejs-history@1.0.2","maintainers":[{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"}],"dist":{"shasum":"6b0022589b2da2ba4c122878f2c978ef468164f7","tarball":"https://registry.npmjs.org/@aaronbushnell/alpinejs-history/-/alpinejs-history-1.0.2.tgz","fileCount":4,"integrity":"sha512-hKhKJ300TT+Mh4AnRURyj37pbmQCv4xdEp9t7Nsxf0EWsmGx1OuqmY7sCXYBoIsqCVP+xW+CWhXsZeWydqk/kw==","signatures":[{"sig":"MEYCIQCFUQd8He51Y5Fbxudny23otc5aHH31Gy7NsriySHxI+AIhALb4t8+chjwMT513KMGmv5ND+Nne1NobK/tcvfvaw6X2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13993},"main":"./index.js","type":"module","module":"./index.js","exports":{".":"./index.js"},"gitHead":"0b5beb2e623b36869e4f8c9c159416c980e0223b","_npmUser":{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"},"_npmVersion":"11.6.3","description":"Alpine.js plugin to persist state in the URL query string with browser history traversal (supports objects via bracket params).","directories":{},"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"peerDependencies":{"alpinejs":">=3"},"_npmOperationalInternal":{"tmp":"tmp/alpinejs-history_1.0.2_1765591731258_0.8546003361361221","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@aaronbushnell/alpinejs-history","version":"1.0.7","description":"Alpine.js plugin to persist state in the URL query string with browser history traversal (supports objects via bracket params).","license":"MIT","author":{"name":"Aaron Bushnell"},"type":"module","main":"./index.js","module":"./index.js","exports":{".":"./index.js"},"keywords":["alpinejs","alpine","history","querystring","url","persist"],"peerDependencies":{"alpinejs":">=3"},"repository":{"url":"git+https://github.com/aaronbushnell/alpinejs-history.git"},"gitHead":"5ea843a9ef7e5fe5a189817b7218ceb8db9aecdc","_id":"@aaronbushnell/alpinejs-history@1.0.7","bugs":{"url":"https://github.com/aaronbushnell/alpinejs-history/issues"},"homepage":"https://github.com/aaronbushnell/alpinejs-history#readme","_nodeVersion":"20.19.6","_npmVersion":"11.7.0","dist":{"integrity":"sha512-Fu4w7g42OSKJSx5+jhdmsrVull0OAlhoM/nZJVmmJayavG+5vPccXh/gfNcv4m3Vz51F8lFN5Nz0ftqrGJsFpg==","shasum":"f1d224434a37acdf3d84f342881d577c3e4bafdd","tarball":"https://registry.npmjs.org/@aaronbushnell/alpinejs-history/-/alpinejs-history-1.0.7.tgz","fileCount":4,"unpackedSize":14698,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aaronbushnell%2falpinejs-history@1.0.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIC3PvQeykvG+n8mqg6wsaaBd0MEKE/6ZFBYuvk+ohwn0AiAhf2Q119kbDmPJb/gIZNJiC4CDAWjj5166QMvzJENZCA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b199f575-abe6-4df1-8661-b5ef7c271d27"}},"directories":{},"maintainers":[{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/alpinejs-history_1.0.7_1765593253160_0.35886308942030176"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-13T01:48:30.861Z","modified":"2025-12-13T02:34:13.663Z","1.0.0":"2025-12-13T01:48:31.131Z","1.0.2":"2025-12-13T02:08:51.392Z","1.0.7":"2025-12-13T02:34:13.308Z"},"author":{"name":"Aaron Bushnell"},"license":"MIT","keywords":["alpinejs","alpine","history","querystring","url","persist"],"description":"Alpine.js plugin to persist state in the URL query string with browser history traversal (supports objects via bracket params).","maintainers":[{"name":"aaronbushnell","email":"aaron.bushnell@gmail.com"}],"readme":"# alpinejs-history\n\nPersist Alpine.js state in the URL query string with browser history support.\n\nThis plugin lets you bind Alpine state to the URL so:\n\n- state is shareable via links\n- Back/Forward buttons rehydrate UI state\n- text input doesn’t spam browser history\n- complex objects use conventional bracketed query params\n\nDesigned to feel like `@alpinejs/persist`.\n\n- - -\n\n## Install\n\n```bash\nnpm install @aaronbushnell/alpinejs-history\n```\n\n- - -\n\n## Setup\n\n```js\nimport Alpine from \"alpinejs\"\nimport history from \"@aaronbushnell/alpinejs-history\"\n\nAlpine.plugin(history)\nAlpine.start()\n```\n\n- - -\n\n## Basic usage\n\n```html\n<div x-data=\"{ open: $history(false).as('open') }\">\n<button @click=\"open = !open\">Toggle</button>\n\n<div x-show=\"open\" x-cloak>\nhello\n</div>\n</div>\n```\n\n**URL output**\n\n```\n?open=true\n?open=false\n```\n\n*   Booleans and numbers use `pushState`\n*   Back/Forward buttons traverse state correctly\n\n- - -\n\n## Text input (debounced)\n\n```html\n<div x-data=\"{ query: $history(null).as('query') }\">\n<input x-model=\"query\" placeholder=\"Search…\" />\n</div>\n```\n\n**URL output**\n\n```\n?query=hello+world\n```\n\n*   Writes are debounced\n*   Uses `replaceState` to avoid history spam while typing\n*   Back/Forward rehydrates state without page reload\n\n- - -\n\n## Objects and forms\n\n```html\n<div\nx-data=\"{\nform: $history({\n  name: '',\n  email: ''\n}).as('form')\n}\"\n>\n<input x-model=\"form.name\" placeholder=\"Name\" />\n<input x-model=\"form.email\" placeholder=\"Email\" />\n</div>\n```\n\n**URL output**\n\n```\n?form[name]=Aaron&form[email]=aaron@example.com\n```\n\n*   Uses conventional bracketed query params\n*   Nested objects and arrays are supported\n*   Rehydrates cleanly on reload or history navigation\n\n- - -\n\n## Aliases\n\n```js\nopen: $history(false).as('menu')\n```\n\n```\n?menu=true\n```\n\nAliases work the same way as `@alpinejs/persist`.\n\n- - -\n\n## History behavior\n\n| Value type | History method | Notes |\n| --- | --- | --- |\n| Boolean / Number | `pushState` | Traversable with Back/Forward |\n| String | `replaceState` | Debounced (typing-friendly) |\n| Object / Array | `replaceState` | Debounced form editing |\n\n- - -\n\n## Security notes\n\n*   URL values are untrusted input\n*   Avoid rendering `$history()` values with `x-html` unless sanitized\n*   This plugin blocks `__proto__`, `constructor`, and `prototype` keys to reduce prototype pollution risks\n\n- - -\n\n## Compatibility\n\n*   Alpine.js v3+\n*   ESM-only package (no bundler required)\n*   Works with Vite, Webpack, Rollup, etc.\n\n- - -\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/aaronbushnell/alpinejs-history#readme","repository":{"url":"git+https://github.com/aaronbushnell/alpinejs-history.git"},"bugs":{"url":"https://github.com/aaronbushnell/alpinejs-history/issues"}}