@ctx-core/window 15.1.15 → 15.1.20

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.
@@ -1,8 +1,8 @@
1
- import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
1
+ import type { be_computed_pair_T } from '@ctx-core/nanostores'
2
2
  export declare const [
3
3
  hostname$_,
4
4
  hostname_,
5
- ]:val__be_computed_pair_T<string>
5
+ ]:be_computed_pair_T<string>
6
6
  export {
7
7
  hostname$_ as hostname__,
8
8
  hostname$_ as window_location_hostname__,
package/hostname/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { nullish__none_ } from '@ctx-core/function'
2
- import { val__be_computed_pair_ } from '@ctx-core/nanostores'
2
+ import { be_computed_pair_ } from '@ctx-core/nanostores'
3
3
  import { window_location_ } from '../window_location/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx}Ctx */
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
- ] = val__be_computed_pair_('hostname$_', ctx=>
9
+ ] = be_computed_pair_(ctx=>
10
10
  nullish__none_([window_location_(ctx)], window_location=>
11
11
  window_location.hostname))
12
+ .config({ id: 'hostname' })
12
13
  export {
13
14
  hostname$_ as hostname__,
14
15
  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.15",
3
+ "version": "15.1.20",
4
4
  "description": "ctx-core window",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -31,15 +31,15 @@
31
31
  "./package.json": "./package.json"
32
32
  },
33
33
  "dependencies": {
34
- "@ctx-core/dom": "^15.1.15",
35
- "@ctx-core/function": "^21.22.10",
36
- "@ctx-core/nanostores": "^7.1.16",
37
- "@ctx-core/object": "^30.4.7"
34
+ "@ctx-core/dom": "^15.1.18",
35
+ "@ctx-core/function": "^21.22.13",
36
+ "@ctx-core/nanostores": "^9.0.2",
37
+ "@ctx-core/object": "^31.0.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "c8": "^8.0.1",
41
41
  "check-dts": "^0.7.2",
42
- "tsx": "^4.1.3",
42
+ "tsx": "^4.1.4",
43
43
  "typescript": "next",
44
44
  "uvu": "^0.5.6"
45
45
  },
@@ -1,8 +1,8 @@
1
- import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
1
+ import type { be_computed_pair_T } from '@ctx-core/nanostores'
2
2
  export declare const [
3
3
  pathname$_,
4
4
  pathname_,
5
- ]:val__be_computed_pair_T<string>
5
+ ]:be_computed_pair_T<string>
6
6
  export {
7
7
  pathname$_ as pathname__,
8
8
  pathname$_ as b__pathname,
package/pathname/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { nullish__none_ } from '@ctx-core/function'
2
- import { val__be_computed_pair_ } from '@ctx-core/nanostores'
2
+ import { be_computed_pair_ } from '@ctx-core/nanostores'
3
3
  import { window_location_ } from '../window_location/index.js'
4
- /** @typedef {import('@ctx-core/object').Ctx}Ctx */
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
- ] = val__be_computed_pair_('pathname$_', ctx=>
9
+ ] = be_computed_pair_(ctx=>
10
10
  nullish__none_([window_location_(ctx)], window_location=>
11
11
  window_location.pathname))
12
+ .config({ id: 'pathname' })
12
13
  export {
13
14
  pathname$_ as pathname__,
14
15
  pathname$_ as b__pathname,
@@ -1,8 +1,8 @@
1
- import type { val__be_computed_pair_T } from '@ctx-core/nanostores'
1
+ import type { be_computed_pair_T } from '@ctx-core/nanostores'
2
2
  import type { Ctx } from '@ctx-core/object'
3
3
  export declare const [
4
4
  window_location$_,
5
5
  window_location_,
6
- ]:val__be_computed_pair_T<Location>
6
+ ]:be_computed_pair_T<Location>
7
7
  export { window_location$_ as window_location__ }
8
8
  export declare function window_location__reset(ctx:Ctx):void
@@ -1,24 +1,28 @@
1
1
  import { has_dom, no_dom } from '@ctx-core/dom'
2
- import { atom_, val__be_computed_pair_ } from '@ctx-core/nanostores'
2
+ import { atom_, be_computed_pair_, onMount } from '@ctx-core/nanostores'
3
3
  import { be_ } from '@ctx-core/object'
4
4
  const window_location__atom$_ = be_(()=>
5
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 */
6
+ /** @typedef {import('@ctx-core/object').be_atom_triple_T} */
7
+ /** @typedef {import('@ctx-core/nanostores').WritableAtom_} */
8
+ /** @typedef {import('@ctx-core/object').Be} */
9
+ /** @typedef {import('@ctx-core/object').Ctx} */
9
10
  /** @type {typeof import('./index.d.ts').window_location$_} */
10
11
  export const [
11
12
  window_location$_,
12
13
  window_location_,
13
- ] = val__be_computed_pair_('window_location$_', ctx=>{
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
- })
14
+ ] = /** @type {be_computed_pair_T<Location>} */ be_computed_pair_(ctx=>
15
+ window_location__atom$_(ctx))
16
+ .config({ id: 'window_location' })
17
+ .oninit((ctx, window_location$)=>{
18
+ if (has_dom) {
19
+ let onpopstate = ()=>window_location__reset(ctx)
20
+ onMount(window_location$, ()=>{
21
+ window.addEventListener('popstate', onpopstate)
22
+ return ()=>window.removeEventListener('popstate', onpopstate)
23
+ })
24
+ }
25
+ })
22
26
  export { window_location$_ as window_location__ }
23
27
  /**
24
28
  * @param {Ctx}ctx