@ctx-core/window 15.1.20 → 15.1.21
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/hostname/index.js +6 -5
- package/package.json +5 -5
- package/pathname/index.js +6 -5
- package/window_location/index.js +13 -13
package/hostname/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { nullish__none_ } from '@ctx-core/function'
|
|
2
2
|
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
3
|
-
import {
|
|
3
|
+
import { window_location$_ } from '../window_location/index.js'
|
|
4
4
|
/** @typedef {import('@ctx-core/object').Ctx} */
|
|
5
5
|
/** @type {typeof import('./index.d.ts').hostname$_} */
|
|
6
6
|
export const [
|
|
7
7
|
hostname$_,
|
|
8
8
|
hostname_,
|
|
9
|
-
] = be_computed_pair_(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
] = be_computed_pair_(
|
|
10
|
+
ctx=>window_location$_(ctx),
|
|
11
|
+
window_location=>nullish__none_([window_location], ()=>
|
|
12
|
+
window_location.hostname),
|
|
13
|
+
{ id: 'hostname' })
|
|
13
14
|
export {
|
|
14
15
|
hostname$_ as hostname__,
|
|
15
16
|
hostname$_ as window_location_hostname__,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/window",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.21",
|
|
4
4
|
"description": "ctx-core window",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ctx-core/dom": "^15.1.
|
|
35
|
-
"@ctx-core/function": "^21.22.
|
|
36
|
-
"@ctx-core/nanostores": "^9.0.
|
|
37
|
-
"@ctx-core/object": "^31.0
|
|
34
|
+
"@ctx-core/dom": "^15.1.19",
|
|
35
|
+
"@ctx-core/function": "^21.22.14",
|
|
36
|
+
"@ctx-core/nanostores": "^9.0.3",
|
|
37
|
+
"@ctx-core/object": "^31.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"c8": "^8.0.1",
|
package/pathname/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { nullish__none_ } from '@ctx-core/function'
|
|
2
2
|
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
3
|
-
import {
|
|
3
|
+
import { window_location$_ } from '../window_location/index.js'
|
|
4
4
|
/** @typedef {import('@ctx-core/object').Ctx} */
|
|
5
5
|
/** @type {typeof import('./index.d.ts').pathname$_} */
|
|
6
6
|
export const [
|
|
7
7
|
pathname$_,
|
|
8
8
|
pathname_,
|
|
9
|
-
] = be_computed_pair_(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
] = be_computed_pair_(
|
|
10
|
+
ctx=>window_location$_(ctx),
|
|
11
|
+
window_location=>nullish__none_([window_location], ()=>
|
|
12
|
+
window_location.pathname),
|
|
13
|
+
{ id: 'pathname' })
|
|
13
14
|
export {
|
|
14
15
|
pathname$_ as pathname__,
|
|
15
16
|
pathname$_ as b__pathname,
|
package/window_location/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { has_dom, no_dom } from '@ctx-core/dom'
|
|
2
|
-
import { atom_, be_computed_pair_, onMount } from '@ctx-core/nanostores'
|
|
2
|
+
import { atom_, be_computed_pair_, computed_, onMount } from '@ctx-core/nanostores'
|
|
3
3
|
import { be_ } from '@ctx-core/object'
|
|
4
4
|
const window_location__atom$_ = be_(()=>
|
|
5
5
|
atom_())
|
|
@@ -11,18 +11,18 @@ const window_location__atom$_ = be_(()=>
|
|
|
11
11
|
export const [
|
|
12
12
|
window_location$_,
|
|
13
13
|
window_location_,
|
|
14
|
-
] = /** @type {be_computed_pair_T<Location>} */ be_computed_pair_(ctx=>
|
|
15
|
-
window_location__atom$_(ctx)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
] = /** @type {be_computed_pair_T<Location>} */ be_computed_pair_(be_(ctx=>{
|
|
15
|
+
const window_location$ = computed_(window_location__atom$_(ctx),
|
|
16
|
+
window_location__atom=>window_location__atom)
|
|
17
|
+
if (has_dom) {
|
|
18
|
+
let onpopstate = ()=>window_location__reset(ctx)
|
|
19
|
+
onMount(window_location$, ()=>{
|
|
20
|
+
window.addEventListener('popstate', onpopstate)
|
|
21
|
+
return ()=>window.removeEventListener('popstate', onpopstate)
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
return window_location$
|
|
25
|
+
}, { id: 'window_location' }))
|
|
26
26
|
export { window_location$_ as window_location__ }
|
|
27
27
|
/**
|
|
28
28
|
* @param {Ctx}ctx
|