@ctx-core/window 15.1.76 → 16.0.1
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.d.ts +2 -2
- package/hostname/index.js +2 -2
- package/package.json +9 -9
- package/pathname/index.d.ts +2 -2
- package/pathname/index.js +6 -6
- package/window_location/index.d.ts +2 -2
- package/window_location/index.js +15 -17
package/hostname/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { be_memo_pair_T } from 'ctx-core/rmemo'
|
|
2
2
|
export declare const [
|
|
3
3
|
hostname$_,
|
|
4
4
|
hostname_,
|
|
5
|
-
]:
|
|
5
|
+
]:be_memo_pair_T<string>
|
|
6
6
|
export {
|
|
7
7
|
hostname$_ as hostname__,
|
|
8
8
|
hostname$_ as window_location_hostname__,
|
package/hostname/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="ctx-core" />
|
|
2
2
|
/// <reference types="./index.d.ts" />
|
|
3
|
-
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
4
3
|
import { nullish__none_ } from 'ctx-core/function'
|
|
4
|
+
import { be_memo_pair_ } from 'ctx-core/rmemo'
|
|
5
5
|
import { window_location$_ } from '../window_location/index.js'
|
|
6
6
|
/** @type {typeof hostname$_} */
|
|
7
7
|
export const [
|
|
8
8
|
hostname$_,
|
|
9
9
|
hostname_,
|
|
10
|
-
] =
|
|
10
|
+
] = be_memo_pair_(
|
|
11
11
|
ctx=>window_location$_(ctx),
|
|
12
12
|
window_location=>nullish__none_([window_location], ()=>
|
|
13
13
|
window_location.hostname),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/window",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"description": "ctx-core window",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"*.d.ts",
|
|
22
22
|
"*.js",
|
|
23
23
|
"*.json",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
24
|
+
"hostname",
|
|
25
|
+
"pathname",
|
|
26
|
+
"window_location"
|
|
27
27
|
],
|
|
28
28
|
"types": "./index.d.ts",
|
|
29
29
|
"exports": {
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"./package.json": "./package.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ctx-core/dom": "^15.
|
|
35
|
-
"@ctx-core/nanostores": "^10.0.14",
|
|
34
|
+
"@ctx-core/dom": "^15.2.0",
|
|
36
35
|
"ctx-core": "^5.5.0"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
@@ -51,8 +50,9 @@
|
|
|
51
50
|
"build": ":",
|
|
52
51
|
"clean": ":",
|
|
53
52
|
"exec": "$@",
|
|
54
|
-
"test": "pnpm test
|
|
55
|
-
"test
|
|
56
|
-
"test
|
|
53
|
+
"test": "pnpm test:unit && pnpm test:types",
|
|
54
|
+
"test:types": "check-dts",
|
|
55
|
+
"test:unit": "tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
|
|
56
|
+
"test:unit:coverage": "c8 pnpm test:unit"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/pathname/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { be_memo_pair_T } from 'ctx-core/rmemo'
|
|
2
2
|
export declare const [
|
|
3
3
|
pathname$_,
|
|
4
4
|
pathname_,
|
|
5
|
-
]:
|
|
5
|
+
]:be_memo_pair_T<string>
|
|
6
6
|
export {
|
|
7
7
|
pathname$_ as pathname__,
|
|
8
8
|
pathname$_ as b__pathname,
|
package/pathname/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference types="ctx-core" />
|
|
2
2
|
/// <reference types="./index.d.ts" />
|
|
3
|
-
import { be_computed_pair_ } from '@ctx-core/nanostores'
|
|
4
3
|
import { nullish__none_ } from 'ctx-core/function'
|
|
5
|
-
import {
|
|
4
|
+
import { be_memo_pair_ } from 'ctx-core/rmemo'
|
|
5
|
+
import { window_location_ } from '../window_location/index.js'
|
|
6
6
|
/** @typedef {Ctx} */
|
|
7
7
|
/** @type {typeof pathname$_} */
|
|
8
8
|
export const [
|
|
9
9
|
pathname$_,
|
|
10
10
|
pathname_,
|
|
11
|
-
] =
|
|
12
|
-
ctx=>
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
] = be_memo_pair_(
|
|
12
|
+
ctx=>
|
|
13
|
+
nullish__none_([window_location_(ctx)], window_location=>
|
|
14
|
+
window_location.pathname),
|
|
15
15
|
{ id: 'pathname' })
|
|
16
16
|
export {
|
|
17
17
|
pathname$_ as pathname__,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { be_memo_pair_T } from 'ctx-core/rmemo'
|
|
2
2
|
import type { Ctx } from 'ctx-core/be'
|
|
3
3
|
export declare const [
|
|
4
4
|
window_location$_,
|
|
5
5
|
window_location_,
|
|
6
|
-
]:
|
|
6
|
+
]:be_memo_pair_T<Location>
|
|
7
7
|
export { window_location$_ as window_location__ }
|
|
8
8
|
export declare function window_location__reset(ctx:Ctx):void
|
package/window_location/index.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
/// <reference types="ctx-core" />
|
|
2
|
+
/// <reference types="./index.d.ts" />
|
|
2
3
|
import { has_dom, no_dom } from '@ctx-core/dom'
|
|
3
|
-
import { atom_, be_computed_pair_, computed_, onMount } from '@ctx-core/nanostores'
|
|
4
4
|
import { be_ } from 'ctx-core/be'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** @type {typeof
|
|
5
|
+
import { be_memo_pair_, memo_, sig_ } from 'ctx-core/rmemo'
|
|
6
|
+
const window_location__sig$_ = be_(()=>
|
|
7
|
+
sig_())
|
|
8
|
+
/** @type {typeof window_location$_} */
|
|
9
9
|
export const [
|
|
10
10
|
window_location$_,
|
|
11
11
|
window_location_,
|
|
12
|
-
] = /** @type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
] = /** @type {be_memo_pair_T<Location>} */ be_memo_pair_(be_(ctx=>
|
|
13
|
+
memo_(()=>
|
|
14
|
+
window_location__sig$_(ctx)(),
|
|
15
|
+
()=>{
|
|
16
|
+
if (has_dom) {
|
|
17
|
+
let onpopstate = ()=>window_location__reset(ctx)
|
|
18
18
|
window.addEventListener('popstate', onpopstate)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return window_location$
|
|
23
|
-
}, { id: 'window_location' }))
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
{ id: 'window_location' }))
|
|
24
22
|
export { window_location$_ as window_location__ }
|
|
25
23
|
/**
|
|
26
24
|
* @param {Ctx}ctx
|
|
27
25
|
*/
|
|
28
26
|
export function window_location__reset(ctx) {
|
|
29
27
|
if (no_dom) return
|
|
30
|
-
|
|
28
|
+
window_location__sig$_(ctx)._ = window.location
|
|
31
29
|
}
|