@ctx-core/window 14.0.7 → 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.
Files changed (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/ctx-core-window-14.0.8.tgz +0 -0
  3. package/package.json +15 -15
  4. package/src/hostname$_.d.ts +4 -0
  5. package/src/hostname$_.js +4 -0
  6. package/src/index.d.ts +5 -0
  7. package/src/{index.ts → index.js} +0 -0
  8. package/src/pathname$_.d.ts +5 -0
  9. package/src/pathname$_.js +5 -0
  10. package/src/window_location$_.d.ts +6 -0
  11. package/src/window_location$_.js +21 -0
  12. package/src/window_location_hostname$_.d.ts +4 -0
  13. package/src/window_location_hostname$_.js +9 -0
  14. package/src/window_location_pathname$_.d.ts +5 -0
  15. package/src/window_location_pathname$_.js +9 -0
  16. package/.swcrc +0 -10
  17. package/ctx-core-window-14.0.7.tgz +0 -0
  18. package/lib/hostname$_.d.ts +0 -4
  19. package/lib/hostname$_.js +0 -6
  20. package/lib/hostname$_.js.map +0 -1
  21. package/lib/index.d.ts +0 -5
  22. package/lib/index.js +0 -7
  23. package/lib/index.js.map +0 -1
  24. package/lib/pathname$_.d.ts +0 -5
  25. package/lib/pathname$_.js +0 -7
  26. package/lib/pathname$_.js.map +0 -1
  27. package/lib/window_location$_.d.ts +0 -6
  28. package/lib/window_location$_.js +0 -23
  29. package/lib/window_location$_.js.map +0 -1
  30. package/lib/window_location_hostname$_.d.ts +0 -4
  31. package/lib/window_location_hostname$_.js +0 -12
  32. package/lib/window_location_hostname$_.js.map +0 -1
  33. package/lib/window_location_pathname$_.d.ts +0 -5
  34. package/lib/window_location_pathname$_.js +0 -12
  35. package/lib/window_location_pathname$_.js.map +0 -1
  36. package/src/hostname$_.ts +0 -6
  37. package/src/pathname$_.ts +0 -7
  38. package/src/window_location$_.ts +0 -25
  39. package/src/window_location_hostname$_.ts +0 -14
  40. package/src/window_location_pathname$_.ts +0 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ctx-core/window
2
2
 
3
+ ## 14.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - .js + .d.ts instead of .ts
8
+
3
9
  ## 14.0.7
4
10
 
5
11
  ### Patch Changes
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/window",
3
- "version": "14.0.7",
3
+ "version": "14.0.8",
4
4
  "description": "ctx-core window",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -17,22 +17,22 @@
17
17
  "license": "Apache-2.0",
18
18
  "author": "Brian Takita",
19
19
  "type": "module",
20
- "types": "./lib/index.d.ts",
20
+ "types": "./src/index.d.ts",
21
+ "svelte": "./src/index.js",
21
22
  "exports": {
22
23
  ".": {
23
- "import": "./lib/index.js"
24
+ "import": "./src/index.js"
24
25
  },
25
26
  "./package.json": "./package.json"
26
27
  },
27
28
  "scripts": {
28
- "build": "npm run compile",
29
- "clean": "rimraf lib && npm run clean:tsbuildinfo",
30
- "clean:tsbuildinfo": "rimraf tsconfig.tsbuildinfo && rimraf lib/**/*.d.ts",
31
- "compile": "npm run compile:source && npm run compile:declaration",
32
- "compile:source": "swc src --out-dir lib --copy-files --source-maps --config-file .swcrc",
33
- "compile:declaration": "npm run clean:tsbuildinfo && tsc --declaration --emitDeclarationOnly --declarationDir lib",
29
+ "build": ":",
30
+ "clean": ":",
34
31
  "exec": "$@",
35
- "prepublishOnly": "npm run clean && npm run build"
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
36
  },
37
37
  "dependencies": {
38
38
  "@ctx-core/dom": "^11.1.8",
@@ -41,15 +41,15 @@
41
41
  "@ctx-core/object": "*"
42
42
  },
43
43
  "devDependencies": {
44
- "@swc/cli": "^0.1.55",
45
- "@swc/core": "^1.2.147",
46
- "rimraf": "^3.0.2",
47
- "typescript": "next"
44
+ "c8": "^7.11.0",
45
+ "check-dts": "^0.6.6",
46
+ "tsm": "^2.2.1",
47
+ "typescript": "next",
48
+ "uvu": "^0.5.3"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public",
51
52
  "cache": "~/.npm"
52
53
  },
53
- "svelte": "./lib/index.js",
54
54
  "sideEffects": false
55
55
  }
@@ -0,0 +1,4 @@
1
+ import { WritableAtom$ } from '@ctx-core/nanostores'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const hostname$_:B<hostname$_T>
4
+ export declare type hostname$_T = WritableAtom$<string|undefined>;
@@ -0,0 +1,4 @@
1
+ import { atom$ } from '@ctx-core/nanostores'
2
+ import { be_ } from '@ctx-core/object'
3
+ export const hostname$_ = be_('hostname$', ()=>
4
+ atom$(undefined))
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './hostname$_'
2
+ export * from './pathname$_'
3
+ export * from './window_location$_'
4
+ export * from './window_location_hostname$_'
5
+ export * from './window_location_pathname$_'
File without changes
@@ -0,0 +1,5 @@
1
+ import { WritableAtom$ } from '@ctx-core/nanostores'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const pathname$_:B<pathname$_T>
4
+ export declare type pathname$_T = WritableAtom$<string|undefined>;
5
+ export { pathname$_ as b__pathname }
@@ -0,0 +1,5 @@
1
+ import { atom$ } from '@ctx-core/nanostores'
2
+ import { be_ } from '@ctx-core/object'
3
+ export const pathname$_ = be_('pathname$',
4
+ ()=>atom$(undefined))
5
+ export { pathname$_ as b__pathname }
@@ -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,4 @@
1
+ import { ReadableAtom$ } from '@ctx-core/nanostores'
2
+ import { B } from '@ctx-core/object'
3
+ export declare const window_location_hostname$_:B<window_location_hostname$_T>
4
+ export declare type window_location_hostname$_T = ReadableAtom$<string|undefined>;
@@ -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
@@ -1,10 +0,0 @@
1
- {
2
- "jsc": {
3
- "target": "es2020",
4
- "parser": {
5
- "syntax": "typescript",
6
- "tsx": true,
7
- "dynamicImport": true
8
- }
9
- }
10
- }
Binary file
@@ -1,4 +0,0 @@
1
- import { WritableAtom$ } from '@ctx-core/nanostores';
2
- import { B } from '@ctx-core/object';
3
- export declare const hostname$_: B<hostname$_T>;
4
- export declare type hostname$_T = WritableAtom$<string | undefined>;
package/lib/hostname$_.js DELETED
@@ -1,6 +0,0 @@
1
- import { atom$ } from '@ctx-core/nanostores';
2
- import { be_ } from '@ctx-core/object';
3
- export const hostname$_ = be_('hostname$', ()=>atom$(undefined)
4
- );
5
-
6
- //# sourceMappingURL=hostname$_.js.map
@@ -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
@@ -1,5 +0,0 @@
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';
package/lib/index.js DELETED
@@ -1,7 +0,0 @@
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';
6
-
7
- //# sourceMappingURL=index.js.map
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"}
@@ -1,5 +0,0 @@
1
- import { WritableAtom$ } from '@ctx-core/nanostores';
2
- import { B } from '@ctx-core/object';
3
- export declare const pathname$_: B<pathname$_T>;
4
- export declare type pathname$_T = WritableAtom$<string | undefined>;
5
- export { pathname$_ as b__pathname };
package/lib/pathname$_.js DELETED
@@ -1,7 +0,0 @@
1
- import { atom$ } from '@ctx-core/nanostores';
2
- import { be_ } from '@ctx-core/object';
3
- export const pathname$_ = be_('pathname$', ()=>atom$(undefined)
4
- );
5
- export { pathname$_ as b__pathname };
6
-
7
- //# sourceMappingURL=pathname$_.js.map
@@ -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
- }
@@ -1,23 +0,0 @@
1
- import { has_dom } from '@ctx-core/dom';
2
- import { atom$, WritableAtom$ } 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$","WritableAtom$","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,EAAEC,aAAa,QAAQ,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,GAAGL,KAAK,CAAqBM,SAAS;IAC5D,KAAK,CAACC,sCAAsC,GAC3CP,KAAK,CAACM,SAAS;IAChB,EAAE,EAAEP,OAAO,EAAE,CAAC;QACbS,qBAAqB,E;IACtB,CAAC;IACD,MAAM,CAACN,MAAM,CAACG,gBAAgB,EAAE,CAAC;QAACG,qBAAqB;IAAC,CAAC;aAChDA,qBAAqB,GAAG,CAAC;QACjC,EAAE,GAAGT,OAAO,EAAE,MAAM;QACpB,EAAE,GAAGQ,sCAAsC,CAACE,CAAC,EAAE,CAAC;YAC/CF,sCAAsC,CAACG,GAAG,CAAC,IAAI,C;YAC/CC,MAAM,CAACC,gBAAgB,CACtB,CAAU,WACVJ,qBAAqB,C;QACvB,CAAC;QACDH,gBAAgB,CAACK,GAAG,CAACC,MAAM,CAACE,QAAQ,C;IACrC,CAAC;AACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { ReadableAtom$ } from '@ctx-core/nanostores';
2
- import { B } from '@ctx-core/object';
3
- export declare const window_location_hostname$_: B<window_location_hostname$_T>;
4
- export declare type window_location_hostname$_T = ReadableAtom$<string | undefined>;
@@ -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
@@ -1,6 +0,0 @@
1
- import { atom$, WritableAtom$ } from '@ctx-core/nanostores'
2
- import { B, be_ } from '@ctx-core/object'
3
- export const hostname$_:B<hostname$_T> = be_('hostname$', ()=>
4
- atom$(undefined) as hostname$_T
5
- )
6
- export type hostname$_T = WritableAtom$<string|undefined>
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 }
@@ -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>