@orderly.network/hooks 1.1.7 → 1.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"painter.d.ts","sourceRoot":"","sources":["../../../src/services/painter/painter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,aAAa;IAOtB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,GAAG,CAA2B;IACtC,KAAK,EAAE,MAAM,CAAK;IAClB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,CAAC;gBAGJ,MAAM,EAAE,iBAAiB,EACjC,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;KACf;IAsBH,IAAI,CAAC,OAAO,EAAE,WAAW;IAInB,KAAK,CAAC,OAAO,EAAE,WAAW;CAWjC"}
1
+ {"version":3,"file":"painter.d.ts","sourceRoot":"","sources":["../../../src/services/painter/painter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,aAAa;IAOtB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,GAAG,CAA2B;IACtC,KAAK,EAAE,MAAM,CAAK;IAClB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,CAAC;gBAGJ,MAAM,EAAE,iBAAiB,EACjC,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;KACf;IA2BH,IAAI,CAAC,OAAO,EAAE,WAAW;IAInB,KAAK,CAAC,OAAO,EAAE,WAAW;CAWjC"}
@@ -10,7 +10,12 @@ export class PosterPainter {
10
10
  this.ctx = this.canvas.getContext("2d");
11
11
  this.width = this.canvas.width;
12
12
  this.height = this.canvas.height;
13
- this.ratio = options?.ratio || Math.floor(window.devicePixelRatio) || 1;
13
+ this.ratio =
14
+ options?.ratio ||
15
+ (typeof window !== "undefined"
16
+ ? Math.floor(window.devicePixelRatio)
17
+ : 1) ||
18
+ 1;
14
19
  console.log("this ratio", this.ratio);
15
20
  // render to high resolution
16
21
  this.canvas.width = this.width * this.ratio;
@@ -1 +1 @@
1
- {"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
1
+ {"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAQ1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
package/esm/useWS.js CHANGED
@@ -4,6 +4,7 @@ import { WS } from "@orderly.network/net";
4
4
  import useConstant from "use-constant";
5
5
  import { AccountStatusEnum } from "@orderly.network/types";
6
6
  import { OrderlyContext } from "./orderlyContext";
7
+ import { getGlobalObject } from "@orderly.network/utils";
7
8
  const WS_NAME = "nativeWebsocketClient";
8
9
  export const useWS = () => {
9
10
  const { configStore } = useContext(OrderlyContext);
@@ -40,7 +41,7 @@ export const useWS = () => {
40
41
  // prevAccountState.current = nextState;
41
42
  });
42
43
  if (typeof window !== "undefined") {
43
- window["__Orderly_WS"] = websocketClient;
44
+ getGlobalObject()["__Orderly_WS"] = websocketClient;
44
45
  }
45
46
  SimpleDI.registerByName(WS_NAME, websocketClient);
46
47
  }
package/esm/utils/dev.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { SimpleDI } from "@orderly.network/core";
2
+ import { getGlobalObject } from "@orderly.network/utils";
2
3
  const __ORDERLY__DEBUGER_TAG = "__ORDERLY__DEBUGER";
3
4
  function debugPrint(msg, tag) {
4
5
  tag = `${__ORDERLY__DEBUGER_TAG}:${tag} `;
5
- if (!window.__ORDERLY__DEBUGER) {
6
+ if (!getGlobalObject().__ORDERLY__DEBUGER) {
6
7
  console.log("${tag}${msg}");
7
8
  // console.info(
8
9
  // "You can add `DebugPrinter` component to see the data in your UI"
package/esm/version.d.ts CHANGED
@@ -5,6 +5,6 @@ declare global {
5
5
  };
6
6
  }
7
7
  }
8
- declare const _default: "1.1.7";
8
+ declare const _default: "1.1.8";
9
9
  export default _default;
10
10
  //# sourceMappingURL=version.d.ts.map
package/esm/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  if (typeof window !== 'undefined') {
2
2
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
3
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.7";
3
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.8";
4
4
  }
5
5
  ;
6
- export default "1.1.7";
6
+ export default "1.1.8";
@@ -1 +1 @@
1
- {"version":3,"file":"painter.d.ts","sourceRoot":"","sources":["../../../src/services/painter/painter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,aAAa;IAOtB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,GAAG,CAA2B;IACtC,KAAK,EAAE,MAAM,CAAK;IAClB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,CAAC;gBAGJ,MAAM,EAAE,iBAAiB,EACjC,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;KACf;IAsBH,IAAI,CAAC,OAAO,EAAE,WAAW;IAInB,KAAK,CAAC,OAAO,EAAE,WAAW;CAWjC"}
1
+ {"version":3,"file":"painter.d.ts","sourceRoot":"","sources":["../../../src/services/painter/painter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,aAAa;IAOtB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,GAAG,CAA2B;IACtC,KAAK,EAAE,MAAM,CAAK;IAClB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,CAAC;gBAGJ,MAAM,EAAE,iBAAiB,EACjC,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;KACf;IA2BH,IAAI,CAAC,OAAO,EAAE,WAAW;IAInB,KAAK,CAAC,OAAO,EAAE,WAAW;CAWjC"}
@@ -13,7 +13,12 @@ class PosterPainter {
13
13
  this.ctx = this.canvas.getContext("2d");
14
14
  this.width = this.canvas.width;
15
15
  this.height = this.canvas.height;
16
- this.ratio = options?.ratio || Math.floor(window.devicePixelRatio) || 1;
16
+ this.ratio =
17
+ options?.ratio ||
18
+ (typeof window !== "undefined"
19
+ ? Math.floor(window.devicePixelRatio)
20
+ : 1) ||
21
+ 1;
17
22
  console.log("this ratio", this.ratio);
18
23
  // render to high resolution
19
24
  this.canvas.width = this.width * this.ratio;
@@ -1 +1 @@
1
- {"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAO1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
1
+ {"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAQ1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
package/lib/useWS.js CHANGED
@@ -10,6 +10,7 @@ const net_1 = require("@orderly.network/net");
10
10
  const use_constant_1 = __importDefault(require("use-constant"));
11
11
  const types_1 = require("@orderly.network/types");
12
12
  const orderlyContext_1 = require("./orderlyContext");
13
+ const utils_1 = require("@orderly.network/utils");
13
14
  const WS_NAME = "nativeWebsocketClient";
14
15
  const useWS = () => {
15
16
  const { configStore } = (0, react_1.useContext)(orderlyContext_1.OrderlyContext);
@@ -46,7 +47,7 @@ const useWS = () => {
46
47
  // prevAccountState.current = nextState;
47
48
  });
48
49
  if (typeof window !== "undefined") {
49
- window["__Orderly_WS"] = websocketClient;
50
+ (0, utils_1.getGlobalObject)()["__Orderly_WS"] = websocketClient;
50
51
  }
51
52
  core_1.SimpleDI.registerByName(WS_NAME, websocketClient);
52
53
  }
package/lib/utils/dev.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@orderly.network/core");
4
+ const utils_1 = require("@orderly.network/utils");
4
5
  const __ORDERLY__DEBUGER_TAG = "__ORDERLY__DEBUGER";
5
6
  function debugPrint(msg, tag) {
6
7
  tag = `${__ORDERLY__DEBUGER_TAG}:${tag} `;
7
- if (!window.__ORDERLY__DEBUGER) {
8
+ if (!(0, utils_1.getGlobalObject)().__ORDERLY__DEBUGER) {
8
9
  console.log("${tag}${msg}");
9
10
  // console.info(
10
11
  // "You can add `DebugPrinter` component to see the data in your UI"
package/lib/version.d.ts CHANGED
@@ -5,6 +5,6 @@ declare global {
5
5
  };
6
6
  }
7
7
  }
8
- declare const _default: "1.1.7";
8
+ declare const _default: "1.1.8";
9
9
  export default _default;
10
10
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  if (typeof window !== 'undefined') {
4
4
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
5
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.7";
5
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.8";
6
6
  }
7
7
  ;
8
- exports.default = "1.1.7";
8
+ exports.default = "1.1.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orderly.network/hooks",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -27,18 +27,18 @@
27
27
  "tsup": "^7.1.0",
28
28
  "typedoc": "^0.24.8",
29
29
  "typescript": "^5.1.6",
30
- "tsconfig": "0.1.6"
30
+ "tsconfig": "0.1.7"
31
31
  },
32
32
  "dependencies": {
33
33
  "ramda": "^0.29.0",
34
34
  "swr": "^2.2.4",
35
35
  "use-constant": "^1.1.1",
36
36
  "use-debounce": "^9.0.4",
37
- "@orderly.network/perp": "2.0.6",
38
- "@orderly.network/types": "0.2.6",
39
- "@orderly.network/net": "1.1.6",
40
- "@orderly.network/core": "0.2.6",
41
- "@orderly.network/utils": "0.1.6"
37
+ "@orderly.network/utils": "0.1.7",
38
+ "@orderly.network/net": "1.1.7",
39
+ "@orderly.network/perp": "2.0.7",
40
+ "@orderly.network/types": "0.2.7",
41
+ "@orderly.network/core": "0.2.7"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"