@tamagui/core 1.99.0 → 1.99.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.
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createElement, useContext } from "react";
|
|
2
|
+
function createOptimizedView(children, viewProps, baseViews) {
|
|
3
|
+
const TextAncestor = baseViews.TextAncestor,
|
|
4
|
+
ViewNativeComponent = baseViews.View,
|
|
5
|
+
{
|
|
6
|
+
accessibilityElementsHidden,
|
|
7
|
+
accessibilityLabel,
|
|
8
|
+
accessibilityLabelledBy,
|
|
9
|
+
accessibilityLiveRegion,
|
|
10
|
+
accessibilityRole,
|
|
11
|
+
accessibilityState,
|
|
12
|
+
accessibilityValue,
|
|
13
|
+
"aria-busy": ariaBusy,
|
|
14
|
+
"aria-checked": ariaChecked,
|
|
15
|
+
"aria-disabled": ariaDisabled,
|
|
16
|
+
"aria-expanded": ariaExpanded,
|
|
17
|
+
"aria-hidden": ariaHidden,
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
"aria-labelledby": ariaLabelledBy,
|
|
20
|
+
"aria-live": ariaLive,
|
|
21
|
+
"aria-selected": ariaSelected,
|
|
22
|
+
"aria-valuemax": ariaValueMax,
|
|
23
|
+
"aria-valuemin": ariaValueMin,
|
|
24
|
+
"aria-valuenow": ariaValueNow,
|
|
25
|
+
"aria-valuetext": ariaValueText,
|
|
26
|
+
focusable,
|
|
27
|
+
id,
|
|
28
|
+
importantForAccessibility,
|
|
29
|
+
nativeID,
|
|
30
|
+
pointerEvents,
|
|
31
|
+
role,
|
|
32
|
+
tabIndex
|
|
33
|
+
// ...otherProps
|
|
34
|
+
} = viewProps,
|
|
35
|
+
_accessibilityLabelledBy = ariaLabelledBy?.split(/\s*,\s*/g) ?? accessibilityLabelledBy;
|
|
36
|
+
let _accessibilityState;
|
|
37
|
+
(accessibilityState != null || ariaBusy != null || ariaChecked != null || ariaDisabled != null || ariaExpanded != null || ariaSelected != null) && (_accessibilityState = {
|
|
38
|
+
busy: ariaBusy ?? accessibilityState?.busy,
|
|
39
|
+
checked: ariaChecked ?? accessibilityState?.checked,
|
|
40
|
+
disabled: ariaDisabled ?? accessibilityState?.disabled,
|
|
41
|
+
expanded: ariaExpanded ?? accessibilityState?.expanded,
|
|
42
|
+
selected: ariaSelected ?? accessibilityState?.selected
|
|
43
|
+
});
|
|
44
|
+
let _accessibilityValue;
|
|
45
|
+
(accessibilityValue != null || ariaValueMax != null || ariaValueMin != null || ariaValueNow != null || ariaValueText != null) && (_accessibilityValue = {
|
|
46
|
+
max: ariaValueMax ?? accessibilityValue?.max,
|
|
47
|
+
min: ariaValueMin ?? accessibilityValue?.min,
|
|
48
|
+
now: ariaValueNow ?? accessibilityValue?.now,
|
|
49
|
+
text: ariaValueText ?? accessibilityValue?.text
|
|
50
|
+
});
|
|
51
|
+
let style = Array.isArray(viewProps.style) ? baseViews.StyleSheet.flatten(viewProps.style) : viewProps.style;
|
|
52
|
+
const newPointerEvents = style?.pointerEvents || pointerEvents,
|
|
53
|
+
finalProps = viewProps,
|
|
54
|
+
extras = {
|
|
55
|
+
accessibilityLiveRegion: ariaLive === "off" ? "none" : ariaLive ?? accessibilityLiveRegion,
|
|
56
|
+
accessibilityLabel: ariaLabel ?? accessibilityLabel,
|
|
57
|
+
focusable: tabIndex !== void 0 ? !tabIndex : focusable,
|
|
58
|
+
accessibilityState: _accessibilityState,
|
|
59
|
+
accessibilityRole: role ? getAccessibilityRoleFromRole(role) : accessibilityRole,
|
|
60
|
+
accessibilityElementsHidden: ariaHidden ?? accessibilityElementsHidden,
|
|
61
|
+
accessibilityLabelledBy: _accessibilityLabelledBy,
|
|
62
|
+
accessibilityValue: _accessibilityValue,
|
|
63
|
+
importantForAccessibility: ariaHidden === !0 ? "no-hide-descendants" : importantForAccessibility,
|
|
64
|
+
nativeID: id ?? nativeID,
|
|
65
|
+
style,
|
|
66
|
+
pointerEvents: newPointerEvents
|
|
67
|
+
};
|
|
68
|
+
for (const key in extras) extras[key] != null && (finalProps[key] = extras[key]);
|
|
69
|
+
const isInText = useContext(TextAncestor),
|
|
70
|
+
finalElement = createElement(ViewNativeComponent, finalProps, children);
|
|
71
|
+
return isInText ? createElement(TextAncestor.Provider, {
|
|
72
|
+
value: !1
|
|
73
|
+
}, finalElement) : finalElement;
|
|
74
|
+
}
|
|
75
|
+
function getAccessibilityRoleFromRole(role) {
|
|
76
|
+
switch (role) {
|
|
77
|
+
case "alert":
|
|
78
|
+
return "alert";
|
|
79
|
+
case "alertdialog":
|
|
80
|
+
return;
|
|
81
|
+
case "application":
|
|
82
|
+
return;
|
|
83
|
+
case "article":
|
|
84
|
+
return;
|
|
85
|
+
case "banner":
|
|
86
|
+
return;
|
|
87
|
+
case "button":
|
|
88
|
+
return "button";
|
|
89
|
+
case "cell":
|
|
90
|
+
return;
|
|
91
|
+
case "checkbox":
|
|
92
|
+
return "checkbox";
|
|
93
|
+
case "columnheader":
|
|
94
|
+
return;
|
|
95
|
+
case "combobox":
|
|
96
|
+
return "combobox";
|
|
97
|
+
case "complementary":
|
|
98
|
+
return;
|
|
99
|
+
case "contentinfo":
|
|
100
|
+
return;
|
|
101
|
+
case "definition":
|
|
102
|
+
return;
|
|
103
|
+
case "dialog":
|
|
104
|
+
return;
|
|
105
|
+
case "directory":
|
|
106
|
+
return;
|
|
107
|
+
case "document":
|
|
108
|
+
return;
|
|
109
|
+
case "feed":
|
|
110
|
+
return;
|
|
111
|
+
case "figure":
|
|
112
|
+
return;
|
|
113
|
+
case "form":
|
|
114
|
+
return;
|
|
115
|
+
case "grid":
|
|
116
|
+
return "grid";
|
|
117
|
+
case "group":
|
|
118
|
+
return;
|
|
119
|
+
case "heading":
|
|
120
|
+
return "header";
|
|
121
|
+
case "img":
|
|
122
|
+
return "image";
|
|
123
|
+
case "link":
|
|
124
|
+
return "link";
|
|
125
|
+
case "list":
|
|
126
|
+
return "list";
|
|
127
|
+
case "listitem":
|
|
128
|
+
return;
|
|
129
|
+
case "log":
|
|
130
|
+
return;
|
|
131
|
+
case "main":
|
|
132
|
+
return;
|
|
133
|
+
case "marquee":
|
|
134
|
+
return;
|
|
135
|
+
case "math":
|
|
136
|
+
return;
|
|
137
|
+
case "menu":
|
|
138
|
+
return "menu";
|
|
139
|
+
case "menubar":
|
|
140
|
+
return "menubar";
|
|
141
|
+
case "menuitem":
|
|
142
|
+
return "menuitem";
|
|
143
|
+
case "meter":
|
|
144
|
+
return;
|
|
145
|
+
case "navigation":
|
|
146
|
+
return;
|
|
147
|
+
case "none":
|
|
148
|
+
return "none";
|
|
149
|
+
case "note":
|
|
150
|
+
return;
|
|
151
|
+
case "option":
|
|
152
|
+
return;
|
|
153
|
+
case "presentation":
|
|
154
|
+
return "none";
|
|
155
|
+
case "progressbar":
|
|
156
|
+
return "progressbar";
|
|
157
|
+
case "radio":
|
|
158
|
+
return "radio";
|
|
159
|
+
case "radiogroup":
|
|
160
|
+
return "radiogroup";
|
|
161
|
+
case "region":
|
|
162
|
+
return;
|
|
163
|
+
case "row":
|
|
164
|
+
return;
|
|
165
|
+
case "rowgroup":
|
|
166
|
+
return;
|
|
167
|
+
case "rowheader":
|
|
168
|
+
return;
|
|
169
|
+
case "scrollbar":
|
|
170
|
+
return "scrollbar";
|
|
171
|
+
case "searchbox":
|
|
172
|
+
return "search";
|
|
173
|
+
case "separator":
|
|
174
|
+
return;
|
|
175
|
+
case "slider":
|
|
176
|
+
return "adjustable";
|
|
177
|
+
case "spinbutton":
|
|
178
|
+
return "spinbutton";
|
|
179
|
+
case "status":
|
|
180
|
+
return;
|
|
181
|
+
case "summary":
|
|
182
|
+
return "summary";
|
|
183
|
+
case "switch":
|
|
184
|
+
return "switch";
|
|
185
|
+
case "tab":
|
|
186
|
+
return "tab";
|
|
187
|
+
case "table":
|
|
188
|
+
return;
|
|
189
|
+
case "tablist":
|
|
190
|
+
return "tablist";
|
|
191
|
+
case "tabpanel":
|
|
192
|
+
return;
|
|
193
|
+
case "term":
|
|
194
|
+
return;
|
|
195
|
+
case "timer":
|
|
196
|
+
return "timer";
|
|
197
|
+
case "toolbar":
|
|
198
|
+
return "toolbar";
|
|
199
|
+
case "tooltip":
|
|
200
|
+
return;
|
|
201
|
+
case "tree":
|
|
202
|
+
return;
|
|
203
|
+
case "treegrid":
|
|
204
|
+
return;
|
|
205
|
+
case "treeitem":
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export { createOptimizedView, getAccessibilityRoleFromRole };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function getBaseViews() {
|
|
2
|
+
const native = require("react-native");
|
|
3
|
+
let View, TextAncestor;
|
|
4
|
+
return process.env.NODE_ENV !== "test" && (View = require("react-native/Libraries/Components/View/ViewNativeComponent").default, TextAncestor = require("react-native/Libraries/Text/TextAncestor")), View || (View = native.View || native.default.View), {
|
|
5
|
+
View,
|
|
6
|
+
Text: native.Text || native.default.Text,
|
|
7
|
+
StyleSheet: native.StyleSheet || native.default.StyleSheet,
|
|
8
|
+
TextAncestor,
|
|
9
|
+
Pressable: native.Pressable || native.default.Pressable
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export { getBaseViews };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.99.
|
|
3
|
+
"version": "1.99.1",
|
|
4
4
|
"source": "src/index.tsx",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"native-test.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/react-native-use-pressable": "1.99.
|
|
39
|
-
"@tamagui/react-native-use-responder-events": "1.99.
|
|
40
|
-
"@tamagui/use-event": "1.99.
|
|
41
|
-
"@tamagui/web": "1.99.
|
|
38
|
+
"@tamagui/react-native-use-pressable": "1.99.1",
|
|
39
|
+
"@tamagui/react-native-use-responder-events": "1.99.1",
|
|
40
|
+
"@tamagui/use-event": "1.99.1",
|
|
41
|
+
"@tamagui/web": "1.99.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "1.99.
|
|
44
|
+
"@tamagui/build": "1.99.1",
|
|
45
45
|
"@testing-library/react": "^14.0.0",
|
|
46
46
|
"csstype": "^3.0.10",
|
|
47
47
|
"react": "^18.2.0",
|