File tree 12 files changed +34
-21
lines changed
12 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "version" : " 0.25.0 " ,
2
+ "version" : " 0.25.1 " ,
3
3
"private" : true ,
4
4
"license" : " ISC" ,
5
5
"name" : " metablock" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/cli" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " A node client for interacting with metablock cloud" ,
5
5
"main" : " dist/index.js" ,
6
6
"type" : " module" ,
12
12
"author" : " Quantmind" ,
13
13
"license" : " ISC" ,
14
14
"dependencies" : {
15
- "@metablock/core" : " ^0.25.0 " ,
15
+ "@metablock/core" : " ^0.25.1 " ,
16
16
"@rollup/plugin-node-resolve" : " ^15.0.1" ,
17
17
"archiver" : " ^5.1.0" ,
18
18
"colors" : " ^1.4.0" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/core" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " Metablock core library" ,
5
5
"type" : " module" ,
6
6
"browser" : " dist/index.js" ,
Original file line number Diff line number Diff line change
1
+ import getWindow from "../window" ;
1
2
import HttpComponent from "./httpComponent" ;
2
3
3
4
class Photos extends HttpComponent {
@@ -7,8 +8,9 @@ class Photos extends HttpComponent {
7
8
}
8
9
9
10
fromStore ( photoId : string ) : any | undefined {
10
- if ( global . window ) {
11
- const jsonStr = window . localStorage . getItem ( `photo-${ photoId } ` ) ;
11
+ const w = getWindow ( ) ;
12
+ if ( w ) {
13
+ const jsonStr = w . localStorage . getItem ( `photo-${ photoId } ` ) ;
12
14
if ( jsonStr ) return JSON . parse ( jsonStr ) ;
13
15
}
14
16
}
@@ -19,7 +21,8 @@ class Photos extends HttpComponent {
19
21
return data ;
20
22
} else {
21
23
const photo = await this . get ( photoId ) ;
22
- if ( global . window ) {
24
+ const w = getWindow ( ) ;
25
+ if ( w ) {
23
26
window . localStorage . setItem ( `photo-${ photoId } ` , JSON . stringify ( photo ) ) ;
24
27
}
25
28
return photo ;
Original file line number Diff line number Diff line change 1
- export { default as getBlock , WebBlock } from "./block" ;
1
+ export { WebBlock , default as getBlock } from "./block" ;
2
2
export * from "./cli" ;
3
3
export * from "./data" ;
4
4
export * from "./headers" ;
@@ -9,3 +9,4 @@ export { default as compileOptions } from "./options";
9
9
export { default as HttpResponse } from "./response" ;
10
10
export { default as urlQuery } from "./url" ;
11
11
export * from "./urls" ;
12
+ export { default as getWindow } from "./window" ;
Original file line number Diff line number Diff line change
1
+ import getWindow from "./window" ;
1
2
export type QueryType = Record < string , any > ;
2
3
3
4
const urlQuery = ( url : string , query : QueryType ) : string => {
4
5
if ( query ) {
5
- const u = global . window
6
- ? new URL ( url , global . window . location . origin )
7
- : new URL ( url ) ;
6
+ const w = getWindow ( ) ;
7
+ const u = w ? new URL ( url , w . location . origin ) : new URL ( url ) ;
8
8
Object . keys ( query ) . forEach ( ( key ) => {
9
9
let values = query [ key ] ;
10
10
if ( ! Array . isArray ( values ) ) values = [ values ] ;
Original file line number Diff line number Diff line change
1
+ const getWindow = ( ) => {
2
+ try {
3
+ return window ;
4
+ } catch {
5
+ return undefined ;
6
+ }
7
+ } ;
8
+
9
+ export default getWindow ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/notebook" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " Metablock Notebook" ,
5
5
"type" : " module" ,
6
6
"browser" : " dist/index.js" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/react" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " React Components for Metablock" ,
5
5
"type" : " module" ,
6
6
"browser" : " dist/index.js" ,
22
22
"@emotion/react" : " ^11.4.1" ,
23
23
"@emotion/styled" : " ^11.3.0" ,
24
24
"@loadable/component" : " ^5.14.1" ,
25
- "@metablock/core" : " ^0.25.0 " ,
26
- "@metablock/notebook" : " ^0.25.0 " ,
25
+ "@metablock/core" : " ^0.25.1 " ,
26
+ "@metablock/notebook" : " ^0.25.1 " ,
27
27
"@mui/icons-material" : " ~5.11.16" ,
28
28
"@mui/lab" : " ~5.0.0-alpha.50" ,
29
29
"@mui/material" : " ~5.13.4" ,
Original file line number Diff line number Diff line change 1
1
import React , { ReactNode } from "react" ;
2
2
3
- const NoSsr = ( props : { children : ReactNode } ) => {
4
- const { children } = props ;
3
+ const NoSsr = ( { children } : { children ? : ReactNode } ) => {
4
+ if ( ! children ) return null ;
5
5
return < > { isSsr ( ) ? null : children } </ > ;
6
6
} ;
7
7
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/server" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " Metablock dev server" ,
5
5
"main" : " dist/index.js" ,
6
6
"license" : " ISC" ,
12
12
" dev"
13
13
],
14
14
"dependencies" : {
15
- "@metablock/core" : " ^0.25.0 " ,
15
+ "@metablock/core" : " ^0.25.1 " ,
16
16
"async-lock" : " ^1.2.4" ,
17
17
"body-parser" : " ^1.19.0" ,
18
18
"btoa" : " ^1.2.1" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @metablock/store" ,
3
- "version" : " 0.25.0 " ,
3
+ "version" : " 0.25.1 " ,
4
4
"description" : " Metablock MobX store" ,
5
5
"main" : " dist/index.js" ,
6
6
"repository" : {
16
16
" store"
17
17
],
18
18
"dependencies" : {
19
- "@metablock/core" : " ^0.25.0 " ,
19
+ "@metablock/core" : " ^0.25.1 " ,
20
20
"mobx" : " ^6.0.3"
21
21
},
22
22
"scripts" : {
You can’t perform that action at this time.
0 commit comments