@koine/browser 2.0.0-beta.13 → 2.0.0-beta.131
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/README.md +1 -1
- package/createStorage.cjs.d.ts +2 -0
- package/createStorage.cjs.default.js +1 -0
- package/createStorage.cjs.js +50 -0
- package/createStorage.cjs.mjs +2 -0
- package/createStorage.d.ts +7 -54
- package/createStorage.esm.d.ts +2 -0
- package/createStorage.esm.js +45 -0
- package/getZonedDate.cjs.d.ts +2 -0
- package/getZonedDate.cjs.default.js +1 -0
- package/{getZonedDate.mjs → getZonedDate.cjs.js} +13 -18
- package/getZonedDate.cjs.mjs +2 -0
- package/getZonedDate.d.ts +1 -15
- package/getZonedDate.esm.d.ts +2 -0
- package/getZonedDate.esm.js +21 -0
- package/gtag.cjs.d.ts +2 -0
- package/gtag.cjs.default.js +1 -0
- package/gtag.cjs.js +22 -0
- package/gtag.cjs.mjs +2 -0
- package/gtag.d.ts +2 -0
- package/gtag.esm.d.ts +2 -0
- package/gtag.esm.js +17 -0
- package/gtagPageview.cjs.d.ts +2 -0
- package/gtagPageview.cjs.default.js +1 -0
- package/gtagPageview.cjs.js +12 -0
- package/gtagPageview.cjs.mjs +2 -0
- package/gtagPageview.d.ts +1 -4
- package/gtagPageview.esm.d.ts +2 -0
- package/gtagPageview.esm.js +7 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +41 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +4 -1
- package/index.esm.d.ts +1 -0
- package/index.esm.js +18 -0
- package/isIE.cjs.d.ts +2 -0
- package/isIE.cjs.default.js +1 -0
- package/isIE.cjs.js +14 -0
- package/isIE.cjs.mjs +2 -0
- package/isIE.d.ts +1 -6
- package/isIE.esm.d.ts +2 -0
- package/isIE.esm.js +9 -0
- package/isMobile.cjs.d.ts +2 -0
- package/isMobile.cjs.default.js +1 -0
- package/isMobile.cjs.js +16 -0
- package/isMobile.cjs.mjs +2 -0
- package/isMobile.d.ts +1 -6
- package/isMobile.esm.d.ts +2 -0
- package/isMobile.esm.js +11 -0
- package/listenUrlSearch.cjs.d.ts +2 -0
- package/listenUrlSearch.cjs.default.js +1 -0
- package/listenUrlSearch.cjs.js +32 -0
- package/listenUrlSearch.cjs.mjs +2 -0
- package/listenUrlSearch.d.ts +3 -0
- package/listenUrlSearch.esm.d.ts +2 -0
- package/listenUrlSearch.esm.js +27 -0
- package/listenUrlSearchParams.cjs.d.ts +2 -0
- package/listenUrlSearchParams.cjs.default.js +1 -0
- package/listenUrlSearchParams.cjs.js +14 -0
- package/listenUrlSearchParams.cjs.mjs +2 -0
- package/listenUrlSearchParams.d.ts +2 -0
- package/listenUrlSearchParams.esm.d.ts +2 -0
- package/listenUrlSearchParams.esm.js +9 -0
- package/navigateToHash.cjs.d.ts +2 -0
- package/navigateToHash.cjs.default.js +1 -0
- package/navigateToHash.cjs.js +15 -0
- package/navigateToHash.cjs.mjs +2 -0
- package/navigateToHash.d.ts +1 -7
- package/navigateToHash.esm.d.ts +2 -0
- package/navigateToHash.esm.js +10 -0
- package/navigateToHashParams.cjs.d.ts +2 -0
- package/navigateToHashParams.cjs.default.js +1 -0
- package/navigateToHashParams.cjs.js +15 -0
- package/navigateToHashParams.cjs.mjs +2 -0
- package/navigateToHashParams.d.ts +2 -8
- package/navigateToHashParams.esm.d.ts +2 -0
- package/navigateToHashParams.esm.js +10 -0
- package/navigateToMergedHashParams.cjs.d.ts +2 -0
- package/navigateToMergedHashParams.cjs.default.js +1 -0
- package/navigateToMergedHashParams.cjs.js +15 -0
- package/navigateToMergedHashParams.cjs.mjs +2 -0
- package/navigateToMergedHashParams.d.ts +2 -7
- package/navigateToMergedHashParams.esm.d.ts +2 -0
- package/navigateToMergedHashParams.esm.js +10 -0
- package/navigateToMergedParams.cjs.d.ts +2 -0
- package/navigateToMergedParams.cjs.default.js +1 -0
- package/navigateToMergedParams.cjs.js +16 -0
- package/navigateToMergedParams.cjs.mjs +2 -0
- package/navigateToMergedParams.d.ts +2 -8
- package/navigateToMergedParams.esm.d.ts +2 -0
- package/navigateToMergedParams.esm.js +11 -0
- package/navigateToParams.cjs.d.ts +2 -0
- package/navigateToParams.cjs.default.js +1 -0
- package/navigateToParams.cjs.js +17 -0
- package/navigateToParams.cjs.mjs +2 -0
- package/navigateToParams.d.ts +2 -9
- package/navigateToParams.esm.d.ts +2 -0
- package/navigateToParams.esm.js +12 -0
- package/navigateToUrl.cjs.d.ts +2 -0
- package/navigateToUrl.cjs.default.js +1 -0
- package/navigateToUrl.cjs.js +12 -0
- package/navigateToUrl.cjs.mjs +2 -0
- package/navigateToUrl.d.ts +1 -6
- package/navigateToUrl.esm.d.ts +2 -0
- package/navigateToUrl.esm.js +7 -0
- package/navigateWithoutUrlParam.cjs.d.ts +2 -0
- package/navigateWithoutUrlParam.cjs.default.js +1 -0
- package/navigateWithoutUrlParam.cjs.js +16 -0
- package/navigateWithoutUrlParam.cjs.mjs +2 -0
- package/navigateWithoutUrlParam.d.ts +1 -7
- package/navigateWithoutUrlParam.esm.d.ts +2 -0
- package/navigateWithoutUrlParam.esm.js +11 -0
- package/package.json +129 -8
- package/redirectTo.cjs.d.ts +2 -0
- package/redirectTo.cjs.default.js +1 -0
- package/redirectTo.cjs.js +15 -0
- package/redirectTo.cjs.mjs +2 -0
- package/redirectTo.d.ts +2 -8
- package/redirectTo.esm.d.ts +2 -0
- package/redirectTo.esm.js +10 -0
- package/storage.cjs.d.ts +2 -0
- package/storage.cjs.default.js +1 -0
- package/storage.cjs.js +14 -0
- package/storage.cjs.mjs +2 -0
- package/storage.d.ts +7 -12
- package/storage.esm.d.ts +2 -0
- package/storage.esm.js +9 -0
- package/storageClient.cjs.d.ts +2 -0
- package/storageClient.cjs.default.js +1 -0
- package/storageClient.cjs.js +21 -0
- package/storageClient.cjs.mjs +2 -0
- package/storageClient.d.ts +5 -13
- package/storageClient.esm.d.ts +2 -0
- package/storageClient.esm.js +16 -0
- package/createStorage.mjs +0 -133
- package/gtagPageview.mjs +0 -23
- package/index.mjs +0 -15
- package/isIE.mjs +0 -16
- package/isMobile.mjs +0 -14
- package/navigateToHash.mjs +0 -11
- package/navigateToHashParams.mjs +0 -19
- package/navigateToMergedHashParams.mjs +0 -11
- package/navigateToMergedParams.mjs +0 -12
- package/navigateToParams.mjs +0 -17
- package/navigateToUrl.mjs +0 -10
- package/navigateWithoutUrlParam.mjs +0 -18
- package/redirectTo.mjs +0 -14
- package/storage.mjs +0 -10
- package/storageClient.mjs +0 -97
- package/typings.d.ts +0 -12
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
var dom = require('@koine/dom');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Flag that tells if `history` methods have been replaced
|
|
10
|
+
*//**
|
|
11
|
+
* @param prevLocationSearch The previous URL search query e.g. `?myparam=mvalue`
|
|
12
|
+
* @param newLocationSearch The previous URL search query e.g. `?myparam=mvalue`
|
|
13
|
+
*/let r=(t,e,r)=>function(...o){let i=t.apply(this,o);return e(),i},o=utils.isBrowser?location.search:"",i=()=>{let t=location.search;// console.log(`listenUrlSearch: "${prevSearch}" vs "${newSearch}`);
|
|
14
|
+
if(t!==o)for(let e of history.__.h.values())e(o,t);o=t;};/**
|
|
15
|
+
* Here we extend and mutate the native `window.history` object so that multiple
|
|
16
|
+
* scripts can add url change handlers without interfering each other and using
|
|
17
|
+
* the same single listener.
|
|
18
|
+
*
|
|
19
|
+
* @borrows [SO answer](https://stackoverflow.com/a/42727249/1938970)
|
|
20
|
+
*
|
|
21
|
+
* @category location
|
|
22
|
+
* @category navigation
|
|
23
|
+
* @category events
|
|
24
|
+
*
|
|
25
|
+
* @returns A de-register function to remove the handler
|
|
26
|
+
*/let listenUrlSearch=t=>(history.__||(// replace browser's history global methods
|
|
27
|
+
history.pushState=r(history.pushState,i),history.replaceState=r(history.replaceState,i),// listen native history events
|
|
28
|
+
dom.on(window,"popstate",i),// extend history object
|
|
29
|
+
history.__={h:new Set}),history.__.h.has(t)||history.__.h.add(t),()=>{history.__.h.delete(t);});
|
|
30
|
+
|
|
31
|
+
exports.default = listenUrlSearch;
|
|
32
|
+
exports.listenUrlSearch = listenUrlSearch;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isBrowser } from '@koine/utils';
|
|
2
|
+
import { on } from '@koine/dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Flag that tells if `history` methods have been replaced
|
|
6
|
+
*//**
|
|
7
|
+
* @param prevLocationSearch The previous URL search query e.g. `?myparam=mvalue`
|
|
8
|
+
* @param newLocationSearch The previous URL search query e.g. `?myparam=mvalue`
|
|
9
|
+
*/let r=(t,e,r)=>function(...o){let i=t.apply(this,o);return e(),i},o=isBrowser?location.search:"",i=()=>{let t=location.search;// console.log(`listenUrlSearch: "${prevSearch}" vs "${newSearch}`);
|
|
10
|
+
if(t!==o)for(let e of history.__.h.values())e(o,t);o=t;};/**
|
|
11
|
+
* Here we extend and mutate the native `window.history` object so that multiple
|
|
12
|
+
* scripts can add url change handlers without interfering each other and using
|
|
13
|
+
* the same single listener.
|
|
14
|
+
*
|
|
15
|
+
* @borrows [SO answer](https://stackoverflow.com/a/42727249/1938970)
|
|
16
|
+
*
|
|
17
|
+
* @category location
|
|
18
|
+
* @category navigation
|
|
19
|
+
* @category events
|
|
20
|
+
*
|
|
21
|
+
* @returns A de-register function to remove the handler
|
|
22
|
+
*/let listenUrlSearch=t=>(history.__||(// replace browser's history global methods
|
|
23
|
+
history.pushState=r(history.pushState,i),history.replaceState=r(history.replaceState,i),// listen native history events
|
|
24
|
+
on(window,"popstate",i),// extend history object
|
|
25
|
+
history.__={h:new Set}),history.__.h.has(t)||history.__.h.add(t),()=>{history.__.h.delete(t);});
|
|
26
|
+
|
|
27
|
+
export { listenUrlSearch as default, listenUrlSearch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./listenUrlSearchParams.cjs.js').default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var listenUrlSearch = require('./listenUrlSearch.cjs.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @category events
|
|
9
|
+
* @category navigation
|
|
10
|
+
* @category events
|
|
11
|
+
*/let listenUrlSearchParams=(r,a)=>listenUrlSearch.listenUrlSearch((e,t)=>{let l=new URLSearchParams(e),s=new URLSearchParams(t).get(r);l.get(r)!==s&&a(s);});
|
|
12
|
+
|
|
13
|
+
exports.default = listenUrlSearchParams;
|
|
14
|
+
exports.listenUrlSearchParams = listenUrlSearchParams;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { listenUrlSearch } from './listenUrlSearch.esm.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @category events
|
|
5
|
+
* @category navigation
|
|
6
|
+
* @category events
|
|
7
|
+
*/let listenUrlSearchParams=(r,a)=>listenUrlSearch((e,t)=>{let l=new URLSearchParams(e),s=new URLSearchParams(t).get(r);l.get(r)!==s&&a(s);});
|
|
8
|
+
|
|
9
|
+
export { listenUrlSearchParams as default, listenUrlSearchParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToHash.cjs.js').default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var navigateToUrl = require('./navigateToUrl.cjs.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* It updates the browser's location hash by replacing the history state.
|
|
9
|
+
* The non-silent standard way would simply be `location.hash = "#new-hash"`
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
*/let navigateToHash=(t="")=>{let{pathname:o,search:e}=location;navigateToUrl.navigateToUrl(o+(e?"?"+e:"")+(t?"#"+t:""),!0);};
|
|
13
|
+
|
|
14
|
+
exports.default = navigateToHash;
|
|
15
|
+
exports.navigateToHash = navigateToHash;
|
package/navigateToHash.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* It updates the browser's location hash by replacing the history state.
|
|
3
|
-
* The non-silent standard way would simply be `location.hash = "#new-hash"`
|
|
4
|
-
*
|
|
5
|
-
* @category location
|
|
6
|
-
*/
|
|
7
|
-
export declare function navigateToHash(hash?: string): void;
|
|
1
|
+
export declare let navigateToHash: (hash?: string) => void;
|
|
8
2
|
export default navigateToHash;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { navigateToUrl } from './navigateToUrl.esm.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* It updates the browser's location hash by replacing the history state.
|
|
5
|
+
* The non-silent standard way would simply be `location.hash = "#new-hash"`
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
*/let navigateToHash=(t="")=>{let{pathname:o,search:e}=location;navigateToUrl(o+(e?"?"+e:"")+(t?"#"+t:""),!0);};
|
|
9
|
+
|
|
10
|
+
export { navigateToHash as default, navigateToHash };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToHashParams.cjs.js').default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* It updates the `location.hash` with the given query params, it uses `location.hash`
|
|
9
|
+
* if a second argument `hash` is not provded
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
*/let navigateToHashParams=(o={},e="")=>{let r=!e,i="#/"+utils.getUrlHashPathname(e=e||location.hash)+("string"==typeof o?o:utils.buildUrlQueryString(o));return r&&(location.hash=i),i};
|
|
13
|
+
|
|
14
|
+
exports.default = navigateToHashParams;
|
|
15
|
+
exports.navigateToHashParams = navigateToHashParams;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
* It updates the `location.hash` with the given query params, it uses `location.hash`
|
|
4
|
-
* if a second argument `hash` is not provded
|
|
5
|
-
*
|
|
6
|
-
* @category location
|
|
7
|
-
*/
|
|
8
|
-
export declare function navigateToHashParams(params?: string | AnyQueryParams, hash?: string): string;
|
|
1
|
+
import { type AnyQueryParams } from "@koine/utils";
|
|
2
|
+
export declare let navigateToHashParams: (params?: string | AnyQueryParams, hash?: string) => string;
|
|
9
3
|
export default navigateToHashParams;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getUrlHashPathname, buildUrlQueryString } from '@koine/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* It updates the `location.hash` with the given query params, it uses `location.hash`
|
|
5
|
+
* if a second argument `hash` is not provded
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
*/let navigateToHashParams=(o={},e="")=>{let r=!e,i="#/"+getUrlHashPathname(e=e||location.hash)+("string"==typeof o?o:buildUrlQueryString(o));return r&&(location.hash=i),i};
|
|
9
|
+
|
|
10
|
+
export { navigateToHashParams as default, navigateToHashParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToMergedHashParams.cjs.js').default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
var navigateToHashParams = require('./navigateToHashParams.cjs.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* It updates the "query params" within the `location.hash`, it uses `location`
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
*/let navigateToMergedHashParams=(o={},t="")=>navigateToHashParams.navigateToHashParams(utils.mergeUrlQueryParams(utils.getUrlHashParams(t),o),t);
|
|
13
|
+
|
|
14
|
+
exports.default = navigateToMergedHashParams;
|
|
15
|
+
exports.navigateToMergedHashParams = navigateToMergedHashParams;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
* It updates the "query params" within the `location.hash`, it uses `location`
|
|
4
|
-
*
|
|
5
|
-
* @category location
|
|
6
|
-
*/
|
|
7
|
-
export declare function navigateToMergedHashParams(params?: NonNullable<AnyQueryParams>, hash?: string): string;
|
|
1
|
+
import { type AnyQueryParams } from "@koine/utils";
|
|
2
|
+
export declare let navigateToMergedHashParams: (params?: NonNullable<AnyQueryParams>, hash?: string) => string;
|
|
8
3
|
export default navigateToMergedHashParams;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergeUrlQueryParams, getUrlHashParams } from '@koine/utils';
|
|
2
|
+
import { navigateToHashParams } from './navigateToHashParams.esm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* It updates the "query params" within the `location.hash`, it uses `location`
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
*/let navigateToMergedHashParams=(o={},t="")=>navigateToHashParams(mergeUrlQueryParams(getUrlHashParams(t),o),t);
|
|
9
|
+
|
|
10
|
+
export { navigateToMergedHashParams as default, navigateToMergedHashParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToMergedParams.cjs.js').default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
var navigateToParams = require('./navigateToParams.cjs.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Merge current URL query parameters with the given ones, it uses `history`.
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
13
|
+
*/let navigateToMergedParams=(o={},t)=>navigateToParams.navigateToParams(utils.mergeUrlQueryParams(utils.getUrlQueryParams(),o),t);
|
|
14
|
+
|
|
15
|
+
exports.default = navigateToMergedParams;
|
|
16
|
+
exports.navigateToMergedParams = navigateToMergedParams;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
* Merge current URL query parameters with the given ones, it uses `history`.
|
|
4
|
-
*
|
|
5
|
-
* @category location
|
|
6
|
-
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function navigateToMergedParams(params?: NonNullable<AnyQueryParams>, replace?: boolean): string;
|
|
1
|
+
import { type AnyQueryParams } from "@koine/utils";
|
|
2
|
+
export declare let navigateToMergedParams: (params?: NonNullable<AnyQueryParams>, replace?: boolean) => string;
|
|
9
3
|
export default navigateToMergedParams;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mergeUrlQueryParams, getUrlQueryParams } from '@koine/utils';
|
|
2
|
+
import { navigateToParams } from './navigateToParams.esm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Merge current URL query parameters with the given ones, it uses `history`.
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
|
+
*/let navigateToMergedParams=(o={},t)=>navigateToParams(mergeUrlQueryParams(getUrlQueryParams(),o),t);
|
|
10
|
+
|
|
11
|
+
export { navigateToMergedParams as default, navigateToMergedParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToParams.cjs.js').default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
var navigateToUrl = require('./navigateToUrl.cjs.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Change current URL query parameters, it uses `history`.
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
13
|
+
* @returns The query string with initial `?`
|
|
14
|
+
*/let navigateToParams=(e={},r)=>{let i="string"==typeof e?e:utils.buildUrlQueryString(e);return utils.isBrowser&&navigateToUrl.navigateToUrl(location.pathname+i,r),i};
|
|
15
|
+
|
|
16
|
+
exports.default = navigateToParams;
|
|
17
|
+
exports.navigateToParams = navigateToParams;
|
package/navigateToParams.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
* Change current URL query parameters, it uses `history`.
|
|
4
|
-
*
|
|
5
|
-
* @category location
|
|
6
|
-
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
7
|
-
* @returns The query string with initial `?`
|
|
8
|
-
*/
|
|
9
|
-
export declare function navigateToParams(params?: string | AnyQueryParams, replace?: boolean): string;
|
|
1
|
+
import { type AnyQueryParams } from "@koine/utils";
|
|
2
|
+
export declare let navigateToParams: (params?: string | AnyQueryParams, replace?: boolean) => string;
|
|
10
3
|
export default navigateToParams;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buildUrlQueryString, isBrowser } from '@koine/utils';
|
|
2
|
+
import { navigateToUrl } from './navigateToUrl.esm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Change current URL query parameters, it uses `history`.
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
|
+
* @returns The query string with initial `?`
|
|
10
|
+
*/let navigateToParams=(e={},r)=>{let i="string"==typeof e?e:buildUrlQueryString(e);return isBrowser&&navigateToUrl(location.pathname+i,r),i};
|
|
11
|
+
|
|
12
|
+
export { navigateToParams as default, navigateToParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateToUrl.cjs.js').default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* It updates the browser's location URL with global `history` object
|
|
7
|
+
*
|
|
8
|
+
* @category location
|
|
9
|
+
*/let navigateToUrl=(t="",e)=>{t&&history[e?"replaceState":"pushState"](history.state,"",t);};
|
|
10
|
+
|
|
11
|
+
exports.default = navigateToUrl;
|
|
12
|
+
exports.navigateToUrl = navigateToUrl;
|
package/navigateToUrl.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* It updates the browser's location URL with global `history` object
|
|
3
|
-
*
|
|
4
|
-
* @category location
|
|
5
|
-
*/
|
|
6
|
-
export declare function navigateToUrl(url?: string, replace?: boolean): void;
|
|
1
|
+
export declare let navigateToUrl: (url?: string, replace?: boolean) => void;
|
|
7
2
|
export default navigateToUrl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./navigateWithoutUrlParam.cjs.js').default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@koine/utils');
|
|
6
|
+
var navigateToParams = require('./navigateToParams.cjs.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Remove URL query parameter, it uses `history`
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
13
|
+
*/let navigateWithoutUrlParam=(a,e)=>{let o={},i=utils.getUrlQueryParams();for(let t in i)t!==a&&(o[t]=i[t]);return navigateToParams.navigateToParams(o,e)};
|
|
14
|
+
|
|
15
|
+
exports.default = navigateWithoutUrlParam;
|
|
16
|
+
exports.navigateWithoutUrlParam = navigateWithoutUrlParam;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Remove URL query parameter, it uses `history`
|
|
3
|
-
*
|
|
4
|
-
* @category location
|
|
5
|
-
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
6
|
-
*/
|
|
7
|
-
export declare function navigateWithoutUrlParam(paramName?: string, replace?: boolean): string;
|
|
1
|
+
export declare let navigateWithoutUrlParam: (paramName?: string, replace?: boolean) => string;
|
|
8
2
|
export default navigateWithoutUrlParam;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getUrlQueryParams } from '@koine/utils';
|
|
2
|
+
import { navigateToParams } from './navigateToParams.esm.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Remove URL query parameter, it uses `history`
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
|
+
*/let navigateWithoutUrlParam=(a,e)=>{let o={},i=getUrlQueryParams();for(let t in i)t!==a&&(o[t]=i[t]);return navigateToParams(o,e)};
|
|
10
|
+
|
|
11
|
+
export { navigateWithoutUrlParam as default, navigateWithoutUrlParam };
|