@ctx-core/window 15.0.99 → 15.0.101
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/CHANGELOG.md +16 -0
- package/COMMIT_EDITMSG +0 -2
- package/package.json +2 -2
- package/src/hostname/index.d.ts +10 -0
- package/src/hostname/index.js +16 -0
- package/src/index.d.ts +3 -3
- package/src/index.js +3 -3
- package/src/pathname/index.d.ts +11 -0
- package/src/pathname/index.js +17 -0
- package/src/window_location/index.d.ts +8 -0
- package/src/window_location/index.js +30 -0
- package/src/hostname__/index.d.ts +0 -9
- package/src/hostname__/index.js +0 -23
- package/src/pathname__/index.d.ts +0 -10
- package/src/pathname__/index.js +0 -24
- package/src/window_location__/index.d.ts +0 -6
- package/src/window_location__/index.js +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ctx-core/window
|
|
2
2
|
|
|
3
|
+
## 15.0.101
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @ctx-core/nanostores: ^5.1.0 -> ^5.1.1
|
|
8
|
+
|
|
9
|
+
## 15.0.100
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- \*$\_ name convention:
|
|
14
|
+
|
|
15
|
+
hostname$_: aliased by hostname__
|
|
16
|
+
pathname$_: aliased by pathname__
|
|
17
|
+
window_location$_: aliased by window_location__
|
|
18
|
+
|
|
3
19
|
## 15.0.99
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/window",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.101",
|
|
4
4
|
"description": "ctx-core window",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@ctx-core/dom": "^14.1.54",
|
|
28
28
|
"@ctx-core/function": "^21.18.0",
|
|
29
|
-
"@ctx-core/nanostores": "^5.1.
|
|
29
|
+
"@ctx-core/nanostores": "^5.1.1",
|
|
30
30
|
"@ctx-core/object": "^28.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
|
|
2
|
+
export declare const [
|
|
3
|
+
hostname$_,
|
|
4
|
+
hostname_,
|
|
5
|
+
]:val__be_computed_pair_T<string>
|
|
6
|
+
export {
|
|
7
|
+
hostname$_ as hostname__,
|
|
8
|
+
hostname$_ as window_location_hostname__,
|
|
9
|
+
hostname$_ as window_location_hostname$_
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { nullish__check_ } from '@ctx-core/function'
|
|
2
|
+
import { val__be_computed_pair_ } from '@ctx-core/nanostores'
|
|
3
|
+
import { window_location_ } from '../window_location/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @type {typeof import('./index.d.ts').hostname$_} */
|
|
6
|
+
export const [
|
|
7
|
+
hostname$_,
|
|
8
|
+
hostname_,
|
|
9
|
+
] = val__be_computed_pair_('hostname$_', ctx=>
|
|
10
|
+
nullish__check_([window_location_(ctx)], window_location=>
|
|
11
|
+
window_location.hostname))
|
|
12
|
+
export {
|
|
13
|
+
hostname$_ as hostname__,
|
|
14
|
+
hostname$_ as window_location_hostname__,
|
|
15
|
+
hostname$_ as window_location_hostname$_
|
|
16
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './hostname'
|
|
2
|
+
export * from './pathname'
|
|
3
|
+
export * from './window_location'
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './hostname/index.js'
|
|
2
|
+
export * from './pathname/index.js'
|
|
3
|
+
export * from './window_location/index.js'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
|
|
2
|
+
export declare const [
|
|
3
|
+
pathname$_,
|
|
4
|
+
pathname_,
|
|
5
|
+
]:val__be_computed_pair_T<string>
|
|
6
|
+
export {
|
|
7
|
+
pathname$_ as pathname__,
|
|
8
|
+
pathname$_ as b__pathname,
|
|
9
|
+
pathname$_ as window_location_pathname__,
|
|
10
|
+
pathname$_ as window_location_pathname$_,
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { nullish__check_ } from '@ctx-core/function'
|
|
2
|
+
import { val__be_computed_pair_ } from '@ctx-core/nanostores'
|
|
3
|
+
import { window_location_ } from '../window_location/index.js'
|
|
4
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
5
|
+
/** @type {typeof import('./index.d.ts').pathname$_} */
|
|
6
|
+
export const [
|
|
7
|
+
pathname$_,
|
|
8
|
+
pathname_,
|
|
9
|
+
] = val__be_computed_pair_('pathname$_', ctx=>
|
|
10
|
+
nullish__check_([window_location_(ctx)], window_location=>
|
|
11
|
+
window_location.pathname))
|
|
12
|
+
export {
|
|
13
|
+
pathname$_ as pathname__,
|
|
14
|
+
pathname$_ as b__pathname,
|
|
15
|
+
pathname$_ as window_location_pathname__,
|
|
16
|
+
pathname$_ as window_location_pathname$_,
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
|
|
2
|
+
import type { Ctx } from '@ctx-core/object'
|
|
3
|
+
export declare const [
|
|
4
|
+
window_location$_,
|
|
5
|
+
window_location_,
|
|
6
|
+
]:val__be_computed_pair_T<Location>
|
|
7
|
+
export { window_location$_ as window_location__ }
|
|
8
|
+
export declare function window_location__reset(ctx:Ctx):void
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { has_dom, no_dom } from '@ctx-core/dom'
|
|
2
|
+
import { atom_, val__be_computed_pair_ } from '@ctx-core/nanostores'
|
|
3
|
+
import { be_ } from '@ctx-core/object'
|
|
4
|
+
const window_location__atom$_ = be_(()=>
|
|
5
|
+
atom_())
|
|
6
|
+
/** @typedef {import('@ctx-core/nanostores').WritableAtom_}WritableAtom_ */
|
|
7
|
+
/** @typedef {import('@ctx-core/object').Be}Be */
|
|
8
|
+
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
9
|
+
/** @type {typeof import('./index.d.ts').window_location$_} */
|
|
10
|
+
export const [
|
|
11
|
+
window_location$_,
|
|
12
|
+
window_location_,
|
|
13
|
+
] = val__be_computed_pair_('window_location$_', (ctx, asub)=>{
|
|
14
|
+
if (has_dom) {
|
|
15
|
+
let onpopstate = ()=>window_location__reset(ctx)
|
|
16
|
+
asub
|
|
17
|
+
.on(()=>window.addEventListener('popstate', onpopstate))
|
|
18
|
+
.off(()=>window.removeEventListener('popstate', onpopstate))
|
|
19
|
+
}
|
|
20
|
+
return window_location__atom$_(ctx)
|
|
21
|
+
})
|
|
22
|
+
export { window_location$_ as window_location__ }
|
|
23
|
+
/** @typedef {Be<WritableAtom_<boolean>>} */
|
|
24
|
+
/**
|
|
25
|
+
* @param {Ctx}ctx
|
|
26
|
+
*/
|
|
27
|
+
export function window_location__reset(ctx) {
|
|
28
|
+
if (no_dom) return
|
|
29
|
+
window_location__atom$_(ctx).$ = window.location
|
|
30
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import type { Be, Ctx } from '@ctx-core/object'
|
|
3
|
-
export declare const hostname__:Be<ReadableAtom_<string>>
|
|
4
|
-
export {
|
|
5
|
-
hostname__ as hostname$_,
|
|
6
|
-
hostname__ as window_location_hostname__,
|
|
7
|
-
hostname__ as window_location_hostname$_
|
|
8
|
-
}
|
|
9
|
-
export declare function hostname_(ctx:Ctx):string
|
package/src/hostname__/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { nullish__check_ } from '@ctx-core/function'
|
|
2
|
-
import { computed_ } from '@ctx-core/nanostores'
|
|
3
|
-
import { be_ } from '@ctx-core/object'
|
|
4
|
-
import { window_location__ } from '../window_location__/index.js'
|
|
5
|
-
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
6
|
-
/** @type {typeof import('./index.d.ts').hostname__} */
|
|
7
|
-
export const hostname__ = be_('hostname__', ctx =>
|
|
8
|
-
computed_(window_location__(ctx), window_location=>
|
|
9
|
-
nullish__check_([window_location], ()=>
|
|
10
|
-
window_location.hostname)))
|
|
11
|
-
export {
|
|
12
|
-
hostname__ as hostname$_,
|
|
13
|
-
hostname__ as window_location_hostname__,
|
|
14
|
-
hostname__ as window_location_hostname$_
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @param {Ctx}ctx
|
|
18
|
-
* @returns {string}
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
|
-
export function hostname_(ctx) {
|
|
22
|
-
return hostname__(ctx).$
|
|
23
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import type { Be, Ctx } from '@ctx-core/object'
|
|
3
|
-
export declare const pathname__:Be<ReadableAtom_<string>>
|
|
4
|
-
export {
|
|
5
|
-
pathname__ as pathname$_,
|
|
6
|
-
pathname__ as b__pathname,
|
|
7
|
-
pathname__ as window_location_pathname__,
|
|
8
|
-
pathname__ as window_location_pathname$_,
|
|
9
|
-
}
|
|
10
|
-
export declare function pathname_(ctx:Ctx):string
|
package/src/pathname__/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { nullish__check_ } from '@ctx-core/function'
|
|
2
|
-
import { computed_ } from '@ctx-core/nanostores'
|
|
3
|
-
import { be_ } from '@ctx-core/object'
|
|
4
|
-
import { window_location__ } from '../window_location__/index.js'
|
|
5
|
-
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
6
|
-
/** @type {typeof import('./index.d.ts').pathname__} */
|
|
7
|
-
export const pathname__ = be_('pathname__', ctx=>
|
|
8
|
-
computed_(window_location__(ctx), window_location=>
|
|
9
|
-
nullish__check_([window_location], ()=>
|
|
10
|
-
window_location.pathname)))
|
|
11
|
-
export {
|
|
12
|
-
pathname__ as pathname$_,
|
|
13
|
-
pathname__ as b__pathname,
|
|
14
|
-
pathname__ as window_location_pathname__,
|
|
15
|
-
pathname__ as window_location_pathname$_,
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @param {Ctx}ctx
|
|
19
|
-
* @returns {string}
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
export function pathname_(ctx) {
|
|
23
|
-
return pathname__(ctx).$
|
|
24
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import type { Be, Ctx } from '@ctx-core/object'
|
|
3
|
-
export declare const window_location__:Be<ReadableAtom_<Location>>
|
|
4
|
-
export declare function window_location_(ctx:Ctx):Location
|
|
5
|
-
export { window_location__ as window_location$_ }
|
|
6
|
-
export declare function window_location__reset(ctx:Ctx):void
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { has_dom, no_dom } from '@ctx-core/dom'
|
|
2
|
-
import { atom_, computed_ } from '@ctx-core/nanostores'
|
|
3
|
-
import { be_ } from '@ctx-core/object'
|
|
4
|
-
const window_location__atom_ = be_('window_location__atom_', ()=>
|
|
5
|
-
atom_())
|
|
6
|
-
/** @typedef {import('@ctx-core/nanostores').WritableAtom_}WritableAtom_ */
|
|
7
|
-
/** @typedef {import('@ctx-core/object').Be}Be */
|
|
8
|
-
/** @typedef {import('@ctx-core/object').Ctx}Ctx */
|
|
9
|
-
/** @type {typeof import('./index.d.ts').window_location__} */
|
|
10
|
-
export const window_location__ = be_('window_location__', ctx=>{
|
|
11
|
-
if (has_dom) {
|
|
12
|
-
window.addEventListener('popstate', ()=>
|
|
13
|
-
window_location__reset(ctx))
|
|
14
|
-
}
|
|
15
|
-
return computed_(
|
|
16
|
-
window_location__atom_(ctx),
|
|
17
|
-
$=>$)
|
|
18
|
-
})
|
|
19
|
-
export { window_location__ as window_location$_ }
|
|
20
|
-
/**
|
|
21
|
-
* @param {Ctx}ctx
|
|
22
|
-
* @returns {Location}
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
export function window_location_(ctx) {
|
|
26
|
-
return window_location__(ctx).$
|
|
27
|
-
}
|
|
28
|
-
/** @typedef {Be<WritableAtom_<boolean>>} */
|
|
29
|
-
/**
|
|
30
|
-
* @param {Ctx}ctx
|
|
31
|
-
*/
|
|
32
|
-
export function window_location__reset(ctx) {
|
|
33
|
-
if (no_dom) return
|
|
34
|
-
window_location__atom_(ctx).$ = window.location
|
|
35
|
-
}
|