@ctx-core/window 14.0.5 → 14.0.8
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 +23 -0
- package/ctx-core-window-14.0.8.tgz +0 -0
- package/package.json +54 -53
- package/src/hostname$_.d.ts +4 -0
- package/src/hostname$_.js +4 -0
- package/src/index.d.ts +5 -0
- package/src/{index.ts → index.js} +0 -0
- package/src/pathname$_.d.ts +5 -0
- package/src/pathname$_.js +5 -0
- package/src/window_location$_.d.ts +6 -0
- package/src/window_location$_.js +21 -0
- package/src/window_location_hostname$_.d.ts +4 -0
- package/src/window_location_hostname$_.js +9 -0
- package/src/window_location_pathname$_.d.ts +5 -0
- package/src/window_location_pathname$_.js +9 -0
- package/.swcrc +0 -10
- package/lib/hostname$_.d.ts +0 -4
- package/lib/hostname$_.js +0 -6
- package/lib/hostname$_.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -7
- package/lib/index.js.map +0 -1
- package/lib/pathname$_.d.ts +0 -5
- package/lib/pathname$_.js +0 -7
- package/lib/pathname$_.js.map +0 -1
- package/lib/window_location$_.d.ts +0 -6
- package/lib/window_location$_.js +0 -23
- package/lib/window_location$_.js.map +0 -1
- package/lib/window_location_hostname$_.d.ts +0 -4
- package/lib/window_location_hostname$_.js +0 -12
- package/lib/window_location_hostname$_.js.map +0 -1
- package/lib/window_location_pathname$_.d.ts +0 -5
- package/lib/window_location_pathname$_.js +0 -12
- package/lib/window_location_pathname$_.js.map +0 -1
- package/src/hostname$_.ts +0 -6
- package/src/pathname$_.ts +0 -7
- package/src/window_location$_.ts +0 -25
- package/src/window_location_hostname$_.ts +0 -14
- package/src/window_location_pathname$_.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ctx-core/window
|
|
2
2
|
|
|
3
|
+
## 14.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- .js + .d.ts instead of .ts
|
|
8
|
+
|
|
9
|
+
## 14.0.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- update dependencies
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @ctx-core/dom@11.1.8
|
|
16
|
+
- @ctx-core/nanostores@0.7.5
|
|
17
|
+
- @ctx-core/object@22.1.1
|
|
18
|
+
|
|
19
|
+
## 14.0.6
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @ctx-core/nanostores@0.7.0
|
|
25
|
+
|
|
3
26
|
## 14.0.5
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
2
|
+
"name": "@ctx-core/window",
|
|
3
|
+
"version": "14.0.8",
|
|
4
|
+
"description": "ctx-core window",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ctx-core",
|
|
7
|
+
"window"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/ctx-core/window#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/ctx-core/window/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/ctx-core/window.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"author": "Brian Takita",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"types": "./src/index.d.ts",
|
|
21
|
+
"svelte": "./src/index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./src/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": ":",
|
|
30
|
+
"clean": ":",
|
|
31
|
+
"exec": "$@",
|
|
32
|
+
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
33
|
+
"test": "pnpm test-unit && check-dts",
|
|
34
|
+
"test-unit": "tsm node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
|
|
35
|
+
"test-unit-coverage": "c8 pnpm test-unit"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@ctx-core/dom": "^11.1.8",
|
|
39
|
+
"@ctx-core/function": "*",
|
|
40
|
+
"@ctx-core/nanostores": "^0.7.5",
|
|
41
|
+
"@ctx-core/object": "*"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"c8": "^7.11.0",
|
|
45
|
+
"check-dts": "^0.6.6",
|
|
46
|
+
"tsm": "^2.2.1",
|
|
47
|
+
"typescript": "next",
|
|
48
|
+
"uvu": "^0.5.3"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"cache": "~/.npm"
|
|
53
|
+
},
|
|
54
|
+
"sideEffects": false
|
|
55
|
+
}
|
package/src/index.d.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WritableAtom$ } from '@ctx-core/nanostores'
|
|
2
|
+
import { 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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { has_dom } from '@ctx-core/dom'
|
|
2
|
+
import { atom$ } from '@ctx-core/nanostores'
|
|
3
|
+
import { assign, be_ } from '@ctx-core/object'
|
|
4
|
+
export const window_location$_ = be_('window_location$', ()=>{
|
|
5
|
+
const window_location$ = atom$(undefined)
|
|
6
|
+
const window_location_reload_popstate_bound$ = atom$(undefined)
|
|
7
|
+
if (has_dom) {
|
|
8
|
+
reset_window_location()
|
|
9
|
+
}
|
|
10
|
+
return assign(window_location$, {
|
|
11
|
+
reset_window_location
|
|
12
|
+
})
|
|
13
|
+
function reset_window_location() {
|
|
14
|
+
if (!has_dom) return
|
|
15
|
+
if (!window_location_reload_popstate_bound$.$) {
|
|
16
|
+
window_location_reload_popstate_bound$.set(true)
|
|
17
|
+
window.addEventListener('popstate', reset_window_location)
|
|
18
|
+
}
|
|
19
|
+
window_location$.set(window.location)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { computed$ } from '@ctx-core/nanostores'
|
|
2
|
+
import { be_ } from '@ctx-core/object'
|
|
3
|
+
import { hostname$_ } from './hostname$_.js'
|
|
4
|
+
import { window_location$_ } from './window_location$_.js'
|
|
5
|
+
export const window_location_hostname$_ = be_('window_location_hostname$', (ctx)=>computed$([
|
|
6
|
+
hostname$_(ctx),
|
|
7
|
+
window_location$_(ctx),
|
|
8
|
+
], (hostname, window_location)=>
|
|
9
|
+
window_location && window_location.hostname || hostname || ''))
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReadableAtom$ } from '@ctx-core/nanostores'
|
|
2
|
+
import { B } from '@ctx-core/object'
|
|
3
|
+
export declare const window_location_pathname$_:B<window_location_pathname$_T>
|
|
4
|
+
export declare type window_location_pathname_T = string|undefined;
|
|
5
|
+
export declare type window_location_pathname$_T = ReadableAtom$<window_location_pathname_T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { computed$ } from '@ctx-core/nanostores'
|
|
2
|
+
import { be_ } from '@ctx-core/object'
|
|
3
|
+
import { pathname$_ } from './pathname$_.js'
|
|
4
|
+
import { window_location$_ } from './window_location$_.js'
|
|
5
|
+
export const window_location_pathname$_ = be_('window_location_pathname$', (ctx)=>computed$([
|
|
6
|
+
pathname$_(ctx),
|
|
7
|
+
window_location$_(ctx),
|
|
8
|
+
], (pathname, location__window)=>
|
|
9
|
+
location__window && location__window.pathname || pathname || ''))
|
package/.swcrc
DELETED
package/lib/hostname$_.d.ts
DELETED
package/lib/hostname$_.js
DELETED
package/lib/hostname$_.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hostname$_.ts"],"sourcesContent":["import { atom$, WritableAtom$ } from '@ctx-core/nanostores'\nimport { B, be_ } from '@ctx-core/object'\nexport const hostname$_:B<hostname$_T> = be_('hostname$', ()=>\n\tatom$(undefined) as hostname$_T\n)\nexport type hostname$_T = WritableAtom$<string|undefined>\n"],"names":["atom$","be_","hostname$_","undefined"],"mappings":"AAAA,MAAM,GAAGA,KAAK,QAAuB,CAAsB;AAC3D,MAAM,GAAMC,GAAG,QAAQ,CAAkB;AACzC,MAAM,CAAC,KAAK,CAACC,UAAU,GAAkBD,GAAG,CAAC,CAAW,gBACvDD,KAAK,CAACG,SAAS"}
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './hostname$_.js'\nexport * from './pathname$_.js'\nexport * from './window_location$_.js'\nexport * from './window_location_hostname$_.js'\nexport * from './window_location_pathname$_.js'\n"],"names":[],"mappings":"cAAc,CAAiB;cACjB,CAAiB;cACjB,CAAwB;cACxB,CAAiC;cACjC,CAAiC"}
|
package/lib/pathname$_.d.ts
DELETED
package/lib/pathname$_.js
DELETED
package/lib/pathname$_.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pathname$_.ts"],"sourcesContent":["import { atom$, WritableAtom$ } from '@ctx-core/nanostores'\nimport { B, be_ } from '@ctx-core/object'\nexport const pathname$_:B<pathname$_T> = be_('pathname$', ()=>\n\tatom$(undefined) as pathname$_T\n)\nexport type pathname$_T = WritableAtom$<string|undefined>\nexport { pathname$_ as b__pathname }\n"],"names":["atom$","be_","pathname$_","undefined","b__pathname"],"mappings":"AAAA,MAAM,GAAGA,KAAK,QAAuB,CAAsB;AAC3D,MAAM,GAAMC,GAAG,QAAQ,CAAkB;AACzC,MAAM,CAAC,KAAK,CAACC,UAAU,GAAkBD,GAAG,CAAC,CAAW,gBACvDD,KAAK,CAACG,SAAS;;AAGhB,MAAM,GAAGD,UAAU,IAAIE,WAAW"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { WritableAtom$ } from '@ctx-core/nanostores';
|
|
2
|
-
import { 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
|
-
}
|
package/lib/window_location$_.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { has_dom } from '@ctx-core/dom';
|
|
2
|
-
import { atom$ } from '@ctx-core/nanostores';
|
|
3
|
-
import { assign, be_ } from '@ctx-core/object';
|
|
4
|
-
export const window_location$_ = be_('window_location$', ()=>{
|
|
5
|
-
const window_location$ = atom$(undefined);
|
|
6
|
-
const window_location_reload_popstate_bound$ = atom$(undefined);
|
|
7
|
-
if (has_dom) {
|
|
8
|
-
reset_window_location();
|
|
9
|
-
}
|
|
10
|
-
return assign(window_location$, {
|
|
11
|
-
reset_window_location
|
|
12
|
-
});
|
|
13
|
-
function reset_window_location() {
|
|
14
|
-
if (!has_dom) return;
|
|
15
|
-
if (!window_location_reload_popstate_bound$.$) {
|
|
16
|
-
window_location_reload_popstate_bound$.set(true);
|
|
17
|
-
window.addEventListener('popstate', reset_window_location);
|
|
18
|
-
}
|
|
19
|
-
window_location$.set(window.location);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=window_location$_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/window_location$_.ts"],"sourcesContent":["import { has_dom } from '@ctx-core/dom'\nimport { atom$, WritableAtom$ } from '@ctx-core/nanostores'\nimport { assign, B, be_ } from '@ctx-core/object'\nexport const window_location$_:B<window_location$_T> = be_('window_location$', ()=>{\n\tconst window_location$ = atom$<Location|undefined>(undefined)\n\tconst window_location_reload_popstate_bound$ =\n\t\tatom$(undefined) as WritableAtom$<boolean|undefined>\n\tif (has_dom) {\n\t\treset_window_location()\n\t}\n\treturn assign(window_location$, { reset_window_location }) as window_location$_T\n\tfunction reset_window_location() {\n\t\tif (!has_dom) return\n\t\tif (!window_location_reload_popstate_bound$.$) {\n\t\t\twindow_location_reload_popstate_bound$.set(true)\n\t\t\twindow.addEventListener(\n\t\t\t\t'popstate',\n\t\t\t\treset_window_location)\n\t\t}\n\t\twindow_location$.set(window.location)\n\t}\n})\nexport interface window_location$_T extends WritableAtom$<Location|undefined> {\n\treset_window_location:()=>void\n}\n"],"names":["has_dom","atom$","assign","be_","window_location$_","window_location$","undefined","window_location_reload_popstate_bound$","reset_window_location","$","set","window","addEventListener","location"],"mappings":"AAAA,MAAM,GAAGA,OAAO,QAAQ,CAAe;AACvC,MAAM,GAAGC,KAAK,QAAuB,CAAsB;AAC3D,MAAM,GAAGC,MAAM,EAAKC,GAAG,QAAQ,CAAkB;AACjD,MAAM,CAAC,KAAK,CAACC,iBAAiB,GAAyBD,GAAG,CAAC,CAAkB,uBAAM,CAAC;IACnF,KAAK,CAACE,gBAAgB,GAAGJ,KAAK,CAAqBK,SAAS;IAC5D,KAAK,CAACC,sCAAsC,GAC3CN,KAAK,CAACK,SAAS;IAChB,EAAE,EAAEN,OAAO,EAAE,CAAC;QACbQ,qBAAqB;IACtB,CAAC;IACD,MAAM,CAACN,MAAM,CAACG,gBAAgB,EAAE,CAAC;QAACG,qBAAqB;IAAC,CAAC;aAChDA,qBAAqB,GAAG,CAAC;QACjC,EAAE,GAAGR,OAAO,EAAE,MAAM;QACpB,EAAE,GAAGO,sCAAsC,CAACE,CAAC,EAAE,CAAC;YAC/CF,sCAAsC,CAACG,GAAG,CAAC,IAAI;YAC/CC,MAAM,CAACC,gBAAgB,CACtB,CAAU,WACVJ,qBAAqB;QACvB,CAAC;QACDH,gBAAgB,CAACK,GAAG,CAACC,MAAM,CAACE,QAAQ;IACrC,CAAC;AACF,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { computed$ } from '@ctx-core/nanostores';
|
|
2
|
-
import { be_ } from '@ctx-core/object';
|
|
3
|
-
import { hostname$_ } from './hostname$_.js';
|
|
4
|
-
import { window_location$_ } from './window_location$_.js';
|
|
5
|
-
export const window_location_hostname$_ = be_('window_location_hostname$', (ctx)=>computed$([
|
|
6
|
-
hostname$_(ctx),
|
|
7
|
-
window_location$_(ctx),
|
|
8
|
-
], (hostname, window_location)=>window_location && window_location.hostname || hostname || ''
|
|
9
|
-
)
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=window_location_hostname$_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/window_location_hostname$_.ts"],"sourcesContent":["import { computed$, ReadableAtom$ } from '@ctx-core/nanostores'\nimport { B, be_ } from '@ctx-core/object'\nimport { hostname$_ } from './hostname$_.js'\nimport { window_location$_ } from './window_location$_.js'\nexport const window_location_hostname$_:B<window_location_hostname$_T> = be_('window_location_hostname$', ctx=>\n\tcomputed$([\n\t\t\thostname$_(ctx),\n\t\t\twindow_location$_(ctx),\n\t\t],\n\t\t(hostname, window_location)=>\n\t\t\t(window_location && (window_location as Location).hostname) || hostname || ''\n\t) as window_location_hostname$_T\n)\nexport type window_location_hostname$_T = ReadableAtom$<string|undefined>\n"],"names":["computed$","be_","hostname$_","window_location$_","window_location_hostname$_","ctx","hostname","window_location"],"mappings":"AAAA,MAAM,GAAGA,SAAS,QAAuB,CAAsB;AAC/D,MAAM,GAAMC,GAAG,QAAQ,CAAkB;AACzC,MAAM,GAAGC,UAAU,QAAQ,CAAiB;AAC5C,MAAM,GAAGC,iBAAiB,QAAQ,CAAwB;AAC1D,MAAM,CAAC,KAAK,CAACC,0BAA0B,GAAkCH,GAAG,CAAC,CAA2B,6BAAEI,GAAG,GAC5GL,SAAS,CAAC,CAAC;QACTE,UAAU,CAACG,GAAG;QACdF,iBAAiB,CAACE,GAAG;IACtB,CAAC,GACAC,QAAQ,EAAEC,eAAe,GACxBA,eAAe,IAAKA,eAAe,CAAcD,QAAQ,IAAKA,QAAQ,IAAI,CAAE"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReadableAtom$ } from '@ctx-core/nanostores';
|
|
2
|
-
import { B } from '@ctx-core/object';
|
|
3
|
-
export declare const window_location_pathname$_: B<window_location_pathname$_T>;
|
|
4
|
-
export declare type window_location_pathname_T = string | undefined;
|
|
5
|
-
export declare type window_location_pathname$_T = ReadableAtom$<window_location_pathname_T>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { computed$ } from '@ctx-core/nanostores';
|
|
2
|
-
import { be_ } from '@ctx-core/object';
|
|
3
|
-
import { pathname$_ } from './pathname$_.js';
|
|
4
|
-
import { window_location$_ } from './window_location$_.js';
|
|
5
|
-
export const window_location_pathname$_ = be_('window_location_pathname$', (ctx)=>computed$([
|
|
6
|
-
pathname$_(ctx),
|
|
7
|
-
window_location$_(ctx),
|
|
8
|
-
], (pathname, location__window)=>location__window && location__window.pathname || pathname || ''
|
|
9
|
-
)
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=window_location_pathname$_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/window_location_pathname$_.ts"],"sourcesContent":["import { computed$, ReadableAtom$ } from '@ctx-core/nanostores'\nimport { B, be_ } from '@ctx-core/object'\nimport { pathname$_ } from './pathname$_.js'\nimport { window_location$_ } from './window_location$_.js'\nexport const window_location_pathname$_:B<window_location_pathname$_T> = be_('window_location_pathname$', ctx=>\n\tcomputed$([\n\t\t\tpathname$_(ctx),\n\t\t\twindow_location$_(ctx),\n\t\t],\n\t\t(pathname, location__window)=>\n\t\t\t(location__window && (location__window as Location).pathname)\n\t\t\t|| pathname\n\t\t\t|| ''\n\t) as window_location_pathname$_T\n)\nexport type window_location_pathname_T = string|undefined\nexport type window_location_pathname$_T = ReadableAtom$<window_location_pathname_T>\n"],"names":["computed$","be_","pathname$_","window_location$_","window_location_pathname$_","ctx","pathname","location__window"],"mappings":"AAAA,MAAM,GAAGA,SAAS,QAAuB,CAAsB;AAC/D,MAAM,GAAMC,GAAG,QAAQ,CAAkB;AACzC,MAAM,GAAGC,UAAU,QAAQ,CAAiB;AAC5C,MAAM,GAAGC,iBAAiB,QAAQ,CAAwB;AAC1D,MAAM,CAAC,KAAK,CAACC,0BAA0B,GAAkCH,GAAG,CAAC,CAA2B,6BAAEI,GAAG,GAC5GL,SAAS,CAAC,CAAC;QACTE,UAAU,CAACG,GAAG;QACdF,iBAAiB,CAACE,GAAG;IACtB,CAAC,GACAC,QAAQ,EAAEC,gBAAgB,GACzBA,gBAAgB,IAAKA,gBAAgB,CAAcD,QAAQ,IACzDA,QAAQ,IACR,CAAE"}
|
package/src/hostname$_.ts
DELETED
package/src/pathname$_.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { atom$, WritableAtom$ } from '@ctx-core/nanostores'
|
|
2
|
-
import { B, be_ } from '@ctx-core/object'
|
|
3
|
-
export const pathname$_:B<pathname$_T> = be_('pathname$', ()=>
|
|
4
|
-
atom$(undefined) as pathname$_T
|
|
5
|
-
)
|
|
6
|
-
export type pathname$_T = WritableAtom$<string|undefined>
|
|
7
|
-
export { pathname$_ as b__pathname }
|
package/src/window_location$_.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { has_dom } from '@ctx-core/dom'
|
|
2
|
-
import { atom$, WritableAtom$ } from '@ctx-core/nanostores'
|
|
3
|
-
import { assign, B, be_ } from '@ctx-core/object'
|
|
4
|
-
export const window_location$_:B<window_location$_T> = be_('window_location$', ()=>{
|
|
5
|
-
const window_location$ = atom$<Location|undefined>(undefined)
|
|
6
|
-
const window_location_reload_popstate_bound$ =
|
|
7
|
-
atom$(undefined) as WritableAtom$<boolean|undefined>
|
|
8
|
-
if (has_dom) {
|
|
9
|
-
reset_window_location()
|
|
10
|
-
}
|
|
11
|
-
return assign(window_location$, { reset_window_location }) as window_location$_T
|
|
12
|
-
function reset_window_location() {
|
|
13
|
-
if (!has_dom) return
|
|
14
|
-
if (!window_location_reload_popstate_bound$.$) {
|
|
15
|
-
window_location_reload_popstate_bound$.set(true)
|
|
16
|
-
window.addEventListener(
|
|
17
|
-
'popstate',
|
|
18
|
-
reset_window_location)
|
|
19
|
-
}
|
|
20
|
-
window_location$.set(window.location)
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
export interface window_location$_T extends WritableAtom$<Location|undefined> {
|
|
24
|
-
reset_window_location:()=>void
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { computed$, ReadableAtom$ } from '@ctx-core/nanostores'
|
|
2
|
-
import { B, be_ } from '@ctx-core/object'
|
|
3
|
-
import { hostname$_ } from './hostname$_.js'
|
|
4
|
-
import { window_location$_ } from './window_location$_.js'
|
|
5
|
-
export const window_location_hostname$_:B<window_location_hostname$_T> = be_('window_location_hostname$', ctx=>
|
|
6
|
-
computed$([
|
|
7
|
-
hostname$_(ctx),
|
|
8
|
-
window_location$_(ctx),
|
|
9
|
-
],
|
|
10
|
-
(hostname, window_location)=>
|
|
11
|
-
(window_location && (window_location as Location).hostname) || hostname || ''
|
|
12
|
-
) as window_location_hostname$_T
|
|
13
|
-
)
|
|
14
|
-
export type window_location_hostname$_T = ReadableAtom$<string|undefined>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { computed$, ReadableAtom$ } from '@ctx-core/nanostores'
|
|
2
|
-
import { B, be_ } from '@ctx-core/object'
|
|
3
|
-
import { pathname$_ } from './pathname$_.js'
|
|
4
|
-
import { window_location$_ } from './window_location$_.js'
|
|
5
|
-
export const window_location_pathname$_:B<window_location_pathname$_T> = be_('window_location_pathname$', ctx=>
|
|
6
|
-
computed$([
|
|
7
|
-
pathname$_(ctx),
|
|
8
|
-
window_location$_(ctx),
|
|
9
|
-
],
|
|
10
|
-
(pathname, location__window)=>
|
|
11
|
-
(location__window && (location__window as Location).pathname)
|
|
12
|
-
|| pathname
|
|
13
|
-
|| ''
|
|
14
|
-
) as window_location_pathname$_T
|
|
15
|
-
)
|
|
16
|
-
export type window_location_pathname_T = string|undefined
|
|
17
|
-
export type window_location_pathname$_T = ReadableAtom$<window_location_pathname_T>
|