@tamagui/core 1.0.1-beta.186 → 1.0.1-beta.188
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/addTheme.js +2 -2
- package/dist/cjs/addTheme.js.map +2 -2
- package/dist/cjs/constants/constants.js +2 -2
- package/dist/cjs/constants/constants.js.map +2 -2
- package/dist/cjs/createComponent.js +25 -25
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createTamagui.js +3 -3
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createVariable.js +3 -3
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/calc.js +2 -2
- package/dist/cjs/helpers/calc.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +5 -5
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.js +2 -2
- package/dist/cjs/helpers/expandStyle.js.map +2 -2
- package/dist/cjs/helpers/expandStyles.js +2 -2
- package/dist/cjs/helpers/expandStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +11 -11
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/hooks/useDidFinishSSR.js +60 -0
- package/dist/cjs/hooks/useDidFinishSSR.js.map +7 -0
- package/dist/cjs/hooks/useIsMounted.js +2 -2
- package/dist/cjs/hooks/useIsMounted.js.map +2 -2
- package/dist/cjs/hooks/useIsSSR.js +3 -3
- package/dist/cjs/hooks/useIsSSR.js.map +2 -2
- package/dist/cjs/hooks/useIsTouchDevice.js +4 -4
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +2 -2
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useSafeRef.js +2 -2
- package/dist/cjs/hooks/useSafeRef.js.map +2 -2
- package/dist/cjs/hooks/useServerHooks.js +3 -3
- package/dist/cjs/hooks/useServerHooks.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +7 -7
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/views/Slot.js +2 -2
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/TamaguiProvider.js +4 -4
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Text.js +5 -5
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/Theme.js +2 -2
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +2 -2
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +2 -2
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/addTheme.js +1 -1
- package/dist/esm/addTheme.js.map +2 -2
- package/dist/esm/constants/constants.js +1 -1
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/createComponent.js +1 -1
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +1 -1
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createVariable.js +1 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/calc.js +1 -1
- package/dist/esm/helpers/calc.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +1 -1
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/expandStyle.js +1 -1
- package/dist/esm/helpers/expandStyle.js.map +1 -1
- package/dist/esm/helpers/expandStyles.js +1 -1
- package/dist/esm/helpers/expandStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +1 -1
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/hooks/useDidFinishSSR.js +35 -0
- package/dist/esm/hooks/useDidFinishSSR.js.map +7 -0
- package/dist/esm/hooks/useIsMounted.js +1 -1
- package/dist/esm/hooks/useIsMounted.js.map +2 -2
- package/dist/esm/hooks/useIsSSR.js +1 -1
- package/dist/esm/hooks/useIsSSR.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +1 -1
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +1 -1
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useSafeRef.js +1 -1
- package/dist/esm/hooks/useSafeRef.js.map +2 -2
- package/dist/esm/hooks/useServerHooks.js +1 -1
- package/dist/esm/hooks/useServerHooks.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +1 -1
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/views/Slot.js +1 -1
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +1 -1
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Text.js +1 -1
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +1 -1
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +1 -1
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +1 -1
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +11 -10
- package/src/addTheme.ts +2 -1
- package/src/constants/constants.ts +1 -1
- package/src/createComponent.tsx +1 -1
- package/src/createTamagui.ts +2 -1
- package/src/createVariable.ts +1 -1
- package/src/helpers/calc.ts +2 -1
- package/src/helpers/createPropMapper.ts +2 -1
- package/src/helpers/expandStyle.ts +1 -1
- package/src/helpers/expandStyles.ts +2 -1
- package/src/helpers/getSplitStyles.tsx +1 -1
- package/src/hooks/useIsMounted.ts +1 -2
- package/src/hooks/useIsSSR.tsx +1 -1
- package/src/hooks/useIsTouchDevice.tsx +1 -2
- package/src/hooks/useMedia.tsx +1 -1
- package/src/hooks/useSafeRef.ts +1 -2
- package/src/hooks/useServerHooks.tsx +1 -2
- package/src/hooks/useTheme.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/views/Slot.tsx +1 -2
- package/src/views/TamaguiProvider.tsx +1 -1
- package/src/views/Text.tsx +1 -1
- package/src/views/Theme.tsx +1 -1
- package/src/views/ThemeInverse.tsx +1 -1
- package/src/views/ThemeReset.tsx +1 -1
- package/types/constants/platform.d.ts +2 -2
- package/types/hooks/useDidFinishSSR.d.ts +3 -0
- package/types/index.d.ts +1 -1
package/dist/cjs/addTheme.js
CHANGED
|
@@ -21,8 +21,8 @@ __export(addTheme_exports, {
|
|
|
21
21
|
addTheme: () => addTheme
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(addTheme_exports);
|
|
24
|
+
var import_constants = require("@tamagui/constants");
|
|
24
25
|
var import_config = require("./config");
|
|
25
|
-
var import_platform = require("./constants/platform");
|
|
26
26
|
var import_getThemeCSSRules = require("./helpers/getThemeCSSRules");
|
|
27
27
|
var import_themes = require("./helpers/themes");
|
|
28
28
|
function addTheme({
|
|
@@ -48,7 +48,7 @@ function addTheme({
|
|
|
48
48
|
const themeProxied = (0, import_themes.proxyThemeToParents)(themeName, theme, config.themes);
|
|
49
49
|
config.themes[themeName] = themeProxied;
|
|
50
50
|
let cssRules = [];
|
|
51
|
-
if (
|
|
51
|
+
if (import_constants.isWeb) {
|
|
52
52
|
if (insertCSS) {
|
|
53
53
|
cssRules = (0, import_getThemeCSSRules.getThemeCSSRules)({
|
|
54
54
|
config,
|
package/dist/cjs/addTheme.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/addTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAwC;AACxC,
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getConfig, updateConfig } from './config'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeDefinition, ThemeParsed } from './types'\n\nexport function addTheme({\n name: themeName,\n theme: themeIn,\n insertCSS,\n update,\n}: {\n name: string\n theme: ThemeDefinition\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(`Must run createTamagui once before loading theme`)\n }\n if (!update && config.themes[themeName]) {\n throw new Error(`Already defined theme \"${themeName}\", use updateTheme to change values`)\n }\n }\n\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `tamagui_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEtB,oBAAwC;AACxC,8BAAiC;AACjC,oBAAyD;AAGlD,SAAS,SAAS;AAAA,EACvB,MAAM;AAAA,EACN,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAKG;AAjBH;AAkBE,QAAM,aAAS,yBAAU;AACzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AACA,QAAI,CAAC,UAAU,OAAO,OAAO,YAAY;AACvC,YAAM,IAAI,MAAM,0BAA0B,8CAA8C;AAAA,IAC1F;AAAA,EACF;AAEA,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,2CAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,mBAAe,mCAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,wBAAO;AACT,QAAI,WAAW;AACb,qBAAW,0CAAiB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,uBAAuB;AAClC,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,kCAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,YAAY,aAAa,CAAC;AAItE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,13 +23,13 @@ __export(constants_exports, {
|
|
|
23
23
|
stackDefaultStyles: () => stackDefaultStyles
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(constants_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_constants = require("@tamagui/constants");
|
|
27
27
|
const THEME_NAME_SEPARATOR = "_";
|
|
28
28
|
const THEME_CLASSNAME_PREFIX = `t_`;
|
|
29
29
|
const stackDefaultStyles = {
|
|
30
30
|
alignItems: "stretch",
|
|
31
31
|
flexShrink: 0,
|
|
32
|
-
...
|
|
32
|
+
...import_constants.isWeb && {
|
|
33
33
|
display: "flex",
|
|
34
34
|
flexBasis: "auto",
|
|
35
35
|
boxSizing: "border-box"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nexport const THEME_NAME_SEPARATOR = '_'\nexport const THEME_CLASSNAME_PREFIX = `t_`\n\nexport const stackDefaultStyles = {\n alignItems: 'stretch',\n flexShrink: 0,\n // more accurately match react-native defaults on web\n ...(isWeb && {\n display: 'flex',\n flexBasis: 'auto',\n boxSizing: 'border-box',\n }),\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEf,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAE/B,MAAM,qBAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,YAAY;AAAA,EAEZ,GAAI,0BAAS;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,14 +34,14 @@ __export(createComponent_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(createComponent_exports);
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_constants = require("@tamagui/constants");
|
|
37
38
|
var import_helpers = require("@tamagui/helpers");
|
|
38
39
|
var import_rnw = require("@tamagui/rnw");
|
|
39
40
|
var import_use_force_update = require("@tamagui/use-force-update");
|
|
40
41
|
var import_react = __toESM(require("react"));
|
|
41
42
|
var import_react_native = require("react-native");
|
|
42
43
|
var import_config = require("./config");
|
|
43
|
-
var
|
|
44
|
-
var import_platform = require("./constants/platform");
|
|
44
|
+
var import_constants2 = require("./constants/constants");
|
|
45
45
|
var import_FontLanguageContext = require("./contexts/FontLanguageContext");
|
|
46
46
|
var import_TextAncestorContext = require("./contexts/TextAncestorContext");
|
|
47
47
|
var import_assignNativePropsToWeb = require("./helpers/assignNativePropsToWeb");
|
|
@@ -114,7 +114,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
114
114
|
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
115
115
|
const shouldAvoidClasses = !!(props.animation && avoidClasses) || !staticConfig.acceptsClassName;
|
|
116
116
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
117
|
-
const hasTextAncestor = !!(
|
|
117
|
+
const hasTextAncestor = !!(import_constants.isWeb && isText ? (0, import_react.useContext)(import_TextAncestorContext.TextAncestorContext) : false);
|
|
118
118
|
const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? {
|
|
119
119
|
...state,
|
|
120
120
|
hasTextAncestor,
|
|
@@ -126,7 +126,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
126
126
|
hasTextAncestor,
|
|
127
127
|
resolveVariablesAs: "value"
|
|
128
128
|
};
|
|
129
|
-
const languageContext =
|
|
129
|
+
const languageContext = import_constants.isRSC ? null : (0, import_react.useContext)(import_FontLanguageContext.FontLanguageContext);
|
|
130
130
|
const splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
131
131
|
props,
|
|
132
132
|
staticConfig,
|
|
@@ -169,7 +169,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
169
169
|
classNames,
|
|
170
170
|
mediaKeys
|
|
171
171
|
} = splitStyles;
|
|
172
|
-
(0,
|
|
172
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
173
173
|
if (!mediaKeys.length) {
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
@@ -203,7 +203,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
203
203
|
}
|
|
204
204
|
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
|
|
205
205
|
const propsWithAnimation = props;
|
|
206
|
-
if (!
|
|
206
|
+
if (!import_constants.isRSC && isAnimated && useAnimations) {
|
|
207
207
|
const animationState = useAnimations(propsWithAnimation, {
|
|
208
208
|
state,
|
|
209
209
|
pseudos,
|
|
@@ -284,9 +284,9 @@ function createComponent(configIn, ParentComponent) {
|
|
|
284
284
|
...nonTamaguiProps
|
|
285
285
|
} = viewPropsIn;
|
|
286
286
|
const isTaggable = !Component || typeof Component === "string";
|
|
287
|
-
const element =
|
|
288
|
-
const BaseTextComponent = !
|
|
289
|
-
const BaseViewComponent = !
|
|
287
|
+
const element = import_constants.isWeb ? isTaggable ? tag || Component : Component : Component;
|
|
288
|
+
const BaseTextComponent = !import_constants.isWeb ? import_react_native.Text : element || "span";
|
|
289
|
+
const BaseViewComponent = !import_constants.isWeb ? import_react_native.View : element || (hasTextAncestor ? "span" : "div");
|
|
290
290
|
let elementType = isText ? (isAnimated ? AnimatedText || import_react_native.Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || import_react_native.View : null) || BaseViewComponent;
|
|
291
291
|
elementType = Component || elementType;
|
|
292
292
|
const isStringElement = typeof elementType === "string";
|
|
@@ -294,7 +294,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
294
294
|
let viewProps;
|
|
295
295
|
const hasEnterStyle = !!props.enterStyle;
|
|
296
296
|
const shouldSetMounted = Boolean(
|
|
297
|
-
(
|
|
297
|
+
(import_constants.isWeb ? import_constants.isClient : true) && (hasEnterStyle || props.animation) && !state.mounted
|
|
298
298
|
);
|
|
299
299
|
const setMounted = shouldSetMounted ? () => {
|
|
300
300
|
setTimeout(
|
|
@@ -303,7 +303,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
303
303
|
mounted: true
|
|
304
304
|
});
|
|
305
305
|
},
|
|
306
|
-
|
|
306
|
+
import_constants.isWeb ? 10 : 0
|
|
307
307
|
);
|
|
308
308
|
} : void 0;
|
|
309
309
|
if (process.env.TAMAGUI_TARGET === "web" && !staticConfig.isReactNativeWeb) {
|
|
@@ -381,7 +381,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
381
381
|
} = nonTamaguiProps;
|
|
382
382
|
viewProps = webProps;
|
|
383
383
|
(0, import_assignNativePropsToWeb.assignNativePropsToWeb)(elementType, viewProps, nonTamaguiProps);
|
|
384
|
-
if (!
|
|
384
|
+
if (!import_constants.isRSC) {
|
|
385
385
|
(0, import_rnw.useElementLayout)(hostRef, onLayout);
|
|
386
386
|
(0, import_rnw.useResponderEvents)(hostRef, {
|
|
387
387
|
onMoveShouldSetResponder,
|
|
@@ -440,7 +440,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
440
440
|
viewProps.ref = forwardedRef;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
if (process.env.NODE_ENV === "development" && !isText &&
|
|
443
|
+
if (process.env.NODE_ENV === "development" && !isText && import_constants.isWeb && !staticConfig.isHOC) {
|
|
444
444
|
import_react.Children.toArray(props.children).forEach((item) => {
|
|
445
445
|
if (typeof item === "string") {
|
|
446
446
|
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
@@ -453,7 +453,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
453
453
|
pressIn: false
|
|
454
454
|
});
|
|
455
455
|
}, [setStateShallow]);
|
|
456
|
-
if (!
|
|
456
|
+
if (!import_constants.isRSC) {
|
|
457
457
|
(0, import_react.useEffect)(() => {
|
|
458
458
|
return () => {
|
|
459
459
|
mouseUps.delete(unPress);
|
|
@@ -469,7 +469,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
469
469
|
...medias
|
|
470
470
|
};
|
|
471
471
|
} else {
|
|
472
|
-
styles = [
|
|
472
|
+
styles = [import_constants.isWeb ? null : defaultNativeStyle, animationStyles ?? splitStylesStyle, medias];
|
|
473
473
|
if (!animationStyles && initialSplitStyles) {
|
|
474
474
|
const initPseudos = initialSplitStyles.pseudos;
|
|
475
475
|
!state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
|
|
@@ -563,14 +563,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
563
563
|
}
|
|
564
564
|
const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
|
|
565
565
|
const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
|
|
566
|
-
const isHoverable =
|
|
566
|
+
const isHoverable = import_constants.isWeb;
|
|
567
567
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
568
568
|
const handlesPressEvents = !isStringElement && !asChild;
|
|
569
569
|
const pressKey = handlesPressEvents ? "onPress" : "onClick";
|
|
570
570
|
const pressInKey = handlesPressEvents ? "onPressIn" : "onMouseDown";
|
|
571
571
|
const pressOutKey = handlesPressEvents ? "onPressOut" : "onMouseUp";
|
|
572
|
-
const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props ||
|
|
573
|
-
const events = shouldAttach && !
|
|
572
|
+
const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || import_constants.isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props));
|
|
573
|
+
const events = shouldAttach && !import_constants.isRSC ? {
|
|
574
574
|
[pressOutKey]: attachPress ? (e) => {
|
|
575
575
|
unPress();
|
|
576
576
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
@@ -616,7 +616,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
616
616
|
});
|
|
617
617
|
onPressIn == null ? void 0 : onPressIn(e);
|
|
618
618
|
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
619
|
-
if (
|
|
619
|
+
if (import_constants.isWeb) {
|
|
620
620
|
mouseUps.add(unPress);
|
|
621
621
|
}
|
|
622
622
|
} : null,
|
|
@@ -625,7 +625,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
625
625
|
onClick == null ? void 0 : onClick(e);
|
|
626
626
|
onPress == null ? void 0 : onPress(e);
|
|
627
627
|
} : null,
|
|
628
|
-
...!
|
|
628
|
+
...!import_constants.isWeb && {
|
|
629
629
|
cancelable: !props.rejectResponderTermination,
|
|
630
630
|
disabled: props.disabled !== null ? props.disabled : (_e = props.accessibilityState) == null ? void 0 : _e.disabled,
|
|
631
631
|
hitSlop: props.hitSlop,
|
|
@@ -672,7 +672,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
672
672
|
onPressOut
|
|
673
673
|
};
|
|
674
674
|
}
|
|
675
|
-
if (!
|
|
675
|
+
if (!import_constants.isRSC && import_constants.isWeb) {
|
|
676
676
|
const [pressableProps] = (0, import_usePressable.usePressable)(
|
|
677
677
|
events ? {
|
|
678
678
|
disabled,
|
|
@@ -723,7 +723,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
723
723
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
724
724
|
const isAnimatedRNWView = isAnimated && typeof elementType !== "string";
|
|
725
725
|
const shouldWrapWithComponentTheme = !!theme.className && isAnimatedRNWView && (0, import_createPropMapper.getReturnVariablesAs)(props, splitStyleState) === "non-color-value";
|
|
726
|
-
const shouldWrapWithHover = Boolean(events ||
|
|
726
|
+
const shouldWrapWithHover = Boolean(events || import_constants.isRSC) && attachHover;
|
|
727
727
|
if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
|
|
728
728
|
const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
|
|
729
729
|
const hoverClassName = shouldWrapWithHover ? "t_Hoverable" : "";
|
|
@@ -835,7 +835,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
835
835
|
};
|
|
836
836
|
defaultNativeStyle = {};
|
|
837
837
|
const validStyles2 = staticConfig.validStyles || import_helpers.stylePropsView;
|
|
838
|
-
if (!
|
|
838
|
+
if (!import_constants.isWeb) {
|
|
839
839
|
for (const key in staticConfig.defaultProps) {
|
|
840
840
|
const val = staticConfig.defaultProps[key];
|
|
841
841
|
if (import_helpers.validPseudoKeys[key])
|
|
@@ -898,7 +898,7 @@ const Spacer = createComponent({
|
|
|
898
898
|
componentName: "Spacer",
|
|
899
899
|
validStyles: import_helpers.validStyles,
|
|
900
900
|
defaultProps: {
|
|
901
|
-
...
|
|
901
|
+
...import_constants2.stackDefaultStyles,
|
|
902
902
|
tag: "span",
|
|
903
903
|
size: true
|
|
904
904
|
},
|
|
@@ -1059,7 +1059,7 @@ const accessibilityRoleToWebRole = {
|
|
|
1059
1059
|
};
|
|
1060
1060
|
function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
|
|
1061
1061
|
const pseudoStyle = pseudos[name];
|
|
1062
|
-
const shouldNestObject =
|
|
1062
|
+
const shouldNestObject = import_constants.isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
1063
1063
|
const defaultPseudoStyle = initialPseudos[name];
|
|
1064
1064
|
const style = defaultPseudoStyle ? { ...defaultPseudoStyle, ...pseudoStyle } : pseudoStyle;
|
|
1065
1065
|
if (style) {
|