Skip to content

Commit

Permalink
chore(all): prepare release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 13, 2018
1 parent 0481af4 commit 5f29623
Show file tree
Hide file tree
Showing 13 changed files with 10,306 additions and 99 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-history-browser",
"version": "1.1.1",
"version": "1.2.0",
"description": "An implementation of the Aurelia history interface based on standard browser hash change and push state mechanisms.",
"keywords": [
"aurelia",
Expand Down
43 changes: 23 additions & 20 deletions dist/amd/aurelia-history-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli
var _this = _possibleConstructorReturn(this, _LinkHandler.call(this));

_this.handler = function (e) {
var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e);

var shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent;
var href = _DefaultLinkHandler$g.href;

var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e),
shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent,
href = _DefaultLinkHandler$g.href;

if (shouldHandleEvent) {
e.preventDefault();
Expand Down Expand Up @@ -93,6 +91,10 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli
return info;
}

if (target.hasAttribute('download') || target.hasAttribute('router-ignore')) {
return info;
}

if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
return info;
}
Expand Down Expand Up @@ -122,7 +124,7 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli
var targetWindow = target.getAttribute('target');
var win = _aureliaPal.PLATFORM.global;

return !targetWindow || targetWindow === win.name || targetWindow === '_self' || targetWindow === 'top' && win === win.top;
return !targetWindow || targetWindow === win.name || targetWindow === '_self';
};

return DefaultLinkHandler;
Expand Down Expand Up @@ -184,9 +186,9 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli

return true;
} else if (this._hasPushState && atRoot && loc.hash) {
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
}
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
}
}

if (!this.fragment) {
Expand All @@ -213,12 +215,11 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli
};

BrowserHistory.prototype.navigate = function navigate(fragment) {
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

var _ref$trigger = _ref.trigger;
var trigger = _ref$trigger === undefined ? true : _ref$trigger;
var _ref$replace = _ref.replace;
var replace = _ref$replace === undefined ? false : _ref$replace;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$trigger = _ref.trigger,
trigger = _ref$trigger === undefined ? true : _ref$trigger,
_ref$replace = _ref.replace,
replace = _ref$replace === undefined ? false : _ref$replace;

if (fragment && absoluteUrl.test(fragment)) {
this.location.href = fragment;
Expand Down Expand Up @@ -249,12 +250,14 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli
} else if (this._wantsHashChange) {
updateHash(this.location, fragment, replace);
} else {
return this.location.assign(url);
this.location.assign(url);
}

if (trigger) {
return this._loadUrl(fragment);
}

return true;
};

BrowserHistory.prototype.navigateBack = function navigateBack() {
Expand All @@ -267,10 +270,10 @@ define(['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureli

BrowserHistory.prototype.setState = function setState(key, value) {
var state = Object.assign({}, this.history.state);
var _location = this.location;
var pathname = _location.pathname;
var search = _location.search;
var hash = _location.hash;
var _location = this.location,
pathname = _location.pathname,
search = _location.search,
hash = _location.hash;

state[key] = value;
this.history.replaceState(state, null, '' + pathname + search + hash);
Expand Down
12 changes: 9 additions & 3 deletions dist/aurelia-history-browser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,15 @@ export declare class BrowserHistory extends History {
*
* @param fragment The history fragment to navigate to.
* @param options The set of options that specify how the navigation should occur.
* @return True if navigation occurred/false otherwise.
*/
navigate(fragment?: string, undefined?: any): boolean;
* @return Promise if triggering navigation, otherwise true/false indicating if navigation occurred.
*/
navigate(fragment?: string, {
trigger,
replace
}?: {
trigger?: any,
replace?: any
}): boolean;

/**
* Causes the history state to navigate back.
Expand Down
13 changes: 9 additions & 4 deletions dist/aurelia-history-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class DefaultLinkHandler extends LinkHandler {
return info;
}

if (target.hasAttribute('download') || target.hasAttribute('router-ignore')) {
return info;
}

if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
return info;
}
Expand Down Expand Up @@ -136,8 +140,7 @@ export class DefaultLinkHandler extends LinkHandler {

return !targetWindow ||
targetWindow === win.name ||
targetWindow === '_self' ||
(targetWindow === 'top' && win === win.top);
targetWindow === '_self';
}
}

Expand Down Expand Up @@ -260,7 +263,7 @@ export class BrowserHistory extends History {
*
* @param fragment The history fragment to navigate to.
* @param options The set of options that specify how the navigation should occur.
* @return True if navigation occurred/false otherwise.
* @return Promise if triggering navigation, otherwise true/false indicating if navigation occurred.
*/
navigate(fragment?: string, {trigger = true, replace = false} = {}): boolean {
if (fragment && absoluteUrl.test(fragment)) {
Expand Down Expand Up @@ -298,12 +301,14 @@ export class BrowserHistory extends History {
} else {
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
return this.location.assign(url);
this.location.assign(url);
}

if (trigger) {
return this._loadUrl(fragment);
}

return true;
}

/**
Expand Down
43 changes: 23 additions & 20 deletions dist/commonjs/aurelia-history-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ var DefaultLinkHandler = exports.DefaultLinkHandler = function (_LinkHandler) {
var _this = _possibleConstructorReturn(this, _LinkHandler.call(this));

_this.handler = function (e) {
var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e);

var shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent;
var href = _DefaultLinkHandler$g.href;

var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e),
shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent,
href = _DefaultLinkHandler$g.href;

if (shouldHandleEvent) {
e.preventDefault();
Expand Down Expand Up @@ -77,6 +75,10 @@ var DefaultLinkHandler = exports.DefaultLinkHandler = function (_LinkHandler) {
return info;
}

if (target.hasAttribute('download') || target.hasAttribute('router-ignore')) {
return info;
}

if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
return info;
}
Expand Down Expand Up @@ -106,7 +108,7 @@ var DefaultLinkHandler = exports.DefaultLinkHandler = function (_LinkHandler) {
var targetWindow = target.getAttribute('target');
var win = _aureliaPal.PLATFORM.global;

return !targetWindow || targetWindow === win.name || targetWindow === '_self' || targetWindow === 'top' && win === win.top;
return !targetWindow || targetWindow === win.name || targetWindow === '_self';
};

return DefaultLinkHandler;
Expand Down Expand Up @@ -168,9 +170,9 @@ var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_Histo

return true;
} else if (this._hasPushState && atRoot && loc.hash) {
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
}
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
}
}

if (!this.fragment) {
Expand All @@ -197,12 +199,11 @@ var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_Histo
};

BrowserHistory.prototype.navigate = function navigate(fragment) {
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

var _ref$trigger = _ref.trigger;
var trigger = _ref$trigger === undefined ? true : _ref$trigger;
var _ref$replace = _ref.replace;
var replace = _ref$replace === undefined ? false : _ref$replace;
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$trigger = _ref.trigger,
trigger = _ref$trigger === undefined ? true : _ref$trigger,
_ref$replace = _ref.replace,
replace = _ref$replace === undefined ? false : _ref$replace;

if (fragment && absoluteUrl.test(fragment)) {
this.location.href = fragment;
Expand Down Expand Up @@ -233,12 +234,14 @@ var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_Histo
} else if (this._wantsHashChange) {
updateHash(this.location, fragment, replace);
} else {
return this.location.assign(url);
this.location.assign(url);
}

if (trigger) {
return this._loadUrl(fragment);
}

return true;
};

BrowserHistory.prototype.navigateBack = function navigateBack() {
Expand All @@ -251,10 +254,10 @@ var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_Histo

BrowserHistory.prototype.setState = function setState(key, value) {
var state = Object.assign({}, this.history.state);
var _location = this.location;
var pathname = _location.pathname;
var search = _location.search;
var hash = _location.hash;
var _location = this.location,
pathname = _location.pathname,
search = _location.search,
hash = _location.hash;

state[key] = value;
this.history.replaceState(state, null, '' + pathname + search + hash);
Expand Down
22 changes: 14 additions & 8 deletions dist/es2015/aurelia-history-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export let DefaultLinkHandler = class DefaultLinkHandler extends LinkHandler {
return info;
}

if (target.hasAttribute('download') || target.hasAttribute('router-ignore')) {
return info;
}

if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
return info;
}
Expand Down Expand Up @@ -75,7 +79,7 @@ export let DefaultLinkHandler = class DefaultLinkHandler extends LinkHandler {
let targetWindow = target.getAttribute('target');
let win = PLATFORM.global;

return !targetWindow || targetWindow === win.name || targetWindow === '_self' || targetWindow === 'top' && win === win.top;
return !targetWindow || targetWindow === win.name || targetWindow === '_self';
}
};

Expand Down Expand Up @@ -130,9 +134,9 @@ export let BrowserHistory = (_temp = _class = class BrowserHistory extends Histo

return true;
} else if (this._hasPushState && atRoot && loc.hash) {
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, DOM.title, this.root + this.fragment + loc.search);
}
this.fragment = this._getHash().replace(routeStripper, '');
this.history.replaceState({}, DOM.title, this.root + this.fragment + loc.search);
}
}

if (!this.fragment) {
Expand All @@ -155,7 +159,7 @@ export let BrowserHistory = (_temp = _class = class BrowserHistory extends Histo

getAbsoluteRoot() {
let origin = createOrigin(this.location.protocol, this.location.hostname, this.location.port);
return `${ origin }${ this.root }`;
return `${origin}${this.root}`;
}

navigate(fragment, { trigger = true, replace = false } = {}) {
Expand Down Expand Up @@ -188,12 +192,14 @@ export let BrowserHistory = (_temp = _class = class BrowserHistory extends Histo
} else if (this._wantsHashChange) {
updateHash(this.location, fragment, replace);
} else {
return this.location.assign(url);
this.location.assign(url);
}

if (trigger) {
return this._loadUrl(fragment);
}

return true;
}

navigateBack() {
Expand All @@ -208,7 +214,7 @@ export let BrowserHistory = (_temp = _class = class BrowserHistory extends Histo
let state = Object.assign({}, this.history.state);
let { pathname, search, hash } = this.location;
state[key] = value;
this.history.replaceState(state, null, `${ pathname }${ search }${ hash }`);
this.history.replaceState(state, null, `${pathname}${search}${hash}`);
}

getState(key) {
Expand Down Expand Up @@ -270,5 +276,5 @@ function updateHash(location, fragment, replace) {
}

function createOrigin(protocol, hostname, port) {
return `${ protocol }//${ hostname }${ port ? ':' + port : '' }`;
return `${protocol}//${hostname}${port ? ':' + port : ''}`;
}
Loading

0 comments on commit 5f29623

Please sign in to comment.