@hanzogui/constants 7.0.0 → 7.3.1
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 +40 -19
- package/dist/cjs/constants.cjs +6 -13
- package/dist/cjs/constants.native.js +2 -6
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/esm/constants.mjs +5 -12
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +2 -6
- package/dist/esm/constants.native.js.map +1 -1
- package/package.json +14 -7
- package/src/constants.native.ts +5 -5
- package/src/constants.ts +5 -5
- package/types/constants.d.ts.map +1 -1
- package/types/constants.native.d.ts.map +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Hanzo AI, Inc.
|
|
4
|
+
|
|
5
|
+
Portions of this software are derived from upstream code originally licensed under
|
|
6
|
+
the MIT License, with the following copyright notices retained per its terms:
|
|
2
7
|
|
|
3
8
|
Copyright (c) 2020 Nate Wienert
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
Copyright (c) 2015-present, Nicolas Gallagher.
|
|
10
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
11
|
+
Copyright (c) 2021 Radix
|
|
12
|
+
Copyright (c) 2017 Carmelo Pullara
|
|
13
|
+
Copyright (c) 2018 Framer B.V.
|
|
14
|
+
Copyright (c) 2022 WorkOS
|
|
15
|
+
|
|
16
|
+
All rights reserved.
|
|
17
|
+
|
|
18
|
+
Redistribution and use in source and binary forms, with or without
|
|
19
|
+
modification, are permitted provided that the following conditions are met:
|
|
20
|
+
|
|
21
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
22
|
+
list of conditions and the following disclaimer.
|
|
23
|
+
|
|
24
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
25
|
+
this list of conditions and the following disclaimer in the documentation
|
|
26
|
+
and/or other materials provided with the distribution.
|
|
27
|
+
|
|
28
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
29
|
+
may be used to endorse or promote products derived from this software
|
|
30
|
+
without specific prior written permission.
|
|
31
|
+
|
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
33
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
34
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
35
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
36
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
37
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
38
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
39
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
40
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
41
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
package/dist/cjs/constants.cjs
CHANGED
|
@@ -40,21 +40,14 @@ module.exports = __toCommonJS(constants_exports);
|
|
|
40
40
|
var import_react = require("react");
|
|
41
41
|
const isWeb = true;
|
|
42
42
|
const isBrowser = typeof document !== "undefined";
|
|
43
|
-
const isServer =
|
|
44
|
-
const isClient =
|
|
43
|
+
const isServer = !isBrowser;
|
|
44
|
+
const isClient = isBrowser;
|
|
45
45
|
const isWindowDefined = isBrowser;
|
|
46
46
|
const useIsomorphicLayoutEffect = isServer ? import_react.useEffect : import_react.useLayoutEffect;
|
|
47
47
|
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
48
48
|
const isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
49
|
-
const isTouchable =
|
|
50
|
-
const isAndroid = process.env.TEST_NATIVE_PLATFORM === "android" ||
|
|
51
|
-
|
|
52
|
-
process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
53
|
-
const isIos = process.env.TEST_NATIVE_PLATFORM === "ios" ||
|
|
54
|
-
// tvOS has Platform.OS === 'ios' per react-native-tvos
|
|
55
|
-
process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
49
|
+
const isTouchable = isWebTouchable;
|
|
50
|
+
const isAndroid = process.env.TEST_NATIVE_PLATFORM === "android" || process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
51
|
+
const isIos = process.env.TEST_NATIVE_PLATFORM === "ios" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
56
52
|
const isTV = process.env.TEST_NATIVE_PLATFORM === "androidtv" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
57
|
-
const currentPlatform = "web";
|
|
58
|
-
if (!process.env.TAMAGUI_TARGET) {
|
|
59
|
-
process.env.TAMAGUI_TARGET = "web";
|
|
60
|
-
}
|
|
53
|
+
const currentPlatform = "web";
|
|
@@ -53,12 +53,8 @@ var isTouchable = true;
|
|
|
53
53
|
var 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" || process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
54
54
|
var 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" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
55
55
|
var isTV = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.isTV) || process.env.TEST_NATIVE_PLATFORM === "androidtv" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
56
|
-
var
|
|
56
|
+
var currentPlatform = ((import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) ? {
|
|
57
57
|
ios: "ios",
|
|
58
58
|
android: "android"
|
|
59
|
-
};
|
|
60
|
-
var currentPlatform = ((import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) ? platforms[import_react_native.Platform.OS] : void 0) || "native";
|
|
61
|
-
if (!process.env.TAMAGUI_TARGET) {
|
|
62
|
-
process.env.TAMAGUI_TARGET = "native";
|
|
63
|
-
}
|
|
59
|
+
}[import_react_native.Platform.OS] : void 0) || "native";
|
|
64
60
|
//# sourceMappingURL=constants.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["constants_native_exports","__export","currentPlatform","isAndroid","isBrowser","isChrome","isClient","isIos","isServer","isTV","isTouchable","isWeb","isWebTouchable","isWindowDefined","useIsomorphicLayoutEffect","module","exports","
|
|
1
|
+
{"version":3,"names":["to","__toCommonJS","mod","__copyProps","__defProp","value","constants_native_exports","__export","currentPlatform","isAndroid","isBrowser","isChrome","isClient","isIos","isServer","isTV","isTouchable","isWeb","isWebTouchable","isWindowDefined","useIsomorphicLayoutEffect","module","exports","import_react","require","import_react_native","useLayoutEffect","Platform","OS","process","env","TEST_NATIVE_PLATFORM","ios","android"],"sources":["../../src/constants.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;EAAA,OAAAA,EAAA;AAAA;AAAA,IAAAC,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,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,IAAA,EAAAA,CAAA,KAAAA,IAAA;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,yBAAgC,EAAAA,CAAA,KAAAA;AAChC;AACOC,MAAI,CAAAC,OAAQ,GAAArB,YAAA,CAAAK,wBAAA;AACZ,IAAIiB,YAAY,GAAAC,OAAA;AAChB,IAAIC,mBAAW,GAAAD,OAAA;AACf,IAAIP,KAAA,QAAW;AAC0B,IAAIP,SAAA;AAC7C,IAAII,QAAA;AACJ,IAAIF,QAAA,GAAW;AACf,IAAIO,eAAA,GAAiB;AACrB,IAAIC,yBAAc,GAAAG,YAAA,CAAAG,eAAA;AAGlB,IAAIf,QAAA,QAAa;AAEjB,IAAIO,cAAS;AACb,IAAIF,WAAQ;AACnB,IAAIP,SAAA,GAAY,CAAAgB,mBAAA,CAAAE,QAAA,aAAAF,mBAAA,CAAAE,QAAA,uBAAAF,mBAAA,CAAAE,QAAA,CAAAC,EAAA,mBAAAC,OAAA,CAAAC,GAAA,CAAAC,oBAAA,kBAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AAAA,IACZlB,KAAK,IAAAY,mBAAA,CAAAE,QAAA,aAAAF,mBAAA,CAAAE,QAAA,uBAAAF,mBAAA,CAAAE,QAAA,CAAAC,EAAA,eAAAC,OAAA,CAAAC,GAAA,CAAAC,oBAAA,cAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AAAA,IACLhB,IAAA,GAAS,CAAAU,mBAAA,CAAAE,QAAA,aAAAF,mBAAA,CAAAE,QAAA,uBAAAF,mBAAA,CAAAE,QAAA,CAAAZ,IAAA,KAAAc,OAAA,CAAAC,GAAA,CAAAC,oBAAA,oBAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AACb,IAAAvB,eAAA,KAAAiB,mBAAA,CAAAE,QAAA,aAAAF,mBAAA,CAAAE,QAAA,uBAAAF,mBAAA,CAAAE,QAAA,CAAAC,EAAA;EAMWI,GAAI;EAKfC,OAAK;AACD,EAAAR,mBAAY,CAAAE,QAAa,CAAAC,EAAA","ignoreList":[]}
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect } from "react";
|
|
2
2
|
const isWeb = true;
|
|
3
3
|
const isBrowser = typeof document !== "undefined";
|
|
4
|
-
const isServer =
|
|
5
|
-
const isClient =
|
|
4
|
+
const isServer = !isBrowser;
|
|
5
|
+
const isClient = isBrowser;
|
|
6
6
|
const isWindowDefined = isBrowser;
|
|
7
7
|
const useIsomorphicLayoutEffect = isServer ? useEffect : useLayoutEffect;
|
|
8
8
|
const isChrome = typeof navigator !== "undefined" && /Chrome/.test(navigator.userAgent || "");
|
|
9
9
|
const isWebTouchable = isClient && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
10
|
-
const isTouchable =
|
|
11
|
-
const isAndroid = process.env.TEST_NATIVE_PLATFORM === "android" ||
|
|
12
|
-
|
|
13
|
-
process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
14
|
-
const isIos = process.env.TEST_NATIVE_PLATFORM === "ios" ||
|
|
15
|
-
// tvOS has Platform.OS === 'ios' per react-native-tvos
|
|
16
|
-
process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
10
|
+
const isTouchable = isWebTouchable;
|
|
11
|
+
const isAndroid = process.env.TEST_NATIVE_PLATFORM === "android" || process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
12
|
+
const isIos = process.env.TEST_NATIVE_PLATFORM === "ios" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
17
13
|
const isTV = process.env.TEST_NATIVE_PLATFORM === "androidtv" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
18
14
|
const currentPlatform = "web";
|
|
19
|
-
if (!process.env.TAMAGUI_TARGET) {
|
|
20
|
-
process.env.TAMAGUI_TARGET = "web";
|
|
21
|
-
}
|
|
22
15
|
export { currentPlatform, isAndroid, isBrowser, isChrome, isClient, isIos, isServer, isTV, isTouchable, isWeb, isWebTouchable, isWindowDefined, useIsomorphicLayoutEffect };
|
|
23
16
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useLayoutEffect","isWeb","isBrowser","document","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","navigator","test","userAgent","isWebTouchable","window","maxTouchPoints","isTouchable","isAndroid","process","env","TEST_NATIVE_PLATFORM","isIos","isTV","currentPlatform"
|
|
1
|
+
{"version":3,"names":["useEffect","useLayoutEffect","isWeb","isBrowser","document","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","navigator","test","userAgent","isWebTouchable","window","maxTouchPoints","isTouchable","isAndroid","process","env","TEST_NATIVE_PLATFORM","isIos","isTV","currentPlatform"],"sources":["../../src/constants.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAA,EAAWC,eAAA,QAAuB;AAEpC,MAAMC,KAAA,GAAiB;AAGvB,MAAMC,SAAA,GAAqB,OAAOC,QAAA,KAAa;AAC/C,MAAMC,QAAA,GAAoB,CAAAF,SAAU;AACpC,MAAMG,QAAA,GAAoBH,SAAS;AAEnC,MAAMI,eAAA,GAA2BJ,SAAA;AAEjC,MAAMK,yBAAA,GAA8CH,QAAA,GACvDL,SAAA,GACAC,eAAA;AAEG,MAAMQ,QAAA,GACX,OAAOC,SAAA,KAAc,eAAe,SAASC,IAAA,CAAKD,SAAA,CAAUE,SAAA,IAAa,EAAE;AAEtE,MAAMC,cAAA,GACXP,QAAA,KAAa,kBAAkBQ,MAAA,IAAUJ,SAAA,CAAUK,cAAA,GAAiB;AAE/D,MAAMC,WAAA,GAAuBH,cAAU;AAKvC,MAAMI,SAAA,GACXC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB,aAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AAErC,MAAAC,KAAQ,GAAIH,OAAA,CAAAC,GAAA,CAAAC,oBAAyB,cAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AAChC,MAAME,IAAA,GAAAJ,OACX,CAAAC,GAAQ,CAAAC,oBAAI,gBAAyB,IAAAF,OAAA,CAAAC,GAAA,CAAAC,oBAAA;AAErC,MAAAG,eAAY;AACP,SAAMA,eACH,EAAIN,SAAA,EAAAd,SAAA,EAAAM,QAAyB,EAAAH,QACrC,EAAAe,KAAQ,EAAAhB,QAAI,EAAAiB,IAAA,EAAAN,WAAyB,EAAAd,KAAA,EAAAW,cAAA,EAAAN,eAAA,EAAAC,yBAAA","ignoreList":[]}
|
|
@@ -12,13 +12,9 @@ var isTouchable = true;
|
|
|
12
12
|
var isAndroid = (Platform === null || Platform === void 0 ? void 0 : Platform.OS) === "android" || process.env.TEST_NATIVE_PLATFORM === "android" || process.env.TEST_NATIVE_PLATFORM === "androidtv";
|
|
13
13
|
var isIos = (Platform === null || Platform === void 0 ? void 0 : Platform.OS) === "ios" || process.env.TEST_NATIVE_PLATFORM === "ios" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
14
14
|
var isTV = (Platform === null || Platform === void 0 ? void 0 : Platform.isTV) || process.env.TEST_NATIVE_PLATFORM === "androidtv" || process.env.TEST_NATIVE_PLATFORM === "tvos";
|
|
15
|
-
var
|
|
15
|
+
var currentPlatform = ((Platform === null || Platform === void 0 ? void 0 : Platform.OS) ? {
|
|
16
16
|
ios: "ios",
|
|
17
17
|
android: "android"
|
|
18
|
-
};
|
|
19
|
-
var currentPlatform = ((Platform === null || Platform === void 0 ? void 0 : Platform.OS) ? platforms[Platform.OS] : void 0) || "native";
|
|
20
|
-
if (!process.env.TAMAGUI_TARGET) {
|
|
21
|
-
process.env.TAMAGUI_TARGET = "native";
|
|
22
|
-
}
|
|
18
|
+
}[Platform.OS] : void 0) || "native";
|
|
23
19
|
export { currentPlatform, isAndroid, isBrowser, isChrome, isClient, isIos, isServer, isTV, isTouchable, isWeb, isWebTouchable, isWindowDefined, useIsomorphicLayoutEffect };
|
|
24
20
|
//# sourceMappingURL=constants.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLayoutEffect","Platform","isWeb","isBrowser","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","isWebTouchable","isTouchable","isAndroid","OS","process","env","TEST_NATIVE_PLATFORM","isIos","isTV","
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","Platform","isWeb","isBrowser","isServer","isClient","isWindowDefined","useIsomorphicLayoutEffect","isChrome","isWebTouchable","isTouchable","isAndroid","OS","process","env","TEST_NATIVE_PLATFORM","isIos","isTV","currentPlatform","ios","android"],"sources":["../../src/constants.native.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,SAASC,QAAA,QAAgB;AAClB,IAAIC,KAAA,GAAQ;AACZ,IAAIC,SAAA,GAAY;AAChB,IAAIC,QAAA,GAAW;AACf,IAAIC,QAAA,GAAW;AAC0B,IAAIC,eAAA,GAAkB;AAC/D,IAAIC,yBAAA,GAA4BP,eAAA;AAChC,IAAIQ,QAAA,GAAW;AACf,IAAIC,cAAA,GAAiB;AACrB,IAAIC,WAAA,GAAc;AAGlB,IAAIC,SAAA,IAAaV,QAAA,KAAa,QAAQA,QAAA,KAAa,SAAS,SAASA,QAAA,CAASW,EAAA,MAAQ,aAAaC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB,aAAaF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAE1L,IAAIC,KAAA,IAASf,QAAA,KAAa,QAAQA,QAAA,KAAa,SAAS,SAASA,QAAA,CAASW,EAAA,MAAQ,SAASC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB,SAASF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAC9K,IAAIE,IAAA,IAAQhB,QAAA,KAAa,QAAQA,QAAA,KAAa,SAAS,SAASA,QAAA,CAASgB,IAAA,KAASJ,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB,eAAeF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAClL,IAAIG,eAAY,KAAAjB,QAAA,aAAAA,QAAA,uBAAAA,QAAA,CAAAW,EAAA;EAAAO,GACZ,OAAK;EAAAC,OACL;AACJ,EAAAnB,QAAA,CAAAW,EAAA;AAMW,SAAIM,eAAoB,EAAAP,SAAA,EAAaR,SAAQ,EAAAK,QAAA,EAAaH,QAAA,EAASW,KAAA,EAAAZ,QAAS,EAASa,IAAA,EAAMP,WAAU,EAAAR,KAAA,EAASO,cAAM,EAAcH,eAAA,EAAAC,yBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/constants",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -28,18 +28,25 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"build": "
|
|
32
|
-
"watch": "
|
|
33
|
-
"clean": "
|
|
34
|
-
"clean:build": "
|
|
31
|
+
"build": "gui-build",
|
|
32
|
+
"watch": "gui-build --watch",
|
|
33
|
+
"clean": "gui-build clean",
|
|
34
|
+
"clean:build": "gui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@hanzogui/build": "
|
|
37
|
+
"@hanzogui/build": "7.3.1",
|
|
38
38
|
"react": ">=19",
|
|
39
39
|
"react-native": "0.83.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=19",
|
|
43
43
|
"react-native": "*"
|
|
44
|
+
},
|
|
45
|
+
"license": "BSD-3-Clause",
|
|
46
|
+
"author": "Hanzo AI <dev@hanzo.ai>",
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"react-native": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
|
-
}
|
|
52
|
+
}
|
package/src/constants.native.ts
CHANGED
|
@@ -37,10 +37,10 @@ const platforms = { ios: 'ios', android: 'android' } as const
|
|
|
37
37
|
export const currentPlatform: 'web' | 'ios' | 'native' | 'android' =
|
|
38
38
|
(Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'
|
|
39
39
|
|
|
40
|
-
// In Metro source mode,
|
|
41
|
-
// Set it here so all process.env.
|
|
42
|
-
// In pre-built dist, the build tool inlines
|
|
40
|
+
// In Metro source mode, GUI_TARGET may not be set by the build tool.
|
|
41
|
+
// Set it here so all process.env.GUI_TARGET runtime checks work correctly.
|
|
42
|
+
// In pre-built dist, the build tool inlines GUI_TARGET as a literal string,
|
|
43
43
|
// making this block dead code (if (!'native') → never executes).
|
|
44
|
-
if (!process.env.
|
|
45
|
-
process.env.
|
|
44
|
+
if (!process.env.GUI_TARGET) {
|
|
45
|
+
process.env.GUI_TARGET = 'native'
|
|
46
46
|
}
|
package/src/constants.ts
CHANGED
|
@@ -43,10 +43,10 @@ export const isTV: boolean =
|
|
|
43
43
|
*/
|
|
44
44
|
export const currentPlatform: 'web' | 'ios' | 'native' | 'android' = 'web'
|
|
45
45
|
|
|
46
|
-
// In web source mode (Vite/webpack without pre-built dist),
|
|
47
|
-
// Set it here so all process.env.
|
|
48
|
-
// In pre-built dist, the build tool inlines
|
|
46
|
+
// In web source mode (Vite/webpack without pre-built dist), GUI_TARGET may not be set.
|
|
47
|
+
// Set it here so all process.env.GUI_TARGET runtime checks work correctly.
|
|
48
|
+
// In pre-built dist, the build tool inlines GUI_TARGET as a literal string,
|
|
49
49
|
// making this block dead code (if (!'web') → never executes).
|
|
50
|
-
if (!process.env.
|
|
51
|
-
process.env.
|
|
50
|
+
if (!process.env.GUI_TARGET) {
|
|
51
|
+
process.env.GUI_TARGET = 'web'
|
|
52
52
|
}
|
package/types/constants.d.ts.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\n// check document not window — RN polyfills global.window but not document,\n// so this is the only reliable \"is DOM environment\" check.\nexport const isBrowser: boolean = typeof document !== '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\n// On web, isAndroid/isIos are always false in production.\n// TEST_NATIVE_PLATFORM is only set by the test runner (vitest) to simulate native\n// environments (e.g. androidtv, tvos) from a web/jsdom test context.\nexport const isAndroid: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n // Android TV has Platform.OS === 'android' per react-native-tvos\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\nexport const isIos: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n // tvOS has Platform.OS === 'ios' per react-native-tvos\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const isTV: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `isTV` combined with `isAndroid`/`isIos` to detect specific TV platforms.\n */\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' = 'web'\n\n// In web source mode (Vite/webpack without pre-built dist),
|
|
9
|
+
"import { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\n// check document not window — RN polyfills global.window but not document,\n// so this is the only reliable \"is DOM environment\" check.\nexport const isBrowser: boolean = typeof document !== '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\n// On web, isAndroid/isIos are always false in production.\n// TEST_NATIVE_PLATFORM is only set by the test runner (vitest) to simulate native\n// environments (e.g. androidtv, tvos) from a web/jsdom test context.\nexport const isAndroid: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n // Android TV has Platform.OS === 'android' per react-native-tvos\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\nexport const isIos: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n // tvOS has Platform.OS === 'ios' per react-native-tvos\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const isTV: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `isTV` combined with `isAndroid`/`isIos` to detect specific TV platforms.\n */\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' = 'web'\n\n// In web source mode (Vite/webpack without pre-built dist), GUI_TARGET may not be set.\n// Set it here so all process.env.GUI_TARGET runtime checks work correctly.\n// In pre-built dist, the build tool inlines GUI_TARGET as a literal string,\n// making this block dead code (if (!'web') → never executes).\nif (!process.env.GUI_TARGET) {\n process.env.GUI_TARGET = 'web'\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
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\n// On Android TV: Platform.OS === 'android' per react-native-tvos\nexport const isAndroid: boolean =\n Platform?.OS === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\n// On tvOS: Platform.OS === 'ios' per react-native-tvos\nexport const isIos: boolean =\n Platform?.OS === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const isTV: boolean =\n Platform?.isTV ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n\nconst platforms = { ios: 'ios', android: 'android' } as const\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `isTV` combined with `isAndroid`/`isIos` to detect specific TV platforms.\n */\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' =\n (Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'\n\n// In Metro source mode,
|
|
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\n// On Android TV: Platform.OS === 'android' per react-native-tvos\nexport const isAndroid: boolean =\n Platform?.OS === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'android' ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv'\n// On tvOS: Platform.OS === 'ios' per react-native-tvos\nexport const isIos: boolean =\n Platform?.OS === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const isTV: boolean =\n Platform?.isTV ||\n process.env.TEST_NATIVE_PLATFORM === 'androidtv' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\n\nconst platforms = { ios: 'ios', android: 'android' } as const\n/**\n * Reflects Platform.OS. TV platforms are intentionally NOT separate values:\n * - Android TV has Platform.OS === 'android' (react-native-tvos behavior)\n * - tvOS has Platform.OS === 'ios' (react-native-tvos behavior)\n * Use `isTV` combined with `isAndroid`/`isIos` to detect specific TV platforms.\n */\nexport const currentPlatform: 'web' | 'ios' | 'native' | 'android' =\n (Platform?.OS ? platforms[Platform.OS] : undefined) || 'native'\n\n// In Metro source mode, GUI_TARGET may not be set by the build tool.\n// Set it here so all process.env.GUI_TARGET runtime checks work correctly.\n// In pre-built dist, the build tool inlines GUI_TARGET as a literal string,\n// making this block dead code (if (!'native') → never executes).\nif (!process.env.GUI_TARGET) {\n process.env.GUI_TARGET = 'native'\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|