@bbn/bbn 2.0.227 → 2.0.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +3 -3
- package/dist/bbn.js.map +1 -1
- package/dist/bbn.sw.js +1 -1
- package/dist/bbn.sw.js.map +1 -1
- package/dist/dt/classes/dt.js +2 -2
- package/dist/env.d.ts +1 -0
- package/dist/env.js +1 -0
- package/dist/fn/ajax/setNavigationVars.d.ts +1 -1
- package/dist/fn/ajax/setNavigationVars.js +11 -4
- package/dist/fn/init.js +10 -14
- package/package.json +1 -1
package/dist/dt/classes/dt.js
CHANGED
|
@@ -403,7 +403,7 @@ export class bbnDt {
|
|
|
403
403
|
if (!('year' in this.value)) {
|
|
404
404
|
throw new Error('year() is not supported for this type');
|
|
405
405
|
}
|
|
406
|
-
if ((v !== undefined) && !(v instanceof Event) && (
|
|
406
|
+
if ((v !== undefined) && !(v instanceof Event) && parseInt(v)) {
|
|
407
407
|
const d = this.value.with({ year: v });
|
|
408
408
|
return new this.constructor(d);
|
|
409
409
|
}
|
|
@@ -416,7 +416,7 @@ export class bbnDt {
|
|
|
416
416
|
if (!('month' in this.value)) {
|
|
417
417
|
throw new Error('month() is not supported for this type');
|
|
418
418
|
}
|
|
419
|
-
if ((v !== undefined) && !(v instanceof Event) && (
|
|
419
|
+
if ((v !== undefined) && !(v instanceof Event) && parseInt(v)) {
|
|
420
420
|
const d = this.value.with({ month: v });
|
|
421
421
|
return new this.constructor(d);
|
|
422
422
|
}
|
package/dist/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -10,6 +10,7 @@ export default {
|
|
|
10
10
|
host: ((_b = globalThis.location) === null || _b === void 0 ? void 0 : _b.protocol) + '//' + ((_c = globalThis.location) === null || _c === void 0 ? void 0 : _c.hostname),
|
|
11
11
|
url: (_d = globalThis.location) === null || _d === void 0 ? void 0 : _d.href,
|
|
12
12
|
old_path: null,
|
|
13
|
+
getParameters: {},
|
|
13
14
|
/* True when non asynchronous Ajax loads */
|
|
14
15
|
loading: false,
|
|
15
16
|
_enumerated: [],
|
|
@@ -24,13 +24,20 @@ import html2text from '../html/html2text.js';
|
|
|
24
24
|
*
|
|
25
25
|
* @returns {void}
|
|
26
26
|
*/
|
|
27
|
-
export default function setNavigationVars(url, title, data = null,
|
|
27
|
+
export default function setNavigationVars(url, title, data = null, replace = false) {
|
|
28
28
|
// Current path becomes old path
|
|
29
29
|
bbn.env.old_path = bbn.env.path;
|
|
30
30
|
// URL includes the domain
|
|
31
31
|
bbn.env.url = ['https:/', 'http://'].includes(substr(url, 0, 7)) ? url : bbn.env.root + url;
|
|
32
32
|
// Path does not
|
|
33
|
-
|
|
33
|
+
const [path, getParams] = bbn.env.url.split('?');
|
|
34
|
+
const getParameters = getParams ? getParams.split('&').reduce((acc, param) => {
|
|
35
|
+
const [key, value] = param.split('=');
|
|
36
|
+
acc[key] = value;
|
|
37
|
+
return acc;
|
|
38
|
+
}, {}) : {};
|
|
39
|
+
bbn.env.getParameters = getParameters;
|
|
40
|
+
bbn.env.path = substr(path, bbn.env.root.length);
|
|
34
41
|
// Params will include each part of the URL
|
|
35
42
|
bbn.env.params = bbn.env.path.split('/').filter(v => v !== '');
|
|
36
43
|
// Managing history
|
|
@@ -53,7 +60,7 @@ export default function setNavigationVars(url, title, data = null, repl = false)
|
|
|
53
60
|
if (state.title && !title) {
|
|
54
61
|
title = state.title;
|
|
55
62
|
}
|
|
56
|
-
|
|
63
|
+
replace = true;
|
|
57
64
|
}
|
|
58
65
|
// If no title the global title
|
|
59
66
|
if (!title) {
|
|
@@ -64,7 +71,7 @@ export default function setNavigationVars(url, title, data = null, repl = false)
|
|
|
64
71
|
title = html2text(title);
|
|
65
72
|
}
|
|
66
73
|
// Replacing state
|
|
67
|
-
if (
|
|
74
|
+
if (replace) {
|
|
68
75
|
obj.reload = true;
|
|
69
76
|
h.replaceState(obj, title, bbn.env.url);
|
|
70
77
|
}
|
package/dist/fn/init.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import substr from './string/substr.js';
|
|
2
|
-
import each from './loop/each.js';
|
|
3
2
|
import extend from './object/extend.js';
|
|
4
3
|
import addColors from './style/addColors.js';
|
|
5
4
|
import link from './ajax/link.js';
|
|
@@ -57,7 +56,6 @@ const onActivity = (e) => {
|
|
|
57
56
|
*/
|
|
58
57
|
export default function init(cfg, force) {
|
|
59
58
|
var _a, _b;
|
|
60
|
-
let parts;
|
|
61
59
|
if (!bbn.env.isInit) {
|
|
62
60
|
bbn.env.root = ((_b = (_a = globalThis.document) === null || _a === void 0 ? void 0 : _a.baseURI) === null || _b === void 0 ? void 0 : _b.length) ? globalThis.document.baseURI : bbn.env.host;
|
|
63
61
|
if (bbn.env.root.length && substr(bbn.env.root, -1) !== "/") {
|
|
@@ -67,15 +65,16 @@ export default function init(cfg, force) {
|
|
|
67
65
|
if (typeof cfg === "object") {
|
|
68
66
|
extend(true, bbn, cfg);
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
const [path, getParams] = bbn.env.url.split('?');
|
|
69
|
+
const getParameters = getParams ? getParams.split('&').reduce((acc, param) => {
|
|
70
|
+
const [key, value] = param.split('=');
|
|
71
|
+
acc[key] = value;
|
|
72
|
+
return acc;
|
|
73
|
+
}, {}) : {};
|
|
74
|
+
bbn.env.getParameters = getParameters;
|
|
75
|
+
bbn.env.path = substr(path, bbn.env.root.length);
|
|
76
|
+
// Params will include each part of the URL
|
|
77
|
+
bbn.env.params = bbn.env.path.split('/').filter(v => v !== '');
|
|
79
78
|
setupIntl();
|
|
80
79
|
if (globalThis.document) {
|
|
81
80
|
if (bbn.var.colors) {
|
|
@@ -152,9 +151,6 @@ export default function init(cfg, force) {
|
|
|
152
151
|
bbn.env.isInit = true;
|
|
153
152
|
document.dispatchEvent(new Event("bbninit"));
|
|
154
153
|
}
|
|
155
|
-
if (bbn.env.logging) {
|
|
156
|
-
log("Logging in bbn is enabled");
|
|
157
|
-
}
|
|
158
154
|
}
|
|
159
155
|
}
|
|
160
156
|
;
|