@take-out/helpers 0.4.19 → 0.4.20
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 +4 -4
- package/types/platform.d.ts.map +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/helpers",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"./package.json": "./package.json",
|
|
26
26
|
".": {
|
|
27
27
|
"react-native": "./dist/esm/index.native.js",
|
|
28
|
-
"types": "./
|
|
28
|
+
"types": "./types/index.d.ts",
|
|
29
29
|
"import": "./dist/esm/index.mjs",
|
|
30
30
|
"require": "./dist/cjs/index.cjs",
|
|
31
31
|
"default": "./dist/esm/index.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./server-only": {
|
|
34
34
|
"react-native": "./dist/esm/server-only.native.js",
|
|
35
|
-
"types": "./
|
|
35
|
+
"types": "./types/server-only.d.ts",
|
|
36
36
|
"import": "./dist/esm/server-only.mjs",
|
|
37
37
|
"require": "./dist/cjs/server-only.cjs",
|
|
38
38
|
"default": "./dist/esm/server-only.mjs"
|
|
39
39
|
},
|
|
40
40
|
"./client-only": {
|
|
41
41
|
"react-native": "./dist/esm/client-only.native.js",
|
|
42
|
-
"types": "./
|
|
42
|
+
"types": "./types/client-only.d.ts",
|
|
43
43
|
"import": "./dist/esm/client-only.mjs",
|
|
44
44
|
"require": "./dist/cjs/client-only.cjs",
|
|
45
45
|
"default": "./dist/esm/client-only.mjs"
|
package/types/platform.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAIA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AAIb,OAAO,cAAM;AAGb,OAAO,cAAM;AACb,OAAO,cAAM;;AAEb,OAAO,cAAM;AAEb,OAAO,cAAM,kCAAkC;AAI/C,OAAO,cAAM;
|
|
2
|
+
"mappings": "AAIA,SAAS,iBAAkC;AAE3C,OAAO,cAAM;AAIb,OAAO,cAAM;AAGb,OAAO,cAAM;AACb,OAAO,cAAM;;AAEb,OAAO,cAAM;AAEb,OAAO,cAAM,kCAAkC;AAI/C,OAAO,cAAM;AASb,OAAO,cAAM;AAKb,OAAO,cAAM;AACb,OAAO,cAAM;AAKb,OAAO,cAAM;AAGb,OAAO,cAAM;AAGb,OAAO,cAAM;AAEb,OAAO,cAAM;;;;;;;AASb,OAAO,cAAM,iBAAiB,QAAQ,QAAQ,WAAW",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/platform.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"// platform booleans, web/default variant.\n// Re-implemented locally (mirrors @tamagui/constants) so @take-out/helpers carries no @tamagui/* runtime dep.\n// The native values live in platform.native.ts (resolved by metro / the react-native export condition).\n\nimport { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\n\n// RN adds fake window and document so its not simple to get this right\n// check both navigator and location\nexport const isBrowser: boolean =\n typeof navigator !== 'undefined' && typeof location !== 'undefined'\n\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
|
|
9
|
+
"// platform booleans, web/default variant.\n// Re-implemented locally (mirrors @tamagui/constants) so @take-out/helpers carries no @tamagui/* runtime dep.\n// The native values live in platform.native.ts (resolved by metro / the react-native export condition).\n\nimport { useEffect, useLayoutEffect } from 'react'\n\nexport const isWeb: boolean = true\n\n// RN adds fake window and document so its not simple to get this right\n// check both navigator and location\nexport const isBrowser: boolean =\n typeof navigator !== 'undefined' && typeof location !== 'undefined'\n\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\n// guard the `window` access: in a web worker `navigator`/`location` exist (so\n// isClient is true) but `window` does NOT — touching it throws \"window is not\n// defined\" and kills the worker. soot bundles @take-out/helpers into its\n// project-server web worker, so the unguarded form (which @tamagui/constants\n// also ships, but never loads in a worker) hard-crashes preview bundling.\n// keep this typeof guard even though it diverges from @tamagui/constants.\nexport const isWebTouchable: boolean =\n isClient &&\n typeof window !== 'undefined' &&\n ('ontouchstart' in window || navigator.maxTouchPoints > 0)\n\nexport const isNativeDesktop: boolean = false\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 process.env.TEST_NATIVE_PLATFORM === 'androidtv'\nexport const isIos: boolean =\n process.env.TEST_NATIVE_PLATFORM === 'ios' ||\n process.env.TEST_NATIVE_PLATFORM === 'tvos'\nexport const supportsDynamicColorIOS: boolean =\n isIos || process.env.TAMAGUI_DYNAMIC_COLOR_IOS === '1'\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
|
}
|