Skip to content

Releases: ItalyPaleAle/svelte-spa-router

v2.2.0

30 May 21:58
Compare
Choose a tag to compare

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's href 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 own nextTickPromise. From now, the method remains an alias of Svelte's own tick, 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 the className 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 the loc store later in their lifecycle (e.g. if the router is added after page navigations have happened already).

Misc:

  • Updated devDependencies

v2.1.0

21 Mar 20:35
Compare
Choose a tag to compare

New features:

  • The custom event routeEvent now bubbles from a component inside the router to the router's parent; see docs
  • push, pop, and replace 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

08 Mar 03:52
Compare
Choose a tag to compare

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

17 Nov 20:55
Compare
Choose a tag to compare

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 the routeLoaded and conditionsFailed events. event.detail.component is now the actual Svelte component (a JavaScript function), while the name (the previous component property) is now event.detail.name

New features:

  • The wrap function can now be used to add a custom user dictionary to routes, which will be passed to the routeLoaded and conditionsFailed events under event.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 and conditionsFailed 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

31 Oct 14:35
7aab5f1
Compare
Choose a tag to compare

New features:

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

04 Oct 15:56
Compare
Choose a tag to compare

Fixes:

  • Fixed: active action was not behaving correctly within a loop (#28)

v1.2.0

01 Aug 06:47
Compare
Choose a tag to compare

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

26 Jun 14:47
Compare
Choose a tag to compare

Fixes:

  • Fixed active.js file looking for the router.svelte, which caused issues on case-sensitive file-systems.
  • Updated regexparam to 1.2.2

v1.1.2

19 Jun 19:35
Compare
Choose a tag to compare

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 importing svelte-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

26 May 08:05
Compare
Choose a tag to compare

Fixes:

  • Fixed: the "link" action could behave unexpectedly and navigate to the incorrect path when applied to an element updated by Svelte.