@onehat/ui 0.2.24 → 0.2.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,12 +1,12 @@
1
- import { isBrowser, isNode, isWebWorker, } from '../Functions/PlatformDetector.js';
1
+ import { isReactNative, isBrowser, isWebWorker, } from '../Functions/PlatformDetector.js';
2
2
 
3
3
 
4
4
  export const UI_MODE_WEB = 'Web';
5
5
  export const UI_MODE_REACT_NATIVE = 'ReactNative';
6
6
 
7
7
  export let CURRENT_MODE;
8
- if (isBrowser || isWebWorker) {
9
- CURRENT_MODE = UI_MODE_WEB;
10
- } else if (isNode) {
8
+ if (isReactNative) {
11
9
  CURRENT_MODE = UI_MODE_REACT_NATIVE;
10
+ } else if (isBrowser || isWebWorker) {
11
+ CURRENT_MODE = UI_MODE_WEB;
12
12
  }
@@ -1,4 +1,7 @@
1
- // Taken from https://github.com/flexdinesh/browser-or-node/blob/master/src/index.js
1
+ // Based on https://github.com/flexdinesh/browser-or-node/blob/master/src/index.js
2
+
3
+ const isReactNative =
4
+ typeof process !== 'undefined' && !!process.env;
2
5
 
3
6
  const isBrowser =
4
7
  typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -24,6 +27,8 @@ const isJsDom =
24
27
  navigator.userAgent?.includes("jsdom")));
25
28
 
26
29
  const isDeno =
27
- typeof Deno !== "undefined" && Deno.version?.deno;
30
+ typeof Deno !== "undefined" &&
31
+ typeof Deno.version !== "undefined" &&
32
+ typeof Deno.version.deno !== "undefined";
28
33
 
29
- export { isBrowser, isWebWorker, isNode, isJsDom, isDeno };
34
+ export { isReactNative, isBrowser, isWebWorker, isNode, isJsDom, isDeno };