Releases: ItalyPaleAle/svelte-spa-router
Releases · ItalyPaleAle/svelte-spa-router
v2.2.0
This release contains a new feature and other small improvements.
New features:
- You can now pass a parameter to the
use:link
action (e.g.use:link={val}
) which will take precedence over the tag'shref
value. You can use this to create links whose target changes reactively, for example. (Thanks to @cianx!) - Using the
tick
method from the Svelte runtime in place of running our ownnextTickPromise
. From now, the method remains an alias of Svelte's owntick
, but will be deprecated in version 3 of the router. (Using the method directly will show a deprecation warning in the console)
Fixes:
- Fixed: passing more than one class to
use:active
using theclassName
property (use:active={{className: 'something something-else'}}
) was causing a runtime exception. - Setting the initial value for the
loc
readable store when the first object subscribes to it, rather than during initialization. This fixes issues when applications subscribe to theloc
store later in their lifecycle (e.g. if the router is added after page navigations have happened already).
Misc:
- Updated devDependencies
v2.1.0
New features:
- The custom event
routeEvent
now bubbles from a component inside the router to the router's parent; see docs push
,pop
, andreplace
now return a Promise that is resolved when the route navigation succeeded (but not necessarily after the new route has been loaded)
Fixes:
- Showing a warning in the console when the
replace
method is used in an environment that doesn't support it, such as the Svelte REPL (see #93)
Changes:
- For security reasons, the non-dev dependency (
regexparam
) is added with the exact version now, rather than a caret
v2.0.1
New features:
use:active
action can support a custom regular expression to decide which links to highlight, and not just a string
Fixes:
- Fixed warning
<component> was created with unknown prop 'params'
with recent versions of Svelte when a component doesn't need params from the route - Removed the for..of loop to make the code more compatible with ES5 transpilers
v2.0.0
Breaking changes:
Check out the UPGRADING.md file for instructions on updating your code.
- New syntax for
use:active
parameters, compatible with Svelte 3.13+ - New list of arguments for route pre-conditions functions, which now receive a single object rather than two values
- Updated
event.detail
object in therouteLoaded
andconditionsFailed
events.event.detail.component
is now the actual Svelte component (a JavaScript function), while the name (the previouscomponent
property) is nowevent.detail.name
New features:
- The
wrap
function can now be used to add a custom user dictionary to routes, which will be passed to therouteLoaded
andconditionsFailed
events underevent.detail.userData
, as well as to the route pre-condition functions. - The
Router
component now supports a prefix that will be added to all route paths; this is useful for nested routers - The route pre-condition functions and the
routeLoaded
andconditionsFailed
events now receive more data and unlock more opportunities for developers
Fixes:
- Make
use:active
action compatible with Svelte 3.13+
Misc:
- Replaced Azure Pipelines with GitHub Actions for Continuous Integration tests
v1.3.0
New features:
- Added route pre-conditions
- Apps can now subscribe to the
routeLoaded
event
Fixes:
link
action now changes the value of the link's href attribute, rather than listening to click events, so this works with right- and middle-clicks too #33- Updated dependencies
v1.2.1
v1.2.0
New features:
- It's now possible to define route patterns using custom regular expressions, by passing routes as a Map rather than a plain object.
Fixes:
- Updated
regexparam
to 1.3.0
v1.1.3
Fixes:
- Fixed
active.js
file looking for therouter.svelte
, which caused issues on case-sensitive file-systems. - Updated
regexparam
to 1.2.2
v1.1.2
Fixes:
- Fixed: Elements inside
<a>
tags were not triggering page navigations (#15) - The
Router
component is now capitalized so it's consistent with the ecosystem around Svelte. This shouldn't be a breaking change as users can continue importingsvelte-spa-router
- In examples and tests, replaced http-server with serve which is more stable
Misc:
- Removed the
package-lock.json
file from the repo, which was not published to NPM anyways and created administrative burden
v1.1.1
Fixes:
- Fixed: the "link" action could behave unexpectedly and navigate to the incorrect path when applied to an element updated by Svelte.