{"id":17223408,"url":"https://github.com/conduitry/svelte-tiny-spa","last_synced_at":"2025-07-19T08:33:06.544Z","repository":{"id":163440928,"uuid":"224875043","full_name":"Conduitry/svelte-tiny-spa","owner":"Conduitry","description":"A tiny unframework for making SPAs in Svelte // Mirror of https://git.chor.date/Conduitry/svelte-tiny-spa","archived":false,"fork":false,"pushed_at":"2024-06-24T11:15:21.000Z","size":14,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T14:22:02.791Z","etag":null,"topics":[],"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/Conduitry.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":"2019-11-29T15:03:59.000Z","updated_at":"2024-06-24T11:15:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"2918442c-d158-4c91-a853-afd8e8d6ef4b","html_url":"https://github.com/Conduitry/svelte-tiny-spa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsvelte-tiny-spa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsvelte-tiny-spa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsvelte-tiny-spa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conduitry%2Fsvelte-tiny-spa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Conduitry","download_url":"https://codeload.github.com/Conduitry/svelte-tiny-spa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248800053,"owners_count":21163404,"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-15T04:08:15.798Z","updated_at":"2025-04-14T00:22:43.025Z","avatar_url":"https://github.com/Conduitry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-tiny-spa\n\nA tiny unframework for making SPAs in Svelte.\n\n## Overview\n\nThis library intercepts clicks on internal links and turns them into `history.pushState()` calls. The browser's `location` object is exposed through a Svelte store, which updates upon these intercepted clicks and upon `popstate` events. It also optionally provides a mechanism for hosts which do not support falling back to `index.html` for missing files.\n\n## Setup\n\nIf your host supports falling back to `index.html` for requests of all unknown files, you should use that feature. Copy [`location.js`](location.js) into your project, and you're done.\n\n### If your host does not support falling back to `index.html`\n\nYou'll use a custom 404 page that redirects to the root and encodes the original URL in a query parameter. The root page then rewrites the URL using `history.replaceState()`.\n\nAdd [`404.html`](404.html) to your project at the appropriate path. Uncomment the lines at the top of [`location.js`](location.js) to handle the rewrite after the redirection.\n\n## Usage\n\n```js\nimport location from '.../location.js';\n```\n\nThis is a Svelte store containing the `location` object, and updates whenever a link click is intercepted or a `popstate` event occurs.\n\nInterception occurs when all of the following are met:\n\n1. The link is same-origin.\n1. The link is not merely a `#hash` change.\n1. The link does not have a `target` attribute.\n1. The link does not have a `download` attribute.\n1. The link was left clicked.\n1. The link was not clicked while pressing Alt/Ctrl/Meta/Shift.\n1. The link click was not `preventDefault`ed.\n\nThe store also contains `goto(url, replace)` and `scroll()` methods.\n\n- `goto(url, replace)` navigates to a URL.\n\t- `url` is resolved according to normal rules.\n\t- `replace` is a boolean indicating whether to use `history.pushState()` or `history.replaceState()`.\n- `scroll()` scrolls to either the top of the page or the element indicated by the `#hash` portion of the URL. This should be called after you've finished rendering a page.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitry%2Fsvelte-tiny-spa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduitry%2Fsvelte-tiny-spa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitry%2Fsvelte-tiny-spa/lists"}