@tamagui/web 3.0.0-beta.1479.1 → 3.0.0-beta.1537.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/eventHandling.native.cjs +2 -2
- package/dist/cjs/eventHandling.native.js +2 -2
- package/dist/cjs/eventHandling.native.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.cjs +25 -1
- package/dist/cjs/helpers/expandStyle.native.cjs +25 -1
- package/dist/cjs/helpers/expandStyle.native.js +25 -1
- package/dist/cjs/helpers/expandStyle.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.cjs +16 -6
- package/dist/cjs/helpers/getSplitStyles.native.js +16 -6
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/mainThreadPressEvents.native.cjs +47 -120
- package/dist/cjs/helpers/mainThreadPressEvents.native.js +47 -120
- package/dist/cjs/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeState.cjs +2 -2
- package/dist/cjs/hooks/useThemeState.native.cjs +2 -2
- package/dist/cjs/hooks/useThemeState.native.js +2 -2
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/eventHandling.native.js +2 -2
- package/dist/esm/eventHandling.native.js.map +1 -1
- package/dist/esm/helpers/expandStyle.mjs +22 -1
- package/dist/esm/helpers/expandStyle.mjs.map +1 -1
- package/dist/esm/helpers/expandStyle.native.js +22 -1
- package/dist/esm/helpers/expandStyle.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +17 -7
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/mainThreadPressEvents.native.js +48 -121
- package/dist/esm/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/esm/hooks/useThemeState.mjs +2 -2
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +2 -2
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/package.json +16 -16
- package/src/eventHandling.native.ts +4 -4
- package/src/helpers/expandStyle.ts +26 -0
- package/src/helpers/getSplitStyles.tsx +18 -1
- package/src/helpers/mainThreadPressEvents.native.ts +66 -187
- package/src/hooks/useThemeState.ts +10 -2
- package/types/helpers/expandStyle.d.ts +1 -0
- package/types/helpers/expandStyle.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/mainThreadPressEvents.native.d.ts +0 -7
- package/types/helpers/mainThreadPressEvents.native.d.ts.map +1 -1
- package/types/hooks/useThemeState.d.ts.map +1 -1
|
@@ -1,153 +1,80 @@
|
|
|
1
1
|
import { unstable_hasExternalPressOwnership } from "@tamagui/native";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from "react";
|
|
3
3
|
|
|
4
|
-
var DEFAULT_LONG_PRESS_DELAY = 500;
|
|
5
|
-
var DEFAULT_MIN_PRESS_DURATION = 130;
|
|
6
4
|
function useMainThreadPressEvents(events, viewProps) {
|
|
7
5
|
var enabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, debugName = arguments.length > 3 ? arguments[3] : void 0;
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
activateTime: 0,
|
|
16
|
-
blockedByExternalOwnership: false,
|
|
17
|
-
pressInOutstanding: false
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
useEffect(function() {
|
|
21
|
-
return function() {
|
|
22
|
-
clearStartTimers();
|
|
23
|
-
if (ref.current.pressOutTimer) {
|
|
24
|
-
clearTimeout(ref.current.pressOutTimer);
|
|
25
|
-
ref.current.pressOutTimer = null;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
if (!enabled || !events) return;
|
|
30
|
-
var _events_delayPressIn;
|
|
31
|
-
var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
|
|
32
|
-
var _events_delayPressOut;
|
|
33
|
-
var delayPressOut = Math.max(0, (_events_delayPressOut = events.delayPressOut) !== null && _events_delayPressOut !== void 0 ? _events_delayPressOut : 0);
|
|
34
|
-
var _events_delayLongPress;
|
|
35
|
-
var delayLongPress = Math.max(0, (_events_delayLongPress = events.delayLongPress) !== null && _events_delayLongPress !== void 0 ? _events_delayLongPress : DEFAULT_LONG_PRESS_DELAY);
|
|
36
|
-
var _events_minPressDuration;
|
|
37
|
-
var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
|
|
38
|
-
function activate(e) {
|
|
39
|
-
var _events_onPressIn;
|
|
40
|
-
if (ref.current.pressInOutstanding) return;
|
|
41
|
-
ref.current.pressInOutstanding = true;
|
|
42
|
-
ref.current.state = "active";
|
|
43
|
-
ref.current.activateTime = Date.now();
|
|
44
|
-
(_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);
|
|
45
|
-
}
|
|
46
|
-
function clearStartTimers() {
|
|
47
|
-
if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
|
|
48
|
-
if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
|
|
49
|
-
ref.current.pressInTimer = null;
|
|
50
|
-
ref.current.longPressTimer = null;
|
|
51
|
-
}
|
|
52
|
-
function releasePressOut(e) {
|
|
6
|
+
var usePressability = require("react-native/Libraries/Pressability/usePressability").default;
|
|
7
|
+
var initialized = useRef(false);
|
|
8
|
+
var ownsResponder = useRef(false);
|
|
9
|
+
var pressActive = useRef(false);
|
|
10
|
+
var active = enabled && Boolean(events);
|
|
11
|
+
if (active) initialized.current = true;
|
|
12
|
+
function endPress(e) {
|
|
53
13
|
var _events_onPressOut;
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
if (!ref.current.pressInOutstanding) return;
|
|
59
|
-
ref.current.pressInOutstanding = false;
|
|
60
|
-
ref.current.state = "idle";
|
|
61
|
-
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
62
|
-
}
|
|
63
|
-
function deactivate(e) {
|
|
64
|
-
if (!ref.current.pressInOutstanding) return;
|
|
65
|
-
var pressDuration = Date.now() - ref.current.activateTime;
|
|
66
|
-
var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
|
|
67
|
-
if (remaining > 0) {
|
|
68
|
-
if (!ref.current.pressOutTimer) {
|
|
69
|
-
ref.current.pressOutTimer = setTimeout(function() {
|
|
70
|
-
ref.current.pressOutTimer = null;
|
|
71
|
-
releasePressOut(e);
|
|
72
|
-
}, remaining);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
releasePressOut(e);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function resetPress(e) {
|
|
79
|
-
releasePressOut(e);
|
|
80
|
-
clearStartTimers();
|
|
81
|
-
ref.current.blockedByExternalOwnership = false;
|
|
14
|
+
if (!pressActive.current) return;
|
|
15
|
+
pressActive.current = false;
|
|
16
|
+
events === null || events === void 0 ? void 0 : (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
82
17
|
}
|
|
18
|
+
var handlers = usePressability(initialized.current ? {
|
|
19
|
+
...active ? events : {},
|
|
20
|
+
disabled: !active || (events === null || events === void 0 ? void 0 : events.disabled),
|
|
21
|
+
android_disableSound: true,
|
|
22
|
+
onPressIn: active ? function(e) {
|
|
23
|
+
var _events_onPressIn;
|
|
24
|
+
endPress(e);
|
|
25
|
+
pressActive.current = true;
|
|
26
|
+
(_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);
|
|
27
|
+
} : void 0,
|
|
28
|
+
onPressOut: active ? endPress : void 0,
|
|
29
|
+
hitSlop: viewProps.hitSlop,
|
|
30
|
+
pressRectOffset: viewProps.pressRetentionOffset
|
|
31
|
+
} : null);
|
|
32
|
+
if (!active || !handlers) return;
|
|
83
33
|
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
84
34
|
var userGrant = viewProps.onResponderGrant;
|
|
85
35
|
var userRelease = viewProps.onResponderRelease;
|
|
86
36
|
var userTerminate = viewProps.onResponderTerminate;
|
|
87
37
|
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
88
38
|
var userMove = viewProps.onResponderMove;
|
|
39
|
+
var userClick = viewProps.onClick;
|
|
89
40
|
viewProps.onStartShouldSetResponder = function(e) {
|
|
90
|
-
|
|
91
|
-
return !events.disabled && !unstable_hasExternalPressOwnership();
|
|
41
|
+
return (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !unstable_hasExternalPressOwnership() && handlers.onStartShouldSetResponder();
|
|
92
42
|
};
|
|
93
43
|
viewProps.onResponderGrant = function(e) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (unstable_hasExternalPressOwnership()) {
|
|
97
|
-
ref.current.state = "idle";
|
|
98
|
-
ref.current.blockedByExternalOwnership = true;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
44
|
+
endPress(e);
|
|
45
|
+
if (unstable_hasExternalPressOwnership()) return;
|
|
101
46
|
userGrant === null || userGrant === void 0 ? void 0 : userGrant(e);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (delayPressIn > 0) {
|
|
105
|
-
ref.current.pressInTimer = setTimeout(function() {
|
|
106
|
-
return activate(e);
|
|
107
|
-
}, delayPressIn);
|
|
108
|
-
} else {
|
|
109
|
-
activate(e);
|
|
110
|
-
}
|
|
111
|
-
if (events.onLongPress) {
|
|
112
|
-
ref.current.longPressTimer = setTimeout(function() {
|
|
113
|
-
if (ref.current.state === "active") {
|
|
114
|
-
var _events_onLongPress;
|
|
115
|
-
ref.current.state = "longPressed";
|
|
116
|
-
(_events_onLongPress = events.onLongPress) === null || _events_onLongPress === void 0 ? void 0 : _events_onLongPress.call(events, e);
|
|
117
|
-
}
|
|
118
|
-
}, delayLongPress + delayPressIn);
|
|
119
|
-
}
|
|
47
|
+
ownsResponder.current = true;
|
|
48
|
+
return handlers.onResponderGrant(e);
|
|
120
49
|
};
|
|
121
50
|
viewProps.onResponderRelease = function(e) {
|
|
122
|
-
if (
|
|
123
|
-
|
|
51
|
+
if (!ownsResponder.current) return;
|
|
52
|
+
ownsResponder.current = false;
|
|
53
|
+
if (unstable_hasExternalPressOwnership()) {
|
|
54
|
+
handlers.onResponderTerminate(e);
|
|
55
|
+
endPress(e);
|
|
124
56
|
return;
|
|
125
57
|
}
|
|
126
58
|
userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);
|
|
127
|
-
|
|
128
|
-
clearStartTimers();
|
|
129
|
-
if (ref.current.state === "pressing") {
|
|
130
|
-
activate(e);
|
|
131
|
-
}
|
|
132
|
-
if (!wasLongPressed) {
|
|
133
|
-
var _events_onPress;
|
|
134
|
-
(_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);
|
|
135
|
-
}
|
|
136
|
-
deactivate(e);
|
|
137
|
-
ref.current.blockedByExternalOwnership = false;
|
|
59
|
+
handlers.onResponderRelease(e);
|
|
138
60
|
};
|
|
139
61
|
viewProps.onResponderTerminate = function(e) {
|
|
140
62
|
userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);
|
|
141
|
-
|
|
63
|
+
if (ownsResponder.current) handlers.onResponderTerminate(e);
|
|
64
|
+
endPress(e);
|
|
65
|
+
ownsResponder.current = false;
|
|
142
66
|
};
|
|
143
67
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
144
|
-
|
|
145
|
-
return
|
|
68
|
+
var _userTerminationRequest;
|
|
69
|
+
return (_userTerminationRequest = userTerminationRequest === null || userTerminationRequest === void 0 ? void 0 : userTerminationRequest(e)) !== null && _userTerminationRequest !== void 0 ? _userTerminationRequest : handlers.onResponderTerminationRequest();
|
|
146
70
|
};
|
|
147
71
|
viewProps.onResponderMove = function(e) {
|
|
148
|
-
var _events_onPressMove;
|
|
149
72
|
userMove === null || userMove === void 0 ? void 0 : userMove(e);
|
|
150
|
-
(
|
|
73
|
+
if (ownsResponder.current) handlers.onResponderMove(e);
|
|
74
|
+
};
|
|
75
|
+
viewProps.onClick = function(e) {
|
|
76
|
+
userClick === null || userClick === void 0 ? void 0 : userClick(e);
|
|
77
|
+
if (!unstable_hasExternalPressOwnership()) handlers.onClick(e);
|
|
151
78
|
};
|
|
152
79
|
}
|
|
153
80
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainThreadPressEvents.native.js","names":[],"sources":["esm/helpers/mainThreadPressEvents.native.js"],"sourcesContent":["import { unstable_hasExternalPressOwnership } from \"@tamagui/native\";\nimport { useEffect, useRef } from \"react\";\nvar DEFAULT_LONG_PRESS_DELAY = 500;\nvar DEFAULT_MIN_PRESS_DURATION = 130;\nfunction useMainThreadPressEvents(events, viewProps) {\n var enabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, debugName = arguments.length > 3 ? arguments[3] : void 0;\n var ref = useRef(null);\n if (!ref.current) {\n ref.current = {\n state: \"idle\",\n pressInTimer: null,\n pressOutTimer: null,\n longPressTimer: null,\n activateTime: 0,\n blockedByExternalOwnership: false,\n pressInOutstanding: false\n };\n }\n useEffect(\n function() {\n return function() {\n clearStartTimers();\n if (ref.current.pressOutTimer) {\n clearTimeout(ref.current.pressOutTimer);\n ref.current.pressOutTimer = null;\n }\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n if (!enabled || !events) return;\n var _events_delayPressIn;\n var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);\n var _events_delayPressOut;\n var delayPressOut = Math.max(0, (_events_delayPressOut = events.delayPressOut) !== null && _events_delayPressOut !== void 0 ? _events_delayPressOut : 0);\n var _events_delayLongPress;\n var delayLongPress = Math.max(0, (_events_delayLongPress = events.delayLongPress) !== null && _events_delayLongPress !== void 0 ? _events_delayLongPress : DEFAULT_LONG_PRESS_DELAY);\n var _events_minPressDuration;\n var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);\n function activate(e) {\n var _events_onPressIn;\n if (ref.current.pressInOutstanding) return;\n ref.current.pressInOutstanding = true;\n ref.current.state = \"active\";\n ref.current.activateTime = Date.now();\n (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);\n }\n function clearStartTimers() {\n if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);\n if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);\n ref.current.pressInTimer = null;\n ref.current.longPressTimer = null;\n }\n function releasePressOut(e) {\n var _events_onPressOut;\n if (ref.current.pressOutTimer) {\n clearTimeout(ref.current.pressOutTimer);\n ref.current.pressOutTimer = null;\n }\n if (!ref.current.pressInOutstanding) return;\n ref.current.pressInOutstanding = false;\n ref.current.state = \"idle\";\n (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);\n }\n function deactivate(e) {\n if (!ref.current.pressInOutstanding) return;\n var pressDuration = Date.now() - ref.current.activateTime;\n var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);\n if (remaining > 0) {\n if (!ref.current.pressOutTimer) {\n ref.current.pressOutTimer = setTimeout(function() {\n ref.current.pressOutTimer = null;\n releasePressOut(e);\n }, remaining);\n }\n } else {\n releasePressOut(e);\n }\n }\n function resetPress(e) {\n releasePressOut(e);\n clearStartTimers();\n ref.current.blockedByExternalOwnership = false;\n }\n var userStartShouldSet = viewProps.onStartShouldSetResponder;\n var userGrant = viewProps.onResponderGrant;\n var userRelease = viewProps.onResponderRelease;\n var userTerminate = viewProps.onResponderTerminate;\n var userTerminationRequest = viewProps.onResponderTerminationRequest;\n var userMove = viewProps.onResponderMove;\n viewProps.onStartShouldSetResponder = function(e) {\n if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;\n return !events.disabled && !unstable_hasExternalPressOwnership();\n };\n viewProps.onResponderGrant = function(e) {\n releasePressOut(e);\n clearStartTimers();\n if (unstable_hasExternalPressOwnership()) {\n ref.current.state = \"idle\";\n ref.current.blockedByExternalOwnership = true;\n return;\n }\n userGrant === null || userGrant === void 0 ? void 0 : userGrant(e);\n ref.current.blockedByExternalOwnership = false;\n ref.current.state = \"pressing\";\n if (delayPressIn > 0) {\n ref.current.pressInTimer = setTimeout(function() {\n return activate(e);\n }, delayPressIn);\n } else {\n activate(e);\n }\n if (events.onLongPress) {\n ref.current.longPressTimer = setTimeout(function() {\n if (ref.current.state === \"active\") {\n var _events_onLongPress;\n ref.current.state = \"longPressed\";\n (_events_onLongPress = events.onLongPress) === null || _events_onLongPress === void 0 ? void 0 : _events_onLongPress.call(events, e);\n }\n }, delayLongPress + delayPressIn);\n }\n };\n viewProps.onResponderRelease = function(e) {\n if (ref.current.blockedByExternalOwnership || unstable_hasExternalPressOwnership()) {\n resetPress(e);\n return;\n }\n userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);\n var wasLongPressed = ref.current.state === \"longPressed\";\n clearStartTimers();\n if (ref.current.state === \"pressing\") {\n activate(e);\n }\n if (!wasLongPressed) {\n var _events_onPress;\n (_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);\n }\n deactivate(e);\n ref.current.blockedByExternalOwnership = false;\n };\n viewProps.onResponderTerminate = function(e) {\n userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);\n resetPress(e);\n };\n viewProps.onResponderTerminationRequest = function(e) {\n if (userTerminationRequest) return userTerminationRequest(e);\n return events.cancelable !== false;\n };\n viewProps.onResponderMove = function(e) {\n var _events_onPressMove;\n userMove === null || userMove === void 0 ? void 0 : userMove(e);\n (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 ? void 0 : _events_onPressMove.call(events, e);\n };\n}\nexport {\n useMainThreadPressEvents\n};\n//# sourceMappingURL=mainThreadPressEvents.native.js.map\n"],"mappings":";;;;AAEA,IAAI,2BAA2B;AAC/B,IAAI,6BAA6B;AACjC,SAAS,yBAAyB,QAAQ,WAAW;CACnD,IAAI,UAAU,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,MAAM,YAAY,UAAU,SAAS,IAAI,UAAU,KAAK,KAAK;CAC5I,IAAI,MAAM,OAAO,IAAI;CACrB,IAAI,CAAC,IAAI,SAAS;EAChB,IAAI,UAAU;GACZ,OAAO;GACP,cAAc;GACd,eAAe;GACf,gBAAgB;GAChB,cAAc;GACd,4BAA4B;GAC5B,oBAAoB;EACtB;CACF;CACA,UACE,WAAW;EACT,OAAO,WAAW;GAChB,iBAAiB;GACjB,IAAI,IAAI,QAAQ,eAAe;IAC7B,aAAa,IAAI,QAAQ,aAAa;IACtC,IAAI,QAAQ,gBAAgB;GAC9B;EACF;CACF,GAEA,CAAC,CACH;CACA,IAAI,CAAC,WAAW,CAAC,QAAQ;CACzB,IAAI;CACJ,IAAI,eAAe,KAAK,IAAI,IAAI,uBAAuB,OAAO,kBAAkB,QAAQ,yBAAyB,KAAK,IAAI,uBAAuB,CAAC;CAClJ,IAAI;CACJ,IAAI,gBAAgB,KAAK,IAAI,IAAI,wBAAwB,OAAO,mBAAmB,QAAQ,0BAA0B,KAAK,IAAI,wBAAwB,CAAC;CACvJ,IAAI;CACJ,IAAI,iBAAiB,KAAK,IAAI,IAAI,yBAAyB,OAAO,oBAAoB,QAAQ,2BAA2B,KAAK,IAAI,yBAAyB,wBAAwB;CACnL,IAAI;CACJ,IAAI,mBAAmB,KAAK,IAAI,IAAI,2BA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;EACF;EACA,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,CAAC;EACvE,IAAI,iBAAiB,IAAI,QAAQ,UAAU;EAC3C,iBAAiB;EACjB,IAAI,IAAI,QAAQ,UAAU,YAAY;GACpC,SAAS,CAAC;EACZ;EACA,IAAI,CAAC,gBAAgB;GACnB,IAAI;GACJ,CAAC,kBAAkB,OAAO,aAAa,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,KAAK,QAAQ,CAAC;EACrH;EACA,WAAW,CAAC;EACZ,IAAI,QAAQ,6BAA6B;CAC3C;CACA,UAAU,uBAAuB,SAAS,GAAG;EAC3C,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC;EAC7E,WAAW,CAAC;CACd;CACA,UAAU,gCAAgC,SAAS,GAAG;EACpD,IAAI,wBAAwB,OAAO,uBAAuB,CAAC;EAC3D,OAAO,OAAO,eAAe;CAC/B;CACA,UAAU,kBAAkB,SAAS,GAAG;EACtC,IAAI;EACJ,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,CAAC;EAC9D,CAAC,sBAAsB,OAAO,iBAAiB,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,KAAK,QAAQ,CAAC;CACrI;AACF"}
|
|
1
|
+
{"version":3,"file":"mainThreadPressEvents.native.js","names":[],"sources":["esm/helpers/mainThreadPressEvents.native.js"],"sourcesContent":["import { unstable_hasExternalPressOwnership } from \"@tamagui/native\";\nimport { useRef } from \"react\";\nfunction useMainThreadPressEvents(events, viewProps) {\n var enabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, debugName = arguments.length > 3 ? arguments[3] : void 0;\n var usePressability = require(\"react-native/Libraries/Pressability/usePressability\").default;\n var initialized = useRef(false);\n var ownsResponder = useRef(false);\n var pressActive = useRef(false);\n var active = enabled && Boolean(events);\n if (active) initialized.current = true;\n function endPress(e) {\n var _events_onPressOut;\n if (!pressActive.current) return;\n pressActive.current = false;\n events === null || events === void 0 ? void 0 : (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);\n }\n var handlers = usePressability(initialized.current ? {\n ...active ? events : {},\n disabled: !active || (events === null || events === void 0 ? void 0 : events.disabled),\n android_disableSound: true,\n onPressIn: active ? function(e) {\n var _events_onPressIn;\n endPress(e);\n pressActive.current = true;\n (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);\n } : void 0,\n onPressOut: active ? endPress : void 0,\n hitSlop: viewProps.hitSlop,\n pressRectOffset: viewProps.pressRetentionOffset\n } : null);\n if (!active || !handlers) return;\n var userStartShouldSet = viewProps.onStartShouldSetResponder;\n var userGrant = viewProps.onResponderGrant;\n var userRelease = viewProps.onResponderRelease;\n var userTerminate = viewProps.onResponderTerminate;\n var userTerminationRequest = viewProps.onResponderTerminationRequest;\n var userMove = viewProps.onResponderMove;\n var userClick = viewProps.onClick;\n viewProps.onStartShouldSetResponder = function(e) {\n return (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !unstable_hasExternalPressOwnership() && handlers.onStartShouldSetResponder();\n };\n viewProps.onResponderGrant = function(e) {\n endPress(e);\n if (unstable_hasExternalPressOwnership()) return;\n userGrant === null || userGrant === void 0 ? void 0 : userGrant(e);\n ownsResponder.current = true;\n return handlers.onResponderGrant(e);\n };\n viewProps.onResponderRelease = function(e) {\n if (!ownsResponder.current) return;\n ownsResponder.current = false;\n if (unstable_hasExternalPressOwnership()) {\n handlers.onResponderTerminate(e);\n endPress(e);\n return;\n }\n userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);\n handlers.onResponderRelease(e);\n };\n viewProps.onResponderTerminate = function(e) {\n userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);\n if (ownsResponder.current) handlers.onResponderTerminate(e);\n endPress(e);\n ownsResponder.current = false;\n };\n viewProps.onResponderTerminationRequest = function(e) {\n var _userTerminationRequest;\n return (_userTerminationRequest = userTerminationRequest === null || userTerminationRequest === void 0 ? void 0 : userTerminationRequest(e)) !== null && _userTerminationRequest !== void 0 ? _userTerminationRequest : handlers.onResponderTerminationRequest();\n };\n viewProps.onResponderMove = function(e) {\n userMove === null || userMove === void 0 ? void 0 : userMove(e);\n if (ownsResponder.current) handlers.onResponderMove(e);\n };\n viewProps.onClick = function(e) {\n userClick === null || userClick === void 0 ? void 0 : userClick(e);\n if (!unstable_hasExternalPressOwnership()) handlers.onClick(e);\n };\n}\nexport {\n useMainThreadPressEvents\n};\n//# sourceMappingURL=mainThreadPressEvents.native.js.map\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,yBAAyB,QAAQ,WAAW;CACnD,IAAI,UAAU,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,MAAM,YAAY,UAAU,SAAS,IAAI,UAAU,KAAK,KAAK;CAC5I,IAAI,4BAA0B,qDAAqD,CAAC,CAAC;CACrF,IAAI,cAAc,OAAO,KAAK;CAC9B,IAAI,gBAAgB,OAAO,KAAK;CAChC,IAAI,cAAc,OAAO,KAAK;CAC9B,IAAI,SAAS,WAAW,QAAQ,MAAM;CACtC,IAAI,QAAQ,YAAY,UAAU;CAClC,SAAS,SAAS,GAAG;EACnB,IAAI;EACJ,IAAI,CAAC,YAAY,SAAS;EAC1B,YAAY,UAAU;EACtB,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,KAAK,qBAAqB,OAAO,gBAAgB,QAAQ,uBAAuB,KAAK,IAAI,KAAK,IAAI,mBAAmB,KAAK,QAAQ,CAAC;CACjL;CACA,IAAI,WAAW,gBAAgB,YAAY,UAAU;EACnD,GAAG,SAAS,SAAS,CAAC;EACtB,UAAU,CAAC,WAAW,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO;EAC7E,sBAAsB;EACtB,WAAW,SAAS,SAAS,GAAG;GA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AS,CAAC;EACV,cAAc,UAAU;CAC1B;CACA,UAAU,gCAAgC,SAAS,GAAG;EACpD,IAAI;EACJ,QAAQ,0BAA0B,2BAA2B,QAAQ,2BAA2B,KAAK,IAAI,KAAK,IAAI,uBAAuB,CAAC,OAAO,QAAQ,4BAA4B,KAAK,IAAI,0BAA0B,SAAS,8BAA8B;CACjQ;CACA,UAAU,kBAAkB,SAAS,GAAG;EACtC,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,CAAC;EAC9D,IAAI,cAAc,SAAS,SAAS,gBAAgB,CAAC;CACvD;CACA,UAAU,UAAU,SAAS,GAAG;EAC9B,cAAc,QAAQ,cAAc,KAAK,IAAI,KAAK,IAAI,UAAU,CAAC;EACjE,IAAI,CAAC,mCAAmC,GAAG,SAAS,QAAQ,CAAC;CAC/D;AACF"}
|
|
@@ -158,7 +158,7 @@ const getSnapshotImpl = (r) => {
|
|
|
158
158
|
const isSchemeOnlyChange = !optimizeForFirstRender && false;
|
|
159
159
|
const allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(keys.current?.size && schemeKeys?.current?.size === keys.current.size);
|
|
160
160
|
const canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
|
|
161
|
-
const needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();
|
|
161
|
+
const needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();
|
|
162
162
|
const [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
163
163
|
let next = nextRaw;
|
|
164
164
|
if (props._themeUpdate && nextRaw?.theme) {
|
|
@@ -186,7 +186,7 @@ const getSnapshotImpl = (r) => {
|
|
|
186
186
|
};
|
|
187
187
|
const getNextState = (lastState, props, propsKey, isRoot = false, id, parentId, needsUpdate, pendingUpdate) => {
|
|
188
188
|
const parentState = states.get(parentId);
|
|
189
|
-
if (props.passThrough) return [false,
|
|
189
|
+
if (props.passThrough) return [false, parentState || lastState || { name: "" }];
|
|
190
190
|
themes ||= getConfig().themes;
|
|
191
191
|
const name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === "force" ? true : !!needsUpdate);
|
|
192
192
|
const authoredName = props.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.js","names":[],"sources":["esm/hooks/useThemeState.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nconst ThemeStateContext = createContext(\"\");\nconst allListeners = /* @__PURE__ */ new Map();\nconst listenersByParent = {};\nconst HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nconst HadTheme = /* @__PURE__ */ new WeakMap();\nconst PendingUpdate = /* @__PURE__ */ new Map();\nconst states = /* @__PURE__ */ new Map();\nconst localStates = /* @__PURE__ */ new Map();\nlet shouldForce = false;\nconst forceUpdateThemes = () => {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach((cb) => cb());\n\tshouldForce = false;\n};\nconst getThemeState = (id) => states.get(id);\nconst themeUpdateLayers = /* @__PURE__ */ new Map();\nconst themeProviderParents = /* @__PURE__ */ new Map();\nconst getThemeUpdateLayer = (id) => themeUpdateLayers.get(id);\nconst getThemeProviderParent = (id) => themeProviderParents.get(id);\nconst getThemeProviderChainSizes = () => ({\n\tlayers: themeUpdateLayers.size,\n\tparents: themeProviderParents.size\n});\nconst registerThemeProviderChain = (id, parentId, props) => {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nlet cacheVersion = 0;\nconst themeNameCache = /* @__PURE__ */ new Map();\nlet themeNameCacheVer = -1;\nlet themes = null;\nlet rootThemeState = null;\nconst getRootThemeState = () => rootThemeState;\nconst incReducer = (c) => c + 1;\nconst useThemeState = (props, isRoot = false, keys, schemeKeys, cascadeOnChange = false, optimizeForFirstRender = false) => {\n\t\"use no memo\";\n\tconst { disable } = props;\n\tconst parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tconst id = useId();\n\tconst propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tconst ref = useRef(null);\n\tconst r = ref.current ||= {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t};\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tconst [, forceUpdate] = useReducer(incReducer, 0);\n\tconst state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(() => {\n\t\tconst renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tlocalStates.set(r.id, r.lastSnap);\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tconst pid = r.parentId;\n\t\t\t\tconst sid = r.id;\n\t\t\t\tconst cb = (forced) => {\n\t\t\t\t\tconst next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && r.props.nativeUpdate?.(next)) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t(listenersByParent[pid] ||= /* @__PURE__ */ new Set()).add(sid);\n\t\t\t\tallListeners.set(sid, () => {\n\t\t\t\t\tconst forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedParentId = pid;\n\t\t\t\tr.unsubscribe = () => {\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\tlistenersByParent[pid]?.delete(sid);\n\t\t\t\t\tlocalStates.delete(sid);\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedParentId = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn () => {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(() => {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nconst shouldSubscribeToTheme = (r, cascadeOnChange) => Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || r.keys.current?.size || r.props.needsUpdate?.());\nfunction cleanupThemeSubscription(r) {\n\tr.unsubscribe?.();\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tlocalStates.delete(r.id);\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nconst getSnapshotImpl = (r) => {\n\tconst { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tlet local = localStates.get(id);\n\tconst parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tconst isSchemeOnlyChange = !optimizeForFirstRender && false;\n\tconst allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(keys.current?.size && schemeKeys?.current?.size === keys.current.size);\n\tconst canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tconst needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();\n\tconst [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tlet next = nextRaw;\n\tif (props._themeUpdate && nextRaw?.theme) {\n\t\tconst parentTheme = states.get(parentId)?.theme || nextRaw.theme;\n\t\tconst merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tlocalStates.set(id, local);\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState?.name;\n\tlocal._parentSchemeAuthored = parentState?.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nconst getNextState = (lastState, props, propsKey, isRoot = false, id, parentId, needsUpdate, pendingUpdate) => {\n\tconst parentState = states.get(parentId);\n\tif (props.passThrough) return [false, lastState || parentState || { name: \"\" }];\n\tthemes ||= getConfig().themes;\n\tconst name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tconst authoredName = props.name;\n\tconst parentSchemeAuthored = !!parentState?.schemeAuthored;\n\tconst schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tconst intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tconst resolvedName = name || parentState?.name;\n\tconst sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tconst isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tconst shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || lastState?.name !== parentState?.name || !!lastState?.schemeAuthored !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tconst next = lastState ?? parentState ?? rootThemeState ?? {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tconst scheme = getThemeScheme(resolvedName);\n\tconst parentInverses = parentState?.inverses ?? 0;\n\tconst isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tconst inverses = parentInverses + (isInverse ? 1 : 0);\n\tconst nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState?.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tconst queue = [id];\n\tconst visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tconst children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tfor (const childId of children) if (!visited.has(childId)) {\n\t\t\t\tvisited.add(childId);\n\t\t\t\tqueue.push(childId);\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach((childId) => {\n\t\tallListeners.get(childId)?.();\n\t});\n}\nfunction getNewThemeName(parentName = \"\", props, forceUpdate = false) {\n\tconst { name } = props;\n\tconst cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tconst cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tconst result = resolveThemeName(parentName, name ?? void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nconst getThemeNameCacheSize = () => themeNameCache.size;\nfunction resolveThemeName(parentName, name, themes2, forceUpdate = false) {\n\tconst parentParts = parentName ? parentName.split(\"_\") : [];\n\tlet found = null;\n\tif (name) {\n\t\tconst nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (let i = parentParts.length; i >= 0; i--) {\n\t\t\tconst base = parentParts.slice(0, i).join(\"_\");\n\t\t\tconst potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nconst getPropsKey = ({ name, forceClassName, _themeUpdate }) => `${name || \"\"}${forceClassName || \"\"}${_themeUpdate?.key || \"\"}`;\nconst hasThemeUpdatingProps = (props) => \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;AAMA,MAAM,oBAAoB,cAAc,EAAE;AAC1C,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,oBAAoB,CAAC;AAC3B,MAAM,kCAAkC,IAAI,QAAQ;AACpD,MAAM,2BAA2B,IAAI,QAAQ;AAC7C,MAAM,gCAAgC,IAAI,IAAI;AAC9C,MAAM,yBAAyB,IAAI,IAAI;AACvC,MAAM,8BAA8B,IAAI,IAAI;AAC5C,IAAI,cAAc;AAClB,MAAM,0BAA0B;CAC/B;CACA,cAAc;CACd,aAAa,SAAS,OAAO,GAAG,CAAC;CACjC,cAAc;AACf;AACA,MAAM,iBAAiB,OAAO,OAAO,IAAI,EAAE;AAC3C,MAAM,oCAAoC,IAAI,IAAI;AAClD,MAAM,uCAAuC,IAAI,IAAI;AACrD,MAAM,uBAAuB,OAAO,kBAAkB,IAAI,EAAE;AAC5D,MAAM,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AC3E,MAAM,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC7C,MAAM,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC7C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,MAAM,eAAe,EAAE,MAAM,gBAAgB,mBAAmB,GAAG,QAAQ,KAAK,kBAAkB,KAAK,cAAc,OAAO;AAC5H,MAAM,yBAAyB,UAAU,UAAU,SAAS,oBAAoB,SAAS,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"useThemeState.js","names":[],"sources":["esm/hooks/useThemeState.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nconst ThemeStateContext = createContext(\"\");\nconst allListeners = /* @__PURE__ */ new Map();\nconst listenersByParent = {};\nconst HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nconst HadTheme = /* @__PURE__ */ new WeakMap();\nconst PendingUpdate = /* @__PURE__ */ new Map();\nconst states = /* @__PURE__ */ new Map();\nconst localStates = /* @__PURE__ */ new Map();\nlet shouldForce = false;\nconst forceUpdateThemes = () => {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach((cb) => cb());\n\tshouldForce = false;\n};\nconst getThemeState = (id) => states.get(id);\nconst themeUpdateLayers = /* @__PURE__ */ new Map();\nconst themeProviderParents = /* @__PURE__ */ new Map();\nconst getThemeUpdateLayer = (id) => themeUpdateLayers.get(id);\nconst getThemeProviderParent = (id) => themeProviderParents.get(id);\nconst getThemeProviderChainSizes = () => ({\n\tlayers: themeUpdateLayers.size,\n\tparents: themeProviderParents.size\n});\nconst registerThemeProviderChain = (id, parentId, props) => {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nlet cacheVersion = 0;\nconst themeNameCache = /* @__PURE__ */ new Map();\nlet themeNameCacheVer = -1;\nlet themes = null;\nlet rootThemeState = null;\nconst getRootThemeState = () => rootThemeState;\nconst incReducer = (c) => c + 1;\nconst useThemeState = (props, isRoot = false, keys, schemeKeys, cascadeOnChange = false, optimizeForFirstRender = false) => {\n\t\"use no memo\";\n\tconst { disable } = props;\n\tconst parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tconst id = useId();\n\tconst propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tconst ref = useRef(null);\n\tconst r = ref.current ||= {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t};\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tconst [, forceUpdate] = useReducer(incReducer, 0);\n\tconst state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(() => {\n\t\tconst renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tlocalStates.set(r.id, r.lastSnap);\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tconst pid = r.parentId;\n\t\t\t\tconst sid = r.id;\n\t\t\t\tconst cb = (forced) => {\n\t\t\t\t\tconst next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && r.props.nativeUpdate?.(next)) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t(listenersByParent[pid] ||= /* @__PURE__ */ new Set()).add(sid);\n\t\t\t\tallListeners.set(sid, () => {\n\t\t\t\t\tconst forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedParentId = pid;\n\t\t\t\tr.unsubscribe = () => {\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\tlistenersByParent[pid]?.delete(sid);\n\t\t\t\t\tlocalStates.delete(sid);\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedParentId = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn () => {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(() => {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nconst shouldSubscribeToTheme = (r, cascadeOnChange) => Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || r.keys.current?.size || r.props.needsUpdate?.());\nfunction cleanupThemeSubscription(r) {\n\tr.unsubscribe?.();\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tlocalStates.delete(r.id);\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nconst getSnapshotImpl = (r) => {\n\tconst { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tlet local = localStates.get(id);\n\tconst parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tconst isSchemeOnlyChange = !optimizeForFirstRender && false;\n\tconst allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(keys.current?.size && schemeKeys?.current?.size === keys.current.size);\n\tconst canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tconst needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : keys?.current?.size ? true : props.needsUpdate?.();\n\tconst [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tlet next = nextRaw;\n\tif (props._themeUpdate && nextRaw?.theme) {\n\t\tconst parentTheme = states.get(parentId)?.theme || nextRaw.theme;\n\t\tconst merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tlocalStates.set(id, local);\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState?.name;\n\tlocal._parentSchemeAuthored = parentState?.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nconst getNextState = (lastState, props, propsKey, isRoot = false, id, parentId, needsUpdate, pendingUpdate) => {\n\tconst parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes ||= getConfig().themes;\n\tconst name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState?.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tconst authoredName = props.name;\n\tconst parentSchemeAuthored = !!parentState?.schemeAuthored;\n\tconst schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tconst intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tconst resolvedName = name || parentState?.name;\n\tconst sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tconst isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tconst shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || lastState?.name !== parentState?.name || !!lastState?.schemeAuthored !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tconst next = lastState ?? parentState ?? rootThemeState ?? {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tconst scheme = getThemeScheme(resolvedName);\n\tconst parentInverses = parentState?.inverses ?? 0;\n\tconst isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tconst inverses = parentInverses + (isInverse ? 1 : 0);\n\tconst nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState?.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tconst queue = [id];\n\tconst visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tconst children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tfor (const childId of children) if (!visited.has(childId)) {\n\t\t\t\tvisited.add(childId);\n\t\t\t\tqueue.push(childId);\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach((childId) => {\n\t\tallListeners.get(childId)?.();\n\t});\n}\nfunction getNewThemeName(parentName = \"\", props, forceUpdate = false) {\n\tconst { name } = props;\n\tconst cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tconst cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tconst result = resolveThemeName(parentName, name ?? void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nconst getThemeNameCacheSize = () => themeNameCache.size;\nfunction resolveThemeName(parentName, name, themes2, forceUpdate = false) {\n\tconst parentParts = parentName ? parentName.split(\"_\") : [];\n\tlet found = null;\n\tif (name) {\n\t\tconst nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (let i = parentParts.length; i >= 0; i--) {\n\t\t\tconst base = parentParts.slice(0, i).join(\"_\");\n\t\t\tconst potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nconst getPropsKey = ({ name, forceClassName, _themeUpdate }) => `${name || \"\"}${forceClassName || \"\"}${_themeUpdate?.key || \"\"}`;\nconst hasThemeUpdatingProps = (props) => \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;AAMA,MAAM,oBAAoB,cAAc,EAAE;AAC1C,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,oBAAoB,CAAC;AAC3B,MAAM,kCAAkC,IAAI,QAAQ;AACpD,MAAM,2BAA2B,IAAI,QAAQ;AAC7C,MAAM,gCAAgC,IAAI,IAAI;AAC9C,MAAM,yBAAyB,IAAI,IAAI;AACvC,MAAM,8BAA8B,IAAI,IAAI;AAC5C,IAAI,cAAc;AAClB,MAAM,0BAA0B;CAC/B;CACA,cAAc;CACd,aAAa,SAAS,OAAO,GAAG,CAAC;CACjC,cAAc;AACf;AACA,MAAM,iBAAiB,OAAO,OAAO,IAAI,EAAE;AAC3C,MAAM,oCAAoC,IAAI,IAAI;AAClD,MAAM,uCAAuC,IAAI,IAAI;AACrD,MAAM,uBAAuB,OAAO,kBAAkB,IAAI,EAAE;AAC5D,M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KAAK,GAAG,KAAK;GAC3E,MAAM,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC7C,MAAM,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC7C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,MAAM,eAAe,EAAE,MAAM,gBAAgB,mBAAmB,GAAG,QAAQ,KAAK,kBAAkB,KAAK,cAAc,OAAO;AAC5H,MAAM,yBAAyB,UAAU,UAAU,SAAS,oBAAoB,SAAS,kBAAkB"}
|
|
@@ -184,7 +184,7 @@ var getSnapshotImpl = function(r) {
|
|
|
184
184
|
var isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
185
185
|
var allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);
|
|
186
186
|
var canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);
|
|
187
|
-
var needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
|
|
187
|
+
var needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
|
|
188
188
|
var [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
189
189
|
var next = nextRaw;
|
|
190
190
|
if (props._themeUpdate && (nextRaw === null || nextRaw === void 0 ? void 0 : nextRaw.theme)) {
|
|
@@ -214,7 +214,7 @@ var getSnapshotImpl = function(r) {
|
|
|
214
214
|
var getNextState = function(lastState, props, propsKey) {
|
|
215
215
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0;
|
|
216
216
|
var parentState = states.get(parentId);
|
|
217
|
-
if (props.passThrough) return [false,
|
|
217
|
+
if (props.passThrough) return [false, parentState || lastState || { name: "" }];
|
|
218
218
|
themes || (themes = getConfig().themes);
|
|
219
219
|
var name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState === null || parentState === void 0 ? void 0 : parentState.name, props, pendingUpdate === "force" ? true : !!needsUpdate);
|
|
220
220
|
var authoredName = props.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.native.js","names":[],"sources":["esm/hooks/useThemeState.native.js"],"sourcesContent":["import { supportsDynamicColorIOS, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig, getSetting } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nvar ThemeStateContext = createContext(\"\");\nvar allListeners = /* @__PURE__ */ new Map();\nvar listenersByParent = {};\nvar HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nvar HadTheme = /* @__PURE__ */ new WeakMap();\nvar PendingUpdate = /* @__PURE__ */ new Map();\nvar states = /* @__PURE__ */ new Map();\nvar localStates = /* @__PURE__ */ new Map();\nvar shouldForce = false;\nvar forceUpdateThemes = function() {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach(function(cb) {\n\t\treturn cb();\n\t});\n\tshouldForce = false;\n};\nvar getThemeState = function(id) {\n\treturn states.get(id);\n};\nvar themeUpdateLayers = /* @__PURE__ */ new Map();\nvar themeProviderParents = /* @__PURE__ */ new Map();\nvar getThemeUpdateLayer = function(id) {\n\treturn themeUpdateLayers.get(id);\n};\nvar getThemeProviderParent = function(id) {\n\treturn themeProviderParents.get(id);\n};\nvar getThemeProviderChainSizes = function() {\n\treturn {\n\t\tlayers: themeUpdateLayers.size,\n\t\tparents: themeProviderParents.size\n\t};\n};\nvar registerThemeProviderChain = function(id, parentId, props) {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nvar cacheVersion = 0;\nvar themeNameCache = /* @__PURE__ */ new Map();\nvar themeNameCacheVer = -1;\nvar themes = null;\nvar rootThemeState = null;\nvar getRootThemeState = function() {\n\treturn rootThemeState;\n};\nvar getThemeBaseName = function(name) {\n\treturn name.replace(/^(light|dark)_/, \"\");\n};\nvar incReducer = function(c) {\n\treturn c + 1;\n};\nvar useThemeState = function(props) {\n\t\"use no memo\";\n\tvar isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar _ref;\n\tvar { disable } = props;\n\tvar parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tvar id = useId();\n\tvar propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tvar r = (_ref = useRef(null)).current || (_ref.current = {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t});\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tvar [, forceUpdate] = useReducer(incReducer, 0);\n\tvar state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(function() {\n\t\tvar renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tlocalStates.set(r.id, r.lastSnap);\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tvar _listenersByParent, _pid;\n\t\t\t\tvar pid = r.parentId;\n\t\t\t\tvar sid = r.id;\n\t\t\t\tvar cb = function(forced) {\n\t\t\t\t\tvar next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tvar _r_props_nativeUpdate, _r_props;\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && ((_r_props_nativeUpdate = (_r_props = r.props).nativeUpdate) === null || _r_props_nativeUpdate === void 0 ? void 0 : _r_props_nativeUpdate.call(_r_props, next))) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t((_listenersByParent = listenersByParent)[_pid = pid] || (_listenersByParent[_pid] = /* @__PURE__ */ new Set())).add(sid);\n\t\t\t\tallListeners.set(sid, function() {\n\t\t\t\t\tvar forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedParentId = pid;\n\t\t\t\tr.unsubscribe = function() {\n\t\t\t\t\tvar _listenersByParent_pid;\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\t(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);\n\t\t\t\t\tlocalStates.delete(sid);\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedParentId = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn function() {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(function() {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nvar shouldSubscribeToTheme = function(r, cascadeOnChange) {\n\tvar _r_keys_current, _r_props_needsUpdate, _r_props;\n\treturn Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));\n};\nfunction cleanupThemeSubscription(r) {\n\tvar _r_unsubscribe;\n\t(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tlocalStates.delete(r.id);\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nvar getSnapshotImpl = function(r) {\n\tvar _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;\n\tvar { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tvar local = localStates.get(id);\n\tvar parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tvar isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting(\"fastSchemeChange\") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);\n\tvar allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);\n\tvar canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tvar needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);\n\tvar [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tvar next = nextRaw;\n\tif (props._themeUpdate && (nextRaw === null || nextRaw === void 0 ? void 0 : nextRaw.theme)) {\n\t\tvar _states_get;\n\t\tvar parentTheme = ((_states_get = states.get(parentId)) === null || _states_get === void 0 ? void 0 : _states_get.theme) || nextRaw.theme;\n\t\tvar merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tlocalStates.set(id, local);\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;\n\tlocal._parentSchemeAuthored = parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nvar getNextState = function(lastState, props, propsKey) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0;\n\tvar parentState = states.get(parentId);\n\tif (props.passThrough) return [false, lastState || parentState || { name: \"\" }];\n\tthemes || (themes = getConfig().themes);\n\tvar name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState === null || parentState === void 0 ? void 0 : parentState.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tvar authoredName = props.name;\n\tvar parentSchemeAuthored = !!(parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored);\n\tvar schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tvar intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tvar resolvedName = name || (parentState === null || parentState === void 0 ? void 0 : parentState.name);\n\tvar sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tvar isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tvar shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || (lastState === null || lastState === void 0 ? void 0 : lastState.name) !== (parentState === null || parentState === void 0 ? void 0 : parentState.name) || !!(lastState === null || lastState === void 0 ? void 0 : lastState.schemeAuthored) !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tvar _ref, _ref1;\n\t\tvar next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tvar scheme = getThemeScheme(resolvedName);\n\tvar _parentState_inverses;\n\tvar parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;\n\tvar isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tvar inverses = parentInverses + (isInverse ? 1 : 0);\n\tvar nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState === null || parentState === void 0 ? void 0 : parentState.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tvar queue = [id];\n\tvar visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tvar children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar childId = _step.value;\n\t\t\t\t\tif (!visited.has(childId)) {\n\t\t\t\t\t\tvisited.add(childId);\n\t\t\t\t\t\tqueue.push(childId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach(function(childId2) {\n\t\tvar _allListeners_get;\n\t\t(_allListeners_get = allListeners.get(childId2)) === null || _allListeners_get === void 0 || _allListeners_get();\n\t});\n}\nfunction getNewThemeName() {\n\tvar parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\", props = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tvar { name } = props;\n\tvar cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tvar cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tvar result = resolveThemeName(parentName, name !== null && name !== void 0 ? name : void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nvar getThemeNameCacheSize = function() {\n\treturn themeNameCache.size;\n};\nfunction resolveThemeName(parentName, name, themes2) {\n\tvar forceUpdate = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;\n\tvar parentParts = parentName ? parentName.split(\"_\") : [];\n\tvar found = null;\n\tif (name) {\n\t\tvar nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (var i = parentParts.length; i >= 0; i--) {\n\t\t\tvar base = parentParts.slice(0, i).join(\"_\");\n\t\t\tvar potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nvar getPropsKey = function(param) {\n\tvar { name, forceClassName, _themeUpdate } = param;\n\treturn `${name || \"\"}${forceClassName || \"\"}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || \"\"}`;\n};\nvar hasThemeUpdatingProps = function(props) {\n\treturn \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n};\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeUpdatingProps, resolveThemeName, useThemeState };"],"mappings":";;;;;;;AAMA,IAAI,oBAAoB,cAAc,EAAE;AACxC,IAAI,+BAA+B,IAAI,IAAI;AAC3C,IAAI,oBAAoB,CAAC;AACzB,IAAI,kCAAkC,IAAI,QAAQ;AAClD,IAAI,2BAA2B,IAAI,QAAQ;AAC3C,IAAI,gCAAgC,IAAI,IAAI;AAC5C,IAAI,yBAAyB,IAAI,IAAI;AACrC,IAAI,8BAA8B,IAAI,IAAI;AAC1C,IAAI,cAAc;AAClB,IAAI,oBAAoB,WAAW;CAClC;CACA,cAAc;CACd,aAAa,QAAQ,SAAS,IAAI;EACjC,OAAO,GAAG;CACX,CAAC;CACD,cAAc;AACf;AACA,IAAI,gBAAgB,SAAS,IAAI;CAChC,OAAO,OAAO,IAAI,EAAE;AACrB;AACA,IAAI,oCAAoC,IAAI,IAAI;AAChD,IAAI,uCAAuC,IAAI,IAAI;AACnD,IAAI,sBAAsB,SAAS,IAAI;CACtC,OAAO,kBAAkB,IAAI,EAAE;AAChC;AACA,IAAI,yBAAyB,SAAS,IAAI;CACzC,OAAO,qBAAqB,IAAI,EAAE;AACnC;AACA,IAAI,6BAA6B,WAAW;CAC3C,OAAO;EACN,QAAQ,kBAAkB;EAC1B,SAAS,qBAAqB;CAC/B;AACD;AACA,IAAI,6BAA6B,SAAS,IAAI,UAAU,OAAO;CAC9D,qBAAqB,IAAI,IAAI,QAAQ;CACrC,IAAI,MAAM,cAAc,kBAAkB,IAAI,IAAI,MAAM,YAAY;MAC/D,kBAAkB,OAAO,EAAE;AACjC;AACA,IAAI,eAAe;AACnB,IAAI,iCAAiC,IAAI,IAAI;AAC7C,IAAI,oBAAoB,CAAC;A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K,IAAI,UAAU,KAAK;CACnF,IAAI,cAAc,aAAa,WAAW,MAAM,GAAG,IAAI,CAAC;CACxD,IAAI,QAAQ;CACZ,IAAI,MAAM;EACT,IAAI,gBAAgB,eAAe,IAAI;EACvC,IAAI,iBAAiB,QAAQ,SAAS,QAAQ;EAC9C,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,IAAI,IAAI,YAAY,QAAQ,KAAK,GAAG,KAAK;GAC3E,IAAI,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC3C,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC3C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,IAAI,cAAc,SAAS,OAAO;CACjC,IAAI,EAAE,MAAM,gBAAgB,iBAAiB;CAC7C,OAAO,GAAG,QAAQ,KAAK,kBAAkB,MAAM,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,QAAQ;AACjI;AACA,IAAI,wBAAwB,SAAS,OAAO;CAC3C,OAAO,UAAU,SAAS,oBAAoB,SAAS,kBAAkB;AAC1E"}
|
|
1
|
+
{"version":3,"file":"useThemeState.native.js","names":[],"sources":["esm/hooks/useThemeState.native.js"],"sourcesContent":["import { supportsDynamicColorIOS, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useEffect, useId, useReducer, useRef } from \"react\";\nimport { getThemeScheme } from \"@tamagui/helpers\";\nimport { getConfig, getSetting } from \"../config\";\nimport { MISSING_THEME_MESSAGE } from \"../constants/constants\";\n\nvar ThemeStateContext = createContext(\"\");\nvar allListeners = /* @__PURE__ */ new Map();\nvar listenersByParent = {};\nvar HasRenderedOnce = /* @__PURE__ */ new WeakMap();\nvar HadTheme = /* @__PURE__ */ new WeakMap();\nvar PendingUpdate = /* @__PURE__ */ new Map();\nvar states = /* @__PURE__ */ new Map();\nvar localStates = /* @__PURE__ */ new Map();\nvar shouldForce = false;\nvar forceUpdateThemes = function() {\n\tcacheVersion++;\n\tshouldForce = true;\n\tallListeners.forEach(function(cb) {\n\t\treturn cb();\n\t});\n\tshouldForce = false;\n};\nvar getThemeState = function(id) {\n\treturn states.get(id);\n};\nvar themeUpdateLayers = /* @__PURE__ */ new Map();\nvar themeProviderParents = /* @__PURE__ */ new Map();\nvar getThemeUpdateLayer = function(id) {\n\treturn themeUpdateLayers.get(id);\n};\nvar getThemeProviderParent = function(id) {\n\treturn themeProviderParents.get(id);\n};\nvar getThemeProviderChainSizes = function() {\n\treturn {\n\t\tlayers: themeUpdateLayers.size,\n\t\tparents: themeProviderParents.size\n\t};\n};\nvar registerThemeProviderChain = function(id, parentId, props) {\n\tthemeProviderParents.set(id, parentId);\n\tif (props._themeUpdate) themeUpdateLayers.set(id, props._themeUpdate);\n\telse themeUpdateLayers.delete(id);\n};\nvar cacheVersion = 0;\nvar themeNameCache = /* @__PURE__ */ new Map();\nvar themeNameCacheVer = -1;\nvar themes = null;\nvar rootThemeState = null;\nvar getRootThemeState = function() {\n\treturn rootThemeState;\n};\nvar getThemeBaseName = function(name) {\n\treturn name.replace(/^(light|dark)_/, \"\");\n};\nvar incReducer = function(c) {\n\treturn c + 1;\n};\nvar useThemeState = function(props) {\n\t\"use no memo\";\n\tvar isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false, optimizeForFirstRender = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar _ref;\n\tvar { disable } = props;\n\tvar parentId = useContext(ThemeStateContext);\n\tif (!parentId && !isRoot) throw new Error(process.env.NODE_ENV === \"development\" ? `${MISSING_THEME_MESSAGE}\n\nLooked for theme${props.name ? ` \"${props.name}\"` : \"\"}, but no parent theme context was found (parentId: ${parentId}).` : MISSING_THEME_MESSAGE);\n\tif (disable) return states.get(parentId) || {\n\t\tid: \"\",\n\t\tname: \"light\",\n\t\ttheme: getConfig().themes.light\n\t};\n\tvar id = useId();\n\tvar propsKey = getPropsKey(props);\n\tif (cascadeOnChange) registerThemeProviderChain(id, parentId, props);\n\tvar r = (_ref = useRef(null)).current || (_ref.current = {\n\t\tid,\n\t\tparentId,\n\t\tprops,\n\t\tpropsKey,\n\t\tisRoot,\n\t\tkeys,\n\t\tschemeKeys,\n\t\toptimizeForFirstRender,\n\t\trenderVersion: 0\n\t});\n\tr.props = props;\n\tr.propsKey = propsKey;\n\tr.isRoot = isRoot;\n\tr.keys = keys;\n\tr.schemeKeys = schemeKeys;\n\tr.parentId = parentId;\n\tr.renderVersion++;\n\tvar [, forceUpdate] = useReducer(incReducer, 0);\n\tvar state = getSnapshotImpl(r);\n\tr.lastSnap = state;\n\tuseEffect(function() {\n\t\tvar renderVersion = r.renderVersion;\n\t\tif (r.lastSnap && !states.has(r.id)) {\n\t\t\tstates.set(r.id, r.lastSnap);\n\t\t\tlocalStates.set(r.id, r.lastSnap);\n\t\t}\n\t\tif (cascadeOnChange && !themeProviderParents.has(r.id)) registerThemeProviderChain(r.id, r.parentId, r.props);\n\t\tif (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);\n\t\tif (shouldSubscribeToTheme(r, cascadeOnChange)) {\n\t\t\tif (!r.unsubscribe) {\n\t\t\t\tvar _listenersByParent, _pid;\n\t\t\t\tvar pid = r.parentId;\n\t\t\t\tvar sid = r.id;\n\t\t\t\tvar cb = function(forced) {\n\t\t\t\t\tvar next = getSnapshotImpl(r);\n\t\t\t\t\tif (next !== r.lastSnap) {\n\t\t\t\t\t\tvar _r_props_nativeUpdate, _r_props;\n\t\t\t\t\t\tr.lastSnap = next;\n\t\t\t\t\t\tif (!forced && ((_r_props_nativeUpdate = (_r_props = r.props).nativeUpdate) === null || _r_props_nativeUpdate === void 0 ? void 0 : _r_props_nativeUpdate.call(_r_props, next))) return;\n\t\t\t\t\t\tforceUpdate();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t((_listenersByParent = listenersByParent)[_pid = pid] || (_listenersByParent[_pid] = /* @__PURE__ */ new Set())).add(sid);\n\t\t\t\tallListeners.set(sid, function() {\n\t\t\t\t\tvar forced = shouldForce;\n\t\t\t\t\tPendingUpdate.set(sid, forced ? \"force\" : true);\n\t\t\t\t\tcb(forced);\n\t\t\t\t});\n\t\t\t\tr.subscribedParentId = pid;\n\t\t\t\tr.unsubscribe = function() {\n\t\t\t\t\tvar _listenersByParent_pid;\n\t\t\t\t\tallListeners.delete(sid);\n\t\t\t\t\t(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);\n\t\t\t\t\tlocalStates.delete(sid);\n\t\t\t\t\tstates.delete(sid);\n\t\t\t\t\tPendingUpdate.delete(sid);\n\t\t\t\t\tr.unsubscribe = void 0;\n\t\t\t\t\tr.subscribedParentId = void 0;\n\t\t\t\t};\n\t\t\t}\n\t\t} else if (r.unsubscribe) cleanupThemeSubscription(r);\n\t\treturn function() {\n\t\t\tif (r.renderVersion === renderVersion) cleanupThemeState(r);\n\t\t};\n\t});\n\tif (cascadeOnChange) useIsomorphicLayoutEffect(function() {\n\t\tif (!HasRenderedOnce.get(keys)) {\n\t\t\tHasRenderedOnce.set(keys, true);\n\t\t\treturn;\n\t\t}\n\t\tif (!propsKey) {\n\t\t\tif (HadTheme.get(keys)) scheduleUpdate(id);\n\t\t\tHadTheme.set(keys, false);\n\t\t\treturn;\n\t\t}\n\t\tscheduleUpdate(id);\n\t\tHadTheme.set(keys, true);\n\t}, [keys, propsKey]);\n\treturn state;\n};\nvar shouldSubscribeToTheme = function(r, cascadeOnChange) {\n\tvar _r_keys_current, _r_props_needsUpdate, _r_props;\n\treturn Boolean(r.optimizeForFirstRender || r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || ((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || ((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props)));\n};\nfunction cleanupThemeSubscription(r) {\n\tvar _r_unsubscribe;\n\t(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);\n}\nfunction cleanupThemeState(r) {\n\tif (r.unsubscribe) cleanupThemeSubscription(r);\n\telse {\n\t\tlocalStates.delete(r.id);\n\t\tstates.delete(r.id);\n\t\tPendingUpdate.delete(r.id);\n\t}\n\tthemeUpdateLayers.delete(r.id);\n\tthemeProviderParents.delete(r.id);\n}\nvar getSnapshotImpl = function(r) {\n\tvar _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;\n\tvar { id, parentId, props, propsKey, isRoot, keys, schemeKeys, optimizeForFirstRender } = r;\n\tvar local = localStates.get(id);\n\tvar parentState = states.get(parentId);\n\tif (local && !PendingUpdate.has(id)) {\n\t\tif (parentState && local._parentName === parentState.name && local._parentSchemeAuthored === parentState.schemeAuthored && local._propsKey === propsKey) return local;\n\t}\n\tvar isSchemeOnlyChange = !optimizeForFirstRender && supportsDynamicColorIOS && getSetting(\"fastSchemeChange\") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);\n\tvar allKeysSchemeOptimized = !optimizeForFirstRender && Boolean(((_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) && (schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) === keys.current.size);\n\tvar canSkipForSchemeChange = Boolean(isSchemeOnlyChange && allKeysSchemeOptimized);\n\tvar needsUpdate = props.passThrough ? false : optimizeForFirstRender ? true : isRoot || props.forceClassName || props.name === \"light\" || props.name === \"dark\" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);\n\tvar [rerender, nextRaw] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));\n\tvar next = nextRaw;\n\tif (props._themeUpdate && (nextRaw === null || nextRaw === void 0 ? void 0 : nextRaw.theme)) {\n\t\tvar _states_get;\n\t\tvar parentTheme = ((_states_get = states.get(parentId)) === null || _states_get === void 0 ? void 0 : _states_get.theme) || nextRaw.theme;\n\t\tvar merged = props._themeUpdate.getTheme(parentTheme, nextRaw.name, getConfig());\n\t\tif (merged !== nextRaw.theme) next = {\n\t\t\t...nextRaw,\n\t\t\ttheme: merged\n\t\t};\n\t}\n\tPendingUpdate.delete(id);\n\tif (!local || rerender) {\n\t\tlocal = { ...next };\n\t\tlocalStates.set(id, local);\n\t}\n\tif (next !== local) {\n\t\tObject.assign(local, next);\n\t\tlocal.id = id;\n\t}\n\tlocal._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;\n\tlocal._parentSchemeAuthored = parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored;\n\tlocal._propsKey = propsKey;\n\tstates.set(id, next);\n\treturn local;\n};\nvar getNextState = function(lastState, props, propsKey) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0;\n\tvar parentState = states.get(parentId);\n\tif (props.passThrough) return [false, parentState || lastState || { name: \"\" }];\n\tthemes || (themes = getConfig().themes);\n\tvar name = !propsKey && (!lastState || !lastState.isNew) ? null : getNewThemeName(parentState === null || parentState === void 0 ? void 0 : parentState.name, props, pendingUpdate === \"force\" ? true : !!needsUpdate);\n\tvar authoredName = props.name;\n\tvar parentSchemeAuthored = !!(parentState === null || parentState === void 0 ? void 0 : parentState.schemeAuthored);\n\tvar schemeAuthored = isRoot ? !!props.forceClassName : parentSchemeAuthored || !!(authoredName && getThemeScheme(authoredName) && authoredName in themes);\n\tvar intentChanged = schemeAuthored !== parentSchemeAuthored;\n\tvar resolvedName = name || (parentState === null || parentState === void 0 ? void 0 : parentState.name);\n\tvar sameAsLast = lastState && lastState.name === resolvedName && !!lastState.schemeAuthored === schemeAuthored;\n\tvar isSameAsParent = Boolean(parentState && resolvedName === parentState.name && !intentChanged);\n\tvar shouldRerender = Boolean(pendingUpdate === \"force\" || needsUpdate && (pendingUpdate || (lastState === null || lastState === void 0 ? void 0 : lastState.name) !== (parentState === null || parentState === void 0 ? void 0 : parentState.name) || !!(lastState === null || lastState === void 0 ? void 0 : lastState.schemeAuthored) !== schemeAuthored));\n\tif (isSameAsParent) {\n\t\tif (!shouldRerender && sameAsLast) return [false, lastState];\n\t\treturn [shouldRerender, {\n\t\t\t...parentState,\n\t\t\tisNew: false\n\t\t}];\n\t}\n\tif (!resolvedName) {\n\t\tvar _ref, _ref1;\n\t\tvar next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {\n\t\t\tid,\n\t\t\tname: \"light\",\n\t\t\ttheme: getConfig().themes.light\n\t\t};\n\t\tif (shouldRerender) return [true, { ...parentState || lastState || next }];\n\t\treturn [false, next];\n\t}\n\tvar scheme = getThemeScheme(resolvedName);\n\tvar _parentState_inverses;\n\tvar parentInverses = (_parentState_inverses = parentState === null || parentState === void 0 ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0;\n\tvar isInverse = Boolean(parentState && scheme !== parentState.scheme);\n\tvar inverses = parentInverses + (isInverse ? 1 : 0);\n\tvar nextState = {\n\t\tid,\n\t\tname: resolvedName,\n\t\ttheme: themes[resolvedName],\n\t\tscheme,\n\t\tparentId,\n\t\tparentName: parentState === null || parentState === void 0 ? void 0 : parentState.name,\n\t\tinverses,\n\t\tisInverse,\n\t\tschemeAuthored,\n\t\tisNew: true\n\t};\n\tif (isRoot) rootThemeState = nextState;\n\treturn [pendingUpdate === \"force\" || !sameAsLast, nextState];\n};\nfunction scheduleUpdate(id) {\n\tvar queue = [id];\n\tvar visited = /* @__PURE__ */ new Set();\n\twhile (queue.length) {\n\t\tvar children = listenersByParent[queue.shift()];\n\t\tif (children) {\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar childId = _step.value;\n\t\t\t\t\tif (!visited.has(childId)) {\n\t\t\t\t\t\tvisited.add(childId);\n\t\t\t\t\t\tqueue.push(childId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvisited.forEach(function(childId2) {\n\t\tvar _allListeners_get;\n\t\t(_allListeners_get = allListeners.get(childId2)) === null || _allListeners_get === void 0 || _allListeners_get();\n\t});\n}\nfunction getNewThemeName() {\n\tvar parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\", props = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tvar { name } = props;\n\tvar cacheKey = `${parentName}|${name || \"\"}|${forceUpdate ? 1 : 0}`;\n\tif (themeNameCacheVer !== cacheVersion) {\n\t\tthemeNameCache.clear();\n\t\tthemeNameCacheVer = cacheVersion;\n\t} else {\n\t\tvar cached = themeNameCache.get(cacheKey);\n\t\tif (cached !== void 0) return cached;\n\t}\n\tvar result = resolveThemeName(parentName, name !== null && name !== void 0 ? name : void 0, getConfig().themes, forceUpdate);\n\tif (themeNameCache.size >= 1e4) themeNameCache.clear();\n\tthemeNameCache.set(cacheKey, result);\n\treturn result;\n}\nvar getThemeNameCacheSize = function() {\n\treturn themeNameCache.size;\n};\nfunction resolveThemeName(parentName, name, themes2) {\n\tvar forceUpdate = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;\n\tvar parentParts = parentName ? parentName.split(\"_\") : [];\n\tvar found = null;\n\tif (name) {\n\t\tvar nameHasScheme = getThemeScheme(name);\n\t\tif (nameHasScheme && name in themes2) found = name;\n\t\tif (!found && !nameHasScheme) for (var i = parentParts.length; i >= 0; i--) {\n\t\t\tvar base = parentParts.slice(0, i).join(\"_\");\n\t\t\tvar potential = base ? `${base}_${name}` : name;\n\t\t\tif (potential in themes2) {\n\t\t\t\tfound = potential;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (!forceUpdate && found === parentName && found !== \"light\" && found !== \"dark\") return null;\n\treturn found;\n}\nvar getPropsKey = function(param) {\n\tvar { name, forceClassName, _themeUpdate } = param;\n\treturn `${name || \"\"}${forceClassName || \"\"}${(_themeUpdate === null || _themeUpdate === void 0 ? void 0 : _themeUpdate.key) || \"\"}`;\n};\nvar hasThemeUpdatingProps = function(props) {\n\treturn \"name\" in props || \"forceClassName\" in props || \"_themeUpdate\" in props;\n};\n\nexport { ThemeStateContext, forceUpdateThemes, getNewThemeName, getRootThemeState, getThemeNameCacheSize, getThemeProviderChainSizes, getThemeProviderParent, getThemeState, getThemeUpdateLayer, hasThemeU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AQ,SAAS,QAAQ;EAC9C,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,IAAI,IAAI,YAAY,QAAQ,KAAK,GAAG,KAAK;GAC3E,IAAI,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;GAC3C,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;GAC3C,IAAI,aAAa,SAAS;IACzB,QAAQ;IACR;GACD;EACD;CACD;CACA,IAAI,CAAC,eAAe,UAAU,cAAc,UAAU,WAAW,UAAU,QAAQ,OAAO;CAC1F,OAAO;AACR;AACA,IAAI,cAAc,SAAS,OAAO;CACjC,IAAI,EAAE,MAAM,gBAAgB,iBAAiB;CAC7C,OAAO,GAAG,QAAQ,KAAK,kBAAkB,MAAM,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,QAAQ;AACjI;AACA,IAAI,wBAAwB,SAAS,OAAO;CAC3C,OAAO,UAAU,SAAS,oBAAoB,SAAS,kBAAkB;AAC1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1537.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nate Wienert"
|
|
@@ -100,23 +100,23 @@
|
|
|
100
100
|
"test:web": "vitest --typecheck --run"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tamagui/animation-helpers": "3.0.0-beta.
|
|
104
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
105
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
106
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
107
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
108
|
-
"@tamagui/is-equal-shallow": "3.0.0-beta.
|
|
109
|
-
"@tamagui/native": "3.0.0-beta.
|
|
110
|
-
"@tamagui/normalize-css-color": "3.0.0-beta.
|
|
111
|
-
"@tamagui/react-native-types": "3.0.0-beta.
|
|
112
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
113
|
-
"@tamagui/types": "3.0.0-beta.
|
|
114
|
-
"@tamagui/use-did-finish-ssr": "3.0.0-beta.
|
|
115
|
-
"@tamagui/use-event": "3.0.0-beta.
|
|
116
|
-
"@tamagui/use-force-update": "3.0.0-beta.
|
|
103
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1537.1",
|
|
104
|
+
"@tamagui/compose-refs": "3.0.0-beta.1537.1",
|
|
105
|
+
"@tamagui/constants": "3.0.0-beta.1537.1",
|
|
106
|
+
"@tamagui/dom": "3.0.0-beta.1537.1",
|
|
107
|
+
"@tamagui/helpers": "3.0.0-beta.1537.1",
|
|
108
|
+
"@tamagui/is-equal-shallow": "3.0.0-beta.1537.1",
|
|
109
|
+
"@tamagui/native": "3.0.0-beta.1537.1",
|
|
110
|
+
"@tamagui/normalize-css-color": "3.0.0-beta.1537.1",
|
|
111
|
+
"@tamagui/react-native-types": "3.0.0-beta.1537.1",
|
|
112
|
+
"@tamagui/style-grammar": "3.0.0-beta.1537.1",
|
|
113
|
+
"@tamagui/types": "3.0.0-beta.1537.1",
|
|
114
|
+
"@tamagui/use-did-finish-ssr": "3.0.0-beta.1537.1",
|
|
115
|
+
"@tamagui/use-event": "3.0.0-beta.1537.1",
|
|
116
|
+
"@tamagui/use-force-update": "3.0.0-beta.1537.1"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@tamagui/build": "3.0.0-beta.
|
|
119
|
+
"@tamagui/build": "3.0.0-beta.1537.1",
|
|
120
120
|
"@testing-library/react": "^16.1.0",
|
|
121
121
|
"csstype": "^3.0.10",
|
|
122
122
|
"react": "19.2.3",
|
|
@@ -183,9 +183,9 @@ export function useEvents(
|
|
|
183
183
|
// freezes Android — see top-of-file isAndroid comment). Hook is called
|
|
184
184
|
// unconditionally here for stable hooks order; useMainThreadPressEvents
|
|
185
185
|
// no-ops when enabled is false.
|
|
186
|
-
const useResponderFallback =
|
|
187
|
-
!isInsideNativeMenu &&
|
|
188
|
-
|
|
186
|
+
const useResponderFallback = Boolean(
|
|
187
|
+
hasRealPressEvents || (!isInsideNativeMenu && getIsAndroid() && hasPressEvents)
|
|
188
|
+
)
|
|
189
189
|
useMainThreadPressEvents(events, viewProps, useResponderFallback, debugName)
|
|
190
190
|
|
|
191
191
|
if (everEnabled) {
|
|
@@ -199,7 +199,7 @@ export function useEvents(
|
|
|
199
199
|
}
|
|
200
200
|
: {}
|
|
201
201
|
|
|
202
|
-
if (hasRealPressEvents
|
|
202
|
+
if (hasRealPressEvents) {
|
|
203
203
|
// Real handlers are delivered by useMainThreadPressEvents above. Clear
|
|
204
204
|
// any cached press-clause observer from an earlier render so it cannot
|
|
205
205
|
// double-fire after onPress appears dynamically.
|
|
@@ -343,3 +343,29 @@ const nativeInlineExpansions: Record<string, string[]> = {
|
|
|
343
343
|
insetInlineStart: ['left'],
|
|
344
344
|
insetInlineEnd: ['right'],
|
|
345
345
|
}
|
|
346
|
+
|
|
347
|
+
// react native ranks an rtl-aware longhand (paddingStart, borderTopStartRadius)
|
|
348
|
+
// and rowGap/columnGap above the shorthand regardless of order, so a later
|
|
349
|
+
// shorthand has to retract the earlier ones it covers to keep authored order.
|
|
350
|
+
// physical longhands need no entry: the shorthand expands onto them
|
|
351
|
+
const paddingLogicals = ['paddingStart', 'paddingEnd']
|
|
352
|
+
const marginLogicals = ['marginStart', 'marginEnd']
|
|
353
|
+
export const nativeShorthandLogicals: Record<string, string[]> = {
|
|
354
|
+
padding: paddingLogicals,
|
|
355
|
+
paddingHorizontal: paddingLogicals,
|
|
356
|
+
margin: marginLogicals,
|
|
357
|
+
marginHorizontal: marginLogicals,
|
|
358
|
+
borderRadius: [
|
|
359
|
+
'borderTopStartRadius',
|
|
360
|
+
'borderTopEndRadius',
|
|
361
|
+
'borderBottomStartRadius',
|
|
362
|
+
'borderBottomEndRadius',
|
|
363
|
+
'borderStartStartRadius',
|
|
364
|
+
'borderStartEndRadius',
|
|
365
|
+
'borderEndStartRadius',
|
|
366
|
+
'borderEndEndRadius',
|
|
367
|
+
],
|
|
368
|
+
borderWidth: ['borderStartWidth', 'borderEndWidth'],
|
|
369
|
+
borderColor: ['borderStartColor', 'borderEndColor'],
|
|
370
|
+
gap: ['rowGap', 'columnGap'],
|
|
371
|
+
}
|