- Laminar 15
signal
directive is gonerelativeHref
withMatchedPath
navMod
navModExact
matchedMod
?matchedModExact
?provideOption
frontroute now depends on Laminar and is only usable with Laminar (previously, frontroute depended only on Airstream).
The way to use frontroute has changed significantly (all the boilerplate is gone). The directives, path matchers and routes remained mostly the same.
Please see the documentation for more details: https://frontroute.dev/v/0.16.x/
A non-exclusive list of breaking changes:
memoize
directive is gone (event streams in routes interfere withnoneMatched
)state
directive is gonemapOption
->optionMap
when
-->whenTrue
(conflict with laminext)BrowserNavigation.replaceTitle
is gone (to be replaced by another utility)
Airstream v0.14.2
.
skipped
Airstream v0.14.0
and scala-js-dom
v2.0.0
.
- Internal implementation refactoring.
- Scala.js 1.6.0+
- API breaking:
pathMatcher
combinators (.map
,.filter
, etc) no longer accept adescription
parameter - API new:
.recover
,.emap
and.tryParse
forPathMatchers
- API breaking:
fromTry
path matcher has been removed - API new: new path matchers
segment(oneOf: Seq[String])
segment(oneOf: Set[String])
- API new: implicit conversion from
Set[String]
andSeq[String]
toPathMatcher[String]
- API new:
testPath
andtestPathPrefix
directives (same aspath
andpathPrefix
but preserving the unmatched path) - API new:
memoize
directive (example)
- Breaking: one of the
complete
overloads is nowcompleteN
The reason for the change is that its argument needs to be by-name (same as the other overload), and the two overloads would end up having the same byte-code signature.
Sourcemaps are now pointing to GitHub.
- API: new implicit conversion from
Regex
to a path matcher
Update to Airstream v0.13.0
. Publishing for Scala 3.0.0-RC3.
History and title behavior updates.
- API:
LinkHandler
now looks at thedata-title
attribute of anchors and uses it when pushing state - API:
LinkHandler.install
now accepts adefaultTitle: String = ""
argument to use when thedata-title
is missing - Change:
LinkHandler
will not be pushing state when the current path, search query and hash are equal to the ones in the anchor - API: new
BrowserNavigation.replaceTitle(title: String)
function, that replaces the document title (and, optionally, the<title>
element in the<head>
) and stores the new title in the history state.
LocationProvider.browser
now has three new parameters:
setTitleOnPopStateEvents: Boolean = true
– iftrue
, it will be updating the document title with the title saved by frontroute in the PopState event stateupdateTitleElement: Boolean = true
– iftrue
, it will also be updating the content of the head/title elementignoreEmptyTitle: Boolean = false
– iftrue
, it will not be doing anything if thetitle
is empty
Update to Airstream v0.12.2
. No longer publishing for Scala 3.0.0-RC1.
- Bugfix: historyState directive was returning
undefined
due to emitted pop state events did not include the state value
Update to Airstream v0.12.0
. Publishing for Scala 3.0.0-RC1
- Breaking: the
io.frontroute.directives._
no longer exists and importing it is not needed anymore - API: renamed
RouteLocationProvider
intoLocationProvider
- API: new
CustomLocationProvider
- API: renamed
completeN
intocomplete
- API: new
state
directive - API: new
makeRoute
andmakeRouteWithCallback
- Util: new
LocationUtils
object withparseLocationParams
andencodeLocationParams
functions - Bugfix: pop state event processing – event itself was used as
state
- Bugfix: link handler was not verifying if the link was pointing to the URL within the same origin, caused errors (changing the origin when pushing state is not allowed)
- Bugfix:
.collect
and.mapTo
were not storing the mapped value (in the internal state)
An example that would show this behavior:
(pathEnd.mapTo(true) | path("page-1").mapTo(false)) { isIndex =>
render(Page(isIndex))
}
- Bugfix: disjunction
- Bugfix:
.map
was not storing the mapped value (in the internal state)
The value of the disjunction was not stored (in the internal state), thus a disjunction would not match multiple times in a row (even if the resulting values were different).
An example that would show this behavior:
(pathEnd.map(_ => true) | path("page-1").map(_ => false)) { isIndex =>
render(Page(isIndex))
}
- API: new combinators for directives
.some
– transforms aDirective[A]
into aDirective[Option[A]]
(withSome(_)
value).none
– transforms aDirective[A]
into aDirective[Option[A]]
(withNone
value).mapOption
– transforms aDirective[Option[A]]
into aDirective[Option[B]]
(applying the provided function to theOption
)
Fixing LinkHandler
.
- New: LinkHandler
- New: directives:
origin
,host
,hostname
,port
andprotocol
- simplified directives and path matchers (single values are now scalars, not Tuple1), no more
Tuple
marker - Breaking: Scala.js 1.3.1+ is now required
Update the tuplez dependency to v0.3.0
, no other changes.
- preserving scroll position in history state
- moved apply converters into the
tuplez
library - New:
historyScroll
/historyState
directives - Breaking:
BrowserRouteLocationProvider
is removed, replaced byBrowserNavigation.locationProvider
No code changes. Fixed the publish settings to not exclude the sources from the sources artifact.
- "re-branding" as frontroute
- updated to Airstream v0.11.1
- Bugfix: disjunction + signal
// this will work now (path(segment) | pathEnd.tmap(_ => Tuple1("default")).signal { // ... }
- API: laminar-route does not depend on Laminar anymore (like Waypoint)
- Add
$popStateEvent
toBrowserRouteLocationProvider
constructor - Migration: You should provide
$popStateEvent = windowEvents.onPopState
if using Laminar
- Add
- API: new utility object -
BrowserNavigation
withpushState
function
- initial public release