- make patternCompiler configurable
- regexparam as default pattern compiler (replace path-to-regexp by regexparam)
- add router-links component
- remove withRouterLinks decorator
- add customizable property hooks
- replace paramValue and queryValue by withParam and withQuery hooks
- default entry point exports a Router with wc and routerLinks middlewares
- basic typescript support
- router-links: catch errors when generating link
- router-links: convert from kebab case to camel case param-_ and query-_ attributes
- animated-outlet: export GenericCSS class
- implement animated-outlet component
- routerLinks: implement replace option
- wc: fix rendering when transitioning from a child to a parent route
- wc: add getRouteEl function
- events: add before:transition event
- Implement exact active matching in isActive
- routerLinks: fix updating active class when link is created outside an active transition
- routerLinks: implement exact active matching through exact attribute
- Add events middleware
- routerLinks: fix using withRouterLinks with non legacy decorators
- wc: Implement reuse option
- wc: Implement properties option
- wc: Set $route property before connectedCallback is called
- routerLinks: Fix creating router links when link is not a direct child of root el
- Fix URL generation of index routes
- Allow to customize outlet selector with outlet static property
- Allow to define routes without component
- Accept a selector as router outlet
- Add wc middleware (render web components)
- Add routerLinks middleware
- Rename
next
middleware hook toresolve
- Export Router as named export instead of as default
- Convert classes to ES6 syntax
- Do not transpile to ES5 (publishes package as ES6)
- Use path-to-regexp instead of path-to-regexp-es
- Allow to create index routes without using abstract option
- Extract intercepLinks funcionality from Router class
- Add
at
option to control middleware insert position
- replace path-to-regexp by path-to-regexp-es
- improve log messages
- update examples
- reset version to 0.9
- renamed project to Slick Router (published as slick-router)
- update path-to-regexp to v3
- use path-to-regexp-es instead of path-to-regexp
- improve default logging
- Implement defining routes as array
- Allow to pass routes as a constructor option (calls map automatically)
- Use rollup instead of webpack for tests
- Optimize clone
- Optimize mapping routes from function dsl
- Add module entry for package
- Implement cancel hook
- Reset URL when transition started by URL is cancelled
- Use rollup instead of webpack for main bundle
- Optimize dash functions
- API changes:
- Published package with cherrytreex name
- Export router constructor instead of factory function
- Add possibility to register middleware with a object containing next/done/error hooks
- Drop ability to customize Promise implementation. To run in browsers without native Promise is necessary a polyfill
- Do not use active state to generate links
- Infrastructure changes
- Update build system simplifying it and producing smaller bundle
- Incorporated location-bar dependency removing shared code
- Upgraded dev dependencies
- Fix a broken release, for some reason the
npm run release
failed to package correctly
- Make it possible to
transitionTo('anAbstractRoute')
andgenerate('anAbstractRoute')
in cases where the abstract route has a corresponding index route. This can be more intuitive in some cases.
- URL encode slashes in route params
- Don't intercept clicks on
mailto:
links
- Fix: stop using Array.prototype.find which is not available in older browsers
- Add router.isActive method for testing if a given route is currently active. See docs
- Parse query params when transitioning even when no route matches
Nothing changed from v2.0.0-rc4.
- BrowserLocation and HistoryLocation can now be accessed at cherrytree.BrowserLocation and cherrytree.MemoryLocation again. This is to make it easier to use those modules for UMD users (#116).
Breaking changes:
HistoryLocation
has been renamed toBrowserLocation
. Location in cherrytree is the place that stores the current location of the app. Location is updated with the new path when cherytree transitions. Location also triggers updates when someone changes the location externally (e.g. by navigating with back/forward buttons or updating the URL).BrowserLocation
is a more apt name since this location implementation represents browser's location bar and is configurable to use pushState or hashchange. This way, the other location that ships with cherrytree,MemoryLocation
- also makes more sense, in this case we're saying the URL is simply stored in this in memory object and not really connected to the browser (which is what makes it useful on the server, for example).
- Fix: query params were stringified incorrectly when more than 2 params and when some of params were undefined.
router.generate('/a/b/c', {}, { id: 'def', foo: 'bar', baz: undefined })
results in/a/b/c?id=def&foo=bar
now as in the older versions of cherrytree.
Breaking changes:
- Every route is now routable. Previously it was only possible to generate links and transition to leaf routes. This simplifies the typical usage of the router and opens up new use cases as well. For example, if you want to redirect from '/' to '/some/:id', it's now easier to implement this kind of redirect behaviour without needing to create many reduntant '.index' routes.
- The special
.index
treatment has been removed. Previously, if the route name ended with.index
, the path was automatically set to ''. Now, such path will default to 'index' as with all other routes. Setpath: ''
on your index routes when upgrading. - An exception is now thrown when multiple routes have the same URL pattern.
- Given all the above changes - a new route option
abstract: true
was introduced for making non leaf routes non routable. This also solves the problem where usingpath: ''
would result in multiple routes with the same path. - The
paramNames
array (e.g. ['id', 'filter']) was replaced withparams
object (e.g. {id: 1, filter: 'foo'}) in the route descriptor on the transition object. - The
ancestors
attribute was removed from the route descriptor. - Switching between using
history
andmemory
locations has been simplified. Previously, you'd need to passnew MemoryLocation(path)
when callinglisten
. Now, specify the location to use withlocation: 'memory'
when creating the router and pass the path when callinglisten
. - The
qs
module was removed from dependencies and was replaced with a tiny, simple query string parser. This can be sufficient for a lot of applications and saves a couple of kilobytes. If you want to useqs
or any other query parsing module, pass it asqs: require('qs')
option to the router. - params, query and route array are now immutable between transitions, i.e. modifying those directly on the transition only affects that transition
- Drop out-of-the-box support for ES3 environments (IE8). To use Cherrytree in older environments - es5 polyfills for native
map
,reduce
andforEach
need to be used now. - An undocumented, noop function
reset
was removed from the router.
New features:
- Support for custom click intercept handlers
Under the hood improvements:
- Update all dependencies to the latest versions
- Tests are being run in more browsers now
- Replaced
co
withbabel-creed-async
in tests - Removed the dependency on
lodash
Documentation:
- Moved docs back to a separate
docs/api.md
file - Documented router.matchers
- Documented 404 handling
- BYOP - Cherrytree now requires a global Promise implementation to be available or a Promise constructor passed in as an option
- Add
transition.redirectTo
so that middleware could initiate redirects without having the router
- Log errors by default (i.e. options.logError: true by default)
- Fix router.destroy() - DOM click events for link interception are now cleaned up when router.destroy() is called
- Add server side support
- events.js now exports an {} object on the server instead of crashing due to missing
window
- MemoryLocation correctly handles option flags and can be instantiated with a starting
path
- events.js now exports an {} object on the server instead of crashing due to missing
- Add a server-side-react example
- When transition is rejected with a
TransitionRedirected
error - theerr.nextPath
is now available)
- Fix dependencies - lodash was declared as a devDependency
- Fix the URL generation when
pushState: true
and root !== '/'
A brand new and improved cherrytree!
See https://github.com/QubitProducts/cherrytree/tree/677f2c915780d712968023b8d24306ff787a426d