@hanzogui/constants 2.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var constants_exports = {};
22
+ __export(constants_exports, {
23
+ currentPlatform: () => currentPlatform,
24
+ isAndroid: () => isAndroid,
25
+ isBrowser: () => isBrowser,
26
+ isChrome: () => isChrome,
27
+ isClient: () => isClient,
28
+ isIos: () => isIos,
29
+ isServer: () => isServer,
30
+ isTouchable: () => isTouchable,
31
+ isWeb: () => isWeb,
32
+ isWebTouchable: () => isWebTouchable,
33
+ isWindowDefined: () => isWindowDefined,
34
+ useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
35
+ });
36
+ module.exports = __toCommonJS(constants_exports);
37
+ var import_react = require("react");
38
+ const isWeb = !0,
39
+ isBrowser = typeof window < "u",
40
+ isServer = isWeb && !isBrowser,
41
+ isClient = isWeb && isBrowser,
42
+ isWindowDefined = isBrowser,
43
+ useIsomorphicLayoutEffect = isServer ? import_react.useEffect : import_react.useLayoutEffect,
44
+ isChrome = typeof navigator < "u" && /Chrome/.test(navigator.userAgent || ""),
45
+ isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0),
46
+ isTouchable = !isWeb || isWebTouchable,
47
+ isAndroid = !1,
48
+ isIos = process.env.TEST_NATIVE_PLATFORM === "ios",
49
+ currentPlatform = "web";
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var constants_native_exports = {};
24
+ __export(constants_native_exports, {
25
+ currentPlatform: () => currentPlatform,
26
+ isAndroid: () => isAndroid,
27
+ isBrowser: () => isBrowser,
28
+ isChrome: () => isChrome,
29
+ isClient: () => isClient,
30
+ isIos: () => isIos,
31
+ isServer: () => isServer,
32
+ isTouchable: () => isTouchable,
33
+ isWeb: () => isWeb,
34
+ isWebTouchable: () => isWebTouchable,
35
+ isWindowDefined: () => isWindowDefined,
36
+ useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
37
+ });
38
+ module.exports = __toCommonJS(constants_native_exports);
39
+ var import_react = require("react"),
40
+ import_react_native = require("react-native"),
41
+ isWeb = !1,
42
+ isBrowser = !1,
43
+ isServer = !1,
44
+ isClient = !0,
45
+ isWindowDefined = !1,
46
+ useIsomorphicLayoutEffect = import_react.useLayoutEffect,
47
+ isChrome = !1,
48
+ isWebTouchable = !1,
49
+ isTouchable = !0,
50
+ isAndroid = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === "android" || process.env.TEST_NATIVE_PLATFORM === "android",
51
+ isIos = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === "ios" || process.env.TEST_NATIVE_PLATFORM === "ios",
52
+ platforms = {
53
+ ios: "ios",
54
+ android: "android"
55
+ },
56
+ currentPlatform = (!(import_react_native.Platform === null || import_react_native.Platform === void 0) && import_react_native.Platform.OS ? platforms[import_react_native.Platform.OS] : void 0) || "native";
57
+ //# sourceMappingURL=constants.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["constants_native_exports","__export","currentPlatform","isAndroid","isBrowser","isChrome","isClient","isIos","isServer","isTouchable","isWeb","isWebTouchable","isWindowDefined","useIsomorphicLayoutEffect","module","exports","__toCommonJS","import_react","require","import_react_native","useLayoutEffect","Platform","OS","process","env","TEST_NATIVE_PLATFORM","platforms","ios","android"],"sources":["../../src/constants.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,wBAAA;AAAAC,QAAA,CAAAD,wBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAA,SAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAA,SAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,KAAA,EAAAA,CAAA,KAAAA,KAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,WAAA,EAAAA,CAAA,KAAAA,WAAA;EAAAC,KAAA,EAAAA,CAAA,KAAAA,KAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,yBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAhB,wBAAA;AAAA,IAAAiB,YAAA,GAAgCC,OAAA;EAChCC,mBAAA,GAAyBD,OAAA;EACdR,KAAA,GAAQ;EACRN,SAAA,GAAY;EACZI,QAAA,GAAW;EACXF,QAAA,GAAW;EAC8BM,eAAA,GAAkB;EAC3DC,yBAAA,GAA4BI,YAAA,CAAAG,eAAA;EAC5Bf,QAAA,GAAW;EACXM,cAAA,GAAiB;EACjBF,WAAA,GAAc;EAEdN,SAAA,IAAagB,mBAAA,CAAAE,QAAA,KAAa,QAAQF,mBAAA,CAAAE,QAAA,KAAa,SAAS,SAASF,mBAAA,CAAAE,QAAA,CAASC,EAAA,MAAQ,aAAaC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;EACpIlB,KAAA,IAASY,mBAAA,CAAAE,QAAA,KAAa,QAAQF,mBAAA,CAAAE,QAAA,KAAa,SAAS,SAASF,mBAAA,CAAAE,QAAA,CAASC,EAAA,MAAQ,SAASC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;EACnIC,SAAA,GAAY;IACZC,GAAA,EAAK;IACLC,OAAA,EAAS;EACb;EACW1B,eAAA,IAAoB,EAAAiB,mBAAA,CAAAE,QAAA,KAAa,QAAQF,mBAAA,CAAAE,QAAA,KAAa,WAAkBF,mBAAA,CAAAE,QAAA,CAASC,EAAA,GAAMI,SAAA,CAAUP,mBAAA,CAAAE,QAAA,CAASC,EAAE,IAAI,WAAc","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require("./constants.cjs"), module.exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ },
14
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: !0
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./constants.native.js"), module.exports);
21
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ import { useEffect, useLayoutEffect } from "react";
2
+ const isWeb = !0,
3
+ isBrowser = typeof window < "u",
4
+ isServer = isWeb && !isBrowser,
5
+ isClient = isWeb && isBrowser,
6
+ isWindowDefined = isBrowser,
7
+ useIsomorphicLayoutEffect = isServer ? useEffect : useLayoutEffect,
8
+ isChrome = typeof navigator < "u" && /Chrome/.test(navigator.userAgent || ""),
9
+ isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0),
10
+ isTouchable = !isWeb || isWebTouchable,
11
+ isAndroid = !1,
12
+ isIos = process.env.TEST_NATIVE_PLATFORM === "ios",
13
+ currentPlatform = "web";
14
+ export { currentPlatform, isAndroid, isBrowser, isChrome, isClient, isIos, isServer, isTouchable, isWeb, isWebTouchable, isWindowDefined, useIsomorphicLayoutEffect };
15
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useLayoutEffect","isWeb","isBrowser","window","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","navigator","test","userAgent","isWebTouchable","maxTouchPoints","isTouchable","isAndroid","isIos","process","env","TEST_NATIVE_PLATFORM","currentPlatform"],"sources":["../../src/constants.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAA,EAAWC,eAAA,QAAuB;AAEpC,MAAMC,KAAA,GAAiB;EACjBC,SAAA,GAAqB,OAAOC,MAAA,GAAW;EACvCC,QAAA,GAAoBH,KAAA,IAAS,CAACC,SAAA;EAC9BG,QAAA,GAAoBJ,KAAA,IAASC,SAAA;EAE7BI,eAAA,GAA2BJ,SAAA;EAE3BK,yBAAA,GAA8CH,QAAA,GACvDL,SAAA,GACAC,eAAA;EAESQ,QAAA,GACX,OAAOC,SAAA,GAAc,OAAe,SAASC,IAAA,CAAKD,SAAA,CAAUE,SAAA,IAAa,EAAE;EAEhEC,cAAA,GACXP,QAAA,KAAa,kBAAkBF,MAAA,IAAUM,SAAA,CAAUI,cAAA,GAAiB;EAEzDC,WAAA,GAAuB,CAACb,KAAA,IAASW,cAAA;EAEjCG,SAAA,GAAqB;EACrBC,KAAA,GAAiBC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;EACtDC,eAAA,GAAwD","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import { useLayoutEffect } from "react";
2
+ import { Platform } from "react-native";
3
+ var isWeb = !1,
4
+ isBrowser = !1,
5
+ isServer = !1,
6
+ isClient = !0,
7
+ isWindowDefined = !1,
8
+ useIsomorphicLayoutEffect = useLayoutEffect,
9
+ isChrome = !1,
10
+ isWebTouchable = !1,
11
+ isTouchable = !0,
12
+ isAndroid = (Platform === null || Platform === void 0 ? void 0 : Platform.OS) === "android" || process.env.TEST_NATIVE_PLATFORM === "android",
13
+ isIos = (Platform === null || Platform === void 0 ? void 0 : Platform.OS) === "ios" || process.env.TEST_NATIVE_PLATFORM === "ios",
14
+ platforms = {
15
+ ios: "ios",
16
+ android: "android"
17
+ },
18
+ currentPlatform = (!(Platform === null || Platform === void 0) && Platform.OS ? platforms[Platform.OS] : void 0) || "native";
19
+ export { currentPlatform, isAndroid, isBrowser, isChrome, isClient, isIos, isServer, isTouchable, isWeb, isWebTouchable, isWindowDefined, useIsomorphicLayoutEffect };
20
+ //# sourceMappingURL=constants.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useLayoutEffect","Platform","isWeb","isBrowser","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","isWebTouchable","isTouchable","isAndroid","OS","process","env","TEST_NATIVE_PLATFORM","isIos","platforms","ios","android","currentPlatform"],"sources":["../../src/constants.native.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,SAASC,QAAA,QAAgB;AAClB,IAAIC,KAAA,GAAQ;EACRC,SAAA,GAAY;EACZC,QAAA,GAAW;EACXC,QAAA,GAAW;EAC8BC,eAAA,GAAkB;EAC3DC,yBAAA,GAA4BP,eAAA;EAC5BQ,QAAA,GAAW;EACXC,cAAA,GAAiB;EACjBC,WAAA,GAAc;EAEdC,SAAA,IAAaV,QAAA,KAAa,QAAQA,QAAA,KAAa,SAAS,SAASA,QAAA,CAASW,EAAA,MAAQ,aAAaC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;EACpIC,KAAA,IAASf,QAAA,KAAa,QAAQA,QAAA,KAAa,SAAS,SAASA,QAAA,CAASW,EAAA,MAAQ,SAASC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;EACnIE,SAAA,GAAY;IACZC,GAAA,EAAK;IACLC,OAAA,EAAS;EACb;EACWC,eAAA,IAAoB,EAAAnB,QAAA,KAAa,QAAQA,QAAA,KAAa,WAAkBA,QAAA,CAASW,EAAA,GAAMK,SAAA,CAAUhB,QAAA,CAASW,EAAE,IAAI,WAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./constants.mjs";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./constants.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./constants.native.js";
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@hanzogui/constants",
3
+ "version": "2.0.0",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "files": [
6
+ "src",
7
+ "types",
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "main": "dist/cjs",
13
+ "module": "dist/esm",
14
+ "types": "./types/index.d.ts",
15
+ "exports": {
16
+ "./package.json": "./package.json",
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
21
+ "module": "./dist/esm/index.mjs",
22
+ "import": "./dist/esm/index.mjs",
23
+ "require": "./dist/cjs/index.cjs",
24
+ "default": "./dist/esm/index.mjs"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "hanzo-gui-build",
32
+ "watch": "hanzo-gui-build --watch",
33
+ "clean": "hanzo-gui-build clean",
34
+ "clean:build": "hanzo-gui-build clean:build"
35
+ },
36
+ "devDependencies": {
37
+ "@hanzogui/build": "workspace:*",
38
+ "react": ">=19",
39
+ "react-native": "0.83.2"
40
+ },
41
+ "peerDependencies": {
42
+ "react": ">=19",
43
+ "react-native": "*"
44
+ }
45
+ }
@@ -0,0 +1,22 @@
1
+ import { useLayoutEffect, type useEffect } from 'react'
2
+ import { Platform } from 'react-native'
3
+
4
+ export const isWeb: boolean = false
5
+ export const isBrowser: boolean = false
6
+ export const isServer: boolean = false
7
+ export const isClient: boolean = true
8
+ /** @deprecated use isBrowser instead */
9
+ export const isWindowDefined: boolean = false
10
+ export const useIsomorphicLayoutEffect: typeof useEffect = useLayoutEffect
11
+ export const isChrome: boolean = false
12
+ export const isWebTouchable: boolean = false
13
+ export const isTouchable: boolean = true
14
+ // optional chain required: babel extractor loads native.cjs in node where Platform is undefined
15
+ export const isAndroid: boolean =
16
+ Platform?.OS === 'android' || process.env.TEST_NATIVE_PLATFORM === 'android'
17
+ export const isIos: boolean =
18
+ Platform?.OS === 'ios' || process.env.TEST_NATIVE_PLATFORM === 'ios'
19
+
20
+ const platforms = { ios: 'ios', android: 'android' } as const
21
+ export const currentPlatform: 'web' | 'ios' | 'native' | 'android' =
22
+ (Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'
@@ -0,0 +1,24 @@
1
+ import { useEffect, useLayoutEffect } from 'react'
2
+
3
+ export const isWeb: boolean = true
4
+ export const isBrowser: boolean = typeof window !== 'undefined'
5
+ export const isServer: boolean = isWeb && !isBrowser
6
+ export const isClient: boolean = isWeb && isBrowser
7
+ /** @deprecated use isBrowser instead */
8
+ export const isWindowDefined: boolean = isBrowser
9
+
10
+ export const useIsomorphicLayoutEffect: typeof useEffect = isServer
11
+ ? useEffect
12
+ : useLayoutEffect
13
+
14
+ export const isChrome: boolean =
15
+ typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')
16
+
17
+ export const isWebTouchable: boolean =
18
+ isClient && ('ontouchstart' in window || navigator.maxTouchPoints > 0)
19
+
20
+ export const isTouchable: boolean = !isWeb || isWebTouchable
21
+ // set :boolean to avoid inferring type to false
22
+ export const isAndroid: boolean = false
23
+ export const isIos: boolean = process.env.TEST_NATIVE_PLATFORM === 'ios'
24
+ export const currentPlatform: 'web' | 'ios' | 'native' | 'android' = 'web'
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './constants'
@@ -0,0 +1,16 @@
1
+ import { useEffect } from "react";
2
+ export declare const isWeb: boolean;
3
+ export declare const isBrowser: boolean;
4
+ export declare const isServer: boolean;
5
+ export declare const isClient: boolean;
6
+ /** @deprecated use isBrowser instead */
7
+ export declare const isWindowDefined: boolean;
8
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
9
+ export declare const isChrome: boolean;
10
+ export declare const isWebTouchable: boolean;
11
+ export declare const isTouchable: boolean;
12
+ export declare const isAndroid: boolean;
13
+ export declare const isIos: boolean;
14
+ export declare const currentPlatform: "web" | "ios" | "native" | "android";
15
+
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;;AAEb,OAAO,cAAM;AAEb,OAAO,cAAM,kCAAkC;AAI/C,OAAO,cAAM;AAGb,OAAO,cAAM;AAGb,OAAO,cAAM;AAEb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM,iBAAiB,QAAQ,QAAQ,WAAW",
3
+ "names": [],
4
+ "sources": [
5
+ "src/constants.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\nexport const isBrowser: boolean = typeof window !== 'undefined'\nexport const isServer: boolean = isWeb && !isBrowser\nexport const isClient: boolean = isWeb && isBrowser\n/** @deprecated use isBrowser instead */\nexport const isWindowDefined: boolean = isBrowser\n\nexport const useIsomorphicLayoutEffect: typeof useEffect = isServer\n ? useEffect\n : useLayoutEffect\n\nexport const isChrome: boolean =\n typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\n\nexport const isWebTouchable: boolean =\n isClient && ('ontouchstart' in window || navigator.maxTouchPoints > 0)\n\nexport const isTouchable: boolean = !isWeb || isWebTouchable\n// set :boolean to avoid inferring type to false\nexport const isAndroid: boolean = false\nexport const isIos: boolean = process.env.TEST_NATIVE_PLATFORM === 'ios'\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' = 'web'\n"
10
+ ]
11
+ }
@@ -0,0 +1,16 @@
1
+ import { type useEffect } from "react";
2
+ export declare const isWeb: boolean;
3
+ export declare const isBrowser: boolean;
4
+ export declare const isServer: boolean;
5
+ export declare const isClient: boolean;
6
+ /** @deprecated use isBrowser instead */
7
+ export declare const isWindowDefined: boolean;
8
+ export declare const useIsomorphicLayoutEffect: typeof useEffect;
9
+ export declare const isChrome: boolean;
10
+ export declare const isWebTouchable: boolean;
11
+ export declare const isTouchable: boolean;
12
+ export declare const isAndroid: boolean;
13
+ export declare const isIos: boolean;
14
+ export declare const currentPlatform: "web" | "ios" | "native" | "android";
15
+
16
+ //# sourceMappingURL=constants.native.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAA+B,iBAAiB;AAGhD,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;;AAEb,OAAO,cAAM;AACb,OAAO,cAAM,kCAAkC;AAC/C,OAAO,cAAM;AACb,OAAO,cAAM;AACb,OAAO,cAAM;AAEb,OAAO,cAAM;AAEb,OAAO,cAAM;AAIb,OAAO,cAAM,iBAAiB,QAAQ,QAAQ,WAAW",
3
+ "names": [],
4
+ "sources": [
5
+ "src/constants.native.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import { useLayoutEffect, type useEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isWeb: boolean = false\nexport const isBrowser: boolean = false\nexport const isServer: boolean = false\nexport const isClient: boolean = true\n/** @deprecated use isBrowser instead */\nexport const isWindowDefined: boolean = false\nexport const useIsomorphicLayoutEffect: typeof useEffect = useLayoutEffect\nexport const isChrome: boolean = false\nexport const isWebTouchable: boolean = false\nexport const isTouchable: boolean = true\n// optional chain required: babel extractor loads native.cjs in node where Platform is undefined\nexport const isAndroid: boolean =\n Platform?.OS === 'android' || process.env.TEST_NATIVE_PLATFORM === 'android'\nexport const isIos: boolean =\n Platform?.OS === 'ios' || process.env.TEST_NATIVE_PLATFORM === 'ios'\n\nconst platforms = { ios: 'ios', android: 'android' } as const\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' =\n (Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'\n"
10
+ ]
11
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./constants";
2
+
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAAc",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export * from './constants'\n"
10
+ ]
11
+ }