@tamagui/web 1.116.1 → 1.116.2
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/Tamagui.js +63 -0
- package/dist/cjs/_withStableStyle.js +33 -0
- package/dist/cjs/config.js +97 -0
- package/dist/cjs/constants/accessibilityDirectMap.js +70 -0
- package/dist/cjs/constants/constants.js +36 -0
- package/dist/cjs/constants/isDevTools.js +28 -0
- package/dist/cjs/constants/webToNativeProps.js +22 -0
- package/dist/cjs/contexts/ComponentContext.js +32 -0
- package/dist/cjs/createComponent.js +670 -0
- package/dist/cjs/createFont.js +53 -0
- package/dist/cjs/createShorthands.js +23 -0
- package/dist/cjs/createTamagui.js +189 -0
- package/dist/cjs/createTheme.js +21 -0
- package/dist/cjs/createTokens.js +24 -0
- package/dist/cjs/createVariable.js +82 -0
- package/dist/cjs/createVariables.js +47 -0
- package/dist/cjs/defaultComponentState.js +33 -0
- package/dist/cjs/helpers/ThemeManager.js +166 -0
- package/dist/cjs/helpers/ThemeManagerContext.js +30 -0
- package/dist/cjs/helpers/createMediaStyle.js +74 -0
- package/dist/cjs/helpers/createShallowSetState.js +44 -0
- package/dist/cjs/helpers/createStyledContext.js +53 -0
- package/dist/cjs/helpers/defaultOffset.js +21 -0
- package/dist/cjs/helpers/expandStyle.js +73 -0
- package/dist/cjs/helpers/expandStyles.js +34 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +29 -0
- package/dist/cjs/helpers/getFontLanguage.js +21 -0
- package/dist/cjs/helpers/getGroupPropParts.js +27 -0
- package/dist/cjs/helpers/getSplitStyles.js +685 -0
- package/dist/cjs/helpers/getStylesAtomic.js +152 -0
- package/dist/cjs/helpers/getThemeCSSRules.js +89 -0
- package/dist/cjs/helpers/getVariantExtras.js +58 -0
- package/dist/cjs/helpers/insertStyleRule.js +231 -0
- package/dist/cjs/helpers/isActivePlatform.js +31 -0
- package/dist/cjs/helpers/isActiveTheme.js +24 -0
- package/dist/cjs/helpers/isObj.js +21 -0
- package/dist/cjs/helpers/isTamaguiComponent.js +24 -0
- package/dist/cjs/helpers/isTamaguiElement.js +30 -0
- package/dist/cjs/helpers/log.js +31 -0
- package/dist/cjs/helpers/matchMedia.js +34 -0
- package/dist/cjs/helpers/matchMedia.native.js +2 -2
- package/dist/cjs/helpers/matchMedia.native.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js +41 -0
- package/dist/cjs/helpers/mergeVariants.js +38 -0
- package/dist/cjs/helpers/normalizeColor.js +43 -0
- package/dist/cjs/helpers/normalizeShadow.js +38 -0
- package/dist/cjs/helpers/normalizeStyle.js +36 -0
- package/dist/cjs/helpers/normalizeStylePropKeys.js +21 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +54 -0
- package/dist/cjs/helpers/objectIdentityKey.js +38 -0
- package/dist/cjs/helpers/propMapper.js +238 -0
- package/dist/cjs/helpers/proxyThemeToParents.js +52 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +31 -0
- package/dist/cjs/helpers/pseudoDescriptors.js +65 -0
- package/dist/cjs/helpers/registerCSSVariable.js +29 -0
- package/dist/cjs/helpers/setElementProps.js +24 -0
- package/dist/cjs/helpers/skipProps.js +68 -0
- package/dist/cjs/helpers/sortString.js +21 -0
- package/dist/cjs/helpers/subscribeToContextGroup.js +53 -0
- package/dist/cjs/helpers/themeable.js +55 -0
- package/dist/cjs/helpers/themes.js +33 -0
- package/dist/cjs/helpers/timer.js +27 -0
- package/dist/cjs/helpers/transformsToString.js +32 -0
- package/dist/cjs/helpers/webPropsToSkip.js +21 -0
- package/dist/cjs/helpers/wrapStyleTags.js +39 -0
- package/dist/cjs/hooks/useComponentState.js +115 -0
- package/dist/cjs/hooks/useConfiguration.js +37 -0
- package/dist/cjs/hooks/useDisableSSR.js +24 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +22 -0
- package/dist/cjs/hooks/useMedia.cjs +1 -1
- package/dist/cjs/hooks/useMedia.js +207 -0
- package/dist/cjs/hooks/useMedia.js.map +6 -0
- package/dist/cjs/hooks/useMedia.native.js +1 -1
- package/dist/cjs/hooks/useMedia.native.js.map +2 -2
- package/dist/cjs/hooks/useProps.js +95 -0
- package/dist/cjs/hooks/useTheme.js +263 -0
- package/dist/cjs/hooks/useThemeName.js +39 -0
- package/dist/cjs/index.js +100 -0
- package/dist/cjs/inject-styles.js +28 -0
- package/dist/cjs/insertFont.js +65 -0
- package/dist/cjs/interfaces/CSSColorNames.js +14 -0
- package/dist/cjs/interfaces/GetRef.js +14 -0
- package/dist/cjs/interfaces/KeyTypes.js +14 -0
- package/dist/cjs/interfaces/RNExclusiveTypes.js +14 -0
- package/dist/cjs/interfaces/Role.js +14 -0
- package/dist/cjs/interfaces/TamaguiComponentEvents.js +14 -0
- package/dist/cjs/interfaces/TamaguiComponentPropsBaseBase.js +14 -0
- package/dist/cjs/interfaces/TamaguiComponentState.js +14 -0
- package/dist/cjs/interfaces/WebOnlyPressEvents.js +14 -0
- package/dist/cjs/setupHooks.js +25 -0
- package/dist/cjs/setupReactNative.js +46 -0
- package/dist/cjs/styled.js +74 -0
- package/dist/cjs/type-utils.js +14 -0
- package/dist/cjs/types.js +16 -0
- package/dist/cjs/views/Configuration.js +34 -0
- package/dist/cjs/views/FontLanguage.js +32 -0
- package/dist/cjs/views/FontLanguage.types.js +14 -0
- package/dist/cjs/views/Slot.js +59 -0
- package/dist/cjs/views/Stack.js +27 -0
- package/dist/cjs/views/TamaguiProvider.js +76 -0
- package/dist/cjs/views/Text.js +77 -0
- package/dist/cjs/views/Theme.js +103 -0
- package/dist/cjs/views/ThemeDebug.js +94 -0
- package/dist/cjs/views/ThemeProvider.js +45 -0
- package/dist/cjs/views/View.js +26 -0
- package/dist/esm/helpers/matchMedia.native.js +2 -2
- package/dist/esm/helpers/matchMedia.native.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +1 -1
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +1 -1
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +1 -1
- package/dist/esm/hooks/useMedia.native.js.map +2 -2
- package/package.json +11 -11
- package/src/helpers/matchMedia.native.ts +12 -1
- package/src/hooks/useMedia.tsx +1 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs +0 -34
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs.map +0 -6
- package/dist/cjs/constants/webToNativeProps.native.cjs +0 -102
- package/dist/cjs/constants/webToNativeProps.native.cjs.map +0 -6
- package/dist/cjs/helpers/getStylesAtomic.native.cjs +0 -33
- package/dist/cjs/helpers/getStylesAtomic.native.cjs.map +0 -6
- package/dist/cjs/helpers/getThemeCSSRules.native.cjs +0 -28
- package/dist/cjs/helpers/getThemeCSSRules.native.cjs.map +0 -6
- package/dist/cjs/helpers/matchMedia.native.cjs +0 -39
- package/dist/cjs/helpers/matchMedia.native.cjs.map +0 -6
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs +0 -37
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs.map +0 -6
- package/dist/cjs/helpers/setElementProps.native.cjs +0 -30
- package/dist/cjs/helpers/setElementProps.native.cjs.map +0 -6
- package/dist/cjs/helpers/webPropsToSkip.native.cjs +0 -79
- package/dist/cjs/helpers/webPropsToSkip.native.cjs.map +0 -6
- package/dist/cjs/hooks/useMedia.cjs.map +0 -6
- package/dist/cjs/views/FontLanguage.native.cjs +0 -50
- package/dist/cjs/views/FontLanguage.native.cjs.map +0 -6
- package/dist/cjs/views/ThemeDebug.native.cjs +0 -33
- package/dist/cjs/views/ThemeDebug.native.cjs.map +0 -6
- /package/dist/cjs/{Tamagui.cjs.map → Tamagui.js.map} +0 -0
- /package/dist/cjs/{_withStableStyle.cjs.map → _withStableStyle.js.map} +0 -0
- /package/dist/cjs/{config.cjs.map → config.js.map} +0 -0
- /package/dist/cjs/constants/{accessibilityDirectMap.cjs.map → accessibilityDirectMap.js.map} +0 -0
- /package/dist/cjs/constants/{constants.cjs.map → constants.js.map} +0 -0
- /package/dist/cjs/constants/{isDevTools.cjs.map → isDevTools.js.map} +0 -0
- /package/dist/cjs/constants/{webToNativeProps.cjs.map → webToNativeProps.js.map} +0 -0
- /package/dist/cjs/contexts/{ComponentContext.cjs.map → ComponentContext.js.map} +0 -0
- /package/dist/cjs/{createComponent.cjs.map → createComponent.js.map} +0 -0
- /package/dist/cjs/{createFont.cjs.map → createFont.js.map} +0 -0
- /package/dist/cjs/{createShorthands.cjs.map → createShorthands.js.map} +0 -0
- /package/dist/cjs/{createTamagui.cjs.map → createTamagui.js.map} +0 -0
- /package/dist/cjs/{createTheme.cjs.map → createTheme.js.map} +0 -0
- /package/dist/cjs/{createTokens.cjs.map → createTokens.js.map} +0 -0
- /package/dist/cjs/{createVariable.cjs.map → createVariable.js.map} +0 -0
- /package/dist/cjs/{createVariables.cjs.map → createVariables.js.map} +0 -0
- /package/dist/cjs/{defaultComponentState.cjs.map → defaultComponentState.js.map} +0 -0
- /package/dist/cjs/helpers/{ThemeManager.cjs.map → ThemeManager.js.map} +0 -0
- /package/dist/cjs/helpers/{ThemeManagerContext.cjs.map → ThemeManagerContext.js.map} +0 -0
- /package/dist/cjs/helpers/{createMediaStyle.cjs.map → createMediaStyle.js.map} +0 -0
- /package/dist/cjs/helpers/{createShallowSetState.cjs.map → createShallowSetState.js.map} +0 -0
- /package/dist/cjs/helpers/{createStyledContext.cjs.map → createStyledContext.js.map} +0 -0
- /package/dist/cjs/helpers/{defaultOffset.cjs.map → defaultOffset.js.map} +0 -0
- /package/dist/cjs/helpers/{expandStyle.cjs.map → expandStyle.js.map} +0 -0
- /package/dist/cjs/helpers/{expandStyles.cjs.map → expandStyles.js.map} +0 -0
- /package/dist/cjs/helpers/{getExpandedShorthands.cjs.map → getExpandedShorthands.js.map} +0 -0
- /package/dist/cjs/helpers/{getFontLanguage.cjs.map → getFontLanguage.js.map} +0 -0
- /package/dist/cjs/helpers/{getGroupPropParts.cjs.map → getGroupPropParts.js.map} +0 -0
- /package/dist/cjs/helpers/{getSplitStyles.cjs.map → getSplitStyles.js.map} +0 -0
- /package/dist/cjs/helpers/{getStylesAtomic.cjs.map → getStylesAtomic.js.map} +0 -0
- /package/dist/cjs/helpers/{getThemeCSSRules.cjs.map → getThemeCSSRules.js.map} +0 -0
- /package/dist/cjs/helpers/{getVariantExtras.cjs.map → getVariantExtras.js.map} +0 -0
- /package/dist/cjs/helpers/{insertStyleRule.cjs.map → insertStyleRule.js.map} +0 -0
- /package/dist/cjs/helpers/{isActivePlatform.cjs.map → isActivePlatform.js.map} +0 -0
- /package/dist/cjs/helpers/{isActiveTheme.cjs.map → isActiveTheme.js.map} +0 -0
- /package/dist/cjs/helpers/{isObj.cjs.map → isObj.js.map} +0 -0
- /package/dist/cjs/helpers/{isTamaguiComponent.cjs.map → isTamaguiComponent.js.map} +0 -0
- /package/dist/cjs/helpers/{isTamaguiElement.cjs.map → isTamaguiElement.js.map} +0 -0
- /package/dist/cjs/helpers/{log.cjs.map → log.js.map} +0 -0
- /package/dist/cjs/helpers/{matchMedia.cjs.map → matchMedia.js.map} +0 -0
- /package/dist/cjs/helpers/{mergeProps.cjs.map → mergeProps.js.map} +0 -0
- /package/dist/cjs/helpers/{mergeVariants.cjs.map → mergeVariants.js.map} +0 -0
- /package/dist/cjs/helpers/{normalizeColor.cjs.map → normalizeColor.js.map} +0 -0
- /package/dist/cjs/helpers/{normalizeShadow.cjs.map → normalizeShadow.js.map} +0 -0
- /package/dist/cjs/helpers/{normalizeStyle.cjs.map → normalizeStyle.js.map} +0 -0
- /package/dist/cjs/helpers/{normalizeStylePropKeys.cjs.map → normalizeStylePropKeys.js.map} +0 -0
- /package/dist/cjs/helpers/{normalizeValueWithProperty.cjs.map → normalizeValueWithProperty.js.map} +0 -0
- /package/dist/cjs/helpers/{objectIdentityKey.cjs.map → objectIdentityKey.js.map} +0 -0
- /package/dist/cjs/helpers/{propMapper.cjs.map → propMapper.js.map} +0 -0
- /package/dist/cjs/helpers/{proxyThemeToParents.cjs.map → proxyThemeToParents.js.map} +0 -0
- /package/dist/cjs/helpers/{proxyThemeVariables.cjs.map → proxyThemeVariables.js.map} +0 -0
- /package/dist/cjs/helpers/{pseudoDescriptors.cjs.map → pseudoDescriptors.js.map} +0 -0
- /package/dist/cjs/helpers/{registerCSSVariable.cjs.map → registerCSSVariable.js.map} +0 -0
- /package/dist/cjs/helpers/{setElementProps.cjs.map → setElementProps.js.map} +0 -0
- /package/dist/cjs/helpers/{skipProps.cjs.map → skipProps.js.map} +0 -0
- /package/dist/cjs/helpers/{sortString.cjs.map → sortString.js.map} +0 -0
- /package/dist/cjs/helpers/{subscribeToContextGroup.cjs.map → subscribeToContextGroup.js.map} +0 -0
- /package/dist/cjs/helpers/{themeable.cjs.map → themeable.js.map} +0 -0
- /package/dist/cjs/helpers/{themes.cjs.map → themes.js.map} +0 -0
- /package/dist/cjs/helpers/{timer.cjs.map → timer.js.map} +0 -0
- /package/dist/cjs/helpers/{transformsToString.cjs.map → transformsToString.js.map} +0 -0
- /package/dist/cjs/helpers/{webPropsToSkip.cjs.map → webPropsToSkip.js.map} +0 -0
- /package/dist/cjs/helpers/{wrapStyleTags.cjs.map → wrapStyleTags.js.map} +0 -0
- /package/dist/cjs/hooks/{useComponentState.cjs.map → useComponentState.js.map} +0 -0
- /package/dist/cjs/hooks/{useConfiguration.cjs.map → useConfiguration.js.map} +0 -0
- /package/dist/cjs/hooks/{useDisableSSR.cjs.map → useDisableSSR.js.map} +0 -0
- /package/dist/cjs/hooks/{useIsTouchDevice.cjs.map → useIsTouchDevice.js.map} +0 -0
- /package/dist/cjs/hooks/{useProps.cjs.map → useProps.js.map} +0 -0
- /package/dist/cjs/hooks/{useTheme.cjs.map → useTheme.js.map} +0 -0
- /package/dist/cjs/hooks/{useThemeName.cjs.map → useThemeName.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{inject-styles.cjs.map → inject-styles.js.map} +0 -0
- /package/dist/cjs/{insertFont.cjs.map → insertFont.js.map} +0 -0
- /package/dist/cjs/interfaces/{CSSColorNames.cjs.map → CSSColorNames.js.map} +0 -0
- /package/dist/cjs/interfaces/{GetRef.cjs.map → GetRef.js.map} +0 -0
- /package/dist/cjs/interfaces/{KeyTypes.cjs.map → KeyTypes.js.map} +0 -0
- /package/dist/cjs/interfaces/{RNExclusiveTypes.cjs.map → RNExclusiveTypes.js.map} +0 -0
- /package/dist/cjs/interfaces/{Role.cjs.map → Role.js.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentEvents.cjs.map → TamaguiComponentEvents.js.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentPropsBaseBase.cjs.map → TamaguiComponentPropsBaseBase.js.map} +0 -0
- /package/dist/cjs/interfaces/{TamaguiComponentState.cjs.map → TamaguiComponentState.js.map} +0 -0
- /package/dist/cjs/interfaces/{WebOnlyPressEvents.cjs.map → WebOnlyPressEvents.js.map} +0 -0
- /package/dist/cjs/{setupHooks.cjs.map → setupHooks.js.map} +0 -0
- /package/dist/cjs/{setupReactNative.cjs.map → setupReactNative.js.map} +0 -0
- /package/dist/cjs/{styled.cjs.map → styled.js.map} +0 -0
- /package/dist/cjs/{type-utils.cjs.map → type-utils.js.map} +0 -0
- /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/views/{Configuration.cjs.map → Configuration.js.map} +0 -0
- /package/dist/cjs/views/{FontLanguage.cjs.map → FontLanguage.js.map} +0 -0
- /package/dist/cjs/views/{FontLanguage.types.cjs.map → FontLanguage.types.js.map} +0 -0
- /package/dist/cjs/views/{Slot.cjs.map → Slot.js.map} +0 -0
- /package/dist/cjs/views/{Stack.cjs.map → Stack.js.map} +0 -0
- /package/dist/cjs/views/{TamaguiProvider.cjs.map → TamaguiProvider.js.map} +0 -0
- /package/dist/cjs/views/{Text.cjs.map → Text.js.map} +0 -0
- /package/dist/cjs/views/{Theme.cjs.map → Theme.js.map} +0 -0
- /package/dist/cjs/views/{ThemeDebug.cjs.map → ThemeDebug.js.map} +0 -0
- /package/dist/cjs/views/{ThemeProvider.cjs.map → ThemeProvider.js.map} +0 -0
- /package/dist/cjs/views/{View.cjs.map → View.js.map} +0 -0
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var getSplitStyles_exports = {};
|
|
24
|
+
__export(getSplitStyles_exports, {
|
|
25
|
+
PROP_SPLIT: () => PROP_SPLIT,
|
|
26
|
+
getSplitStyles: () => getSplitStyles,
|
|
27
|
+
getSubStyle: () => getSubStyle,
|
|
28
|
+
useSplitStyles: () => useSplitStyles
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(getSplitStyles_exports);
|
|
31
|
+
var import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_react = __toESM(require("react")), import_config = require("../config"), import_accessibilityDirectMap = require("../constants/accessibilityDirectMap"), import_constants2 = require("../constants/constants"), import_isDevTools = require("../constants/isDevTools"), import_useMedia = require("../hooks/useMedia"), import_createMediaStyle = require("./createMediaStyle"), import_expandStyles = require("./expandStyles"), import_getGroupPropParts = require("./getGroupPropParts"), import_getStylesAtomic = require("./getStylesAtomic"), import_insertStyleRule = require("./insertStyleRule"), import_isActivePlatform = require("./isActivePlatform"), import_isActiveTheme = require("./isActiveTheme"), import_log = require("./log"), import_normalizeValueWithProperty = require("./normalizeValueWithProperty"), import_propMapper = require("./propMapper"), import_pseudoDescriptors = require("./pseudoDescriptors"), import_skipProps = require("./skipProps"), import_sortString = require("./sortString"), import_transformsToString = require("./transformsToString");
|
|
32
|
+
const consoleGroupCollapsed = import_constants.isWeb ? console.groupCollapsed : console.info;
|
|
33
|
+
let conf;
|
|
34
|
+
const PROP_SPLIT = "-";
|
|
35
|
+
function isValidStyleKey(key, staticConfig) {
|
|
36
|
+
return (staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles))[key] || staticConfig.accept?.[key];
|
|
37
|
+
}
|
|
38
|
+
const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
|
|
39
|
+
conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
|
|
40
|
+
const { shorthands } = conf, {
|
|
41
|
+
isHOC,
|
|
42
|
+
isText,
|
|
43
|
+
isInput,
|
|
44
|
+
variants,
|
|
45
|
+
isReactNative,
|
|
46
|
+
inlineProps,
|
|
47
|
+
inlineWhenUnflattened,
|
|
48
|
+
parentStaticConfig,
|
|
49
|
+
acceptsClassName
|
|
50
|
+
} = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClass, rulesToInsert = {}, classNames = {}, transforms = {};
|
|
51
|
+
let pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0;
|
|
52
|
+
const styleState = {
|
|
53
|
+
classNames,
|
|
54
|
+
conf,
|
|
55
|
+
props,
|
|
56
|
+
styleProps,
|
|
57
|
+
componentState,
|
|
58
|
+
staticConfig,
|
|
59
|
+
style: null,
|
|
60
|
+
theme,
|
|
61
|
+
usedKeys,
|
|
62
|
+
viewProps,
|
|
63
|
+
context,
|
|
64
|
+
debug
|
|
65
|
+
};
|
|
66
|
+
process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (consoleGroupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
|
|
67
|
+
props,
|
|
68
|
+
staticConfig,
|
|
69
|
+
shouldDoClasses,
|
|
70
|
+
styleProps,
|
|
71
|
+
rulesToInsert,
|
|
72
|
+
componentState,
|
|
73
|
+
styleState,
|
|
74
|
+
theme: { ...theme }
|
|
75
|
+
}), console.groupEnd());
|
|
76
|
+
const { asChild } = props, { accept } = staticConfig, { noSkip, disableExpandShorthands, noExpand } = styleProps, { webContainerType } = conf.settings, parentVariants = parentStaticConfig?.variants;
|
|
77
|
+
for (const keyOg in props) {
|
|
78
|
+
let keyInit = keyOg, valInit = props[keyInit];
|
|
79
|
+
if (accept) {
|
|
80
|
+
const accepted = accept[keyInit];
|
|
81
|
+
if ((accepted === "style" || accepted === "textStyle") && valInit && typeof valInit == "object") {
|
|
82
|
+
viewProps[keyInit] = getSubStyle(styleState, keyInit, valInit, styleProps.noClass);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && console.groupEnd(), disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || asChild && import_constants2.webViewFlexCompatStyles[keyInit] === valInit)
|
|
87
|
+
continue;
|
|
88
|
+
if (keyInit in import_skipProps.skipProps && !noSkip && !isHOC) {
|
|
89
|
+
if (keyInit === "group") {
|
|
90
|
+
const identifier = `t_group_${valInit}`, containerCSS = [
|
|
91
|
+
"continer",
|
|
92
|
+
void 0,
|
|
93
|
+
identifier,
|
|
94
|
+
void 0,
|
|
95
|
+
[
|
|
96
|
+
`.${identifier} { container-name: ${valInit}; container-type: ${webContainerType || "inline-size"}; }`
|
|
97
|
+
]
|
|
98
|
+
];
|
|
99
|
+
addStyleToInsertRules(rulesToInsert, containerCSS);
|
|
100
|
+
}
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
|
|
104
|
+
if (staticConfig.isReactNative && keyInit.startsWith("data-")) {
|
|
105
|
+
keyInit = keyInit.replace("data-", ""), viewProps.dataSet ||= {}, viewProps.dataSet[keyInit] = valInit;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (isValidStyleKeyInit && valInitType === "string" && valInit[0] === "_") {
|
|
109
|
+
const isValidClassName = keyInit in import_helpers.validStyles, isMediaOrPseudo2 = !isValidClassName && // media are flattened for some reason to color-hover keys,
|
|
110
|
+
// we should probably just leave them in place to avoid extra complexity
|
|
111
|
+
keyInit.includes(PROP_SPLIT) && import_helpers.validStyles[keyInit.split(PROP_SPLIT)[0]];
|
|
112
|
+
if (isValidClassName || isMediaOrPseudo2) {
|
|
113
|
+
shouldDoClasses ? (mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2), styleState.style && delete styleState.style[keyInit]) : (styleState.style ||= {}, styleState.style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit), delete classNames[keyInit]);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (keyInit === "dataSet") {
|
|
118
|
+
for (const keyInit2 in valInit)
|
|
119
|
+
viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (!noExpand) {
|
|
123
|
+
if (keyInit === "disabled" && valInit === !0 && (viewProps["aria-disabled"] = !0, (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") && (viewProps.disabled = !0), !variants?.disabled))
|
|
124
|
+
continue;
|
|
125
|
+
if (keyInit === "testID") {
|
|
126
|
+
viewProps[isReactNative ? keyInit : "data-testid"] = valInit;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (keyInit === "id" || keyInit === "nativeID") {
|
|
130
|
+
viewProps.id = valInit;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
let didUseKeyInit = !1;
|
|
134
|
+
if (isReactNative) {
|
|
135
|
+
if (keyInit in import_accessibilityDirectMap.accessibilityDirectMap || keyInit.startsWith("accessibility")) {
|
|
136
|
+
viewProps[keyInit] = valInit;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
if (didUseKeyInit = !0, keyInit in import_accessibilityDirectMap.accessibilityDirectMap) {
|
|
141
|
+
viewProps[import_accessibilityDirectMap.accessibilityDirectMap[keyInit]] = valInit;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
switch (keyInit) {
|
|
145
|
+
case "accessibilityRole": {
|
|
146
|
+
valInit === "none" ? viewProps.role = "presentation" : viewProps.role = accessibilityRoleToWebRole[valInit] || valInit;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
case "accessibilityLabelledBy":
|
|
150
|
+
case "accessibilityFlowTo":
|
|
151
|
+
case "accessibilityControls":
|
|
152
|
+
case "accessibilityDescribedBy": {
|
|
153
|
+
viewProps[`aria-${keyInit.replace("accessibility", "").toLowerCase()}`] = processIDRefList(valInit);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
case "accessibilityKeyShortcuts": {
|
|
157
|
+
Array.isArray(valInit) && (viewProps["aria-keyshortcuts"] = valInit.join(" "));
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
case "accessibilityLiveRegion": {
|
|
161
|
+
viewProps["aria-live"] = valInit === "none" ? "off" : valInit;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
case "accessibilityReadOnly": {
|
|
165
|
+
viewProps["aria-readonly"] = valInit, (elementType === "input" || elementType === "select" || elementType === "textarea") && (viewProps.readOnly = !0);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
case "accessibilityRequired": {
|
|
169
|
+
viewProps["aria-required"] = valInit, (elementType === "input" || elementType === "select" || elementType === "textarea") && (viewProps.required = valInit);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
default:
|
|
173
|
+
didUseKeyInit = !1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (didUseKeyInit)
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const isShorthand = keyInit in shorthands;
|
|
180
|
+
let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
|
|
181
|
+
const isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant;
|
|
182
|
+
let isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo);
|
|
183
|
+
if (isMediaOrPseudo && keyInit.startsWith("$group-")) {
|
|
184
|
+
const name = keyInit.split("-")[1];
|
|
185
|
+
context?.groups.subscribe && !context?.groups.state[name] && (keyInit = keyInit.replace("$group-", "$group-true-"));
|
|
186
|
+
}
|
|
187
|
+
const isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand || isShorthand;
|
|
188
|
+
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web"))
|
|
189
|
+
continue;
|
|
190
|
+
const shouldPassProp = !isStyleProp && isHOC || // is in parent variants
|
|
191
|
+
isHOC && parentVariants && keyInit in parentVariants || inlineProps?.has(keyInit), parentVariant = parentVariants?.[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in import_skipProps.skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
192
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupEnd(), console.groupEnd(), consoleGroupCollapsed(
|
|
193
|
+
` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`
|
|
194
|
+
), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
|
|
195
|
+
variants,
|
|
196
|
+
variant: variants?.[keyInit],
|
|
197
|
+
isVariant,
|
|
198
|
+
isHOCShouldPassThrough,
|
|
199
|
+
parentStaticConfig
|
|
200
|
+
})), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant)) {
|
|
201
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && console.groupEnd();
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (!noSkip && keyInit in import_skipProps.skipProps) {
|
|
205
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && console.groupEnd();
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
(isText || isInput) && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit);
|
|
209
|
+
const avoidPropMap = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit, expanded = avoidPropMap ? null : (0, import_propMapper.propMapper)(keyInit, valInit, styleState);
|
|
210
|
+
if (!avoidPropMap) {
|
|
211
|
+
if (!expanded) continue;
|
|
212
|
+
const next = (0, import_propMapper.getPropMappedFontFamily)(expanded);
|
|
213
|
+
next && (styleState.fontFamily = next);
|
|
214
|
+
}
|
|
215
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
216
|
+
consoleGroupCollapsed(" \u{1F4A0} expanded", keyInit, valInit);
|
|
217
|
+
try {
|
|
218
|
+
!import_constants.isServer && import_isDevTools.isDevTools && ((0, import_log.log)({
|
|
219
|
+
expanded,
|
|
220
|
+
styleProps,
|
|
221
|
+
componentState,
|
|
222
|
+
isVariant,
|
|
223
|
+
variant: variants?.[keyInit],
|
|
224
|
+
shouldPassProp,
|
|
225
|
+
isHOCShouldPassThrough,
|
|
226
|
+
usedKeys: { ...usedKeys }
|
|
227
|
+
}), globalThis.tamaguiAvoidTracking = !0, (0, import_log.log)("expanded", expanded, `
|
|
228
|
+
usedKeys`, { ...usedKeys }, `
|
|
229
|
+
current`, {
|
|
230
|
+
...styleState.style
|
|
231
|
+
}), globalThis.tamaguiAvoidTracking = !1);
|
|
232
|
+
} catch {
|
|
233
|
+
}
|
|
234
|
+
console.groupEnd();
|
|
235
|
+
}
|
|
236
|
+
let key = keyInit, val = valInit;
|
|
237
|
+
const max = expanded ? expanded.length : 1;
|
|
238
|
+
for (let i = 0; i < max; i++) {
|
|
239
|
+
if (expanded) {
|
|
240
|
+
const [k, v] = expanded[i];
|
|
241
|
+
key = k, val = v;
|
|
242
|
+
}
|
|
243
|
+
if (val == null || key in usedKeys) continue;
|
|
244
|
+
if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && !isValidStyleKeyInit && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps?.has(key) || process.env.IS_STATIC === "is_static" && inlineWhenUnflattened?.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || parentStaticConfig?.variants?.[keyInit])) {
|
|
245
|
+
passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (consoleGroupCollapsed(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), console.groupEnd());
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (isPseudo) {
|
|
249
|
+
if (!val) continue;
|
|
250
|
+
const pseudoStyleObject = getSubStyle(styleState, key, val, styleProps.noClass), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
|
|
251
|
+
if (!descriptor)
|
|
252
|
+
continue;
|
|
253
|
+
if ((!shouldDoClasses || process.env.IS_STATIC === "is_static") && (pseudos ||= {}, pseudos[key] ||= {}, process.env.IS_STATIC === "is_static")) {
|
|
254
|
+
Object.assign(pseudos[key], pseudoStyleObject);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (shouldDoClasses && !isExit) {
|
|
258
|
+
const pseudoStyles = (0, import_getStylesAtomic.getStyleAtomic)(pseudoStyleObject, descriptor);
|
|
259
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && (consoleGroupCollapsed("pseudo (classes)", key), (0, import_log.log)({ pseudoStyleObject, pseudoStyles }), console.groupEnd());
|
|
260
|
+
for (const psuedoStyle of pseudoStyles) {
|
|
261
|
+
const fullKey = `${psuedoStyle[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
|
|
262
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), mergeClassName(
|
|
263
|
+
transforms,
|
|
264
|
+
classNames,
|
|
265
|
+
fullKey,
|
|
266
|
+
psuedoStyle[import_helpers.StyleObjectIdentifier],
|
|
267
|
+
isMediaOrPseudo,
|
|
268
|
+
!0
|
|
269
|
+
));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (!shouldDoClasses || isExit || isEnter) {
|
|
273
|
+
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
274
|
+
let isDisabled = componentState[descriptorKey] === !1;
|
|
275
|
+
isExit && (isDisabled = !styleProps.isExiting), isEnter && componentState.unmounted === !1 && (isDisabled = !0), process.env.NODE_ENV === "development" && debug === "verbose" && (consoleGroupCollapsed("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), console.groupEnd());
|
|
276
|
+
const importance = descriptor.priority;
|
|
277
|
+
for (const pkey in pseudoStyleObject) {
|
|
278
|
+
const val2 = pseudoStyleObject[pkey];
|
|
279
|
+
if (isDisabled)
|
|
280
|
+
applyDefaultStyle(pkey, styleState);
|
|
281
|
+
else {
|
|
282
|
+
const curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
|
|
283
|
+
shouldMerge && (pseudos ||= {}, pseudos[key] ||= {}, pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
|
|
284
|
+
importance,
|
|
285
|
+
curImportance,
|
|
286
|
+
pkey,
|
|
287
|
+
val: val2
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!isDisabled)
|
|
292
|
+
for (const key2 in val) {
|
|
293
|
+
const k = shorthands[key2] || key2;
|
|
294
|
+
usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (isMedia) {
|
|
300
|
+
if (!val) continue;
|
|
301
|
+
const hasSpace = val.space, mediaKeyShort = key.slice(isMedia == "theme" ? 7 : 1);
|
|
302
|
+
if (hasMedia ||= !0, (hasSpace || !shouldDoClasses || styleProps.willBeAnimated) && (typeof hasMedia != "object" && (hasMedia = {}), hasMedia[mediaKeyShort] = !0), isMedia === "platform" && !(0, import_isActivePlatform.isActivePlatform)(key))
|
|
303
|
+
continue;
|
|
304
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} ${key}`, {
|
|
305
|
+
key,
|
|
306
|
+
val,
|
|
307
|
+
props,
|
|
308
|
+
shouldDoClasses,
|
|
309
|
+
acceptsClassName,
|
|
310
|
+
componentState,
|
|
311
|
+
mediaState
|
|
312
|
+
}), shouldDoClasses) {
|
|
313
|
+
const mediaStyle = getSubStyle(styleState, key, val, !1);
|
|
314
|
+
if (hasSpace && (delete mediaStyle.space, mediaState[mediaKeyShort])) {
|
|
315
|
+
const importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
|
|
316
|
+
mediaKeyShort,
|
|
317
|
+
"space",
|
|
318
|
+
usedKeys,
|
|
319
|
+
!0
|
|
320
|
+
);
|
|
321
|
+
importance && (space = val.space, usedKeys.space = importance, process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
|
|
322
|
+
`Found more important space for current media ${mediaKeyShort}: ${val} (importance: ${importance})`
|
|
323
|
+
));
|
|
324
|
+
}
|
|
325
|
+
const mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle), priority = mediaStylesSeen;
|
|
326
|
+
mediaStylesSeen += 1;
|
|
327
|
+
for (const style of mediaStyles) {
|
|
328
|
+
const property = style[0];
|
|
329
|
+
if (property[0] === "$" && !(0, import_isActivePlatform.isActivePlatform)(property))
|
|
330
|
+
continue;
|
|
331
|
+
const out = (0, import_createMediaStyle.createMediaStyle)(
|
|
332
|
+
style,
|
|
333
|
+
mediaKeyShort,
|
|
334
|
+
import_useMedia.mediaQueryConfig,
|
|
335
|
+
isMedia,
|
|
336
|
+
!1,
|
|
337
|
+
priority
|
|
338
|
+
);
|
|
339
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out);
|
|
340
|
+
const fullKey = `${style[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${mediaKeyShort}${style[import_helpers.StyleObjectPseudo] || ""}`;
|
|
341
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, out), mergeClassName(
|
|
342
|
+
transforms,
|
|
343
|
+
classNames,
|
|
344
|
+
fullKey,
|
|
345
|
+
out[import_helpers.StyleObjectIdentifier],
|
|
346
|
+
!0,
|
|
347
|
+
!0
|
|
348
|
+
));
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
let mergeMediaStyle = function(key2, val2) {
|
|
352
|
+
styleState.style ||= {}, mergeMediaByImportance(
|
|
353
|
+
styleState,
|
|
354
|
+
mediaKeyShort,
|
|
355
|
+
key2,
|
|
356
|
+
val2,
|
|
357
|
+
usedKeys,
|
|
358
|
+
mediaState[mediaKeyShort],
|
|
359
|
+
importanceBump,
|
|
360
|
+
debug
|
|
361
|
+
) && key2 === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
|
|
362
|
+
};
|
|
363
|
+
const isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
|
|
364
|
+
if (!isThemeMedia && !(isMedia === "platform") && !isGroupMedia) {
|
|
365
|
+
if (!mediaState[mediaKeyShort]) {
|
|
366
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} \u274C DISABLED ${mediaKeyShort}`);
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} \u2705 ENABLED ${mediaKeyShort}`);
|
|
370
|
+
}
|
|
371
|
+
const mediaStyle = getSubStyle(styleState, key, val, !0);
|
|
372
|
+
let importanceBump = 0;
|
|
373
|
+
if (isThemeMedia) {
|
|
374
|
+
if (dynamicThemeAccess = !0, !(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort)))
|
|
375
|
+
continue;
|
|
376
|
+
} else if (isGroupMedia) {
|
|
377
|
+
const groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyShort), groupName = groupInfo.name, groupContext = context?.groups.state[groupName];
|
|
378
|
+
if (!groupContext) {
|
|
379
|
+
process.env.NODE_ENV === "development" && debug && (0, import_log.log)(`No parent with group prop, skipping styles: ${groupName}`);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media, componentGroupState = componentState.group?.[groupName];
|
|
383
|
+
if (groupMediaKey) {
|
|
384
|
+
mediaGroups ||= /* @__PURE__ */ new Set(), mediaGroups.add(groupMediaKey);
|
|
385
|
+
const mediaState2 = componentGroupState?.media;
|
|
386
|
+
let isActive = mediaState2?.[groupMediaKey];
|
|
387
|
+
if (!mediaState2 && groupContext.layout && (isActive = (0, import_useMedia.mediaKeyMatch)(groupMediaKey, groupContext.layout)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F3D8}\uFE0F GROUP media ${groupMediaKey} active? ${isActive}`), !isActive) {
|
|
388
|
+
for (const pkey in mediaStyle)
|
|
389
|
+
applyDefaultStyle(pkey, styleState);
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
importanceBump = 2;
|
|
393
|
+
}
|
|
394
|
+
if (groupPseudoKey) {
|
|
395
|
+
pseudoGroups ||= /* @__PURE__ */ new Set(), pseudoGroups.add(groupName);
|
|
396
|
+
const isActive = (componentGroupState || // fallback to context initially
|
|
397
|
+
context.groups.state[groupName]).pseudo?.[groupPseudoKey], priority = import_pseudoDescriptors.pseudoPriorities[groupPseudoKey];
|
|
398
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
|
|
399
|
+
` \u{1F3D8}\uFE0F GROUP pseudo ${groupMediaKey} active? ${isActive}, priority ${priority}`
|
|
400
|
+
), !isActive) {
|
|
401
|
+
for (const pkey in mediaStyle)
|
|
402
|
+
applyDefaultStyle(pkey, styleState);
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
importanceBump = priority;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
for (const subKey in mediaStyle) {
|
|
409
|
+
if (subKey === "space") {
|
|
410
|
+
space = valInit.space;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (subKey[0] === "$") {
|
|
414
|
+
if (!(0, import_isActivePlatform.isActivePlatform)(subKey) || !(0, import_isActiveTheme.isActiveTheme)(subKey, themeName)) continue;
|
|
415
|
+
for (const subSubKey in mediaStyle[subKey])
|
|
416
|
+
mergeMediaStyle(subSubKey, mediaStyle[subKey][subSubKey]);
|
|
417
|
+
} else
|
|
418
|
+
mergeMediaStyle(subKey, mediaStyle[subKey]);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (
|
|
424
|
+
// is HOC we can just pass through the styles as props
|
|
425
|
+
// this fixes issues where style prop got merged with wrong priority
|
|
426
|
+
!isHOC && isValidStyleKey(key, staticConfig)
|
|
427
|
+
) {
|
|
428
|
+
mergeStyle(styleState, key, val);
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (!isVariant) {
|
|
432
|
+
if (styleProps.styledContextProps && key in styleProps.styledContextProps)
|
|
433
|
+
continue;
|
|
434
|
+
viewProps[key] = val;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
438
|
+
try {
|
|
439
|
+
(0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", { ...styleState.style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
|
|
440
|
+
} catch {
|
|
441
|
+
}
|
|
442
|
+
console.groupEnd();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (!(styleProps.noNormalize === !1) && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), import_constants.isWeb && !isReactNative && (0, import_getStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms && (styleState.style ||= {}, Object.entries(styleState.flatTransforms).sort(([a], [b]) => (0, import_sortString.sortString)(a, b)).forEach(([key, val]) => {
|
|
446
|
+
mergeTransform(styleState.style, key, val, !0);
|
|
447
|
+
})), parentSplitStyles)) {
|
|
448
|
+
if (shouldDoClasses)
|
|
449
|
+
for (const key in parentSplitStyles.classNames) {
|
|
450
|
+
const val = parentSplitStyles.classNames[key];
|
|
451
|
+
styleState.style && key in styleState.style || key in classNames || (classNames[key] = val);
|
|
452
|
+
}
|
|
453
|
+
if (!shouldDoClasses)
|
|
454
|
+
for (const key in parentSplitStyles.style)
|
|
455
|
+
key in classNames || styleState.style && key in styleState.style || (styleState.style ||= {}, styleState.style[key] = parentSplitStyles.style[key]);
|
|
456
|
+
}
|
|
457
|
+
if (!styleProps.noNormalize && !staticConfig.isReactNative && !staticConfig.isHOC && (!styleProps.isAnimated || conf.animations.supportsCSSVars) && Array.isArray(styleState.style?.transform) && (styleState.style.transform = (0, import_transformsToString.transformsToString)(styleState.style.transform)), styleState.style && shouldDoClasses) {
|
|
458
|
+
let retainedStyles, shouldRetain = !1;
|
|
459
|
+
if (!styleState.style.$$css) {
|
|
460
|
+
const atomic = (0, import_getStylesAtomic.getStylesAtomic)(styleState.style);
|
|
461
|
+
for (const atomicStyle of atomic) {
|
|
462
|
+
const [key, value, identifier] = atomicStyle, isAnimatedAndAnimateOnly = styleProps.isAnimated && styleProps.noClass && (!props.animateOnly || props.animateOnly.includes(key)), nonAnimatedAnimateOnly = !isAnimatedAndAnimateOnly && !styleProps.isAnimated && props.animateOnly?.includes(key);
|
|
463
|
+
isAnimatedAndAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = styleState.style[key]) : nonAnimatedAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = value, shouldRetain = !0) : (addStyleToInsertRules(rulesToInsert, atomicStyle), mergeClassName(transforms, classNames, key, identifier, !1, !0));
|
|
464
|
+
}
|
|
465
|
+
process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupEnd(), consoleGroupCollapsed("\u{1F539} getSplitStyles final style object"), console.info(styleState.style), console.groupEnd()), (shouldRetain || process.env.IS_STATIC !== "is_static") && (styleState.style = retainedStyles || {});
|
|
466
|
+
}
|
|
467
|
+
if (transforms)
|
|
468
|
+
for (const namespace in transforms) {
|
|
469
|
+
if (!transforms[namespace]) {
|
|
470
|
+
process.env.NODE_ENV === "development" && (0, import_log.log)("Error no transform", transforms, namespace);
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
const [hash, val] = transforms[namespace], identifier = `_transform${hash}`;
|
|
474
|
+
if (import_constants.isClient && !import_insertStyleRule.insertedTransforms[identifier]) {
|
|
475
|
+
const rule = `.${identifier} { transform: ${val}; }`;
|
|
476
|
+
addStyleToInsertRules(rulesToInsert, [
|
|
477
|
+
namespace,
|
|
478
|
+
val,
|
|
479
|
+
identifier,
|
|
480
|
+
void 0,
|
|
481
|
+
[rule]
|
|
482
|
+
]);
|
|
483
|
+
}
|
|
484
|
+
classNames[namespace] = identifier;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (isReactNative)
|
|
488
|
+
viewProps.tabIndex === 0 && (viewProps.accessible ??= !0);
|
|
489
|
+
else if (viewProps.tabIndex == null) {
|
|
490
|
+
const isFocusable = viewProps.focusable ?? viewProps.accessible;
|
|
491
|
+
viewProps.focusable && delete viewProps.focusable;
|
|
492
|
+
const role = viewProps.role;
|
|
493
|
+
isFocusable === !1 && (viewProps.tabIndex = "-1"), // These native elements are focusable by default
|
|
494
|
+
elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea" ? (isFocusable === !1 || props.accessibilityDisabled === !0) && (viewProps.tabIndex = "-1") : (
|
|
495
|
+
// These roles are made focusable by default
|
|
496
|
+
(role === "button" || role === "checkbox" || role === "link" || role === "radio" || // @ts-expect-error (consistent with RNW)
|
|
497
|
+
role === "textbox" || role === "switch") && isFocusable !== !1 && (viewProps.tabIndex = "0")
|
|
498
|
+
), isFocusable && (viewProps.tabIndex = "0", delete viewProps.focusable);
|
|
499
|
+
}
|
|
500
|
+
const styleProp = props.style;
|
|
501
|
+
if (styleProp)
|
|
502
|
+
if (isHOC)
|
|
503
|
+
viewProps.style = normalizeStyle(styleProp);
|
|
504
|
+
else {
|
|
505
|
+
const isArray = Array.isArray(styleProp), len = isArray ? styleProp.length : 1;
|
|
506
|
+
for (let i = 0; i < len; i++) {
|
|
507
|
+
const style = isArray ? styleProp[i] : styleProp;
|
|
508
|
+
style && (style.$$css ? Object.assign(styleState.classNames, style) : (styleState.style ||= {}, Object.assign(styleState.style, normalizeStyle(style))));
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const result = {
|
|
512
|
+
space,
|
|
513
|
+
hasMedia,
|
|
514
|
+
fontFamily: styleState.fontFamily,
|
|
515
|
+
viewProps,
|
|
516
|
+
style: styleState.style,
|
|
517
|
+
pseudos,
|
|
518
|
+
classNames,
|
|
519
|
+
rulesToInsert,
|
|
520
|
+
dynamicThemeAccess,
|
|
521
|
+
pseudoGroups,
|
|
522
|
+
mediaGroups
|
|
523
|
+
};
|
|
524
|
+
if (!(asChild === "except-style" || asChild === "except-style-web")) {
|
|
525
|
+
const style = styleState.style;
|
|
526
|
+
{
|
|
527
|
+
let fontFamily = isText || isInput ? styleState.fontFamily || staticConfig.defaultProps?.fontFamily : null;
|
|
528
|
+
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
529
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", groupClassName = props.group ? `t_group_${props.group}` : "", componentNameFinal = props.componentName || staticConfig.componentName, componentClassName = props.asChild || !componentNameFinal ? "" : `is_${componentNameFinal}`;
|
|
530
|
+
let classList = [];
|
|
531
|
+
componentClassName && classList.push(componentClassName), fontFamilyClassName && classList.push(fontFamilyClassName), classNames && classList.push(Object.values(classNames).join(" ")), groupClassName && classList.push(groupClassName), props.className && classList.push(props.className);
|
|
532
|
+
const finalClassName = classList.join(" ");
|
|
533
|
+
if (styleProps.noMergeStyle)
|
|
534
|
+
finalClassName && (viewProps.className = finalClassName);
|
|
535
|
+
else if (styleProps.isAnimated && !conf.animations.supportsCSSVars && isReactNative)
|
|
536
|
+
style && (viewProps.style = style);
|
|
537
|
+
else if (isReactNative) {
|
|
538
|
+
const cnStyles = { $$css: !0 };
|
|
539
|
+
for (const name of finalClassName.split(" "))
|
|
540
|
+
cnStyles[name] = name;
|
|
541
|
+
viewProps.style = [...Array.isArray(style) ? style : [style], cnStyles];
|
|
542
|
+
} else
|
|
543
|
+
finalClassName && (viewProps.className = finalClassName), style && (viewProps.style = style);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
|
|
547
|
+
consoleGroupCollapsed("\u{1F539} getSplitStyles ===>");
|
|
548
|
+
try {
|
|
549
|
+
const logs = {
|
|
550
|
+
...result,
|
|
551
|
+
className,
|
|
552
|
+
componentState,
|
|
553
|
+
transforms,
|
|
554
|
+
viewProps,
|
|
555
|
+
rulesToInsert,
|
|
556
|
+
parentSplitStyles
|
|
557
|
+
};
|
|
558
|
+
for (const key in logs)
|
|
559
|
+
(0, import_log.log)(key, logs[key]);
|
|
560
|
+
} catch {
|
|
561
|
+
}
|
|
562
|
+
console.groupEnd();
|
|
563
|
+
}
|
|
564
|
+
return result;
|
|
565
|
+
};
|
|
566
|
+
function mergeClassName(transforms, classNames, key, val, isMediaOrPseudo = !1, isInsertingNow = !1) {
|
|
567
|
+
if (val)
|
|
568
|
+
if (!isInsertingNow && val[0] === "_" && val.startsWith("_transform-")) {
|
|
569
|
+
const ns = isMediaOrPseudo ? key : "transform";
|
|
570
|
+
let transform = import_insertStyleRule.insertedTransforms[val];
|
|
571
|
+
import_constants.isClient && !transform && ((0, import_insertStyleRule.scanAllSheets)(), transform = import_insertStyleRule.insertedTransforms[val], !transform && import_constants.isWeb && val[0] !== "_" && (transform = val)), transforms[ns] ||= ["", ""], transforms[ns][0] += val.replace("_transform", ""), transform && (transforms[ns][1] += transform);
|
|
572
|
+
} else
|
|
573
|
+
classNames[key] = val;
|
|
574
|
+
}
|
|
575
|
+
function mergeStyle(styleState, key, val, disableNormalize = !1) {
|
|
576
|
+
const { classNames, viewProps, usedKeys, styleProps, staticConfig } = styleState;
|
|
577
|
+
if (import_constants.isWeb && val?.[0] === "_")
|
|
578
|
+
classNames[key] = val, usedKeys[key] ||= 1;
|
|
579
|
+
else if (key in import_helpers.stylePropsTransform)
|
|
580
|
+
styleState.flatTransforms ||= {}, styleState.flatTransforms[key] = val;
|
|
581
|
+
else {
|
|
582
|
+
const out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
|
|
583
|
+
// accept is for props not styles
|
|
584
|
+
staticConfig.accept && key in staticConfig.accept ? viewProps[key] = out : (styleState.style ||= {}, styleState.style[key] = out);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
588
|
+
const { staticConfig, conf: conf2, styleProps } = styleState, styleOut = {};
|
|
589
|
+
for (let key in styleIn) {
|
|
590
|
+
const val = styleIn[key];
|
|
591
|
+
key = conf2.shorthands[key] || key;
|
|
592
|
+
const expanded = (0, import_propMapper.propMapper)(key, val, styleState);
|
|
593
|
+
if (!(!expanded || !staticConfig.isHOC && key in import_skipProps.skipProps && !styleProps.noSkip))
|
|
594
|
+
for (let [skey, sval] of expanded)
|
|
595
|
+
skey in import_helpers.validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
|
|
596
|
+
}
|
|
597
|
+
return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
|
|
598
|
+
}, useInsertEffectCompat = import_constants.isWeb ? import_react.default.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
|
|
599
|
+
}, useSplitStyles = (a, b, c, d, e, f, g, h, i, j) => {
|
|
600
|
+
conf = conf || (0, import_config.getConfig)();
|
|
601
|
+
const res = getSplitStyles(a, b, c, d, e, f, g, h, i, j);
|
|
602
|
+
return process.env.TAMAGUI_REACT_19 || useInsertEffectCompat(() => {
|
|
603
|
+
(0, import_insertStyleRule.insertStyleRules)(res.rulesToInsert);
|
|
604
|
+
}, [res.rulesToInsert]), res;
|
|
605
|
+
};
|
|
606
|
+
function addStyleToInsertRules(rulesToInsert, styleObject) {
|
|
607
|
+
{
|
|
608
|
+
const identifier = styleObject[import_helpers.StyleObjectIdentifier];
|
|
609
|
+
process.env.TAMAGUI_REACT_19 || (0, import_insertStyleRule.shouldInsertStyleRules)(identifier) && (0, import_insertStyleRule.updateRules)(identifier, styleObject[import_helpers.StyleObjectRules]), rulesToInsert[identifier] = styleObject;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function processIDRefList(idRefList) {
|
|
613
|
+
return Array.isArray(idRefList) ? idRefList.join(" ") : idRefList;
|
|
614
|
+
}
|
|
615
|
+
const defaultColor = process.env.TAMAGUI_DEFAULT_COLOR || "rgba(0,0,0,0)", animatableDefaults = {
|
|
616
|
+
...Object.fromEntries(
|
|
617
|
+
Object.entries(import_helpers.tokenCategories.color).map(([k, v]) => [k, defaultColor])
|
|
618
|
+
),
|
|
619
|
+
opacity: 1,
|
|
620
|
+
scale: 1,
|
|
621
|
+
rotate: "0deg",
|
|
622
|
+
rotateY: "0deg",
|
|
623
|
+
rotateX: "0deg",
|
|
624
|
+
x: 0,
|
|
625
|
+
y: 0,
|
|
626
|
+
borderRadius: 0
|
|
627
|
+
}, lowercaseHyphenate = (match) => `-${match.toLowerCase()}`, hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate), mergeTransform = (obj, key, val, backwards = !1) => {
|
|
628
|
+
typeof obj.transform != "string" && (obj.transform ||= [], obj.transform[backwards ? "unshift" : "push"]({
|
|
629
|
+
[mapTransformKeys[key] || key]: val
|
|
630
|
+
}));
|
|
631
|
+
}, mapTransformKeys = {
|
|
632
|
+
x: "translateX",
|
|
633
|
+
y: "translateY"
|
|
634
|
+
}, accessibilityRoleToWebRole = {
|
|
635
|
+
adjustable: "slider",
|
|
636
|
+
header: "heading",
|
|
637
|
+
image: "img",
|
|
638
|
+
link: "link",
|
|
639
|
+
none: "presentation",
|
|
640
|
+
summary: "region"
|
|
641
|
+
};
|
|
642
|
+
function passDownProp(viewProps, key, val, shouldMergeObject = !1) {
|
|
643
|
+
if (shouldMergeObject) {
|
|
644
|
+
const next = {
|
|
645
|
+
...viewProps[key],
|
|
646
|
+
...val
|
|
647
|
+
};
|
|
648
|
+
delete viewProps[key], viewProps[key] = next;
|
|
649
|
+
} else
|
|
650
|
+
viewProps[key] = val;
|
|
651
|
+
}
|
|
652
|
+
function mergeMediaByImportance(styleState, mediaKey, key, value, importancesUsed, isSizeMedia, importanceBump, debugProp) {
|
|
653
|
+
let importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
|
|
654
|
+
mediaKey,
|
|
655
|
+
key,
|
|
656
|
+
importancesUsed,
|
|
657
|
+
isSizeMedia
|
|
658
|
+
);
|
|
659
|
+
if (importanceBump && (importance = (importance || 0) + importanceBump), process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)(
|
|
660
|
+
`mergeMediaByImportance ${key} importance existing ${importancesUsed[key]} next ${importance}`
|
|
661
|
+
), importance === null)
|
|
662
|
+
return !1;
|
|
663
|
+
if (importancesUsed[key] = importance, key in import_pseudoDescriptors.pseudoDescriptors) {
|
|
664
|
+
const descriptor = import_pseudoDescriptors.pseudoDescriptors[key], descriptorKey = descriptor.stateKey || descriptor.name;
|
|
665
|
+
if (styleState.componentState[descriptorKey] === !1)
|
|
666
|
+
return !1;
|
|
667
|
+
for (const subKey in value)
|
|
668
|
+
mergeStyle(styleState, subKey, value[subKey]);
|
|
669
|
+
} else
|
|
670
|
+
mergeStyle(styleState, key, value);
|
|
671
|
+
return !0;
|
|
672
|
+
}
|
|
673
|
+
function normalizeStyle(style) {
|
|
674
|
+
const out = {};
|
|
675
|
+
for (const key in style) {
|
|
676
|
+
const val = style[key];
|
|
677
|
+
key in import_helpers.stylePropsTransform ? mergeTransform(out, key, val) : out[key] = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key);
|
|
678
|
+
}
|
|
679
|
+
return import_constants.isWeb && Array.isArray(out.transform) && (out.transform = (0, import_transformsToString.transformsToString)(out.transform)), (0, import_expandStyles.fixStyles)(out), out;
|
|
680
|
+
}
|
|
681
|
+
function applyDefaultStyle(pkey, styleState) {
|
|
682
|
+
const defaultValues = animatableDefaults[pkey];
|
|
683
|
+
defaultValues != null && !(pkey in styleState.usedKeys) && (!styleState.style || !(pkey in styleState.style)) && mergeStyle(styleState, pkey, defaultValues);
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=getSplitStyles.js.map
|