@ctx-core/window 14.1.69 → 14.2.0
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/package.json +4 -4
- package/src/hostname__/index.d.ts +4 -0
- package/src/{hostname__.js → hostname__/index.js} +1 -0
- package/src/index.js +5 -5
- package/src/pathname__/index.d.ts +7 -0
- package/src/{pathname__.js → pathname__/index.js} +1 -0
- package/src/window_location__/index.d.ts +7 -0
- package/src/{window_location__.js → window_location__/index.js} +8 -7
- package/src/window_location_hostname__/index.d.ts +4 -0
- package/src/{window_location_hostname__.js → window_location_hostname__/index.js} +3 -2
- package/src/window_location_pathname__/index.d.ts +5 -0
- package/src/{window_location_pathname__.js → window_location_pathname__/index.js} +3 -2
- package/src/hostname__.d.ts +0 -4
- package/src/pathname__.d.ts +0 -7
- package/src/window_location__.d.ts +0 -7
- package/src/window_location_hostname__.d.ts +0 -4
- package/src/window_location_pathname__.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ctx-core/window
|
|
2
2
|
|
|
3
|
+
## 14.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- extract _.js & _.d.ts into directories
|
|
8
|
+
|
|
9
|
+
## 14.1.70
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- @ctx-core/object: ^25.0.0 -> ^25.0.1
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @ctx-core/dom@11.4.12
|
|
17
|
+
- @ctx-core/nanostores@2.2.30
|
|
18
|
+
|
|
3
19
|
## 14.1.69
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/window",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.0",
|
|
4
4
|
"description": "ctx-core window",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ctx-core/dom": "^11.4.
|
|
27
|
+
"@ctx-core/dom": "^11.4.12",
|
|
28
28
|
"@ctx-core/function": "^21.8.0",
|
|
29
|
-
"@ctx-core/nanostores": "^2.2.
|
|
30
|
-
"@ctx-core/object": "^25.0.
|
|
29
|
+
"@ctx-core/nanostores": "^2.2.30",
|
|
30
|
+
"@ctx-core/object": "^25.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"c8": "^7.13.0",
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './hostname__.js'
|
|
2
|
-
export * from './pathname__.js'
|
|
3
|
-
export * from './window_location__.js'
|
|
4
|
-
export * from './window_location_hostname__.js'
|
|
5
|
-
export * from './window_location_pathname__.js'
|
|
1
|
+
export * from './hostname__/index.js'
|
|
2
|
+
export * from './pathname__/index.js'
|
|
3
|
+
export * from './window_location__/index.js'
|
|
4
|
+
export * from './window_location_hostname__/index.js'
|
|
5
|
+
export * from './window_location_pathname__/index.js'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WritableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
+
import type { Be } from '@ctx-core/object'
|
|
3
|
+
export declare const window_location__:Be<window_location__T>
|
|
4
|
+
export interface window_location__T extends WritableAtom_<Location|undefined> {
|
|
5
|
+
window_location__reset:()=>void;
|
|
6
|
+
}
|
|
7
|
+
export { window_location__ as window_location$_ }
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { has_dom } from '@ctx-core/dom'
|
|
2
2
|
import { atom_ } from '@ctx-core/nanostores'
|
|
3
3
|
import { assign, be_ } from '@ctx-core/object'
|
|
4
|
+
/** @type {typeof import('./index.d.ts').window_location__} */
|
|
4
5
|
export const window_location__ = be_('window_location__', ()=>{
|
|
5
6
|
const window_location_ = atom_(undefined)
|
|
6
|
-
const
|
|
7
|
+
const window_location__onpopstate__bound_ = atom_(false)
|
|
7
8
|
if (has_dom) {
|
|
8
|
-
|
|
9
|
+
window_location__reset()
|
|
9
10
|
}
|
|
10
11
|
return assign(window_location_, {
|
|
11
|
-
|
|
12
|
+
window_location__reset
|
|
12
13
|
})
|
|
13
|
-
function
|
|
14
|
+
function window_location__reset() {
|
|
14
15
|
if (!has_dom) return
|
|
15
|
-
if (!
|
|
16
|
-
|
|
17
|
-
window.addEventListener('popstate',
|
|
16
|
+
if (!window_location__onpopstate__bound_.$) {
|
|
17
|
+
window_location__onpopstate__bound_.set(true)
|
|
18
|
+
window.addEventListener('popstate', window_location__reset)
|
|
18
19
|
}
|
|
19
20
|
window_location_.set(window.location)
|
|
20
21
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { computed_ } from '@ctx-core/nanostores'
|
|
2
2
|
import { be_ } from '@ctx-core/object'
|
|
3
|
-
import { hostname__ } from '
|
|
4
|
-
import { window_location__ } from '
|
|
3
|
+
import { hostname__ } from '../hostname__/index.js'
|
|
4
|
+
import { window_location__ } from '../window_location__/index.js'
|
|
5
|
+
/** @type {typeof import('./index.d.ts').window_location_hostname__} */
|
|
5
6
|
export const window_location_hostname__ = be_('window_location_hostname__', (ctx)=>computed_([
|
|
6
7
|
hostname__(ctx),
|
|
7
8
|
window_location__(ctx),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
+
import type { Be } from '@ctx-core/object'
|
|
3
|
+
export declare const window_location_pathname__:Be<ReadableAtom_<window_location_pathname_T>>
|
|
4
|
+
export declare type window_location_pathname_T = string|undefined
|
|
5
|
+
export { window_location_pathname__ as window_location_pathname$_ }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { computed_ } from '@ctx-core/nanostores'
|
|
2
2
|
import { be_ } from '@ctx-core/object'
|
|
3
|
-
import { pathname__ } from '
|
|
4
|
-
import { window_location__ } from '
|
|
3
|
+
import { pathname__ } from '../pathname__/index.js'
|
|
4
|
+
import { window_location__ } from '../window_location__/index.js'
|
|
5
|
+
/** @type {typeof import('./index.d.ts').window_location_pathname__} */
|
|
5
6
|
export const window_location_pathname__ = be_('window_location_pathname__', ctx=>
|
|
6
7
|
computed_([
|
|
7
8
|
pathname__(ctx),
|
package/src/hostname__.d.ts
DELETED
package/src/pathname__.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type WritableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { type B } from '@ctx-core/object'
|
|
3
|
-
export declare const window_location__:B<window_location__T>
|
|
4
|
-
export interface window_location__T extends WritableAtom_<Location|undefined> {
|
|
5
|
-
reset_window_location:()=>void;
|
|
6
|
-
}
|
|
7
|
-
export { window_location__ as window_location$_ }
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type ReadableAtom_ } from '@ctx-core/nanostores'
|
|
2
|
-
import { type B } from '@ctx-core/object'
|
|
3
|
-
export declare const window_location_pathname__:B<ReadableAtom_<window_location_pathname_T>>
|
|
4
|
-
export declare type window_location_pathname_T = string|undefined;
|
|
5
|
-
export { window_location_pathname__ as window_location_pathname$_ }
|