{"_id":"@bardoui/vhistory","_rev":"3-0afe917600bf0c65ff7b41020336e44e","name":"@bardoui/vhistory","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@bardoui/vhistory","version":"1.0.0","private":false,"description":"Track history for Vue 3 (Vue router 4)","license":"ISC","main":"dist/vhistory.cjs.js","module":"dist/vhistory.esm.js","unpkg":"dist/vhistory.global.js","typings":"dist/vhistory.d.ts","scripts":{"serve":"vue-cli-service serve demo/main.ts","build":"rollup -c","prepare":"npm run build"},"keywords":["vue3","route history","redirect"],"authors":[{"email":"m.ajamekramy@gmail.com","homepage":"http://ekramy.ir","name":"Mojtaba Ekramy","role":"Developer"}],"repository":{"type":"git","url":"git+https://github.com/bardoui/vhistory.git"},"dependencies":{"core-js":"^3.6.5","vue":"^3.0.11","vue-router":"^4.0.6"},"devDependencies":{"@rollup/plugin-commonjs":"^18.0.0","@typescript-eslint/eslint-plugin":"^4.18.0","@typescript-eslint/parser":"^4.18.0","@vue/cli-plugin-babel":"~4.5.0","@vue/cli-plugin-eslint":"~4.5.0","@vue/cli-plugin-router":"~4.5.0","@vue/cli-plugin-typescript":"~4.5.0","@vue/cli-service":"~4.5.0","@vue/compiler-sfc":"^3.0.0","@vue/eslint-config-typescript":"^7.0.0","eslint":"^6.7.2","eslint-plugin-vue":"^7.0.0","rollup":"^2.45.2","rollup-plugin-cleaner":"^1.0.0","rollup-plugin-typescript2":"^0.30.0","rollup-plugin-vue":"^6.0.0","typescript":"^4.2.4"},"gitHead":"57cea876f3032127390a340fdcc075f5410992ea","bugs":{"url":"https://github.com/bardoui/vhistory/issues"},"homepage":"https://github.com/bardoui/vhistory#readme","_id":"@bardoui/vhistory@1.0.0","_nodeVersion":"14.9.0","_npmVersion":"7.3.0","dist":{"integrity":"sha512-RFYxn80i4Rzmgy66GEXgG3ROeOWqfnNzbYOgMj/biBsKgajcEatOs0ZFQODtTUEcpBy0u0CiM65FZv2X/FMn0Q==","shasum":"6c915c2557de977b2cd13252f8167c07028ea385","tarball":"https://registry.npmjs.org/@bardoui/vhistory/-/vhistory-1.0.0.tgz","fileCount":9,"unpackedSize":15417,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJge/diCRA9TVsSAnZWagAAgUYP/0Y9RwJ11YzUUFMWDFzs\nsmFHlMtxmG3RTZ+wU+GcMq3/WYRrA6/M1DTJB/KRz3tLZYUeongbXCB19dPY\n3sZdfeEIOy5Uv7yVN0prSnL2XphkgvrfVQGzZ1mm1JaoiGVyDAg9h6kY2Pd7\nv6sYpjTH9dta9Pi2nlJxvfmwoyWyH4eD0spo6x16m2DI5mUJvuWbuQKU6Q5v\nJ1jMdNrxqDXlj6AqGKKVRgQMnVSC6YPBxxZxt1TbfxVm4yR1eH1eAm4x2k++\nKzDhpPDJ+oavMT+J61CLTYbY2B7fqFH0HOZPxy0jXWs6MxjXyOvNuCtBgGuh\nk5hYlPfClFXY1MnRHVxhGwC6sn98g/8y2YScmfXoqgDnEuSIBFSoS1fymX7v\ncE22anDWG7HaP7o5MWhO/8rkwN5f7SYaqw/vt5Umx7EK1QBlRO82v1QAkDhd\n3n7A+hmUgf6PMnij7Cl4I2/gE032YA0qKQMQ8WRhu2+6Hl+ou360EzG9ND7d\nZy36XF6ILziAUSyDrjpxlBcW1M2k18cmfQY1QODFBXNJXfTmfFhvz6zGblNY\nDX6oxDTAztx3CorbnwPFS7pSwsQp3mCOJCJlKp1kR4229j4Bl9qZKXs17EnW\n7IkYIEbW/yalKnVueBmjJu029DgXEjm/EE7uF9UNKdxBtNaTry1f8b2UFeHl\ny1Ar\r\n=Tqw/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0XW11ic8OX+ynOcfT+C2eAUpTrC68iSOFr43v+JEV8wIgZ+2/D/o5rm3gCg2CkzR3W52377sofEgrmeJQ9S4Qctg="}]},"_npmUser":{"name":"mekramy","email":"m.ajamekramy@gmail.com"},"directories":{},"maintainers":[{"name":"mekramy","email":"m.ajamekramy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vhistory_1.0.0_1618736994002_0.8774205375029698"},"_hasShrinkwrap":false},"1.0.1":{"name":"@bardoui/vhistory","version":"1.0.1","private":false,"description":"Track history for Vue 3 (Vue router 4)","license":"ISC","main":"dist/vhistory.cjs.js","module":"dist/vhistory.esm.js","unpkg":"dist/vhistory.global.js","typings":"dist/vhistory.d.ts","scripts":{"serve":"vue-cli-service serve demo/main.ts","build":"rollup -c","prepare":"npm run build"},"keywords":["vue3","route history","redirect"],"authors":[{"email":"m.ajamekramy@gmail.com","homepage":"http://ekramy.ir","name":"Mojtaba Ekramy","role":"Developer"}],"repository":{"type":"git","url":"git+https://github.com/bardoui/vhistory.git"},"dependencies":{"core-js":"^3.6.5","vue":"^3.0.11","vue-router":"^4.0.6"},"devDependencies":{"@rollup/plugin-commonjs":"^18.0.0","@typescript-eslint/eslint-plugin":"^4.18.0","@typescript-eslint/parser":"^4.18.0","@vue/cli-plugin-babel":"~4.5.0","@vue/cli-plugin-eslint":"~4.5.0","@vue/cli-plugin-router":"~4.5.0","@vue/cli-plugin-typescript":"~4.5.0","@vue/cli-service":"~4.5.0","@vue/compiler-sfc":"^3.0.0","@vue/eslint-config-typescript":"^7.0.0","eslint":"^6.7.2","eslint-plugin-vue":"^7.0.0","rollup":"^2.45.2","rollup-plugin-cleaner":"^1.0.0","rollup-plugin-typescript2":"^0.30.0","rollup-plugin-vue":"^6.0.0","typescript":"^4.2.4"},"gitHead":"19602b982aa04bc696beb7e89c3b6982372679e9","bugs":{"url":"https://github.com/bardoui/vhistory/issues"},"homepage":"https://github.com/bardoui/vhistory#readme","_id":"@bardoui/vhistory@1.0.1","_nodeVersion":"16.9.0","_npmVersion":"7.22.0","dist":{"integrity":"sha512-db1hZm1d5zt3Aoph9GsybOewVLvqdPxUVkdq1l8TlmD+BdaWdpC+H+OhWXT0PEzy1JC0xwdnYp/CsVWdDD0j/Q==","shasum":"aa127f84d33d99a329dbbd32e0bd2f4432818367","tarball":"https://registry.npmjs.org/@bardoui/vhistory/-/vhistory-1.0.1.tgz","fileCount":9,"unpackedSize":15417,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhP1feCRA9TVsSAnZWagAAbcoQAI4n3XITXiQVref4xwbI\nXiair+291d/KhdeYDnkgui8+wk+F8ctqAXeeq5v8sFaRF1VbYumnKFe/XZiQ\nXs9kmK01YOH+lYnIfT1lipeohC2dywSYf0En/Ely+iD4RwGVi4kn2ww4yzUX\nfMDIqTni7geXsq2jVbor4U2AAUknRtezJQ0EgzEgsqDclhtTqDN+d4hTSoUe\nuz2k3z2y1jk5U401xUsTnEtbp6hpFS+u8in2Sp8NqpqNic5c6X/0LEsa0NQJ\nw/5eCjBdQB7Gnla/z3ft8Ql24f3zYufsEOp8gwqOSNDH0H5vR4BYgmNdgX+n\nRbKl53eczvfxi0LWM7gelVYQDrK0b8uccNHZb8Anms8j65fMKjm8bwabt8wG\nnE6SrIs0w6VY10diNNyepwW7Vwgjwy8XjhyRQS2rUeKWdqzRiVI6bHrw0sSR\nzetAq8dusrOur5nvPdNfFvPt4RyrIi7waMmhtp35l8fe3FBAiwcvLDWPghqx\nsQ5gwaE+rm/UTLnDssmjkaPKqiapBN+OMm2Edi3dT24vAMerniaU7VgsIquj\nKHENbVFwYczSNu/ciuB2BDgeW5Cy1m6wljEqNrxq5JXKFoc6QV99HchIIofm\netNi7Fppx5Tnxk6WQWJbn/zdE3WSrJZNhl23mFuE82uyO17H7rGknnKENgHS\n5+/F\r\n=5pyG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGFLUIsbZp8Gr1t99if2JrhdTiRFq1cV//YUG5aadXP0AiEAgoUWRUKkTrX9mdoHpAiSg0FNcuRkGYLmmRryoyQcP0I="}]},"_npmUser":{"name":"mekramy","email":"m.ajamekramy@gmail.com"},"directories":{},"maintainers":[{"name":"mekramy","email":"m.ajamekramy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vhistory_1.0.1_1631541214004_0.9154319405578006"},"_hasShrinkwrap":false},"1.1.0":{"private":false,"type":"module","license":"ISC","version":"1.1.0","name":"@bardoui/vhistory","description":"Track history for Vue 3 (Vue router 4)","main":"./dist/vhistory.umd.cjs","module":"./dist/vhistory.es.js","types":"./dist/vhistory.d.ts","exports":{".":{"import":"./dist/vhistory.es.js","require":"./dist/vhistory.umd.js"}},"scripts":{"dev":"vite","build":"vite build && npm run build:types","build:types":"vue-tsc --project tsconfig.types.json --declaration --emitDeclarationOnly --outDir dist ","typecheck":"vue-tsc --project tsconfig.types.json --noEmit","prepare":"npm run build"},"keywords":["vue3","route history","redirect"],"authors":[{"email":"m.ajamekramy@gmail.com","homepage":"http://ekramy.ir","name":"Mojtaba Ekramy","role":"Developer"}],"repository":{"type":"git","url":"git+https://github.com/bardoui/vhistory.git"},"dependencies":{"vue":"^3.3.4","vue-router":"^4.2.4"},"devDependencies":{"@babel/types":"^7.20.7","@types/node":"^18.11.18","@vitejs/plugin-vue":"^4.0.0","@vue/tsconfig":"^0.1.3","rollup-plugin-copy":"^3.4.0","sass":"^1.57.1","typescript":"^4.9.4","vite":"^4.0.4","vue-tsc":"^1.0.24"},"gitHead":"19602b982aa04bc696beb7e89c3b6982372679e9","bugs":{"url":"https://github.com/bardoui/vhistory/issues"},"homepage":"https://github.com/bardoui/vhistory#readme","_id":"@bardoui/vhistory@1.1.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-hYKmBpp55c29yT3Tl2USzHCdtKlRVjv0GBjTYotc1tRsqs3K+ZkfPZy6j7bvhNyjodR/A22VMLLkzahrMCYLCg==","shasum":"4aba821c6e3e73cfd4b2afb9830f0c373cc624e0","tarball":"https://registry.npmjs.org/@bardoui/vhistory/-/vhistory-1.1.0.tgz","fileCount":9,"unpackedSize":15964,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGVpKbWZAHwePrANnA/d/qF6vwA1dgGh5iTP3l5Uyp96AiBW/TsE8scclpqNJRK8Y/oqL8iqA5w6ovaFmFs27GSDKA=="}]},"_npmUser":{"name":"mekramy","email":"m.ajamekramy@gmail.com"},"directories":{},"maintainers":[{"name":"mekramy","email":"m.ajamekramy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vhistory_1.1.0_1689664170804_0.09492358744739948"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-18T09:09:53.752Z","1.0.0":"2021-04-18T09:09:54.165Z","modified":"2023-07-18T07:09:31.151Z","1.0.1":"2021-09-13T13:53:34.126Z","1.1.0":"2023-07-18T07:09:30.946Z"},"maintainers":[{"name":"mekramy","email":"m.ajamekramy@gmail.com"}],"description":"Track history for Vue 3 (Vue router 4)","homepage":"https://github.com/bardoui/vhistory#readme","keywords":["vue3","route history","redirect"],"repository":{"type":"git","url":"git+https://github.com/bardoui/vhistory.git"},"bugs":{"url":"https://github.com/bardoui/vhistory/issues"},"license":"ISC","readme":"# History\r\n\r\nRouter utility for Vue Router 4 to track last address of route (e.g. redirect back to list from edit page and keep all filters)\r\n\r\n## Installation\r\n\r\n### CDN\r\n\r\nthis package published as `vHistory` module in umd.\r\n\r\n```html\r\n<script src=\"https://unpkg.com/@bardoui/vhistory\"></script>\r\n```\r\n\r\n### NPM\r\n\r\n```bash\r\nnpm i @bardoui/vhistory\r\n```\r\n\r\n```ts\r\nimport { createApp } from \"vue\";\r\nimport App from \"./App.vue\";\r\nimport router from \"./router\";\r\nimport { installHistory } from \"@bardoui/vhistory\";\r\n\r\ncreateApp(App)\r\n  .use(router)\r\n  .mount(\"#app\");\r\n\r\ninstallHistory(router);\r\n```\r\n\r\n## Define Route\r\n\r\nTo track route you must specify a key using meta `history` property of route. if history key not set route not tracked.\r\n\r\n```ts\r\nconst routes: Array<RouteRecordRaw> = [\r\n  {\r\n    path: \"/\",\r\n    name: \"home\",\r\n    component: Home,\r\n    meta: {\r\n      history: \"home\"\r\n    }\r\n  },\r\n  {\r\n    path: \"/user-list\",\r\n    name: \"UserList\",\r\n    component: UserList,\r\n    meta: {\r\n      history: \"users\"\r\n    }\r\n  },\r\n  // This route not tracked\r\n  {\r\n    path: \"/not-tracked-route\",\r\n    name: \"About\",\r\n    component: About\r\n  }\r\n];\r\n```\r\n\r\n## Redirect\r\n\r\nYou can use `push` or `replace` method to redirect. Redirect methods accept a fallback address, router will redirect to fallback if no history track exists.\r\n\r\n```ts\r\nimport { defineComponent } from \"vue\";\r\nimport { pushHistory, replaceHistory } from \"@bardoui/vhistory\";\r\nexport default defineComponent({\r\n  setup() {\r\n    function redirectToHome() {\r\n      pushHistory(\"home\", \"/\");\r\n    }\r\n    function redirectToUsers() {\r\n      replaceHistory(\"users\", { name: \"UserList\" });\r\n    }\r\n    return { redirectToHome, redirectToUsers };\r\n  }\r\n});\r\n```\r\n","readmeFilename":"README.md"}