@aiszlab/relax 1.2.46 → 1.2.48

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,5 +1,6 @@
1
1
  import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { useState } from 'react';
3
+ import { isDomUsable } from '../is/is-dom-usable.js';
3
4
 
4
5
  /**
5
6
  * @description
@@ -7,7 +8,10 @@ import { useState } from 'react';
7
8
  * in different device, ratio
8
9
  */
9
10
  var useDevicePixelRatio = function useDevicePixelRatio() {
10
- var _useState = useState(window.devicePixelRatio),
11
+ var _useState = useState(function () {
12
+ if (!isDomUsable()) return 1;
13
+ return window.devicePixelRatio;
14
+ }),
11
15
  _useState2 = _slicedToArray(_useState, 1),
12
16
  devicePixelRatio = _useState2[0];
13
17
  return devicePixelRatio;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.46",
3
+ "version": "1.2.48",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {