@hanzogui/constants 4.3.1 → 4.4.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/dist/cjs/constants.cjs
CHANGED
|
@@ -39,7 +39,7 @@ __export(constants_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(constants_exports);
|
|
40
40
|
var import_react = require("react");
|
|
41
41
|
const isWeb = true;
|
|
42
|
-
const isBrowser = typeof
|
|
42
|
+
const isBrowser = typeof document !== "undefined";
|
|
43
43
|
const isServer = isWeb && !isBrowser;
|
|
44
44
|
const isClient = isWeb && isBrowser;
|
|
45
45
|
const isWindowDefined = isBrowser;
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect } from "react";
|
|
2
2
|
const isWeb = true;
|
|
3
|
-
const isBrowser = typeof
|
|
3
|
+
const isBrowser = typeof document !== "undefined";
|
|
4
4
|
const isServer = isWeb && !isBrowser;
|
|
5
5
|
const isClient = isWeb && isBrowser;
|
|
6
6
|
const isWindowDefined = isBrowser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useLayoutEffect","isWeb","isBrowser","
|
|
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","TAMAGUI_TARGET"],"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,GAAoBH,KAAA,IAAS,CAACC,SAAA;AACpC,MAAMG,QAAA,GAAoBJ,KAAA,IAASC,SAAA;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,GAAuB,CAACd,KAAA,IAASW,cAAA;AAKvC,MAAMI,SAAA,GACXC,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAAA;AAErCF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAChC,MAAMC,KAAA,GACXH,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAAA;AAErCF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAChC,MAAME,IAAA,GACXJ,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB,eACrCF,OAAA,CAAQC,GAAA,CAAIC,oBAAA,KAAyB;AAOhC,MAAMG,eAAA,GAAwD;AAMrE,IAAI,CAACL,OAAA,CAAQC,GAAA,CAAIK,cAAA,EAAgB;EAC/BN,OAAA,CAAQC,GAAA,CAAIK,cAAA,GAAiB;AAC/B","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/constants",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"clean:build": "hanzo-gui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@hanzogui/build": "
|
|
37
|
+
"@hanzogui/build": "4.4.0",
|
|
38
38
|
"react": ">=19",
|
|
39
39
|
"react-native": "0.83.2"
|
|
40
40
|
},
|
package/src/constants.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect } from 'react'
|
|
2
2
|
|
|
3
3
|
export const isWeb: boolean = true
|
|
4
|
-
|
|
4
|
+
// check document not window — RN polyfills global.window but not document,
|
|
5
|
+
// so this is the only reliable "is DOM environment" check.
|
|
6
|
+
export const isBrowser: boolean = typeof document !== 'undefined'
|
|
5
7
|
export const isServer: boolean = isWeb && !isBrowser
|
|
6
8
|
export const isClient: boolean = isWeb && isBrowser
|
|
7
9
|
/** @deprecated use isBrowser instead */
|
package/types/constants.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;
|
|
2
|
+
"mappings": "AAAA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AAGb,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;AAKb,OAAO,cAAM;AAIb,OAAO,cAAM;AAIb,OAAO,cAAM;;;;;;;AASb,OAAO,cAAM,iBAAiB,QAAQ,QAAQ,WAAW",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/constants.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\nexport const isBrowser: boolean = typeof
|
|
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), TAMAGUI_TARGET may not be set.\n// Set it here so all process.env.TAMAGUI_TARGET runtime checks work correctly.\n// In pre-built dist, the build tool inlines TAMAGUI_TARGET as a literal string,\n// making this block dead code (if (!'web') → never executes).\nif (!process.env.TAMAGUI_TARGET) {\n process.env.TAMAGUI_TARGET = 'web'\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|