@tamagui/core 2.7.7 → 3.0.0-beta.1097.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/dist/cjs/createOptimizedView.cjs +14 -18
- package/dist/cjs/createOptimizedView.native.cjs +178 -0
- package/dist/cjs/createOptimizedView.native.js +158 -258
- package/dist/cjs/createOptimizedView.native.js.map +1 -1
- package/dist/cjs/dom.cjs +18 -0
- package/dist/cjs/dom.native.cjs +20 -0
- package/dist/cjs/dom.native.js +22 -0
- package/dist/cjs/dom.native.js.map +1 -0
- package/dist/cjs/getBaseViews.cjs +15 -19
- package/dist/cjs/getBaseViews.native.cjs +43 -0
- package/dist/cjs/getBaseViews.native.js +30 -26
- package/dist/cjs/getBaseViews.native.js.map +1 -1
- package/dist/cjs/index.cjs +28 -98
- package/dist/cjs/index.native.cjs +47 -0
- package/dist/cjs/index.native.js +28 -70
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/inject-styles.cjs +24 -31
- package/dist/cjs/inject-styles.native.cjs +38 -0
- package/dist/cjs/inject-styles.native.js +25 -31
- package/dist/cjs/inject-styles.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +32 -0
- package/dist/cjs/internal-runtime.native.cjs +34 -0
- package/dist/cjs/internal-runtime.native.js +36 -0
- package/dist/cjs/internal-runtime.native.js.map +1 -0
- package/dist/cjs/reactNativeTypes.cjs +9 -11
- package/dist/cjs/reactNativeTypes.native.cjs +18 -0
- package/dist/cjs/reactNativeTypes.native.js +9 -10
- package/dist/cjs/reactNativeTypes.native.js.map +1 -1
- package/dist/cjs/runtime.cjs +71 -0
- package/dist/cjs/runtime.native.cjs +76 -0
- package/dist/cjs/runtime.native.js +78 -0
- package/dist/cjs/runtime.native.js.map +1 -0
- package/dist/cjs/setupMedia.cjs +26 -0
- package/dist/cjs/setupMedia.native.cjs +31 -0
- package/dist/cjs/setupMedia.native.js +33 -0
- package/dist/cjs/setupMedia.native.js.map +1 -0
- package/dist/cjs/static-resolve.cjs +18 -0
- package/dist/cjs/static-resolve.native.cjs +20 -0
- package/dist/cjs/static-resolve.native.js +22 -0
- package/dist/cjs/static-resolve.native.js.map +1 -0
- package/dist/cjs/theme-update.cjs +18 -0
- package/dist/cjs/theme-update.native.cjs +20 -0
- package/dist/cjs/theme-update.native.js +22 -0
- package/dist/cjs/theme-update.native.js.map +1 -0
- package/dist/esm/createOptimizedView.mjs +2 -1
- package/dist/esm/createOptimizedView.mjs.map +1 -1
- package/dist/esm/createOptimizedView.native.js +142 -234
- package/dist/esm/createOptimizedView.native.js.map +1 -1
- package/dist/esm/dom.mjs +1 -0
- package/dist/esm/dom.native.js +1 -0
- package/dist/esm/getBaseViews.mjs +2 -1
- package/dist/esm/getBaseViews.mjs.map +1 -1
- package/dist/esm/getBaseViews.native.js +12 -9
- package/dist/esm/getBaseViews.native.js.map +1 -1
- package/dist/esm/index.js +12 -78
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +12 -78
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +12 -52
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/inject-styles.mjs +11 -13
- package/dist/esm/inject-styles.mjs.map +1 -1
- package/dist/esm/inject-styles.native.js +12 -14
- package/dist/esm/inject-styles.native.js.map +1 -1
- package/dist/esm/internal-runtime.mjs +4 -0
- package/dist/esm/internal-runtime.native.js +4 -0
- package/dist/esm/reactNativeTypes.mjs +0 -2
- package/dist/esm/reactNativeTypes.native.js +0 -2
- package/dist/esm/runtime.mjs +47 -0
- package/dist/esm/runtime.mjs.map +1 -0
- package/dist/esm/runtime.native.js +52 -0
- package/dist/esm/runtime.native.js.map +1 -0
- package/dist/esm/setupMedia.mjs +6 -0
- package/dist/esm/setupMedia.mjs.map +1 -0
- package/dist/esm/setupMedia.native.js +10 -0
- package/dist/esm/setupMedia.native.js.map +1 -0
- package/dist/esm/static-resolve.mjs +1 -0
- package/dist/esm/static-resolve.native.js +1 -0
- package/dist/esm/theme-update.mjs +1 -0
- package/dist/esm/theme-update.native.js +1 -0
- package/dist/native.cjs +17823 -16063
- package/dist/test.native.cjs +11197 -6251
- package/internal-runtime/index.cjs +2 -0
- package/internal-runtime/index.js +4 -0
- package/internal-runtime/index.native.js +2 -0
- package/package.json +76 -15
- package/reset.css +15 -12
- package/src/createOptimizedView.native.tsx +8 -6
- package/src/createOptimizedView.tsx +2 -1
- package/src/dom.native.ts +2 -0
- package/src/dom.ts +9 -0
- package/src/getBaseViews.native.ts +13 -6
- package/src/index.tsx +14 -265
- package/src/internal-runtime.tsx +34 -0
- package/src/runtime.tsx +197 -0
- package/src/setupMedia.native.ts +7 -0
- package/src/setupMedia.ts +3 -0
- package/src/static-resolve.ts +1 -0
- package/src/theme-update.ts +1 -0
- package/types/createOptimizedView.d.ts +1 -1
- package/types/createOptimizedView.d.ts.map +1 -1
- package/types/createOptimizedView.native.d.ts +2 -2
- package/types/createOptimizedView.native.d.ts.map +1 -1
- package/types/dom.d.ts +9 -0
- package/types/dom.d.ts.map +1 -0
- package/types/dom.native.d.ts +3 -0
- package/types/dom.native.d.ts.map +1 -0
- package/types/getBaseViews.native.d.ts.map +1 -1
- package/types/index.d.ts +6 -5
- package/types/index.d.ts.map +1 -1
- package/types/inject-styles.d.ts.map +1 -1
- package/types/internal-runtime.d.ts +3 -0
- package/types/internal-runtime.d.ts.map +1 -0
- package/types/runtime.d.ts +4 -0
- package/types/runtime.d.ts.map +1 -0
- package/types/setupMedia.d.ts +2 -0
- package/types/setupMedia.d.ts.map +1 -0
- package/types/setupMedia.native.d.ts +2 -0
- package/types/setupMedia.native.d.ts.map +1 -0
- package/types/static-resolve.d.ts +2 -0
- package/types/static-resolve.d.ts.map +1 -0
- package/types/theme-update.d.ts +2 -0
- package/types/theme-update.d.ts.map +1 -0
- package/.turbo/turbo-build.log +0 -4
- package/bundle-native.mjs +0 -22
- package/dist/esm/reactNativeTypes.mjs.map +0 -1
- package/dist/esm/reactNativeTypes.native.js.map +0 -1
- package/tsconfig.json +0 -30
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// compat with bundlers that resolve this directory instead of the package `exports`
|
|
2
|
+
// map (metro without package exports). ESM so the resolved graph matches what the
|
|
3
|
+
// exports map hands a modern bundler, instead of downgrading it to the CJS build.
|
|
4
|
+
export * from '../dist/esm/internal-runtime.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.1097.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -14,7 +14,26 @@
|
|
|
14
14
|
"source": "src/index.tsx",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"sideEffects": [
|
|
17
|
-
"*.css"
|
|
17
|
+
"*.css",
|
|
18
|
+
"**/runtime.*"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"types",
|
|
23
|
+
"dist",
|
|
24
|
+
"inject-styles",
|
|
25
|
+
"inject-styles.cjs",
|
|
26
|
+
"internal-runtime",
|
|
27
|
+
"static-resolve",
|
|
28
|
+
"native",
|
|
29
|
+
"native.cjs",
|
|
30
|
+
"native.d.ts",
|
|
31
|
+
"native-test",
|
|
32
|
+
"native-test.cjs",
|
|
33
|
+
"native-test.d.ts",
|
|
34
|
+
"reactNativeTypes",
|
|
35
|
+
"reactNativeTypes.cjs",
|
|
36
|
+
"reset.css"
|
|
18
37
|
],
|
|
19
38
|
"main": "dist/cjs",
|
|
20
39
|
"module": "dist/esm",
|
|
@@ -31,6 +50,15 @@
|
|
|
31
50
|
"require": "./dist/cjs/index.cjs",
|
|
32
51
|
"default": "./dist/esm/index.mjs"
|
|
33
52
|
},
|
|
53
|
+
"./theme-update": {
|
|
54
|
+
"types": "./types/theme-update.d.ts",
|
|
55
|
+
"react-native": "./dist/esm/theme-update.native.js",
|
|
56
|
+
"browser": "./dist/esm/theme-update.mjs",
|
|
57
|
+
"module": "./dist/esm/theme-update.mjs",
|
|
58
|
+
"import": "./dist/esm/theme-update.mjs",
|
|
59
|
+
"require": "./dist/cjs/theme-update.cjs",
|
|
60
|
+
"default": "./dist/esm/theme-update.mjs"
|
|
61
|
+
},
|
|
34
62
|
"./native": {
|
|
35
63
|
"types": "./types/index.d.ts",
|
|
36
64
|
"react-native": "./dist/native.cjs",
|
|
@@ -49,6 +77,36 @@
|
|
|
49
77
|
"require": "./dist/test.native.cjs",
|
|
50
78
|
"default": "./dist/test.native.cjs"
|
|
51
79
|
},
|
|
80
|
+
"./dom": {
|
|
81
|
+
"react-native": {
|
|
82
|
+
"types": "./types/dom.native.d.ts",
|
|
83
|
+
"default": "./dist/esm/dom.native.js"
|
|
84
|
+
},
|
|
85
|
+
"types": "./types/dom.d.ts",
|
|
86
|
+
"browser": "./dist/esm/dom.mjs",
|
|
87
|
+
"module": "./dist/esm/dom.mjs",
|
|
88
|
+
"import": "./dist/esm/dom.mjs",
|
|
89
|
+
"require": "./dist/cjs/dom.cjs",
|
|
90
|
+
"default": "./dist/esm/dom.mjs"
|
|
91
|
+
},
|
|
92
|
+
"./internal-runtime": {
|
|
93
|
+
"types": "./types/internal-runtime.d.ts",
|
|
94
|
+
"react-native": "./dist/esm/internal-runtime.native.js",
|
|
95
|
+
"browser": "./dist/esm/internal-runtime.mjs",
|
|
96
|
+
"module": "./dist/esm/internal-runtime.mjs",
|
|
97
|
+
"import": "./dist/esm/internal-runtime.mjs",
|
|
98
|
+
"require": "./dist/cjs/internal-runtime.cjs",
|
|
99
|
+
"default": "./dist/esm/internal-runtime.mjs"
|
|
100
|
+
},
|
|
101
|
+
"./static-resolve": {
|
|
102
|
+
"types": "./types/static-resolve.d.ts",
|
|
103
|
+
"react-native": "./dist/esm/static-resolve.native.js",
|
|
104
|
+
"browser": "./dist/esm/static-resolve.mjs",
|
|
105
|
+
"module": "./dist/esm/static-resolve.mjs",
|
|
106
|
+
"import": "./dist/esm/static-resolve.mjs",
|
|
107
|
+
"require": "./dist/cjs/static-resolve.cjs",
|
|
108
|
+
"default": "./dist/esm/static-resolve.mjs"
|
|
109
|
+
},
|
|
52
110
|
"./inject-styles": {
|
|
53
111
|
"types": "./types/inject-styles.d.ts",
|
|
54
112
|
"react-native": "./dist/esm/inject-styles.mjs",
|
|
@@ -79,23 +137,26 @@
|
|
|
79
137
|
"clean:build": "tamagui-build clean:build"
|
|
80
138
|
},
|
|
81
139
|
"dependencies": {
|
|
82
|
-
"@tamagui/
|
|
83
|
-
"@tamagui/
|
|
84
|
-
"@tamagui/
|
|
85
|
-
"@tamagui/
|
|
86
|
-
"@tamagui/use-
|
|
87
|
-
"@tamagui/
|
|
140
|
+
"@tamagui/compose-refs": "3.0.0-beta.1097.1",
|
|
141
|
+
"@tamagui/constants": "3.0.0-beta.1097.1",
|
|
142
|
+
"@tamagui/helpers": "3.0.0-beta.1097.1",
|
|
143
|
+
"@tamagui/react-native-media-driver": "3.0.0-beta.1097.1",
|
|
144
|
+
"@tamagui/react-native-use-pressable": "3.0.0-beta.1097.1",
|
|
145
|
+
"@tamagui/size": "3.0.0-beta.1097.1",
|
|
146
|
+
"@tamagui/use-element-layout": "3.0.0-beta.1097.1",
|
|
147
|
+
"@tamagui/use-event": "3.0.0-beta.1097.1",
|
|
148
|
+
"@tamagui/web": "3.0.0-beta.1097.1"
|
|
88
149
|
},
|
|
89
150
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "
|
|
91
|
-
"@tamagui/native-bundle": "
|
|
92
|
-
"@tamagui/react-native-web-lite": "
|
|
151
|
+
"@tamagui/build": "3.0.0-beta.1097.1",
|
|
152
|
+
"@tamagui/native-bundle": "3.0.0-beta.1097.1",
|
|
153
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.1097.1",
|
|
93
154
|
"@testing-library/react": "^16.1.0",
|
|
94
155
|
"csstype": "^3.0.10",
|
|
95
|
-
"react": "
|
|
96
|
-
"react-native": "0.
|
|
97
|
-
"typescript": "~
|
|
98
|
-
"vitest": "4.0
|
|
156
|
+
"react": "19.2.3",
|
|
157
|
+
"react-native": "0.86.2",
|
|
158
|
+
"typescript": "~6.0.3",
|
|
159
|
+
"vitest": "4.1.0"
|
|
99
160
|
},
|
|
100
161
|
"peerDependencies": {
|
|
101
162
|
"react": ">=19"
|
package/reset.css
CHANGED
|
@@ -36,24 +36,27 @@ button,
|
|
|
36
36
|
outline: none;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
39
|
+
.tm-fieldset {
|
|
40
40
|
all: unset;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
p,
|
|
44
|
-
input,
|
|
45
|
-
textarea,
|
|
46
|
-
button,
|
|
47
|
-
ul,
|
|
48
|
-
ol,
|
|
49
|
-
li,
|
|
50
|
-
pre,
|
|
51
|
-
dialog {
|
|
43
|
+
:where(p, input, textarea, button, ul, ol, li, pre, dialog) {
|
|
52
44
|
all: unset;
|
|
53
45
|
box-sizing: border-box;
|
|
54
46
|
}
|
|
55
47
|
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
/* `all: unset` above also unsets display, and this rule and the design
|
|
49
|
+
system's `:where(.is_View)` base are both zero specificity, so whichever
|
|
50
|
+
sheet loads last wins. Restate the base display so a tamagui-rendered
|
|
51
|
+
<button> or <p> keeps its layout however the sheets are ordered. */
|
|
52
|
+
:where(.is_View) {
|
|
53
|
+
display: flex;
|
|
54
|
+
}
|
|
55
|
+
:where(.is_Text) {
|
|
56
|
+
display: inline;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
a.tm-button,
|
|
60
|
+
.tm-anchor:has(.tm-button) {
|
|
58
61
|
text-decoration: none;
|
|
59
62
|
}
|
|
@@ -13,7 +13,10 @@ import React, { Context } from 'react' // native only, taken from react-native
|
|
|
13
13
|
export function createOptimizedView(
|
|
14
14
|
children: any,
|
|
15
15
|
viewProps: Record<string, any>,
|
|
16
|
-
baseViews: { TextAncestor: Context<any> }
|
|
16
|
+
baseViews: { TextAncestor: Context<any> },
|
|
17
|
+
// context value read by the caller (useChildren) — reading it here would put
|
|
18
|
+
// a hook behind per-render branches and break hook-order stability
|
|
19
|
+
isInText: boolean
|
|
17
20
|
) {
|
|
18
21
|
const TextAncestor = baseViews.TextAncestor
|
|
19
22
|
|
|
@@ -37,7 +40,6 @@ export function createOptimizedView(
|
|
|
37
40
|
'aria-valuemin': ariaValueMin,
|
|
38
41
|
'aria-valuenow': ariaValueNow,
|
|
39
42
|
'aria-valuetext': ariaValueText,
|
|
40
|
-
focusable,
|
|
41
43
|
id,
|
|
42
44
|
role,
|
|
43
45
|
tabIndex,
|
|
@@ -114,9 +116,10 @@ export function createOptimizedView(
|
|
|
114
116
|
viewProps.accessibilityLabel = al
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
delete viewProps.focusable
|
|
120
|
+
|
|
121
|
+
if (tabIndex !== undefined) {
|
|
122
|
+
viewProps.focusable = Number(tabIndex) >= 0
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
if (_accessibilityState != null) {
|
|
@@ -133,7 +136,6 @@ export function createOptimizedView(
|
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
// isInText is significantly faster than just providing it each time
|
|
136
|
-
const isInText = React.useContext(TextAncestor)
|
|
137
139
|
const finalElement = React.createElement('RCTView', viewProps, children)
|
|
138
140
|
|
|
139
141
|
if (!isInText) {
|
package/src/dom.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@tamagui/core/dom` — standalone Tamagui DOM.
|
|
3
|
+
*
|
|
4
|
+
* `html.*`, `style()`, and on native the DOM primitives the compiler injects.
|
|
5
|
+
* The entry is compile-only on both platforms; see `standalone.ts` in
|
|
6
|
+
* `@tamagui/web` for what that means and why.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from '@tamagui/web/dom'
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
// a namespace import rather than `require('react-native')`: the ESM native artifact
|
|
2
|
+
// (`dist/esm/*.native.js`) is real ESM, where a bare `require` is not defined, and
|
|
3
|
+
// `runtime.tsx` calls this at module scope. The `.default?.` reads keep the same
|
|
4
|
+
// interop the require form relied on, and the CJS builds compile it back to a
|
|
5
|
+
// require, so nothing changes for metro.
|
|
6
|
+
import * as native from 'react-native'
|
|
7
|
+
|
|
1
8
|
export function getBaseViews() {
|
|
2
|
-
const
|
|
9
|
+
const rn = native as any
|
|
3
10
|
|
|
4
11
|
return {
|
|
5
|
-
View:
|
|
6
|
-
Text:
|
|
7
|
-
TextAncestor:
|
|
8
|
-
StyleSheet:
|
|
9
|
-
Pressable:
|
|
12
|
+
View: rn.View || rn.default?.View,
|
|
13
|
+
Text: rn.Text || rn.default?.Text,
|
|
14
|
+
TextAncestor: rn.unstable_TextAncestorContext,
|
|
15
|
+
StyleSheet: rn.StyleSheet || rn.default?.StyleSheet,
|
|
16
|
+
Pressable: rn.Pressable || rn.default?.Pressable,
|
|
10
17
|
}
|
|
11
18
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,74 +1,32 @@
|
|
|
1
1
|
// re-exports all of @tamagui/web just adds hooks
|
|
2
|
+
export { createRefComponent, type RefProp } from '@tamagui/compose-refs'
|
|
3
|
+
export type * from '@tamagui/size'
|
|
4
|
+
export {
|
|
5
|
+
createSizeContext,
|
|
6
|
+
oneSizeSmaller,
|
|
7
|
+
resolveSize,
|
|
8
|
+
SizeContext,
|
|
9
|
+
} from '@tamagui/size'
|
|
2
10
|
export * from '@tamagui/web'
|
|
3
11
|
|
|
4
|
-
import { createMedia } from '@tamagui/react-native-media-driver'
|
|
5
|
-
import { isWeb } from '@tamagui/constants'
|
|
6
|
-
import {
|
|
7
|
-
createMeasure,
|
|
8
|
-
createMeasureInWindow,
|
|
9
|
-
createMeasureLayout,
|
|
10
|
-
enable,
|
|
11
|
-
useElementLayout,
|
|
12
|
-
} from '@tamagui/use-element-layout'
|
|
13
12
|
import type {
|
|
14
13
|
StackNonStyleProps,
|
|
15
14
|
StackStyleBase,
|
|
16
15
|
TamaDefer,
|
|
17
16
|
TamaguiComponent,
|
|
18
17
|
TamaguiElement,
|
|
19
|
-
TamaguiProviderProps,
|
|
20
18
|
TamaguiTextElement,
|
|
21
19
|
TextNonStyleProps,
|
|
22
20
|
TextProps,
|
|
23
21
|
TextStylePropsBase,
|
|
24
22
|
} from '@tamagui/web'
|
|
25
|
-
import {
|
|
26
|
-
TamaguiProvider as WebTamaguiProvider,
|
|
27
|
-
Text as WebText,
|
|
28
|
-
View as WebView,
|
|
29
|
-
createTamagui as createTamaguiWeb,
|
|
30
|
-
setupHooks,
|
|
31
|
-
useIsomorphicLayoutEffect,
|
|
32
|
-
} from '@tamagui/web'
|
|
33
|
-
import { createOptimizedView } from './createOptimizedView'
|
|
34
|
-
import { getBaseViews } from './getBaseViews'
|
|
23
|
+
import { Text as WebText, View as WebView } from '@tamagui/web'
|
|
35
24
|
import type { RNTextProps, RNViewProps } from './reactNativeTypes'
|
|
36
25
|
|
|
37
|
-
type GestureEnabledFreezeState = {
|
|
38
|
-
frozen: boolean
|
|
39
|
-
enabled: boolean
|
|
40
|
-
warned: boolean
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const GESTURE_STATE_KEY = '__tamagui_gesture__'
|
|
44
|
-
const GESTURE_ENABLED_FREEZE_KEY = '__tamagui_gesture_enabled_freeze__'
|
|
45
|
-
|
|
46
|
-
function freezeGestureHandlerEnabledMode() {
|
|
47
|
-
const g = globalThis as typeof globalThis & {
|
|
48
|
-
[GESTURE_STATE_KEY]?: { enabled?: boolean }
|
|
49
|
-
[GESTURE_ENABLED_FREEZE_KEY]?: GestureEnabledFreezeState
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const freezeState = (g[GESTURE_ENABLED_FREEZE_KEY] ??= {
|
|
53
|
-
frozen: false,
|
|
54
|
-
enabled: false,
|
|
55
|
-
warned: false,
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
if (freezeState.frozen) {
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
freezeState.frozen = true
|
|
63
|
-
freezeState.enabled = Boolean(g[GESTURE_STATE_KEY]?.enabled)
|
|
64
|
-
freezeState.warned = false
|
|
65
|
-
}
|
|
66
|
-
|
|
67
26
|
// helpful for usage outside of tamagui
|
|
68
27
|
export {
|
|
69
28
|
LayoutMeasurementController,
|
|
70
29
|
registerLayoutNode,
|
|
71
|
-
setOnLayoutStrategy,
|
|
72
30
|
type LayoutEvent,
|
|
73
31
|
} from '@tamagui/use-element-layout'
|
|
74
32
|
|
|
@@ -102,125 +60,8 @@ type RNTamaguiText = TamaguiComponent<
|
|
|
102
60
|
// see https://discord.com/channels/909986013848412191/1146150253490348112/1146150253490348112
|
|
103
61
|
export * from './reactNativeTypes'
|
|
104
62
|
|
|
105
|
-
//
|
|
106
|
-
export
|
|
107
|
-
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
108
|
-
freezeGestureHandlerEnabledMode()
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
useIsomorphicLayoutEffect(() => {
|
|
112
|
-
enable()
|
|
113
|
-
}, [])
|
|
114
|
-
|
|
115
|
-
return <WebTamaguiProvider {...props} />
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// automate using the react native media driver
|
|
119
|
-
export const createTamagui: typeof createTamaguiWeb = (conf) => {
|
|
120
|
-
if (!isWeb) {
|
|
121
|
-
if (conf.media) {
|
|
122
|
-
conf.media = createMedia(conf.media)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return createTamaguiWeb(conf)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const baseViews = getBaseViews()
|
|
129
|
-
|
|
130
|
-
// setup internal hooks:
|
|
131
|
-
|
|
132
|
-
setupHooks({
|
|
133
|
-
getBaseViews,
|
|
134
|
-
|
|
135
|
-
setElementProps: (node) => {
|
|
136
|
-
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
137
|
-
// web only
|
|
138
|
-
if (node && !node['measure']) {
|
|
139
|
-
node.measure ||= createMeasure(node)
|
|
140
|
-
node.measureInWindow ||= createMeasureInWindow(node)
|
|
141
|
-
node.measureLayout ||= createMeasureLayout(node)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
usePropsTransform(elementType, propsIn, stateRef, willHydrate) {
|
|
147
|
-
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
148
|
-
const isDOM = typeof elementType === 'string'
|
|
149
|
-
|
|
150
|
-
// replicate react-native-web functionality
|
|
151
|
-
const {
|
|
152
|
-
// remove event props handles by useResponderEvents
|
|
153
|
-
onMoveShouldSetResponder,
|
|
154
|
-
onMoveShouldSetResponderCapture,
|
|
155
|
-
onResponderEnd,
|
|
156
|
-
onResponderGrant,
|
|
157
|
-
onResponderMove,
|
|
158
|
-
onResponderReject,
|
|
159
|
-
onResponderRelease,
|
|
160
|
-
onResponderStart,
|
|
161
|
-
onResponderTerminate,
|
|
162
|
-
onResponderTerminationRequest,
|
|
163
|
-
onScrollShouldSetResponder,
|
|
164
|
-
onScrollShouldSetResponderCapture,
|
|
165
|
-
onSelectionChangeShouldSetResponder,
|
|
166
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
167
|
-
onStartShouldSetResponder,
|
|
168
|
-
onStartShouldSetResponderCapture,
|
|
169
|
-
|
|
170
|
-
// android
|
|
171
|
-
collapsable,
|
|
172
|
-
focusable,
|
|
173
|
-
|
|
174
|
-
// deprecated,
|
|
175
|
-
accessible,
|
|
176
|
-
accessibilityDisabled,
|
|
177
|
-
|
|
178
|
-
onLayout,
|
|
179
|
-
hrefAttrs,
|
|
180
|
-
|
|
181
|
-
...plainDOMProps
|
|
182
|
-
} = propsIn
|
|
183
|
-
|
|
184
|
-
if (willHydrate || isDOM) {
|
|
185
|
-
useElementLayout(stateRef, !isDOM ? undefined : (onLayout as any))
|
|
186
|
-
// responder events removed for web - use native pointer/touch events instead
|
|
187
|
-
// the onResponder* props are stripped above and not passed to DOM
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (isDOM) {
|
|
191
|
-
// TODO move into getSplitStyles
|
|
192
|
-
if (plainDOMProps.href && hrefAttrs) {
|
|
193
|
-
const { download, rel, target } = hrefAttrs
|
|
194
|
-
if (download != null) {
|
|
195
|
-
plainDOMProps.download = download
|
|
196
|
-
}
|
|
197
|
-
if (rel) {
|
|
198
|
-
plainDOMProps.rel = rel
|
|
199
|
-
}
|
|
200
|
-
if (typeof target === 'string') {
|
|
201
|
-
plainDOMProps.target = target.charAt(0) !== '_' ? `_${target}` : target
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return plainDOMProps
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
// attempt at properly fixing RN input, but <Pressable><TextInput /> just doesnt work on RN
|
|
210
|
-
...(process.env.TAMAGUI_TARGET === 'native' && {
|
|
211
|
-
useChildren(elementType, children, viewProps) {
|
|
212
|
-
if (process.env.NODE_ENV === 'test') {
|
|
213
|
-
// test mode - just use regular views since optimizations cause weirdness
|
|
214
|
-
return
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (elementType === baseViews.View && baseViews.TextAncestor) {
|
|
218
|
-
// optimize view
|
|
219
|
-
return createOptimizedView(children, viewProps, baseViews)
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
}),
|
|
223
|
-
})
|
|
63
|
+
// the one platform setup path, shared with `@tamagui/core/internal-runtime`
|
|
64
|
+
export { createTamagui, TamaguiProvider } from './runtime'
|
|
224
65
|
|
|
225
66
|
// overwrite web versions:
|
|
226
67
|
// putting at the end ensures it overwrites in dist/cjs/index.js
|
|
@@ -259,115 +100,23 @@ export const Text = WebText as any as RNTamaguiText
|
|
|
259
100
|
|
|
260
101
|
// const zz = <A />
|
|
261
102
|
|
|
262
|
-
// const variants = {
|
|
263
|
-
// fullscreen: {
|
|
264
|
-
// true: {},
|
|
265
|
-
// },
|
|
266
|
-
// elevation: {
|
|
267
|
-
// '...size': () => ({}),
|
|
268
|
-
// ':number': () => ({}),
|
|
269
|
-
// },
|
|
270
|
-
// } as const
|
|
271
|
-
|
|
272
|
-
// export const YStack = styled(View, {
|
|
273
|
-
// flexDirection: 'column',
|
|
274
|
-
// variants,
|
|
275
|
-
// })
|
|
276
|
-
|
|
277
103
|
// import { TextInput } from 'react-native'
|
|
278
104
|
// export const InputFrame = styled(
|
|
279
105
|
// TextInput,
|
|
280
106
|
// {
|
|
281
|
-
//
|
|
107
|
+
// displayName: 'Input',
|
|
282
108
|
// backgroundColor: 'green',
|
|
283
109
|
|
|
284
110
|
// variants: {
|
|
285
|
-
//
|
|
286
|
-
// // false: {},
|
|
287
|
-
// // },
|
|
288
|
-
|
|
289
|
-
// size: {
|
|
290
|
-
// '...size': () => ({}),
|
|
291
|
-
// },
|
|
111
|
+
// size: styled.dynamic(() => ({})),
|
|
292
112
|
|
|
293
113
|
// // disabled: {
|
|
294
|
-
// //
|
|
114
|
+
// // boolean: () => ({})
|
|
295
115
|
// // },
|
|
296
116
|
// } as const,
|
|
297
|
-
|
|
298
|
-
// // defaultVariants: {
|
|
299
|
-
// // unstyled: process.env.TAMAGUI_HEADLESS === '1' ? true : false,
|
|
300
|
-
// // },
|
|
301
117
|
// },
|
|
302
118
|
// {
|
|
303
119
|
// isText: true,
|
|
304
|
-
// accept: {
|
|
305
|
-
// placeholderTextColor: 'color',
|
|
306
|
-
// },
|
|
307
|
-
// }
|
|
308
|
-
// )
|
|
309
|
-
|
|
310
|
-
// export const StyledInputFrame = styled(InputFrame, {
|
|
311
|
-
// fontSize: 16,
|
|
312
|
-
// fontFamily: '$silkscreen',
|
|
313
|
-
// color: '$color5',
|
|
314
|
-
// minWidth: 0,
|
|
315
|
-
// borderWidth: 0,
|
|
316
|
-
// borderColor: 'transparent',
|
|
317
|
-
|
|
318
|
-
// variants: {
|
|
319
|
-
// unset: {
|
|
320
|
-
// false: {
|
|
321
|
-
// borderWidth: 2,
|
|
322
|
-
// py: 12,
|
|
323
|
-
// px: 14,
|
|
324
|
-
// borderRadius: 6,
|
|
325
|
-
// bg: '$color3',
|
|
326
|
-
// focusStyle: {
|
|
327
|
-
// bg: '$color4',
|
|
328
|
-
// margin: 0,
|
|
329
|
-
// },
|
|
330
|
-
// },
|
|
331
120
|
// },
|
|
332
|
-
// } as const,
|
|
333
|
-
|
|
334
|
-
// defaultVariants: {
|
|
335
|
-
// unset: false,
|
|
336
|
-
// },
|
|
337
|
-
// })
|
|
338
|
-
|
|
339
|
-
// export const StyledStyledInputFrame = styled(
|
|
340
|
-
// StyledInputFrame,
|
|
341
|
-
// {
|
|
342
|
-
// fontSize: 16,
|
|
343
|
-
// fontFamily: '$silkscreen',
|
|
344
|
-
// color: '$color5',
|
|
345
|
-
// minWidth: 0,
|
|
346
|
-
// borderWidth: 0,
|
|
347
|
-
// borderColor: 'transparent',
|
|
348
|
-
|
|
349
|
-
// variants: {
|
|
350
|
-
// unset: {
|
|
351
|
-
// false: {
|
|
352
|
-
// borderWidth: 2,
|
|
353
|
-
// py: 12,
|
|
354
|
-
// px: 14,
|
|
355
|
-
// borderRadius: 6,
|
|
356
|
-
// bg: '$color3',
|
|
357
|
-
// focusStyle: {
|
|
358
|
-
// bg: '$color4',
|
|
359
|
-
// margin: 0,
|
|
360
|
-
// },
|
|
361
|
-
// },
|
|
362
|
-
// },
|
|
363
|
-
// } as const,
|
|
364
|
-
|
|
365
|
-
// defaultVariants: {
|
|
366
|
-
// unset: false,
|
|
367
|
-
// },
|
|
368
|
-
// },
|
|
369
|
-
// {
|
|
370
|
-
// inlineProps: new Set(['id', 'testID']),
|
|
371
121
|
// }
|
|
372
122
|
// )
|
|
373
|
-
// export const DepthTest = () => <StyledStyledInputFrame placeholder="" />
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private implementation boundary: what another style frontend package needs to
|
|
3
|
+
* build components on the shared Tamagui runtime, with the platform setup already
|
|
4
|
+
* applied. Not public API — never reexport it from `@tamagui/core`, `tamagui`, or
|
|
5
|
+
* `@tamagui/tailwind` roots.
|
|
6
|
+
*
|
|
7
|
+
* Reading a real binding from `./runtime` keeps the one platform setup module in
|
|
8
|
+
* the built artifact. A bare side-effect import was pruned from ESM while CJS kept
|
|
9
|
+
* it. `runtime.*` is also declared side-effectful so downstream bundlers retain it.
|
|
10
|
+
* The binding stays private so this declaration entry does not pull the regular
|
|
11
|
+
* provider/config type graph into another frontend.
|
|
12
|
+
*/
|
|
13
|
+
import { createTamagui as platformSetup } from './runtime'
|
|
14
|
+
|
|
15
|
+
void platformSetup
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
createFrontendHTML,
|
|
19
|
+
createFrontendStyled,
|
|
20
|
+
createFrontendViews,
|
|
21
|
+
mergeFrontendCondition,
|
|
22
|
+
plainValueToPayload,
|
|
23
|
+
regularStyleFrontend,
|
|
24
|
+
} from '@tamagui/web/internal-runtime'
|
|
25
|
+
export type {
|
|
26
|
+
FrontendComponent,
|
|
27
|
+
FrontendHTMLTag,
|
|
28
|
+
FrontendClassPlan,
|
|
29
|
+
FrontendClassPlanEntry,
|
|
30
|
+
FrontendClassSink,
|
|
31
|
+
FrontendStaticConfig,
|
|
32
|
+
StyleFrontend,
|
|
33
|
+
StyleFrontendConfig,
|
|
34
|
+
} from '@tamagui/web/internal-runtime'
|