@tamagui/core 1.0.1-beta.60 → 1.0.1-beta.63
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/createComponent.js +15 -5
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/createMediaStyle.js +1 -1
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +34 -15
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createTamaguiProvider.js +3 -3
- package/dist/cjs/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +2 -1
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/generateAtomicStyles.js +65 -122
- package/dist/cjs/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +29 -14
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +8 -22
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +2 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js +40 -0
- package/dist/cjs/helpers/mergeProps.js.map +7 -0
- package/dist/cjs/helpers/pseudos.js +41 -0
- package/dist/cjs/helpers/pseudos.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +2 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +2 -0
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/createComponent.js +15 -8
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/createMediaStyle.js +1 -1
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +34 -15
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createTamaguiProvider.js +2 -2
- package/dist/esm/helpers/createTamaguiProvider.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +5 -3
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/generateAtomicStyles.js +65 -121
- package/dist/esm/helpers/generateAtomicStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +29 -14
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +7 -20
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +2 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/mergeProps.js +18 -0
- package/dist/esm/helpers/mergeProps.js.map +7 -0
- package/dist/esm/helpers/pseudos.js +18 -0
- package/dist/esm/helpers/pseudos.js.map +7 -0
- package/dist/esm/helpers/themeable.js +2 -1
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/static.js +2 -0
- package/dist/esm/static.js.map +2 -2
- package/dist/jsx/createComponent.js +15 -8
- package/dist/jsx/helpers/createMediaStyle.js +1 -1
- package/dist/jsx/helpers/createPropMapper.js +34 -15
- package/dist/jsx/helpers/createTamaguiProvider.js +2 -2
- package/dist/jsx/helpers/extendStaticConfig.js +5 -3
- package/dist/jsx/helpers/generateAtomicStyles.js +65 -121
- package/dist/jsx/helpers/getSplitStyles.js +29 -14
- package/dist/jsx/helpers/getStylesAtomic.js +7 -20
- package/dist/jsx/helpers/insertStyleRule.js +2 -1
- package/dist/jsx/helpers/mergeProps.js +17 -0
- package/dist/jsx/helpers/pseudos.js +17 -0
- package/dist/jsx/helpers/themeable.js +2 -1
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/static.js +2 -0
- package/package.json +5 -6
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +1 -1
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/createTamaguiProvider.d.ts +1 -1
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -1
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/generateAtomicStyles.d.ts +5 -6
- package/types/helpers/generateAtomicStyles.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +2 -2
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts +0 -14
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/mergeProps.d.ts +2 -0
- package/types/helpers/mergeProps.d.ts.map +1 -0
- package/types/helpers/pseudos.d.ts +15 -0
- package/types/helpers/pseudos.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -1
- package/types/static.d.ts +2 -0
- package/types/static.d.ts.map +1 -1
- package/types/types.d.ts +4 -3
- package/types/types.d.ts.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createPropMapper.ts"],
|
|
4
|
-
"sourcesContent": ["import { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { Variable, isVariable } from '../createVariable'\nimport {\n GenericVariantDefinitions,\n PropMapper,\n StaticConfig,\n TamaguiInternalConfig,\n VariantSpreadFunction,\n} from '../types'\nimport { expandStyle, expandStyles } from './generateAtomicStyles'\nimport { getVariantExtras } from './getVariantExtras'\nimport { isObj } from './isObj'\n\nexport type ResolveVariableTypes = 'auto' | 'value' | 'variable' | 'both'\n\nexport const createPropMapper = (staticConfig: Partial<StaticConfig>) => {\n const variants = staticConfig.variants || {}\n const defaultProps = staticConfig.defaultProps || {}\n\n const mapper: PropMapper = (key, value, theme, propsIn, state, avoidDefaultProps = false) => {\n const conf = getConfig()\n if (!conf) {\n console.trace('no conf! err')\n return\n }\n\n const props = state.fallbackProps || propsIn\n const returnVariablesAs =\n state.resolveVariablesAs === 'value' || !!props.animation ? 'value' : 'auto'\n\n // handled here because we need to resolve this off tokens, its the only one-off like this\n const fontFamily = props.fontFamily || defaultProps.fontFamily || '$body'\n\n const variantValue = resolveVariants(\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n '',\n avoidDefaultProps\n )\n if (variantValue) {\n return variantValue\n }\n\n let shouldReturn = value !== undefined && value !== null\n\n // handle shorthands\n if (conf.shorthands[key]) {\n shouldReturn = true\n key = conf.shorthands[key]\n }\n\n if (value) {\n if (value[0] === '$') {\n // prettier-ignore\n value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs)\n } else if (isVariable(value)) {\n value = getVariableValue(value, returnVariablesAs)\n }\n }\n\n if (shouldReturn) {\n return expandStyle(key, value) || [[key, value]]\n }\n }\n\n return mapper\n}\n\ntype StyleResolver = (\n key: string,\n value: any,\n props: Record<string, any>,\n defaultProps: any,\n theme: any,\n variants: GenericVariantDefinitions,\n fontFamily: string,\n conf: TamaguiInternalConfig,\n returnVariablesAs: 'auto' | 'value',\n staticConfig: Partial<StaticConfig>,\n parentVariantKey: string,\n avoidDefaultProps?: boolean\n) => any\n\nconst resolveVariants: StyleResolver = (\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps = false\n) => {\n const variant = variants && variants[key]\n if (variant && value !== undefined) {\n let variantValue = getVariantDefinition(variant, key, value)\n\n if (variantValue) {\n if (typeof variantValue === 'function') {\n const fn = variantValue as VariantSpreadFunction<any>\n variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps))\n }\n\n if (isObj(variantValue)) {\n variantValue = resolveTokensAndVariants(\n key,\n variantValue,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps\n )\n }\n\n return Object.entries(expandStyles(variantValue))\n } else {\n // variant at key exists, but no matching variant value, return nothing\n if (process.env.NODE_ENV === 'development') {\n if (staticConfig.validStyles?.[key]) {\n return null\n }\n console.warn(\n `No variant found: ${\n staticConfig.componentName || '[UnnamedComponent]'\n } has variant \"${key}\", but no matching value \"${value}\"`\n )\n }\n return null\n }\n }\n}\n\nconst resolveTokensAndVariants: StyleResolver = (\n key, // we dont use key assume value is object instead\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps\n) => {\n let res = {}\n for (const rKey in value) {\n const fKey = conf.shorthands[rKey] || rKey\n const val = value[rKey]\n if (isVariable(val)) {\n res[fKey] = !isWeb || returnVariablesAs === 'value' ? val.val : val.variable\n // res[fKey] =\n // resolveAs === 'variable' ? val : !isWeb || resolveAs === 'value' ? val.val : val.variable\n } else if (variants[fKey]) {\n // avoids infinite loop if variant is matching a style prop\n // eg: { variants: { flex: { true: { flex: 2 } } } }\n if (parentVariantKey === key) {\n res[fKey] = val\n } else {\n res = {\n ...res,\n ...Object.fromEntries(\n resolveVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps\n )\n ),\n }\n }\n } else if (typeof val === 'string') {\n const fVal =\n val[0] === '$' ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs) : val\n res[fKey] = fVal\n } else {\n if (isObj(val)) {\n // sub-objects: media queries, pseudos, shadowOffset\n res[fKey] = resolveTokensAndVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps\n )\n } else {\n // nullish values cant be tokens, need no extra parsing\n res[fKey] = value[fKey]\n }\n }\n if (process.env.NODE_ENV === 'development') {\n if (res[fKey]?.[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token in theme ${theme.name}:`, fKey, res[fKey])\n }\n }\n }\n return res\n}\n\n// goes through specificity finding best matching variant function\nfunction getVariantDefinition(variant: any, key: string, value: any) {\n if (typeof variant === 'function') {\n return variant\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const spreadVariant = variant[`...${cat}`]\n if (spreadVariant) {\n return spreadVariant\n }\n }\n }\n let fn: any\n if (typeof value === 'number') {\n fn = variant[':number']\n } else if (typeof value === 'string') {\n fn = variant[':string']\n } else if (value === true || value === false) {\n fn = variant[':boolean']\n }\n fn = fn || variant[value]\n // fallback to size ultimately - could do token level detection\n return fn || variant['...'] || variant['...size']\n}\n\nconst fontShorthand = {\n fontSize: 'size',\n fontWeight: 'weight',\n}\n\nconst getToken = (\n key: string,\n value: string,\n { tokensParsed, fontsParsed }: TamaguiInternalConfig,\n theme: any,\n fontFamily: string | undefined = '$body',\n resolveAs?: ResolveVariableTypes\n) => {\n let valOrVar: any\n let hasSet = false\n if (theme[value]) {\n valOrVar = theme[value]\n hasSet = true\n } else {\n switch (key) {\n case 'fontFamily':\n valOrVar = fontsParsed[value]?.family || value\n hasSet = true\n break\n case 'fontSize':\n case 'lineHeight':\n case 'letterSpacing':\n case 'fontWeight':\n valOrVar = fontsParsed[fontFamily]?.[fontShorthand[key] || key]?.[value] || value\n hasSet = true\n break\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const res = tokensParsed[cat][value]\n if (res) {\n valOrVar = res\n hasSet = true\n }\n }\n }\n if (!hasSet) {\n const spaceVar = tokensParsed.space[value]\n if (spaceVar) {\n valOrVar = spaceVar\n hasSet = true\n }\n }\n }\n if (hasSet) {\n return getVariableValue(valOrVar, resolveAs)\n }\n if (process.env.NODE_ENV === 'development') {\n if (value && value[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token:`, key, value, fontFamily, theme, fontsParsed)\n return null\n }\n }\n return value\n}\n\nfunction getVariableValue(valOrVar: Variable | any, resolveAs: ResolveVariableTypes = 'auto') {\n if (isVariable(valOrVar)) {\n if (resolveAs === 'variable') {\n return valOrVar\n }\n if (!isWeb || resolveAs === 'value') {\n return valOrVar.val\n }\n return valOrVar.variable\n }\n return valOrVar\n}\n\n// just specificy the least costly, all else go to `space` (most keys - we can exclude)\nconst tokenCategories = {\n radius: {\n borderRadius: true,\n },\n size: {\n width: true,\n height: true,\n minWidth: true,\n minHeight: true,\n maxWidth: true,\n maxHeight: true,\n },\n color: {\n color: true,\n backgroundColor: true,\n borderColor: true,\n borderBottomColor: true,\n borderTopColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n },\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,sBAAsB;AACtB,4BAAqC;
|
|
4
|
+
"sourcesContent": ["import { getConfig } from '../conf'\nimport { isWeb } from '../constants/platform'\nimport { Variable, isVariable } from '../createVariable'\nimport {\n DebugProp,\n GenericVariantDefinitions,\n PropMapper,\n StaticConfig,\n TamaguiInternalConfig,\n VariantSpreadFunction,\n} from '../types'\nimport { expandStyle, expandStyles } from './generateAtomicStyles'\nimport { getVariantExtras } from './getVariantExtras'\nimport { isObj } from './isObj'\n\nexport type ResolveVariableTypes = 'auto' | 'value' | 'variable' | 'both' | 'non-color-value'\n\nexport const createPropMapper = (staticConfig: Partial<StaticConfig>) => {\n const variants = staticConfig.variants || {}\n const defaultProps = staticConfig.defaultProps || {}\n\n const mapper: PropMapper = (\n key,\n value,\n theme,\n propsIn,\n state,\n avoidDefaultProps = false,\n debug\n ) => {\n const conf = getConfig()\n if (!conf) {\n console.trace('no conf! err')\n return\n }\n\n const props = state.fallbackProps || propsIn\n const returnVariablesAs =\n state.resolveVariablesAs === 'value' || !!props.animation ? 'non-color-value' : 'auto'\n\n // handled here because we need to resolve this off tokens, its the only one-off like this\n const fontFamily = props.fontFamily || defaultProps.fontFamily || '$body'\n\n const variantValue = resolveVariants(\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n '',\n avoidDefaultProps\n )\n if (variantValue) {\n return variantValue\n }\n\n let shouldReturn = value !== undefined && value !== null\n\n // handle shorthands\n if (conf.shorthands[key]) {\n shouldReturn = true\n key = conf.shorthands[key]\n }\n\n if (value) {\n if (value[0] === '$') {\n // prettier-ignore\n value = getToken(key, value, conf, theme, fontFamily, returnVariablesAs, debug)\n } else if (isVariable(value)) {\n value = getVariableValue(key, value, returnVariablesAs)\n }\n }\n\n if (shouldReturn) {\n return expandStyle(key, value) || [[key, value]]\n }\n }\n\n return mapper\n}\n\ntype StyleResolver = (\n key: string,\n value: any,\n props: Record<string, any>,\n defaultProps: any,\n theme: any,\n variants: GenericVariantDefinitions,\n fontFamily: string,\n conf: TamaguiInternalConfig,\n returnVariablesAs: 'auto' | 'value' | 'non-color-value',\n staticConfig: Partial<StaticConfig>,\n parentVariantKey: string,\n avoidDefaultProps?: boolean,\n debug?: DebugProp\n) => any\n\nconst resolveVariants: StyleResolver = (\n key,\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps = false,\n debug\n) => {\n const variant = variants && variants[key]\n if (variant && value !== undefined) {\n let variantValue = getVariantDefinition(variant, key, value)\n\n if (variantValue) {\n if (typeof variantValue === 'function') {\n const fn = variantValue as VariantSpreadFunction<any>\n variantValue = fn(value, getVariantExtras(props, theme, defaultProps, avoidDefaultProps))\n }\n\n if (isObj(variantValue)) {\n variantValue = resolveTokensAndVariants(\n key,\n variantValue,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps,\n debug\n )\n }\n\n return Object.entries(expandStyles(variantValue))\n } else {\n // variant at key exists, but no matching variant value, return nothing\n if (process.env.NODE_ENV === 'development') {\n if (staticConfig.validStyles?.[key]) {\n return null\n }\n const name = staticConfig.componentName || '[UnnamedComponent]'\n console.warn(\n `No variant found: ${name} has variant \"${key}\", but no matching value \"${value}\"`\n )\n }\n return null\n }\n }\n}\n\nconst resolveTokensAndVariants: StyleResolver = (\n key, // we dont use key assume value is object instead\n value,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n parentVariantKey,\n avoidDefaultProps,\n debug\n) => {\n let res = {}\n for (const rKey in value) {\n const fKey = conf.shorthands[rKey] || rKey\n const val = value[rKey]\n if (isVariable(val)) {\n res[fKey] = !isWeb || returnVariablesAs === 'value' ? val.val : val.variable\n } else if (variants[fKey]) {\n // avoids infinite loop if variant is matching a style prop\n // eg: { variants: { flex: { true: { flex: 2 } } } }\n if (parentVariantKey === key) {\n res[fKey] = val\n } else {\n res = {\n ...res,\n ...Object.fromEntries(\n resolveVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps,\n debug\n )\n ),\n }\n }\n } else if (typeof val === 'string') {\n const fVal =\n val[0] === '$'\n ? getToken(fKey, val, conf, theme, fontFamily, returnVariablesAs, debug)\n : val\n res[fKey] = fVal\n } else {\n if (isObj(val)) {\n // sub-objects: media queries, pseudos, shadowOffset\n res[fKey] = resolveTokensAndVariants(\n fKey,\n val,\n props,\n defaultProps,\n theme,\n variants,\n fontFamily,\n conf,\n returnVariablesAs,\n staticConfig,\n key,\n avoidDefaultProps,\n debug\n )\n } else {\n // nullish values cant be tokens, need no extra parsing\n res[fKey] = value[fKey]\n }\n }\n if (process.env.NODE_ENV === 'development') {\n if (res[fKey]?.[0] === '$') {\n console.warn(`\u26A0\uFE0F Missing token in theme ${theme.name}:`, fKey, res[fKey])\n }\n }\n }\n return res\n}\n\n// goes through specificity finding best matching variant function\nfunction getVariantDefinition(variant: any, key: string, value: any) {\n if (typeof variant === 'function') {\n return variant\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const spreadVariant = variant[`...${cat}`]\n if (spreadVariant) {\n return spreadVariant\n }\n }\n }\n let fn: any\n if (typeof value === 'number') {\n fn = variant[':number']\n } else if (typeof value === 'string') {\n fn = variant[':string']\n } else if (value === true || value === false) {\n fn = variant[':boolean']\n }\n fn = fn || variant[value]\n // fallback to size ultimately - could do token level detection\n return fn || variant['...'] || variant['...size']\n}\n\nconst fontShorthand = {\n fontSize: 'size',\n fontWeight: 'weight',\n}\n\nconst getToken = (\n key: string,\n value: string,\n { tokensParsed, fontsParsed }: TamaguiInternalConfig,\n theme: any,\n fontFamily: string | undefined = '$body',\n resolveAs?: ResolveVariableTypes,\n debug?: DebugProp\n) => {\n let valOrVar: any\n let hasSet = false\n if (theme[value]) {\n valOrVar = theme[value]\n hasSet = true\n } else {\n switch (key) {\n case 'fontFamily':\n valOrVar = fontsParsed[value]?.family || value\n hasSet = true\n break\n case 'fontSize':\n case 'lineHeight':\n case 'letterSpacing':\n case 'fontWeight':\n valOrVar = fontsParsed[fontFamily]?.[fontShorthand[key] || key]?.[value] || value\n hasSet = true\n break\n }\n for (const cat in tokenCategories) {\n if (key in tokenCategories[cat]) {\n const res = tokensParsed[cat][value]\n if (res) {\n valOrVar = res\n hasSet = true\n }\n }\n }\n if (!hasSet) {\n const spaceVar = tokensParsed.space[value]\n if (spaceVar) {\n valOrVar = spaceVar\n hasSet = true\n }\n }\n }\n if (hasSet) {\n return getVariableValue(key, valOrVar, resolveAs)\n }\n if (process.env.NODE_ENV === 'development') {\n if (value && value[0] === '$') {\n console.warn(\n `\u26A0\uFE0F You've passed the value \"${value}\" to the style property \"${key}\", but there's no theme or token with the key \"${value}\". Using theme \"${theme.name}\".\n\nSet the debug prop to true to see more detailed debug information.`\n )\n if (debug) {\n if (typeof window !== 'undefined') {\n console.log('Looked in:')\n console.log('Theme:', theme)\n console.log('Tokens:', tokensParsed)\n console.log('Fonts:', fontsParsed)\n }\n }\n return null\n }\n }\n return value\n}\n\nfunction getVariableValue(\n key: string,\n valOrVar: Variable | any,\n resolveAs: ResolveVariableTypes = 'auto'\n) {\n if (isVariable(valOrVar)) {\n if (resolveAs === 'variable') {\n return valOrVar\n }\n if (resolveAs === 'non-color-value') {\n if (isWeb) {\n if (key in tokenCategories.color) {\n return valOrVar.variable\n }\n }\n return valOrVar.val\n }\n if (!isWeb || resolveAs === 'value') {\n return valOrVar.val\n }\n return valOrVar.variable\n }\n return valOrVar\n}\n\n// just specificy the least costly, all else go to `space` (most keys - we can exclude)\nconst tokenCategories = {\n radius: {\n borderRadius: true,\n },\n size: {\n width: true,\n height: true,\n minWidth: true,\n minHeight: true,\n maxWidth: true,\n maxHeight: true,\n },\n color: {\n color: true,\n backgroundColor: true,\n borderColor: true,\n borderBottomColor: true,\n borderTopColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n },\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,sBAAsB;AACtB,4BAAqC;AASrC,kCAA0C;AAC1C,8BAAiC;AACjC,mBAAsB;AAIf,MAAM,mBAAmB,wBAAC,iBAAwC;AACvE,QAAM,WAAW,aAAa,YAAY,CAAC;AAC3C,QAAM,eAAe,aAAa,gBAAgB,CAAC;AAEnD,QAAM,SAAqB,wBACzB,KACA,OACA,OACA,SACA,OACA,oBAAoB,OACpB,UACG;AACH,UAAM,OAAO,2BAAU;AACvB,QAAI,CAAC,MAAM;AACT,cAAQ,MAAM,cAAc;AAC5B;AAAA,IACF;AAEA,UAAM,QAAQ,MAAM,iBAAiB;AACrC,UAAM,oBACJ,MAAM,uBAAuB,WAAW,CAAC,CAAC,MAAM,YAAY,oBAAoB;AAGlF,UAAM,aAAa,MAAM,c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AAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,15 +62,15 @@ function createTamaguiProvider(_a) {
|
|
|
62
62
|
]);
|
|
63
63
|
return /* @__PURE__ */ __name(function TamaguiProvider(_a2) {
|
|
64
64
|
var _b2 = _a2, {
|
|
65
|
-
|
|
65
|
+
disableInjectCSS,
|
|
66
66
|
children
|
|
67
67
|
} = _b2, themePropsProvider = __objRest(_b2, [
|
|
68
|
-
"
|
|
68
|
+
"disableInjectCSS",
|
|
69
69
|
"children"
|
|
70
70
|
]);
|
|
71
71
|
if (typeof document !== "undefined") {
|
|
72
72
|
React.useLayoutEffect(() => {
|
|
73
|
-
if (
|
|
73
|
+
if (disableInjectCSS)
|
|
74
74
|
return;
|
|
75
75
|
const style = document.createElement("style");
|
|
76
76
|
style.appendChild(document.createTextNode(getCSS()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider({\n getCSS,\n ...themeProps\n}: ThemeProviderProps & {\n getCSS: () => string\n}) {\n return function TamaguiProvider({\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,uCAA0C;AAE1C,iCAAqC;AACrC,2BAAkD;AAE3C,+BAA+B,IAKnC;AALmC,eACpC;AAAA;AAAA,MADoC,IAEjC,uBAFiC,IAEjC;AAAA,IADH;AAAA;AAKA,SAAO,gDAAyB,KAIP;AAJO,mBAC9B;AAAA;AAAA,MACA;AAAA,QAF8B,KAG3B,+BAH2B,KAG3B;AAAA,MAFH;AAAA,MACA;AAAA;AAIA,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TamaguiProviderProps } from '../types'\nimport { TextAncestorProvider } from '../views/TextAncestorContext'\nimport { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider({\n getCSS,\n ...themeProps\n}: ThemeProviderProps & {\n getCSS: () => string\n}) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n // inject CSS if asked to (not SSR compliant)\n if (typeof document !== 'undefined') {\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider {...themeProps} {...themePropsProvider}>\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAEvB,uCAA0C;AAE1C,iCAAqC;AACrC,2BAAkD;AAE3C,+BAA+B,IAKnC;AALmC,eACpC;AAAA;AAAA,MADoC,IAEjC,uBAFiC,IAEjC;AAAA,IADH;AAAA;AAKA,SAAO,gDAAyB,KAIP;AAJO,mBAC9B;AAAA;AAAA,MACA;AAAA,QAF8B,KAG3B,+BAH2B,KAG3B;AAAA,MAFH;AAAA,MACA;AAAA;AAIA,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,CAAC,CAAC;AACnD,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,IACP;AAEA,WACE,oCAAC,2DAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,uDACC,oCAAC,sEAAkB,aAAgB,qBAChC,QACH,CACF,CACF;AAAA,EAEJ,GA3BO;AA4BT;AAlCgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ __export(extendStaticConfig_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(extendStaticConfig_exports);
|
|
42
42
|
var import_helpers = require("@tamagui/helpers");
|
|
43
43
|
var import_createPropMapper = require("./createPropMapper");
|
|
44
|
+
var import_mergeProps = require("./mergeProps");
|
|
44
45
|
function extendStaticConfig(config, parent) {
|
|
45
46
|
if (!parent || !("staticConfig" in parent)) {
|
|
46
47
|
return parseStaticConfig(config);
|
|
@@ -63,7 +64,7 @@ function extendStaticConfig(config, parent) {
|
|
|
63
64
|
neverFlatten: config.neverFlatten || parent.staticConfig.neverFlatten,
|
|
64
65
|
ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,
|
|
65
66
|
validStyles: config.validStyles ? __spreadValues(__spreadValues({}, parent.staticConfig.validStyles), config.validStyles) : parent.staticConfig.validStyles || import_helpers.stylePropsView,
|
|
66
|
-
defaultProps:
|
|
67
|
+
defaultProps: (0, import_mergeProps.mergeProps)(__spreadValues(__spreadValues({}, parent.staticConfig.defaultProps), parent.staticConfig.defaultVariants), __spreadValues(__spreadValues({}, config.defaultProps), config.defaultVariants))
|
|
67
68
|
}));
|
|
68
69
|
}
|
|
69
70
|
__name(extendStaticConfig, "extendStaticConfig");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/extendStaticConfig.ts"],
|
|
4
|
-
"sourcesContent": ["import { stylePropsView } from '@tamagui/helpers'\n\nimport { StaticConfig, StaticConfigParsed, StylableComponent } from '../types'\nimport { createPropMapper } from './createPropMapper'\n\nexport function extendStaticConfig(config: Partial<StaticConfig>, parent?: StylableComponent) {\n if (!parent || !('staticConfig' in parent)) {\n return parseStaticConfig(config)\n }\n\n const variants = {\n ...parent.staticConfig.variants,\n }\n\n // merge variants... can we type this?\n if (config.variants) {\n for (const key in config.variants) {\n if (variants[key]) {\n variants[key] = {\n ...variants[key],\n ...config.variants[key],\n }\n } else {\n variants[key] = config.variants[key]\n }\n }\n }\n\n return parseStaticConfig({\n ...parent.staticConfig,\n ...config,\n variants,\n isZStack: config.isZStack || parent.staticConfig.isZStack,\n isText: config.isText || parent.staticConfig.isText || false,\n isInput: config.isInput || parent.staticConfig.isInput || false,\n neverFlatten: config.neverFlatten || parent.staticConfig.neverFlatten,\n ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,\n validStyles: config.validStyles\n ? {\n ...parent.staticConfig.validStyles,\n ...config.validStyles,\n }\n : parent.staticConfig.validStyles || stylePropsView,\n defaultProps: {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+B;AAG/B,8BAAiC;
|
|
4
|
+
"sourcesContent": ["import { stylePropsView } from '@tamagui/helpers'\n\nimport { StaticConfig, StaticConfigParsed, StylableComponent } from '../types'\nimport { createPropMapper } from './createPropMapper'\nimport { mergeProps } from './mergeProps'\n\nexport function extendStaticConfig(config: Partial<StaticConfig>, parent?: StylableComponent) {\n if (!parent || !('staticConfig' in parent)) {\n return parseStaticConfig(config)\n }\n\n const variants = {\n ...parent.staticConfig.variants,\n }\n\n // merge variants... can we type this?\n if (config.variants) {\n for (const key in config.variants) {\n if (variants[key]) {\n variants[key] = {\n ...variants[key],\n ...config.variants[key],\n }\n } else {\n variants[key] = config.variants[key]\n }\n }\n }\n\n return parseStaticConfig({\n ...parent.staticConfig,\n ...config,\n variants,\n isZStack: config.isZStack || parent.staticConfig.isZStack,\n isText: config.isText || parent.staticConfig.isText || false,\n isInput: config.isInput || parent.staticConfig.isInput || false,\n neverFlatten: config.neverFlatten || parent.staticConfig.neverFlatten,\n ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,\n validStyles: config.validStyles\n ? {\n ...parent.staticConfig.validStyles,\n ...config.validStyles,\n }\n : parent.staticConfig.validStyles || stylePropsView,\n defaultProps: mergeProps(\n {\n ...parent.staticConfig.defaultProps,\n ...parent.staticConfig.defaultVariants,\n },\n {\n ...config.defaultProps,\n ...config.defaultVariants,\n }\n ),\n })\n}\n\nexport const parseStaticConfig = (config: Partial<StaticConfig>): StaticConfigParsed => {\n return {\n ...config,\n parsed: true,\n propMapper: createPropMapper(config),\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+B;AAG/B,8BAAiC;AACjC,wBAA2B;AAEpB,4BAA4B,QAA+B,QAA4B;AAC5F,MAAI,CAAC,UAAU,CAAE,mBAAkB,SAAS;AAC1C,WAAO,kBAAkB,MAAM;AAAA,EACjC;AAEA,QAAM,WAAW,mBACZ,OAAO,aAAa;AAIzB,MAAI,OAAO,UAAU;AACnB,eAAW,OAAO,OAAO,UAAU;AACjC,UAAI,SAAS,MAAM;AACjB,iBAAS,OAAO,kCACX,SAAS,OACT,OAAO,SAAS;AAAA,MAEvB,OAAO;AACL,iBAAS,OAAO,OAAO,SAAS;AAAA,MAClC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,kBAAkB,gDACpB,OAAO,eACP,SAFoB;AAAA,IAGvB;AAAA,IACA,UAAU,OAAO,YAAY,OAAO,aAAa;AAAA,IACjD,QAAQ,OAAO,UAAU,OAAO,aAAa,UAAU;AAAA,IACvD,SAAS,OAAO,WAAW,OAAO,aAAa,WAAW;AAAA,IAC1D,cAAc,OAAO,gBAAgB,OAAO,aAAa;AAAA,IACzD,sBAAsB,OAAO,wBAAwB,OAAO,aAAa;AAAA,IACzE,aAAa,OAAO,cAChB,kCACK,OAAO,aAAa,cACpB,OAAO,eAEZ,OAAO,aAAa,eAAe;AAAA,IACvC,cAAc,kCACZ,kCACK,OAAO,aAAa,eACpB,OAAO,aAAa,kBAEzB,kCACK,OAAO,eACP,OAAO,gBAEd;AAAA,EACF,EAAC;AACH;AAjDgB;AAmDT,MAAM,oBAAoB,wBAAC,WAAsD;AACtF,SAAO,iCACF,SADE;AAAA,IAEL,QAAQ;AAAA,IACR,YAAY,8CAAiB,MAAM;AAAA,EACrC;AACF,GANiC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,62 +37,51 @@ var generateAtomicStyles_exports = {};
|
|
|
37
37
|
__export(generateAtomicStyles_exports, {
|
|
38
38
|
expandStyle: () => expandStyle,
|
|
39
39
|
expandStyles: () => expandStyles,
|
|
40
|
-
generateAtomicStyles: () => generateAtomicStyles
|
|
41
|
-
inline: () => inline
|
|
40
|
+
generateAtomicStyles: () => generateAtomicStyles
|
|
42
41
|
});
|
|
43
42
|
module.exports = __toCommonJS(generateAtomicStyles_exports);
|
|
44
43
|
var import_helpers = require("@tamagui/helpers");
|
|
45
44
|
var import_hyphenate_style_name = __toESM(require("hyphenate-style-name"));
|
|
46
45
|
var import_normalize_css_color = __toESM(require("normalize-css-color"));
|
|
47
46
|
var import_platform = require("../constants/platform");
|
|
48
|
-
var
|
|
47
|
+
var import_pseudos = require("./pseudos");
|
|
48
|
+
const reducedStyleKeys = {
|
|
49
|
+
shadowColor: true,
|
|
50
|
+
shadowOffset: true,
|
|
51
|
+
shadowOpacity: true,
|
|
52
|
+
shadowRadius: true,
|
|
53
|
+
textShadowColor: true,
|
|
54
|
+
textShadowOffset: true,
|
|
55
|
+
textShadowRadius: true
|
|
56
|
+
};
|
|
49
57
|
function expandStyles(style) {
|
|
50
58
|
const res = {};
|
|
59
|
+
boxShadowReducer(res, style);
|
|
60
|
+
textShadowReducer(res, style);
|
|
51
61
|
for (const key in style) {
|
|
52
|
-
|
|
62
|
+
if (reducedStyleKeys[key])
|
|
63
|
+
continue;
|
|
64
|
+
if (key in import_pseudos.pseudos) {
|
|
65
|
+
res[key] = expandStyles(style[key]);
|
|
66
|
+
} else {
|
|
67
|
+
updateReactDOMStyle(res, key, style[key]);
|
|
68
|
+
}
|
|
53
69
|
}
|
|
54
70
|
return res;
|
|
55
71
|
}
|
|
56
72
|
__name(expandStyles, "expandStyles");
|
|
57
|
-
function
|
|
58
|
-
|
|
73
|
+
function updateReactDOMStyle(style, key, value) {
|
|
74
|
+
value = normalizeValueWithProperty(value, key);
|
|
75
|
+
const out = expandStyle(key, value);
|
|
76
|
+
if (out) {
|
|
77
|
+
Object.assign(style, Object.fromEntries(out));
|
|
78
|
+
} else {
|
|
79
|
+
style[key] = value;
|
|
80
|
+
}
|
|
59
81
|
}
|
|
60
|
-
__name(
|
|
61
|
-
const STYLE_SHORT_FORM_EXPANSIONS = __spreadValues({
|
|
62
|
-
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
63
|
-
borderRadius: [
|
|
64
|
-
"borderTopLeftRadius",
|
|
65
|
-
"borderTopRightRadius",
|
|
66
|
-
"borderBottomRightRadius",
|
|
67
|
-
"borderBottomLeftRadius"
|
|
68
|
-
],
|
|
69
|
-
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
70
|
-
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
71
|
-
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
72
|
-
marginHorizontal: ["marginRight", "marginLeft"],
|
|
73
|
-
marginVertical: ["marginTop", "marginBottom"],
|
|
74
|
-
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
|
|
75
|
-
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
76
|
-
paddingHorizontal: ["paddingRight", "paddingLeft"],
|
|
77
|
-
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
78
|
-
}, import_platform.isWeb && {
|
|
79
|
-
overflow: ["overflowX", "overflowY"]
|
|
80
|
-
});
|
|
82
|
+
__name(updateReactDOMStyle, "updateReactDOMStyle");
|
|
81
83
|
const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
|
|
82
84
|
const res = expandStyles(style);
|
|
83
|
-
if (style.shadowColor != null || style.shadowOffset != null || style.shadowOpacity != null || style.shadowRadius != null) {
|
|
84
|
-
boxShadowReducer(res, style);
|
|
85
|
-
delete res["shadowColor"];
|
|
86
|
-
delete res["shadowOffset"];
|
|
87
|
-
delete res["shadowOpacity"];
|
|
88
|
-
delete res["shadowRadius"];
|
|
89
|
-
}
|
|
90
|
-
if (style.textShadowColor != null || style.textShadowOffset != null || style.textShadowRadius != null) {
|
|
91
|
-
textShadowReducer(res, style);
|
|
92
|
-
delete res["textShadowColor"];
|
|
93
|
-
delete res["textShadowOffset"];
|
|
94
|
-
delete res["textShadowRadius"];
|
|
95
|
-
}
|
|
96
85
|
const out = {};
|
|
97
86
|
for (const key in res) {
|
|
98
87
|
const value = res[key];
|
|
@@ -103,11 +92,11 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
|
|
|
103
92
|
const { identifier } = cachedResult;
|
|
104
93
|
out[identifier] = cachedResult;
|
|
105
94
|
} else {
|
|
106
|
-
const identifier =
|
|
107
|
-
const rules = createAtomicRules(identifier, key,
|
|
95
|
+
const identifier = (0, import_helpers.simpleHash)(key + valueString);
|
|
96
|
+
const rules = createAtomicRules(identifier, key, valueString);
|
|
108
97
|
const cachedResult2 = cache.set(key, valueString, {
|
|
109
98
|
property: key,
|
|
110
|
-
value:
|
|
99
|
+
value: valueString,
|
|
111
100
|
identifier,
|
|
112
101
|
rules
|
|
113
102
|
});
|
|
@@ -117,16 +106,6 @@ const generateAtomicStyles = /* @__PURE__ */ __name((style) => {
|
|
|
117
106
|
}
|
|
118
107
|
return out;
|
|
119
108
|
}, "generateAtomicStyles");
|
|
120
|
-
function updateReactDOMStyle(style, key, value) {
|
|
121
|
-
value = normalizeValueWithProperty(value, key);
|
|
122
|
-
const out = expandStyle(key, value);
|
|
123
|
-
if (out) {
|
|
124
|
-
Object.assign(style, Object.fromEntries(out));
|
|
125
|
-
} else {
|
|
126
|
-
style[key] = value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
__name(updateReactDOMStyle, "updateReactDOMStyle");
|
|
130
109
|
function expandStyle(key, value) {
|
|
131
110
|
if (key === "flex") {
|
|
132
111
|
if (value <= -1) {
|
|
@@ -195,15 +174,9 @@ function createAtomicRules(identifier, property, value) {
|
|
|
195
174
|
const rules = [];
|
|
196
175
|
const selector = `.${identifier}`;
|
|
197
176
|
switch (property) {
|
|
198
|
-
case "animationKeyframes": {
|
|
199
|
-
const { animationNames, rules: keyframesRules } = processKeyframesValue(value);
|
|
200
|
-
const block = createDeclarationBlock({ animationName: animationNames.join(",") });
|
|
201
|
-
rules.push(`${selector}${block}`, ...keyframesRules);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
177
|
case "placeholderTextColor": {
|
|
205
178
|
const block = createDeclarationBlock({ color: value, opacity: 1 });
|
|
206
|
-
rules.push(`${selector}
|
|
179
|
+
rules.push(`${selector}::placeholder${block}`);
|
|
207
180
|
break;
|
|
208
181
|
}
|
|
209
182
|
case "pointerEvents": {
|
|
@@ -242,58 +215,16 @@ function createAtomicRules(identifier, property, value) {
|
|
|
242
215
|
return rules;
|
|
243
216
|
}
|
|
244
217
|
__name(createAtomicRules, "createAtomicRules");
|
|
245
|
-
function processKeyframesValue(keyframesValue) {
|
|
246
|
-
if (typeof keyframesValue === "number") {
|
|
247
|
-
throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`);
|
|
248
|
-
}
|
|
249
|
-
const animationNames = [];
|
|
250
|
-
const rules = [];
|
|
251
|
-
const value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue];
|
|
252
|
-
for (const keyframes of value) {
|
|
253
|
-
if (typeof keyframes === "string") {
|
|
254
|
-
animationNames.push(keyframes);
|
|
255
|
-
} else {
|
|
256
|
-
const { identifier, rules: keyframesRules } = createKeyframes(keyframes);
|
|
257
|
-
animationNames.push(identifier);
|
|
258
|
-
rules.push(...keyframesRules);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return { animationNames, rules };
|
|
262
|
-
}
|
|
263
|
-
__name(processKeyframesValue, "processKeyframesValue");
|
|
264
|
-
function createKeyframes(keyframes) {
|
|
265
|
-
const prefixes2 = ["-webkit-", ""];
|
|
266
|
-
const identifier = createIdentifier("r", "animation", keyframes);
|
|
267
|
-
const steps = "{" + Object.keys(keyframes).map((stepName) => {
|
|
268
|
-
const rule = keyframes[stepName];
|
|
269
|
-
const block = createDeclarationBlock(rule);
|
|
270
|
-
return `${stepName}${block}`;
|
|
271
|
-
}).join("") + "}";
|
|
272
|
-
const rules = prefixes2.map((prefix) => {
|
|
273
|
-
return `@${prefix}keyframes ${identifier}${steps}`;
|
|
274
|
-
});
|
|
275
|
-
return { identifier, rules };
|
|
276
|
-
}
|
|
277
|
-
__name(createKeyframes, "createKeyframes");
|
|
278
218
|
function createDeclarationBlock(style) {
|
|
279
|
-
const domStyle =
|
|
219
|
+
const domStyle = expandStyles(style);
|
|
280
220
|
const declarationsString = Object.keys(domStyle).map((property) => {
|
|
281
221
|
const value = domStyle[property];
|
|
282
222
|
const prop = (0, import_hyphenate_style_name.default)(property);
|
|
283
|
-
|
|
284
|
-
return value.map((v) => `${prop}:${v}`).join(";");
|
|
285
|
-
} else {
|
|
286
|
-
return `${prop}:${value}`;
|
|
287
|
-
}
|
|
223
|
+
return `${prop}:${value}`;
|
|
288
224
|
}).sort().join(";");
|
|
289
225
|
return `{${declarationsString};}`;
|
|
290
226
|
}
|
|
291
227
|
__name(createDeclarationBlock, "createDeclarationBlock");
|
|
292
|
-
function createIdentifier(prefix, name, value) {
|
|
293
|
-
const hashedString = (0, import_helpers.simpleHash)(name + stringifyValueWithProperty(value, name));
|
|
294
|
-
return `${prefix}-${hashedString}`;
|
|
295
|
-
}
|
|
296
|
-
__name(createIdentifier, "createIdentifier");
|
|
297
228
|
const cache = {
|
|
298
229
|
get(property, value) {
|
|
299
230
|
if (cache[property] != null && cache[property].hasOwnProperty(value) && cache[property][value] != null) {
|
|
@@ -308,8 +239,7 @@ const cache = {
|
|
|
308
239
|
}
|
|
309
240
|
};
|
|
310
241
|
function stringifyValueWithProperty(value, property) {
|
|
311
|
-
|
|
312
|
-
return typeof normalizedValue !== "string" ? JSON.stringify(normalizedValue || "") : normalizedValue;
|
|
242
|
+
return normalizeValueWithProperty(value, property);
|
|
313
243
|
}
|
|
314
244
|
__name(stringifyValueWithProperty, "stringifyValueWithProperty");
|
|
315
245
|
const mapTransform = /* @__PURE__ */ __name((transform) => {
|
|
@@ -336,7 +266,8 @@ const colorProps = {
|
|
|
336
266
|
};
|
|
337
267
|
function normalizeValueWithProperty(value, property) {
|
|
338
268
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
339
|
-
|
|
269
|
+
const shouldCoerceToPx = typeof value === "number" && (property === void 0 || property === null || !unitlessNumbers[property]);
|
|
270
|
+
if (shouldCoerceToPx) {
|
|
340
271
|
return `${value}px`;
|
|
341
272
|
}
|
|
342
273
|
}
|
|
@@ -364,6 +295,7 @@ const normalizeColor = /* @__PURE__ */ __name((color, opacity = 1) => {
|
|
|
364
295
|
const alpha = (a * opacity).toFixed(2);
|
|
365
296
|
return `rgba(${r},${g},${b},${alpha})`;
|
|
366
297
|
}
|
|
298
|
+
return `${color}`;
|
|
367
299
|
}, "normalizeColor");
|
|
368
300
|
const isWebColor = /* @__PURE__ */ __name((color) => color === "currentcolor" || color === "currentColor" || color === "inherit" || color.indexOf("var(") === 0, "isWebColor");
|
|
369
301
|
const processColor = /* @__PURE__ */ __name((color) => {
|
|
@@ -423,25 +355,17 @@ const unitlessNumbers = {
|
|
|
423
355
|
scaleZ: true,
|
|
424
356
|
shadowOpacity: true
|
|
425
357
|
};
|
|
426
|
-
const prefixes = ["ms", "Moz", "O", "Webkit"];
|
|
427
|
-
const prefixKey = /* @__PURE__ */ __name((prefix, key) => {
|
|
428
|
-
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
|
429
|
-
}, "prefixKey");
|
|
430
|
-
Object.keys(unitlessNumbers).forEach((prop) => {
|
|
431
|
-
prefixes.forEach((prefix) => {
|
|
432
|
-
unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];
|
|
433
|
-
});
|
|
434
|
-
});
|
|
435
358
|
const resolveShadowValue = /* @__PURE__ */ __name((style) => {
|
|
436
359
|
const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
|
|
360
|
+
if (shadowRadius === void 0) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
437
363
|
const { height, width } = shadowOffset || defaultOffset;
|
|
438
364
|
const offsetX = normalizeValueWithProperty(width);
|
|
439
365
|
const offsetY = normalizeValueWithProperty(height);
|
|
440
366
|
const blurRadius = normalizeValueWithProperty(shadowRadius || 0);
|
|
441
|
-
const color = normalizeColor(shadowColor || "black", shadowOpacity);
|
|
442
|
-
|
|
443
|
-
return `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
444
|
-
}
|
|
367
|
+
const color = normalizeColor(String(shadowColor || "black"), shadowOpacity);
|
|
368
|
+
return `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
445
369
|
}, "resolveShadowValue");
|
|
446
370
|
function boxShadowReducer(resolvedStyle, style) {
|
|
447
371
|
const { boxShadow } = style;
|
|
@@ -465,11 +389,30 @@ function textShadowReducer(resolvedStyle, style) {
|
|
|
465
389
|
}
|
|
466
390
|
}
|
|
467
391
|
__name(textShadowReducer, "textShadowReducer");
|
|
392
|
+
const STYLE_SHORT_FORM_EXPANSIONS = __spreadValues({
|
|
393
|
+
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"],
|
|
394
|
+
borderRadius: [
|
|
395
|
+
"borderTopLeftRadius",
|
|
396
|
+
"borderTopRightRadius",
|
|
397
|
+
"borderBottomRightRadius",
|
|
398
|
+
"borderBottomLeftRadius"
|
|
399
|
+
],
|
|
400
|
+
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"],
|
|
401
|
+
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
|
|
402
|
+
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
|
|
403
|
+
marginHorizontal: ["marginRight", "marginLeft"],
|
|
404
|
+
marginVertical: ["marginTop", "marginBottom"],
|
|
405
|
+
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
|
|
406
|
+
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
407
|
+
paddingHorizontal: ["paddingRight", "paddingLeft"],
|
|
408
|
+
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
409
|
+
}, import_platform.isWeb && {
|
|
410
|
+
overflow: ["overflowX", "overflowY"]
|
|
411
|
+
});
|
|
468
412
|
// Annotate the CommonJS export names for ESM import in node:
|
|
469
413
|
0 && (module.exports = {
|
|
470
414
|
expandStyle,
|
|
471
415
|
expandStyles,
|
|
472
|
-
generateAtomicStyles
|
|
473
|
-
inline
|
|
416
|
+
generateAtomicStyles
|
|
474
417
|
});
|
|
475
418
|
//# sourceMappingURL=generateAtomicStyles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/generateAtomicStyles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { prefixInlineStyles, prefixStyles } from './prefixStyles'\n\nexport function expandStyles(style: any) {\n const res = {}\n for (const key in style) {\n updateReactDOMStyle(res, key, style[key])\n }\n return res\n}\n\n// TODO can use for inline styles...\n/**\n * Compile simple style object to inline DOM styles.\n * No support for 'animationKeyframes', 'placeholderTextColor', 'scrollbarWidth', or 'pointerEvents'.\n */\nexport function inline(style: Style): Object {\n return prefixInlineStyles(expandStyles(style))\n}\n\ntype Rule = string\ntype Rules = Array<Rule>\nexport type RulesData = {\n property?: string\n value?: string\n identifier: string\n rules: Rules\n}\ntype CompilerOutput = { [key: string]: RulesData }\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\n\nconst STYLE_SHORT_FORM_EXPANSIONS = {\n borderColor: ['borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor'],\n borderRadius: [\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderBottomRightRadius',\n 'borderBottomLeftRadius',\n ],\n borderStyle: ['borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle'],\n borderWidth: ['borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth'],\n margin: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n marginHorizontal: ['marginRight', 'marginLeft'],\n marginVertical: ['marginTop', 'marginBottom'],\n overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],\n padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n paddingHorizontal: ['paddingRight', 'paddingLeft'],\n paddingVertical: ['paddingTop', 'paddingBottom'],\n ...(isWeb && {\n // react-native doesn't support X / Y\n overflow: ['overflowX', 'overflowY'],\n }),\n}\n\nexport const generateAtomicStyles = (style: ViewStyle & TextStyle): CompilerOutput => {\n const res = expandStyles(style)\n\n if (\n style.shadowColor != null ||\n style.shadowOffset != null ||\n style.shadowOpacity != null ||\n style.shadowRadius != null\n ) {\n boxShadowReducer(res, style)\n delete res['shadowColor']\n delete res['shadowOffset']\n delete res['shadowOpacity']\n delete res['shadowRadius']\n }\n\n if (\n style.textShadowColor != null ||\n style.textShadowOffset != null ||\n style.textShadowRadius != null\n ) {\n textShadowReducer(res, style)\n delete res['textShadowColor']\n delete res['textShadowOffset']\n delete res['textShadowRadius']\n }\n\n const out = {}\n for (const key in res) {\n const value = res[key]\n if (value != null) {\n const valueString = stringifyValueWithProperty(value, key)\n const cachedResult = cache.get(key, valueString)\n if (cachedResult != null) {\n const { identifier } = cachedResult\n out[identifier] = cachedResult\n } else {\n const identifier = createIdentifier('r', key, value)\n const rules = createAtomicRules(identifier, key, value)\n const cachedResult = cache.set(key, valueString, {\n property: key,\n value: stringifyValueWithProperty(value, key),\n identifier,\n rules,\n })\n out[identifier] = cachedResult\n }\n }\n }\n\n return out\n}\n\nfunction updateReactDOMStyle(style: Object, key: string, value: any) {\n value = normalizeValueWithProperty(value, key)\n const out = expandStyle(key, value)\n if (out) {\n Object.assign(style, Object.fromEntries(out))\n } else {\n style[key] = value\n }\n}\n\nexport function expandStyle(key: string, value: any) {\n if (key === 'flex') {\n // The 'flex' property value in React Native must be a positive integer,\n // 0, or -1.\n if (value <= -1) {\n return [\n ['flexGrow', 0],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n // normalizing to better align with native\n // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex\n if (value >= 0) {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ]\n }\n return\n }\n\n // web only\n switch (key) {\n // Ignore some React Native styles\n case 'elevation':\n case 'overlayColor':\n case 'resizeMode':\n case 'tintColor': {\n break\n }\n\n case 'aspectRatio': {\n return [[key, value.toString()]]\n }\n\n // TODO: remove once this issue is fixed\n // https://github.com/rofrischmann/inline-style-prefixer/issues/159\n case 'backgroundClip': {\n if (value === 'text') {\n return [\n ['backgroundClip', value],\n ['WebkitBackgroundClip', value],\n ]\n }\n break\n }\n\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n\n case 'textDecorationLine': {\n return [['textDecorationLine', value]]\n }\n\n case 'transform': {\n if (Array.isArray(value)) {\n return [[key, value.map(mapTransform).join(' ')]]\n }\n break\n }\n\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n\n const longKey = STYLE_SHORT_FORM_EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n } else {\n if (isWeb && Array.isArray(value)) {\n return [[key, value.join(',')]]\n }\n }\n}\n\nfunction createAtomicRules(identifier: string, property, value): Rules {\n const rules: string[] = []\n const selector = `.${identifier}`\n\n // Handle non-standard properties and object values that require multiple\n // CSS rules to be created.\n switch (property) {\n case 'animationKeyframes': {\n const { animationNames, rules: keyframesRules } = processKeyframesValue(value)\n const block = createDeclarationBlock({ animationName: animationNames.join(',') })\n rules.push(`${selector}${block}`, ...keyframesRules)\n break\n }\n\n // Equivalent to using '::placeholder'\n case 'placeholderTextColor': {\n const block = createDeclarationBlock({ color: value, opacity: 1 })\n rules.push(\n `${selector}::-webkit-input-placeholder${block}`,\n `${selector}::-moz-placeholder${block}`,\n `${selector}:-ms-input-placeholder${block}`,\n `${selector}::placeholder${block}`\n )\n break\n }\n\n // Polyfill for additional 'pointer-events' values\n // See d13f78622b233a0afc0c7a200c0a0792c8ca9e58\n case 'pointerEvents': {\n let finalValue = value\n if (value === 'auto' || value === 'box-only') {\n finalValue = 'auto!important'\n if (value === 'box-only') {\n const block = createDeclarationBlock({ pointerEvents: 'none' })\n rules.push(`${selector}>*${block}`)\n }\n } else if (value === 'none' || value === 'box-none') {\n finalValue = 'none!important'\n if (value === 'box-none') {\n const block = createDeclarationBlock({ pointerEvents: 'auto' })\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue })\n rules.push(`${selector}${block}`)\n break\n }\n\n // Polyfill for draft spec\n // https://drafts.csswg.org/css-scrollbars-1/\n case 'scrollbarWidth': {\n if (value === 'none') {\n rules.push(`${selector}::-webkit-scrollbar{display:none}`)\n }\n const block = createDeclarationBlock({ scrollbarWidth: value })\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value })\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n return rules\n}\n\n/**\n * Create CSS keyframes rules and names from a StyleSheet keyframes object.\n */\nfunction processKeyframesValue(keyframesValue: number | string[]) {\n if (typeof keyframesValue === 'number') {\n throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`)\n }\n\n const animationNames: string[] = []\n const rules: string[] = []\n const value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue]\n\n for (const keyframes of value) {\n if (typeof keyframes === 'string') {\n // Support external animation libraries (identifiers only)\n animationNames.push(keyframes)\n } else {\n // Create rules for each of the keyframes\n const { identifier, rules: keyframesRules } = createKeyframes(keyframes)\n animationNames.push(identifier)\n rules.push(...keyframesRules)\n }\n }\n\n return { animationNames, rules }\n}\n\n/**\n * Create individual CSS keyframes rules.\n */\nfunction createKeyframes(keyframes) {\n const prefixes = ['-webkit-', '']\n const identifier = createIdentifier('r', 'animation', keyframes)\n\n const steps =\n '{' +\n Object.keys(keyframes)\n .map((stepName) => {\n const rule = keyframes[stepName]\n const block = createDeclarationBlock(rule)\n return `${stepName}${block}`\n })\n .join('') +\n '}'\n\n const rules = prefixes.map((prefix) => {\n return `@${prefix}keyframes ${identifier}${steps}`\n })\n return { identifier, rules }\n}\n\n/**\n * Creates a CSS declaration block from a StyleSheet object.\n */\nfunction createDeclarationBlock(style: Style) {\n const domStyle = prefixStyles(expandStyles(style))\n const declarationsString = Object.keys(domStyle)\n .map((property) => {\n const value = domStyle[property]\n const prop = hyphenateStyleName(property)\n // The prefixer may return an array of values:\n // { display: [ '-webkit-flex', 'flex' ] }\n // to represent \"fallback\" declarations\n // { display: -webkit-flex; display: flex; }\n if (Array.isArray(value)) {\n return value.map((v) => `${prop}:${v}`).join(';')\n } else {\n return `${prop}:${value}`\n }\n })\n // Once properties are hyphenated, this will put the vendor\n // prefixed and short-form properties first in the list.\n .sort()\n .join(';')\n\n return `{${declarationsString};}`\n}\n\nfunction createIdentifier(prefix: string, name: string, value): string {\n const hashedString = simpleHash(name + stringifyValueWithProperty(value, name))\n return `${prefix}-${hashedString}`\n}\n\nconst cache = {\n get(property, value) {\n if (\n cache[property] != null &&\n cache[property].hasOwnProperty(value) &&\n cache[property][value] != null\n ) {\n return cache[property][value]\n }\n },\n set(property, value, object) {\n if (cache[property] == null) {\n cache[property] = {}\n }\n return (cache[property][value] = object)\n },\n}\n\nfunction stringifyValueWithProperty(value: Value, property?: string): string {\n // e.g., 0 => '0px', 'black' => 'rgba(0,0,0,1)'\n const normalizedValue = normalizeValueWithProperty(value, property)\n return typeof normalizedValue !== 'string'\n ? JSON.stringify(normalizedValue || '')\n : normalizedValue\n}\n\n// { scale: 2 } => 'scale(2)'\n// { translateX: 20 } => 'translateX(20px)'\n// { matrix: [1,2,3,4,5,6] } => 'matrix(1,2,3,4,5,6)'\nconst mapTransform = (transform) => {\n const type = Object.keys(transform)[0]\n const value = transform[type]\n if (type === 'matrix' || type === 'matrix3d') {\n return `${type}(${value.join(',')})`\n } else {\n const normalizedValue = normalizeValueWithProperty(value, type)\n return `${type}(${normalizedValue})`\n }\n}\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nfunction normalizeValueWithProperty(value: any, property?: string): any {\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (\n (property === undefined || property === null || !unitlessNumbers[property]) &&\n typeof value === 'number'\n ) {\n return `${value}px`\n }\n }\n if (property && colorProps[property]) {\n return normalizeColor(value)\n }\n return value\n}\n\nconst normalizeColor = (color?: number | string, opacity = 1): void | string => {\n if (color == null || color == undefined) {\n return\n }\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (typeof color === 'string' && isWebColor(color)) {\n return color\n }\n }\n const colorInt = processColor(color)\n if (colorInt != null) {\n const r = (colorInt >> 16) & 255\n const g = (colorInt >> 8) & 255\n const b = colorInt & 255\n const a = ((colorInt >> 24) & 255) / 255\n const alpha = (a * opacity).toFixed(2)\n return `rgba(${r},${g},${b},${alpha})`\n }\n}\n\nconst isWebColor = (color: string): boolean =>\n color === 'currentcolor' ||\n color === 'currentColor' ||\n color === 'inherit' ||\n color.indexOf('var(') === 0\n\nconst processColor = (color?: number | string): number | undefined | null => {\n if (color === undefined || color === null) {\n return color\n }\n let intColor = normalizeCSSColor(color)\n if (intColor === undefined || intColor === null) {\n return undefined\n }\n return ((+intColor << 24) | (+intColor >>> 8)) >>> 0\n}\n\nconst unitlessNumbers = {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFleGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n/**\n * Support style names that may come passed in prefixed by adding permutations\n * of vendor prefixes.\n */\nconst prefixes = ['ms', 'Moz', 'O', 'Webkit']\nconst prefixKey = (prefix: string, key: string) => {\n return prefix + key.charAt(0).toUpperCase() + key.substring(1)\n}\nObject.keys(unitlessNumbers).forEach((prop) => {\n prefixes.forEach((prefix) => {\n unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop]\n })\n})\n\nconst resolveShadowValue = (style: ViewStyle): void | string => {\n const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n // @ts-ignore\n const color = normalizeColor(shadowColor || 'black', shadowOpacity)\n if (color != null && offsetX != null && offsetY != null && blurRadius != null) {\n return `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n\nfunction boxShadowReducer(resolvedStyle, style) {\n const { boxShadow } = style\n const shadow = resolveShadowValue(style)\n if (shadow != null) {\n resolvedStyle.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n }\n}\n\nconst defaultOffset = { height: 0, width: 0 }\nfunction textShadowReducer(resolvedStyle, style) {\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(radius)\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n\n if (\n color &&\n (height !== 0 || width !== 0 || radius !== 0) &&\n offsetX != null &&\n offsetY != null &&\n blurRadius != null\n ) {\n resolvedStyle.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { simpleHash } from '@tamagui/helpers'\nimport hyphenateStyleName from 'hyphenate-style-name'\nimport normalizeCSSColor from 'normalize-css-color'\nimport { TextStyle, ViewStyle } from 'react-native'\n\nimport { isWeb } from '../constants/platform'\nimport { pseudos } from './pseudos'\n\ntype Value = Object | Array<any> | string | number\nexport type Style = { [key: string]: Value }\n\ntype Rule = string\ntype Rules = Array<Rule>\n\nexport type RulesData = {\n property?: string\n value?: string\n identifier: string\n rules: Rules\n}\n\ntype CompilerOutput = { [key: string]: RulesData }\n\nconst reducedStyleKeys = {\n shadowColor: true,\n shadowOffset: true,\n shadowOpacity: true,\n shadowRadius: true,\n textShadowColor: true,\n textShadowOffset: true,\n textShadowRadius: true,\n}\n\nexport function expandStyles(style: any) {\n const res = {}\n boxShadowReducer(res, style)\n textShadowReducer(res, style)\n for (const key in style) {\n if (reducedStyleKeys[key]) continue\n if (key in pseudos) {\n res[key] = expandStyles(style[key])\n } else {\n updateReactDOMStyle(res, key, style[key])\n }\n }\n return res\n}\n\nfunction updateReactDOMStyle(style: Object, key: string, value: any) {\n value = normalizeValueWithProperty(value, key)\n const out = expandStyle(key, value)\n if (out) {\n Object.assign(style, Object.fromEntries(out))\n } else {\n style[key] = value\n }\n}\n\nexport const generateAtomicStyles = (style: ViewStyle & TextStyle): CompilerOutput => {\n const res = expandStyles(style)\n\n const out = {}\n for (const key in res) {\n const value = res[key]\n if (value != null) {\n const valueString = stringifyValueWithProperty(value, key)\n const cachedResult = cache.get(key, valueString)\n if (cachedResult != null) {\n const { identifier } = cachedResult\n out[identifier] = cachedResult\n } else {\n const identifier = simpleHash(key + valueString)\n const rules = createAtomicRules(identifier, key, valueString)\n const cachedResult = cache.set(key, valueString, {\n property: key,\n value: valueString,\n identifier,\n rules,\n })\n out[identifier] = cachedResult\n }\n }\n }\n\n return out\n}\n\nexport function expandStyle(key: string, value: any) {\n if (key === 'flex') {\n // The 'flex' property value in React Native must be a positive integer,\n // 0, or -1.\n if (value <= -1) {\n return [\n ['flexGrow', 0],\n ['flexShrink', 1],\n ['flexBasis', 'auto'],\n ]\n }\n // normalizing to better align with native\n // see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex\n if (value >= 0) {\n return [\n ['flexGrow', value],\n ['flexShrink', 1],\n ]\n }\n return\n }\n\n // web only\n switch (key) {\n // Ignore some React Native styles\n case 'elevation':\n case 'overlayColor':\n case 'resizeMode':\n case 'tintColor': {\n break\n }\n\n case 'aspectRatio': {\n return [[key, value.toString()]]\n }\n\n // TODO: remove once this issue is fixed\n // https://github.com/rofrischmann/inline-style-prefixer/issues/159\n case 'backgroundClip': {\n if (value === 'text') {\n return [\n ['backgroundClip', value],\n ['WebkitBackgroundClip', value],\n ]\n }\n break\n }\n\n case 'textAlignVertical': {\n return [['verticalAlign', value === 'center' ? 'middle' : value]]\n }\n\n case 'textDecorationLine': {\n return [['textDecorationLine', value]]\n }\n\n case 'transform': {\n if (Array.isArray(value)) {\n return [[key, value.map(mapTransform).join(' ')]]\n }\n break\n }\n\n case 'writingDirection': {\n return [['direction', value]]\n }\n }\n\n const longKey = STYLE_SHORT_FORM_EXPANSIONS[key]\n if (longKey) {\n return longKey.map((key) => {\n return [key, value]\n })\n } else {\n if (isWeb && Array.isArray(value)) {\n return [[key, value.join(',')]]\n }\n }\n}\n\nfunction createAtomicRules(identifier: string, property, value): Rules {\n const rules: string[] = []\n const selector = `.${identifier}`\n\n // Handle non-standard properties and object values that require multiple\n // CSS rules to be created.\n switch (property) {\n // Equivalent to using '::placeholder'\n case 'placeholderTextColor': {\n const block = createDeclarationBlock({ color: value, opacity: 1 })\n rules.push(`${selector}::placeholder${block}`)\n break\n }\n\n // Polyfill for additional 'pointer-events' values\n // See d13f78622b233a0afc0c7a200c0a0792c8ca9e58\n case 'pointerEvents': {\n let finalValue = value\n if (value === 'auto' || value === 'box-only') {\n finalValue = 'auto!important'\n if (value === 'box-only') {\n const block = createDeclarationBlock({ pointerEvents: 'none' })\n rules.push(`${selector}>*${block}`)\n }\n } else if (value === 'none' || value === 'box-none') {\n finalValue = 'none!important'\n if (value === 'box-none') {\n const block = createDeclarationBlock({ pointerEvents: 'auto' })\n rules.push(`${selector}>*${block}`)\n }\n }\n const block = createDeclarationBlock({ pointerEvents: finalValue })\n rules.push(`${selector}${block}`)\n break\n }\n\n // Polyfill for draft spec\n // https://drafts.csswg.org/css-scrollbars-1/\n case 'scrollbarWidth': {\n if (value === 'none') {\n rules.push(`${selector}::-webkit-scrollbar{display:none}`)\n }\n const block = createDeclarationBlock({ scrollbarWidth: value })\n rules.push(`${selector}${block}`)\n break\n }\n\n default: {\n const block = createDeclarationBlock({ [property]: value })\n rules.push(`${selector}${block}`)\n break\n }\n }\n\n return rules\n}\n\n/**\n * Creates a CSS declaration block from a StyleSheet object.\n */\nfunction createDeclarationBlock(style: Style) {\n const domStyle = expandStyles(style)\n const declarationsString = Object.keys(domStyle)\n .map((property) => {\n const value = domStyle[property]\n const prop = hyphenateStyleName(property)\n return `${prop}:${value}`\n })\n // Once properties are hyphenated, this will put the vendor\n // prefixed and short-form properties first in the list.\n .sort()\n .join(';')\n\n return `{${declarationsString};}`\n}\n\nconst cache = {\n get(property, value) {\n if (\n cache[property] != null &&\n cache[property].hasOwnProperty(value) &&\n cache[property][value] != null\n ) {\n return cache[property][value]\n }\n },\n set(property, value, object) {\n if (cache[property] == null) {\n cache[property] = {}\n }\n return (cache[property][value] = object)\n },\n}\n\nfunction stringifyValueWithProperty(value: Value, property?: string): string {\n // e.g., 0 => '0px', 'black' => 'rgba(0,0,0,1)'\n return normalizeValueWithProperty(value, property)\n}\n\n// { scale: 2 } => 'scale(2)'\n// { translateX: 20 } => 'translateX(20px)'\n// { matrix: [1,2,3,4,5,6] } => 'matrix(1,2,3,4,5,6)'\nconst mapTransform = (transform) => {\n const type = Object.keys(transform)[0]\n const value = transform[type]\n if (type === 'matrix' || type === 'matrix3d') {\n return `${type}(${value.join(',')})`\n } else {\n const normalizedValue = normalizeValueWithProperty(value, type)\n return `${type}(${normalizedValue})`\n }\n}\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nfunction normalizeValueWithProperty(value: any, property?: string): any {\n if (process.env.TAMAGUI_TARGET === 'web') {\n const shouldCoerceToPx =\n typeof value === 'number' &&\n (property === undefined || property === null || !unitlessNumbers[property])\n if (shouldCoerceToPx) {\n return `${value}px`\n }\n }\n if (property && colorProps[property]) {\n return normalizeColor(value)\n }\n return value\n}\n\nconst normalizeColor = (color?: number | string, opacity = 1): void | string => {\n if (color == null || color == undefined) {\n return\n }\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (typeof color === 'string' && isWebColor(color)) {\n return color\n }\n }\n const colorInt = processColor(color)\n if (colorInt != null) {\n const r = (colorInt >> 16) & 255\n const g = (colorInt >> 8) & 255\n const b = colorInt & 255\n const a = ((colorInt >> 24) & 255) / 255\n const alpha = (a * opacity).toFixed(2)\n return `rgba(${r},${g},${b},${alpha})`\n }\n return `${color}`\n}\n\nconst isWebColor = (color: string): boolean =>\n color === 'currentcolor' ||\n color === 'currentColor' ||\n color === 'inherit' ||\n color.indexOf('var(') === 0\n\nconst processColor = (color?: number | string): number | undefined | null => {\n if (color === undefined || color === null) {\n return color\n }\n let intColor = normalizeCSSColor(color)\n if (intColor === undefined || intColor === null) {\n return undefined\n }\n return ((+intColor << 24) | (+intColor >>> 8)) >>> 0\n}\n\nconst unitlessNumbers = {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFleGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n\n/**\n * Support style names that may come passed in prefixed by adding permutations\n * of vendor prefixes.\n */\n\nconst resolveShadowValue = (style: ViewStyle): void | string => {\n const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style\n if (shadowRadius === undefined) {\n return\n }\n const { height, width } = shadowOffset || defaultOffset\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(shadowRadius || 0)\n const color = normalizeColor(String(shadowColor || 'black'), shadowOpacity)\n return `${offsetX} ${offsetY} ${blurRadius} ${color}`\n}\n\nfunction boxShadowReducer(resolvedStyle, style) {\n const { boxShadow } = style\n const shadow = resolveShadowValue(style)\n if (shadow != null) {\n resolvedStyle.boxShadow = boxShadow ? `${boxShadow}, ${shadow}` : shadow\n }\n}\n\nconst defaultOffset = { height: 0, width: 0 }\nfunction textShadowReducer(resolvedStyle, style) {\n const { textShadowColor, textShadowOffset, textShadowRadius } = style\n const { height, width } = textShadowOffset || defaultOffset\n const radius = textShadowRadius || 0\n const offsetX = normalizeValueWithProperty(width)\n const offsetY = normalizeValueWithProperty(height)\n const blurRadius = normalizeValueWithProperty(radius)\n const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')\n\n if (\n color &&\n (height !== 0 || width !== 0 || radius !== 0) &&\n offsetX != null &&\n offsetY != null &&\n blurRadius != null\n ) {\n resolvedStyle.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`\n }\n}\n\nconst STYLE_SHORT_FORM_EXPANSIONS = {\n borderColor: ['borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor'],\n borderRadius: [\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderBottomRightRadius',\n 'borderBottomLeftRadius',\n ],\n borderStyle: ['borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle'],\n borderWidth: ['borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth'],\n margin: ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n marginHorizontal: ['marginRight', 'marginLeft'],\n marginVertical: ['marginTop', 'marginBottom'],\n overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],\n padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n paddingHorizontal: ['paddingRight', 'paddingLeft'],\n paddingVertical: ['paddingTop', 'paddingBottom'],\n ...(isWeb && {\n // react-native doesn't support X / Y\n overflow: ['overflowX', 'overflowY'],\n }),\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAA2B;AAC3B,kCAA+B;AAC/B,iCAA8B;AAG9B,sBAAsB;AACtB,qBAAwB;AAiBxB,MAAM,mBAAmB;AAAA,EACvB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,kBAAkB;AACpB;AAEO,sBAAsB,OAAY;AACvC,QAAM,MAAM,CAAC;AACb,mBAAiB,KAAK,KAA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