@tamagui/web 3.0.0-beta.831.1 → 3.0.0-beta.889.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.cjs +12 -1
- package/dist/cjs/createComponent.native.cjs +12 -1
- package/dist/cjs/createComponent.native.js +12 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.js +1 -1
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createVariable.cjs +0 -10
- package/dist/cjs/createVariable.native.cjs +0 -10
- package/dist/cjs/createVariable.native.js +0 -10
- package/dist/cjs/createVariable.native.js.map +1 -1
- package/dist/cjs/helpers/borderComponents.cjs +62 -0
- package/dist/cjs/helpers/borderComponents.native.cjs +82 -0
- package/dist/cjs/helpers/borderComponents.native.js +84 -0
- package/dist/cjs/helpers/borderComponents.native.js.map +1 -0
- package/dist/cjs/helpers/createDesignSystem.cjs +0 -2
- package/dist/cjs/helpers/createStyledContext.cjs +10 -18
- package/dist/cjs/helpers/createStyledContext.native.cjs +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js.map +1 -1
- package/dist/cjs/helpers/formatDiagnostic.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +128 -109
- package/dist/cjs/helpers/getCSSStylesAtomic.native.cjs +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.cjs +13 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.cjs +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/cjs/helpers/getDynamicVal.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +1042 -1715
- package/dist/cjs/helpers/getSplitStyles.native.cjs +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/grammarConfig.cjs +163 -1
- package/dist/cjs/helpers/grammarConfig.native.cjs +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +5 -1
- package/dist/cjs/helpers/insertStyleRule.native.cjs +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/log.cjs +9 -8
- package/dist/cjs/helpers/log.native.cjs +9 -8
- package/dist/cjs/helpers/log.native.js +9 -8
- package/dist/cjs/helpers/log.native.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.cjs +44 -13
- package/dist/cjs/helpers/mergeVariants.native.cjs +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
- package/dist/cjs/helpers/nativeOnlyProps.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/cjs/helpers/nativeStyleEngine.cjs +34 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.cjs +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.cjs +7 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.cjs +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/cjs/helpers/parseBorderShorthand.native.cjs +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/parseOutlineShorthand.native.cjs +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/resolveSafeArea.cjs +35 -100
- package/dist/cjs/helpers/resolveVariantStyle.cjs +57 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.cjs +67 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js +69 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/cjs/helpers/styleStaticConfig.cjs +1 -50
- package/dist/cjs/helpers/styleStaticConfig.native.cjs +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/cjs/helpers/styleStaticConfigCore.cjs +107 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +127 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js +129 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/cjs/helpers/styledDynamic.cjs +160 -0
- package/dist/cjs/helpers/styledDynamic.native.cjs +195 -0
- package/dist/cjs/helpers/styledDynamic.native.js +197 -0
- package/dist/cjs/helpers/styledDynamic.native.js.map +1 -0
- package/dist/cjs/helpers/tokenCategories.cjs +15 -38
- package/dist/cjs/helpers/tokenCategories.native.cjs +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
- package/dist/cjs/helpers/variableValue.cjs +17 -12
- package/dist/cjs/helpers/variableValue.native.cjs +46 -23
- package/dist/cjs/helpers/variableValue.native.js +46 -23
- package/dist/cjs/helpers/variableValue.native.js.map +1 -1
- package/dist/cjs/helpers/warnOnce.cjs +5 -4
- package/dist/cjs/helpers/warnOnce.native.cjs +6 -4
- package/dist/cjs/helpers/warnOnce.native.js +6 -4
- package/dist/cjs/helpers/warnOnce.native.js.map +1 -1
- package/dist/cjs/hooks/useAnimationDriver.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +41 -82
- package/dist/cjs/hooks/useComponentState.native.cjs +45 -84
- package/dist/cjs/hooks/useComponentState.native.js +45 -84
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.js +2 -2
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.cjs} +16 -8
- package/dist/cjs/{helpers/directStyleCSS.native.cjs → hooks/useStyle.native.cjs} +16 -4
- package/dist/cjs/hooks/useStyle.native.js +34 -0
- package/dist/cjs/hooks/useStyle.native.js.map +1 -0
- package/dist/cjs/hooks/useThemeState.cjs +25 -90
- package/dist/cjs/hooks/useThemeState.native.cjs +34 -94
- package/dist/cjs/hooks/useThemeState.native.js +34 -94
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/index.cjs +6 -3
- package/dist/cjs/index.native.cjs +6 -3
- package/dist/cjs/index.native.js +6 -3
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +2 -2
- package/dist/cjs/static-resolve.native.cjs +2 -2
- package/dist/cjs/static-resolve.native.js +2 -2
- package/dist/cjs/static-resolve.native.js.map +1 -1
- package/dist/cjs/style.cjs +91 -0
- package/dist/cjs/style.native.cjs +98 -0
- package/dist/cjs/style.native.js +100 -0
- package/dist/cjs/style.native.js.map +1 -0
- package/dist/cjs/styled.cjs +11 -6
- package/dist/cjs/styled.native.cjs +11 -6
- package/dist/cjs/styled.native.js +11 -6
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +6 -4
- package/dist/cjs/types.native.cjs +6 -4
- package/dist/cjs/types.native.js +6 -4
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +17 -12
- package/dist/cjs/views/Text.native.cjs +1 -0
- package/dist/cjs/views/Text.native.js +1 -0
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +3 -3
- package/dist/cjs/views/Theme.native.cjs +3 -3
- package/dist/cjs/views/Theme.native.js +3 -3
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.cjs +1 -4
- package/dist/esm/createComponent.mjs +12 -1
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +12 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +1 -1
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +1 -1
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createVariable.mjs +1 -9
- package/dist/esm/createVariable.mjs.map +1 -1
- package/dist/esm/createVariable.native.js +1 -9
- package/dist/esm/createVariable.native.js.map +1 -1
- package/dist/esm/helpers/borderComponents.mjs +37 -0
- package/dist/esm/helpers/borderComponents.mjs.map +1 -0
- package/dist/esm/helpers/borderComponents.native.js +55 -0
- package/dist/esm/helpers/borderComponents.native.js.map +1 -0
- package/dist/esm/helpers/createDesignSystem.mjs +0 -2
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.mjs +10 -18
- package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.native.js +14 -18
- package/dist/esm/helpers/createStyledContext.native.js.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.mjs +6 -6
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +6 -6
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +126 -109
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.native.js +7 -4
- package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +8 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +10 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/esm/helpers/getDynamicVal.mjs +5 -1
- package/dist/esm/helpers/getDynamicVal.mjs.map +1 -1
- package/dist/esm/helpers/getDynamicVal.native.js +5 -1
- package/dist/esm/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +1034 -1705
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +1071 -1871
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/grammarConfig.mjs +164 -2
- package/dist/esm/helpers/grammarConfig.mjs.map +1 -1
- package/dist/esm/helpers/grammarConfig.native.js +187 -2
- package/dist/esm/helpers/grammarConfig.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +5 -2
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +7 -2
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/log.mjs +9 -8
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +9 -8
- package/dist/esm/helpers/log.native.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.mjs +44 -13
- package/dist/esm/helpers/mergeVariants.mjs.map +1 -1
- package/dist/esm/helpers/mergeVariants.native.js +79 -14
- package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs +0 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.mjs +34 -15
- package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.native.js +36 -15
- package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +7 -8
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/esm/helpers/parseBorderShorthand.native.js +23 -56
- package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/esm/helpers/parseOutlineShorthand.native.js +10 -49
- package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/esm/helpers/resolveSafeArea.mjs +35 -97
- package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -1
- package/dist/esm/helpers/resolveVariantStyle.mjs +38 -0
- package/dist/esm/helpers/resolveVariantStyle.mjs.map +1 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js +46 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +1 -50
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -1
- package/dist/esm/helpers/styleStaticConfig.native.js +1 -51
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/esm/helpers/styleStaticConfigCore.mjs +88 -0
- package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js +106 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/esm/helpers/styledDynamic.mjs +136 -0
- package/dist/esm/helpers/styledDynamic.mjs.map +1 -0
- package/dist/esm/helpers/styledDynamic.native.js +169 -0
- package/dist/esm/helpers/styledDynamic.native.js.map +1 -0
- package/dist/esm/helpers/tokenCategories.mjs +15 -36
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +15 -38
- package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
- package/dist/esm/helpers/variableValue.mjs +17 -12
- package/dist/esm/helpers/variableValue.mjs.map +1 -1
- package/dist/esm/helpers/variableValue.native.js +46 -23
- package/dist/esm/helpers/variableValue.native.js.map +1 -1
- package/dist/esm/helpers/warnOnce.mjs +5 -4
- package/dist/esm/helpers/warnOnce.mjs.map +1 -1
- package/dist/esm/helpers/warnOnce.native.js +6 -4
- package/dist/esm/helpers/warnOnce.native.js.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
- package/dist/esm/hooks/useAnimationDriver.mjs.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.native.js +2 -2
- package/dist/esm/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +41 -82
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +45 -84
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +2 -2
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +2 -2
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useStyle.mjs +11 -0
- package/dist/esm/hooks/useStyle.mjs.map +1 -0
- package/dist/esm/hooks/useStyle.native.js +11 -0
- package/dist/esm/hooks/useStyle.native.js.map +1 -0
- package/dist/esm/hooks/useThemeState.mjs +25 -90
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +34 -94
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/index.native.js +6 -4
- package/dist/esm/static-resolve.mjs +3 -3
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +3 -3
- package/dist/esm/static-resolve.native.js.map +1 -1
- package/dist/esm/style.mjs +58 -0
- package/dist/esm/style.mjs.map +1 -0
- package/dist/esm/style.native.js +63 -0
- package/dist/esm/style.native.js.map +1 -0
- package/dist/esm/styled.mjs +12 -6
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +12 -6
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +3 -4
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +3 -4
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.mjs +1 -2
- package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +1 -2
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +17 -12
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Theme.mjs +3 -3
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +3 -3
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/dist/esm/views/ThemeDebug.mjs +1 -4
- package/dist/esm/views/ThemeDebug.mjs.map +1 -1
- package/package.json +15 -15
- package/src/createComponent.tsx +21 -1
- package/src/createStyledHOC.tsx +4 -2
- package/src/createVariable.ts +0 -10
- package/src/helpers/borderComponents.ts +62 -0
- package/src/helpers/createDesignSystem.ts +0 -2
- package/src/helpers/createStyledContext.tsx +15 -53
- package/src/helpers/formatDiagnostic.ts +9 -9
- package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
- package/src/helpers/getCSSStylesAtomic.ts +192 -207
- package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
- package/src/helpers/getDynamicVal.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +2080 -3270
- package/src/helpers/grammarConfig.ts +218 -1
- package/src/helpers/insertStyleRule.tsx +4 -2
- package/src/helpers/log.ts +12 -11
- package/src/helpers/mergeVariants.ts +55 -18
- package/src/helpers/nativeOnlyProps.ts +0 -1
- package/src/helpers/nativeStyleEngine.ts +55 -14
- package/src/helpers/normalizeValueWithProperty.ts +10 -12
- package/src/helpers/parseBorderShorthand.native.ts +23 -45
- package/src/helpers/parseOutlineShorthand.native.ts +9 -40
- package/src/helpers/resolveSafeArea.ts +34 -101
- package/src/helpers/resolveVariantStyle.ts +77 -0
- package/src/helpers/styleFrontend.ts +8 -5
- package/src/helpers/styleStaticConfig.ts +5 -72
- package/src/helpers/styleStaticConfigCore.ts +110 -0
- package/src/helpers/styledDynamic.ts +191 -0
- package/src/helpers/tokenCategories.ts +40 -65
- package/src/helpers/variableValue.ts +20 -15
- package/src/helpers/warnOnce.ts +5 -4
- package/src/hooks/useAnimationDriver.ts +6 -2
- package/src/hooks/useComponentState.ts +55 -183
- package/src/hooks/useMedia.tsx +10 -8
- package/src/hooks/useStyle.ts +10 -0
- package/src/hooks/useThemeState.ts +51 -264
- package/src/index.ts +6 -6
- package/src/internalRuntimeTypes.ts +1 -0
- package/src/static-resolve.ts +7 -4
- package/src/style.ts +97 -0
- package/src/styled.tsx +39 -68
- package/src/types.tsx +105 -169
- package/src/views/TamaguiProvider.tsx +0 -2
- package/src/views/Text.tsx +20 -14
- package/src/views/Theme.tsx +13 -9
- package/src/views/ThemeDebug.tsx +0 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createStyledHOC.d.ts +1 -1
- package/types/createStyledHOC.d.ts.map +1 -1
- package/types/createVariable.d.ts +0 -2
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/borderComponents.d.ts +10 -0
- package/types/helpers/borderComponents.d.ts.map +1 -0
- package/types/helpers/createDesignSystem.d.ts.map +1 -1
- package/types/helpers/createStyledContext.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +20 -19
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.native.d.ts +5 -0
- package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts +6 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -1
- package/types/helpers/getDynamicVal.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +3 -5
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/grammarConfig.d.ts +25 -2
- package/types/helpers/grammarConfig.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +1 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/log.d.ts.map +1 -1
- package/types/helpers/mergeVariants.d.ts.map +1 -1
- package/types/helpers/nativeOnlyProps.d.ts +0 -1
- package/types/helpers/nativeOnlyProps.d.ts.map +1 -1
- package/types/helpers/nativeStyleEngine.d.ts +6 -0
- package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
- package/types/helpers/parseBorderShorthand.native.d.ts +1 -0
- package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -1
- package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -1
- package/types/helpers/resolveSafeArea.d.ts +0 -1
- package/types/helpers/resolveSafeArea.d.ts.map +1 -1
- package/types/helpers/resolveVariantStyle.d.ts +3 -0
- package/types/helpers/resolveVariantStyle.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +3 -5
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +4 -9
- package/types/helpers/styleStaticConfig.d.ts.map +1 -1
- package/types/helpers/styleStaticConfigCore.d.ts +4 -0
- package/types/helpers/styleStaticConfigCore.d.ts.map +1 -0
- package/types/helpers/styledDynamic.d.ts +18 -0
- package/types/helpers/styledDynamic.d.ts.map +1 -0
- package/types/helpers/tokenCategories.d.ts +0 -1
- package/types/helpers/tokenCategories.d.ts.map +1 -1
- package/types/helpers/variableValue.d.ts.map +1 -1
- package/types/helpers/warnOnce.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +68 -68
- package/types/hooks/useAnimationDriver.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useStyle.d.ts +4 -0
- package/types/hooks/useStyle.d.ts.map +1 -0
- package/types/hooks/useThemeState.d.ts +1 -11
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/index.d.ts +6 -4
- package/types/index.d.ts.map +1 -1
- package/types/internalRuntimeTypes.d.ts +1 -1
- package/types/internalRuntimeTypes.d.ts.map +1 -1
- package/types/static-resolve.d.ts.map +1 -1
- package/types/style.d.ts +18 -0
- package/types/style.d.ts.map +1 -0
- package/types/styled.d.ts +10 -10
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +74 -49
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +0 -345
- package/dist/cjs/helpers/directStyleCSS.native.js.map +0 -1
- package/dist/cjs/helpers/directStyleCSSCompiled.cjs +0 -40
- package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +0 -46
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js +0 -48
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +0 -91
- package/dist/cjs/helpers/getVariantExtras.native.cjs +0 -94
- package/dist/cjs/helpers/getVariantExtras.native.js +0 -96
- package/dist/cjs/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/cjs/helpers/variantResolvers.cjs +0 -87
- package/dist/cjs/helpers/variantResolvers.native.cjs +0 -140
- package/dist/cjs/helpers/variantResolvers.native.js +0 -142
- package/dist/cjs/helpers/variantResolvers.native.js.map +0 -1
- package/dist/esm/helpers/directStyleCSS.mjs +0 -317
- package/dist/esm/helpers/directStyleCSS.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSS.native.js +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.mjs +0 -11
- package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.native.js +0 -15
- package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/esm/helpers/getVariantExtras.mjs +0 -69
- package/dist/esm/helpers/getVariantExtras.mjs.map +0 -1
- package/dist/esm/helpers/getVariantExtras.native.js +0 -70
- package/dist/esm/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/esm/helpers/variantResolvers.mjs +0 -65
- package/dist/esm/helpers/variantResolvers.mjs.map +0 -1
- package/dist/esm/helpers/variantResolvers.native.js +0 -116
- package/dist/esm/helpers/variantResolvers.native.js.map +0 -1
- package/src/helpers/directStyleCSS.native.ts +0 -1
- package/src/helpers/directStyleCSS.ts +0 -513
- package/src/helpers/directStyleCSSCompiled.ts +0 -32
- package/src/helpers/getVariantExtras.tsx +0 -95
- package/src/helpers/variantResolvers.ts +0 -121
- package/types/helpers/directStyleCSS.d.ts +0 -28
- package/types/helpers/directStyleCSS.d.ts.map +0 -1
- package/types/helpers/directStyleCSS.native.d.ts +0 -2
- package/types/helpers/directStyleCSS.native.d.ts.map +0 -1
- package/types/helpers/directStyleCSSCompiled.d.ts +0 -10
- package/types/helpers/directStyleCSSCompiled.d.ts.map +0 -1
- package/types/helpers/getVariantExtras.d.ts +0 -4
- package/types/helpers/getVariantExtras.d.ts.map +0 -1
- package/types/helpers/variantResolvers.d.ts +0 -9
- package/types/helpers/variantResolvers.d.ts.map +0 -1
package/dist/esm/views/Text.mjs
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import { stylePropsTextOnly, validStyles } from "@tamagui/helpers";
|
|
2
2
|
import { createComponent } from "../createComponent.mjs";
|
|
3
|
+
import { styledDynamic } from "../helpers/styledDynamic.mjs";
|
|
3
4
|
|
|
4
|
-
const ellipsisStyle = {
|
|
5
|
-
maxWidth: "100%",
|
|
6
|
-
overflow: "hidden",
|
|
7
|
-
textOverflow: "ellipsis",
|
|
8
|
-
whiteSpace: "nowrap"
|
|
9
|
-
};
|
|
10
5
|
const textStaticConfig = {
|
|
11
6
|
acceptsClassName: true,
|
|
12
7
|
isText: true,
|
|
13
8
|
defaultProps: void 0,
|
|
14
9
|
inlineProps: /* @__PURE__ */ new Set(["maxFontSizeMultiplier"]),
|
|
15
10
|
variants: {
|
|
16
|
-
numberOfLines: {
|
|
17
|
-
1
|
|
18
|
-
|
|
11
|
+
numberOfLines: styledDynamic((numberOfLines) => {
|
|
12
|
+
if (numberOfLines === 1) return {
|
|
13
|
+
maxWidth: "100%",
|
|
14
|
+
overflow: "hidden",
|
|
15
|
+
textOverflow: "ellipsis",
|
|
16
|
+
whiteSpace: "nowrap"
|
|
17
|
+
};
|
|
18
|
+
return numberOfLines >= 1 ? {
|
|
19
19
|
maxWidth: "100%",
|
|
20
20
|
WebkitLineClamp: numberOfLines,
|
|
21
21
|
WebkitBoxOrient: "vertical",
|
|
22
22
|
display: "-webkit-box",
|
|
23
23
|
overflow: "hidden"
|
|
24
|
-
} : null
|
|
25
|
-
},
|
|
26
|
-
ellipsis: { true:
|
|
24
|
+
} : null;
|
|
25
|
+
}),
|
|
26
|
+
ellipsis: { true: {
|
|
27
|
+
maxWidth: "100%",
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
textOverflow: "ellipsis",
|
|
30
|
+
whiteSpace: "nowrap"
|
|
31
|
+
} }
|
|
27
32
|
},
|
|
28
33
|
validStyles: {
|
|
29
34
|
...validStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":[],"sources":["esm/views/Text.js"],"sourcesContent":["import { stylePropsTextOnly, validStyles } from \"@tamagui/helpers\";\nimport { createComponent } from \"../createComponent\";\
|
|
1
|
+
{"version":3,"file":"Text.js","names":[],"sources":["esm/views/Text.js"],"sourcesContent":["import { stylePropsTextOnly, validStyles } from \"@tamagui/helpers\";\nimport { createComponent } from \"../createComponent\";\nimport { styledDynamic } from \"../helpers/styledDynamic\";\n\nconst textStaticConfig = {\n\tacceptsClassName: true,\n\tisText: true,\n\tdefaultProps: void 0,\n\tinlineProps: /* @__PURE__ */ new Set([\"maxFontSizeMultiplier\"]),\n\tvariants: {\n\t\tnumberOfLines: styledDynamic((numberOfLines) => {\n\t\t\tif (numberOfLines === 1) return {\n\t\t\t\tmaxWidth: \"100%\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\ttextOverflow: \"ellipsis\",\n\t\t\t\twhiteSpace: \"nowrap\"\n\t\t\t};\n\t\t\treturn numberOfLines >= 1 ? {\n\t\t\t\tmaxWidth: \"100%\",\n\t\t\t\tWebkitLineClamp: numberOfLines,\n\t\t\t\tWebkitBoxOrient: \"vertical\",\n\t\t\t\tdisplay: \"-webkit-box\",\n\t\t\t\toverflow: \"hidden\"\n\t\t\t} : null;\n\t\t}),\n\t\tellipsis: { true: {\n\t\t\tmaxWidth: \"100%\",\n\t\t\toverflow: \"hidden\",\n\t\t\ttextOverflow: \"ellipsis\",\n\t\t\twhiteSpace: \"nowrap\"\n\t\t} }\n\t},\n\tvalidStyles: {\n\t\t...validStyles,\n\t\t...stylePropsTextOnly\n\t}\n};\nconst Text = createComponent({\n\t...textStaticConfig,\n\tdisplayName: \"Text\"\n});\n\nexport { Text, textStaticConfig };"],"mappings":";;;;;AAIA,MAAM,mBAAmB;CACxB,kBAAkB;CAClB,QAAQ;CACR,cAAc,KAAK;CACnB,6BAA6B,IAAI,IAAI,CAAC,uBAAuB,CAAC;CAC9D,UAAU;EACT,eAAe,eAAe,kBAAkB;GAC/C,IAAI,kBAAkB,GAAG,OAAO;IAC/B,UAAU;IACV,UAAU;IACV,cAAc;IACd,YAAY;GACb;GACA,OAAO,iBAAiB,IAAI;IAC3B,UAAU;IACV,iBAAiB;IACjB,iBAAiB;IACjB,SAAS;IACT,UAAU;GACX,IAAI;EACL,CAAC;EACD,UAAU,EAAE,MAAM;GACjB,UAAU;GACV,UAAU;GACV,cAAc;GACd,YAAY;EACb,EAAE;CACH;CACA,aAAa;EACZ,GAAG;EACH,GAAG;CACJ;AACD;AACA,MAAM,OAAO,gBAAgB;CAC5B,GAAG;CACH,aAAa;AACd,CAAC"}
|
package/dist/esm/views/Theme.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const Theme = createRefComponent(function Theme2(props, ref) {
|
|
|
14
14
|
"use no memo";
|
|
15
15
|
if (props.disable) return props.children;
|
|
16
16
|
if (process.env.NODE_ENV === "development") {
|
|
17
|
-
for (const key in props) if (!reservedThemeProps[key]) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);
|
|
17
|
+
for (const key in props) if (!reservedThemeProps[key] && key !== "srcloc" && !key.startsWith("data-")) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);
|
|
18
18
|
}
|
|
19
19
|
const { passThrough } = props;
|
|
20
20
|
const isRoot = !!props["_isRoot"];
|
|
@@ -53,10 +53,10 @@ function getThemedChildren(themeState, children, props, isRoot = false, stateRef
|
|
|
53
53
|
if (requiresExtraWrapper || themeState.name === "dark" || themeState.name === "light") state.hasEverThemed = "wrapped";
|
|
54
54
|
if (shallow) if (!themeState.parentId) {} else {
|
|
55
55
|
const parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);
|
|
56
|
-
if (!parentState) throw new Error(formatDiagnostic("‼️010", "Theme", "parent theme state is missing for shallow rendering", "Keep <Theme shallow> inside its mounted parent Theme", "name,parentId", {
|
|
56
|
+
if (!parentState) throw new Error(process.env.NODE_ENV !== "production" ? formatDiagnostic("‼️010", "Theme", "parent theme state is missing for shallow rendering", "Keep <Theme shallow> inside its mounted parent Theme", "name,parentId", {
|
|
57
57
|
name: themeState.name,
|
|
58
58
|
parentId: themeState.parentId
|
|
59
|
-
}));
|
|
59
|
+
}) : "❌ Error 014");
|
|
60
60
|
children = Children.toArray(children).map((child) => {
|
|
61
61
|
return isValidElement(child) ? passThrough ? child : cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {
|
|
62
62
|
name: parentState.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.js","names":[],"sources":["esm/views/Theme.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { getThemeClassNames, reservedThemeProps } from \"@tamagui/helpers\";\nimport React, { Children, cloneElement, isValidElement, useRef } from \"react\";\nimport { variableToString } from \"../createVariable\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { warnOnce } from \"../helpers/warnOnce\";\nimport { useThemeWithState } from \"../hooks/useTheme\";\nimport { ThemeStateContext, getThemeState, hasThemeUpdatingProps } from \"../hooks/useThemeState\";\nimport { ThemeDebug } from \"./ThemeDebug\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst Theme = createRefComponent(function Theme2(props, ref) {\n\t\"use no memo\";\n\tif (props.disable) return props.children;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tfor (const key in props) if (!reservedThemeProps[key]) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);\n\t}\n\tconst { passThrough } = props;\n\tconst isRoot = !!props[\"_isRoot\"];\n\tconst [_, themeState] = useThemeWithState(props, isRoot, true);\n\tuseIsomorphicLayoutEffect(() => {}, [\n\t\tthemeState.id,\n\t\tthemeState.name,\n\t\tthemeState.theme\n\t]);\n\tlet finalChildren = props[\"disable-child-theme\"] ? Children.map(props.children, (child) => passThrough || !isValidElement(child) ? child : cloneElement(child, { [\"data-disable-theme\"]: true })) : props.children;\n\tif (ref) try {\n\t\tReact.Children.only(finalChildren);\n\t\tfinalChildren = cloneElement(finalChildren, { ref });\n\t} catch {}\n\tconst stateRef = useRef({ hasEverThemed: false });\n\treturn getThemedChildren(themeState, finalChildren, props, isRoot, stateRef, passThrough);\n});\nTheme[\"avoidForwardRef\"] = true;\nfunction getThemedChildren(themeState, children, props, isRoot = false, stateRef, passThrough = false) {\n\tconst { shallow, forceClassName } = props;\n\tconst state = stateRef.current;\n\tlet shouldRenderChildrenWithTheme = state.hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props);\n\tif (process.env.NODE_ENV === \"development\" && props.debug === \"visualize\") children = /* @__PURE__ */ jsx(ThemeDebug, {\n\t\tthemeState,\n\t\tthemeProps: props,\n\t\tchildren\n\t});\n\tif (!shouldRenderChildrenWithTheme) return children;\n\tchildren = /* @__PURE__ */ jsx(ThemeStateContext.Provider, {\n\t\tvalue: themeState.id,\n\t\tchildren\n\t});\n\tconst { isInverse, name } = themeState;\n\tconst requiresExtraWrapper = isInverse || forceClassName;\n\tif (!state.hasEverThemed) state.hasEverThemed = true;\n\tif (requiresExtraWrapper || themeState.name === \"dark\" || themeState.name === \"light\") state.hasEverThemed = \"wrapped\";\n\tif (shallow) if (!themeState.parentId) {} else {\n\t\tconst parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);\n\t\tif (!parentState) throw new Error(formatDiagnostic(\"‼️010\", \"Theme\", \"parent theme state is missing for shallow rendering\", \"Keep <Theme shallow> inside its mounted parent Theme\", \"name,parentId\", {\n\t\t\tname: themeState.name,\n\t\t\tparentId: themeState.parentId\n\t\t}));\n\t\tchildren = Children.toArray(children).map((child) => {\n\t\t\treturn isValidElement(child) ? passThrough ? child : cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {\n\t\t\t\tname: parentState.name,\n\t\t\t\tchildren: child.props.children\n\t\t\t})) : child;\n\t\t});\n\t}\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!passThrough && props.debug) console.warn(` getThemedChildren`, {\n\t\t\trequiresExtraWrapper,\n\t\t\tforceClassName,\n\t\t\tthemeState,\n\t\t\tstate,\n\t\t\tthemeSpanProps: getThemeClassNameAndColor(themeState, props, isRoot)\n\t\t});\n\t}\n\tif (forceClassName === false) return children;\n\tif (isWeb) {\n\t\tconst baseStyle = props.contain ? inertContainedStyle : inertStyle;\n\t\tconst { className = \"\", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);\n\t\tconst inlineClassName = passThrough ? void 0 : props._themeUpdate?.className;\n\t\tchildren = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: `${className} is_Theme${inlineClassName ? ` ${inlineClassName}` : \"\"}`,\n\t\t\tstyle: passThrough ? baseStyle : {\n\t\t\t\tcolor,\n\t\t\t\t...baseStyle\n\t\t\t},\n\t\t\tchildren\n\t\t});\n\t\tif (state.hasEverThemed === \"wrapped\") children = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: requiresExtraWrapper ? `${name.startsWith(\"light\") ? \"t_light\" : name.startsWith(\"dark\") ? \"t_dark\" : \"\"} _dsp_contents` : `_dsp_contents`,\n\t\t\tchildren\n\t\t});\n\t\treturn children;\n\t}\n\treturn children;\n}\nconst inertStyle = { display: \"contents\" };\nconst inertContainedStyle = {\n\tdisplay: \"contents\",\n\tcontain: \"strict\"\n};\nconst empty = {\n\tclassName: \"\",\n\tcolor: void 0\n};\nfunction getThemeClassNameAndColor(themeState, props, isRoot = false) {\n\tif (!themeState.isNew && !props.forceClassName) return empty;\n\treturn {\n\t\tcolor: themeState?.theme && themeState.isNew ? variableToString(themeState.theme.color) : \"\",\n\t\tclassName: getThemeClassNames(themeState.name, isRoot)\n\t};\n}\n\nexport { Theme, getThemedChildren };"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,QAAQ,mBAAmB,SAAS,OAAO,OAAO,KAAK;CAC5D;CACA,IAAI,MAAM,SAAS,OAAO,MAAM;CAChC,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC3C,KAAK,MAAM,OAAO,OAAO,IAAI,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Theme.js","names":[],"sources":["esm/views/Theme.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { getThemeClassNames, reservedThemeProps } from \"@tamagui/helpers\";\nimport React, { Children, cloneElement, isValidElement, useRef } from \"react\";\nimport { variableToString } from \"../createVariable\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { warnOnce } from \"../helpers/warnOnce\";\nimport { useThemeWithState } from \"../hooks/useTheme\";\nimport { ThemeStateContext, getThemeState, hasThemeUpdatingProps } from \"../hooks/useThemeState\";\nimport { ThemeDebug } from \"./ThemeDebug\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst Theme = createRefComponent(function Theme2(props, ref) {\n\t\"use no memo\";\n\tif (props.disable) return props.children;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tfor (const key in props) if (!reservedThemeProps[key] && key !== \"srcloc\" && !key.startsWith(\"data-\")) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);\n\t}\n\tconst { passThrough } = props;\n\tconst isRoot = !!props[\"_isRoot\"];\n\tconst [_, themeState] = useThemeWithState(props, isRoot, true);\n\tuseIsomorphicLayoutEffect(() => {}, [\n\t\tthemeState.id,\n\t\tthemeState.name,\n\t\tthemeState.theme\n\t]);\n\tlet finalChildren = props[\"disable-child-theme\"] ? Children.map(props.children, (child) => passThrough || !isValidElement(child) ? child : cloneElement(child, { [\"data-disable-theme\"]: true })) : props.children;\n\tif (ref) try {\n\t\tReact.Children.only(finalChildren);\n\t\tfinalChildren = cloneElement(finalChildren, { ref });\n\t} catch {}\n\tconst stateRef = useRef({ hasEverThemed: false });\n\treturn getThemedChildren(themeState, finalChildren, props, isRoot, stateRef, passThrough);\n});\nTheme[\"avoidForwardRef\"] = true;\nfunction getThemedChildren(themeState, children, props, isRoot = false, stateRef, passThrough = false) {\n\tconst { shallow, forceClassName } = props;\n\tconst state = stateRef.current;\n\tlet shouldRenderChildrenWithTheme = state.hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props);\n\tif (process.env.NODE_ENV === \"development\" && props.debug === \"visualize\") children = /* @__PURE__ */ jsx(ThemeDebug, {\n\t\tthemeState,\n\t\tthemeProps: props,\n\t\tchildren\n\t});\n\tif (!shouldRenderChildrenWithTheme) return children;\n\tchildren = /* @__PURE__ */ jsx(ThemeStateContext.Provider, {\n\t\tvalue: themeState.id,\n\t\tchildren\n\t});\n\tconst { isInverse, name } = themeState;\n\tconst requiresExtraWrapper = isInverse || forceClassName;\n\tif (!state.hasEverThemed) state.hasEverThemed = true;\n\tif (requiresExtraWrapper || themeState.name === \"dark\" || themeState.name === \"light\") state.hasEverThemed = \"wrapped\";\n\tif (shallow) if (!themeState.parentId) {} else {\n\t\tconst parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);\n\t\tif (!parentState) throw new Error(process.env.NODE_ENV !== \"production\" ? formatDiagnostic(\"‼️010\", \"Theme\", \"parent theme state is missing for shallow rendering\", \"Keep <Theme shallow> inside its mounted parent Theme\", \"name,parentId\", {\n\t\t\tname: themeState.name,\n\t\t\tparentId: themeState.parentId\n\t\t}) : \"❌ Error 014\");\n\t\tchildren = Children.toArray(children).map((child) => {\n\t\t\treturn isValidElement(child) ? passThrough ? child : cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {\n\t\t\t\tname: parentState.name,\n\t\t\t\tchildren: child.props.children\n\t\t\t})) : child;\n\t\t});\n\t}\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!passThrough && props.debug) console.warn(` getThemedChildren`, {\n\t\t\trequiresExtraWrapper,\n\t\t\tforceClassName,\n\t\t\tthemeState,\n\t\t\tstate,\n\t\t\tthemeSpanProps: getThemeClassNameAndColor(themeState, props, isRoot)\n\t\t});\n\t}\n\tif (forceClassName === false) return children;\n\tif (isWeb) {\n\t\tconst baseStyle = props.contain ? inertContainedStyle : inertStyle;\n\t\tconst { className = \"\", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);\n\t\tconst inlineClassName = passThrough ? void 0 : props._themeUpdate?.className;\n\t\tchildren = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: `${className} is_Theme${inlineClassName ? ` ${inlineClassName}` : \"\"}`,\n\t\t\tstyle: passThrough ? baseStyle : {\n\t\t\t\tcolor,\n\t\t\t\t...baseStyle\n\t\t\t},\n\t\t\tchildren\n\t\t});\n\t\tif (state.hasEverThemed === \"wrapped\") children = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: requiresExtraWrapper ? `${name.startsWith(\"light\") ? \"t_light\" : name.startsWith(\"dark\") ? \"t_dark\" : \"\"} _dsp_contents` : `_dsp_contents`,\n\t\t\tchildren\n\t\t});\n\t\treturn children;\n\t}\n\treturn children;\n}\nconst inertStyle = { display: \"contents\" };\nconst inertContainedStyle = {\n\tdisplay: \"contents\",\n\tcontain: \"strict\"\n};\nconst empty = {\n\tclassName: \"\",\n\tcolor: void 0\n};\nfunction getThemeClassNameAndColor(themeState, props, isRoot = false) {\n\tif (!themeState.isNew && !props.forceClassName) return empty;\n\treturn {\n\t\tcolor: themeState?.theme && themeState.isNew ? variableToString(themeState.theme.color) : \"\",\n\t\tclassName: getThemeClassNames(themeState.name, isRoot)\n\t};\n}\n\nexport { Theme, getThemedChildren };"],"mappings":"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"}
|
|
@@ -15,7 +15,7 @@ var Theme = createRefComponent(function Theme2(props, ref) {
|
|
|
15
15
|
"use no memo";
|
|
16
16
|
if (props.disable) return props.children;
|
|
17
17
|
if (process.env.NODE_ENV === "development") {
|
|
18
|
-
for (var key in props) if (!reservedThemeProps[key]) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);
|
|
18
|
+
for (var key in props) if (!reservedThemeProps[key] && key !== "srcloc" && !key.startsWith("data-")) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);
|
|
19
19
|
}
|
|
20
20
|
var { passThrough } = props;
|
|
21
21
|
var isRoot = !!props["_isRoot"];
|
|
@@ -62,10 +62,10 @@ function getThemedChildren(themeState, children, props) {
|
|
|
62
62
|
if (requiresExtraWrapper || themeState.name === "dark" || themeState.name === "light") state.hasEverThemed = "wrapped";
|
|
63
63
|
if (shallow) if (!themeState.parentId) {} else {
|
|
64
64
|
var parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);
|
|
65
|
-
if (!parentState) throw new Error(formatDiagnostic("‼️010", "Theme", "parent theme state is missing for shallow rendering", "Keep <Theme shallow> inside its mounted parent Theme", "name,parentId", {
|
|
65
|
+
if (!parentState) throw new Error(process.env.NODE_ENV !== "production" ? formatDiagnostic("‼️010", "Theme", "parent theme state is missing for shallow rendering", "Keep <Theme shallow> inside its mounted parent Theme", "name,parentId", {
|
|
66
66
|
name: themeState.name,
|
|
67
67
|
parentId: themeState.parentId
|
|
68
|
-
}));
|
|
68
|
+
}) : "❌ Error 014");
|
|
69
69
|
children = Children.toArray(children).map(function(child) {
|
|
70
70
|
return /* @__PURE__ */ isValidElement(child) ? passThrough ? child : /* @__PURE__ */ cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {
|
|
71
71
|
name: parentState.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.native.js","names":[],"sources":["esm/views/Theme.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { createRefComponent } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { getThemeClassNames, reservedThemeProps } from \"@tamagui/helpers\";\nimport React, { Children, cloneElement, isValidElement, useRef } from \"react\";\nimport { variableToString } from \"../createVariable\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { removeNativeStyleScope, updateNativeStyleScope } from \"../helpers/nativeStyleEngine\";\nimport { warnOnce } from \"../helpers/warnOnce\";\nimport { useThemeWithState } from \"../hooks/useTheme\";\nimport { ThemeStateContext, getThemeState, hasThemeUpdatingProps } from \"../hooks/useThemeState\";\nimport { ThemeDebug } from \"./ThemeDebug\";\n\nvar Theme = createRefComponent(function Theme2(props, ref) {\n\t\"use no memo\";\n\tif (props.disable) return props.children;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tfor (var key in props) if (!reservedThemeProps[key]) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);\n\t}\n\tvar { passThrough } = props;\n\tvar isRoot = !!props[\"_isRoot\"];\n\tvar [_, themeState] = useThemeWithState(props, isRoot, true);\n\tuseIsomorphicLayoutEffect(function() {\n\t\tupdateNativeStyleScope(themeState.id, themeState.name, themeState.theme);\n\t\treturn function() {\n\t\t\treturn removeNativeStyleScope(themeState.id);\n\t\t};\n\t}, [\n\t\tthemeState.id,\n\t\tthemeState.name,\n\t\tthemeState.theme\n\t]);\n\tvar finalChildren = props[\"disable-child-theme\"] ? Children.map(props.children, function(child) {\n\t\treturn passThrough || !/* @__PURE__ */ isValidElement(child) ? child : /* @__PURE__ */ cloneElement(child, { [\"data-disable-theme\"]: true });\n\t}) : props.children;\n\tif (ref) try {\n\t\tReact.Children.only(finalChildren);\n\t\tfinalChildren = /* @__PURE__ */ cloneElement(finalChildren, { ref });\n\t} catch (e) {}\n\tvar stateRef = useRef({ hasEverThemed: false });\n\treturn getThemedChildren(themeState, finalChildren, props, isRoot, stateRef, passThrough);\n});\nTheme[\"avoidForwardRef\"] = true;\nfunction getThemedChildren(themeState, children, props) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, stateRef = arguments.length > 4 ? arguments[4] : void 0, passThrough = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar { shallow, forceClassName } = props;\n\tvar state = stateRef.current;\n\tvar shouldRenderChildrenWithTheme = state.hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props);\n\tif (process.env.NODE_ENV === \"development\" && props.debug === \"visualize\") children = /* @__PURE__ */ jsx(ThemeDebug, {\n\t\tthemeState,\n\t\tthemeProps: props,\n\t\tchildren\n\t});\n\tif (!shouldRenderChildrenWithTheme) return children;\n\tchildren = /* @__PURE__ */ jsx(ThemeStateContext.Provider, {\n\t\tvalue: themeState.id,\n\t\tchildren\n\t});\n\tvar { isInverse, name } = themeState;\n\tvar requiresExtraWrapper = isInverse || forceClassName;\n\tif (!state.hasEverThemed) state.hasEverThemed = true;\n\tif (requiresExtraWrapper || themeState.name === \"dark\" || themeState.name === \"light\") state.hasEverThemed = \"wrapped\";\n\tif (shallow) if (!themeState.parentId) {} else {\n\t\tvar parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);\n\t\tif (!parentState) throw new Error(formatDiagnostic(\"‼️010\", \"Theme\", \"parent theme state is missing for shallow rendering\", \"Keep <Theme shallow> inside its mounted parent Theme\", \"name,parentId\", {\n\t\t\tname: themeState.name,\n\t\t\tparentId: themeState.parentId\n\t\t}));\n\t\tchildren = Children.toArray(children).map(function(child) {\n\t\t\treturn /* @__PURE__ */ isValidElement(child) ? passThrough ? child : /* @__PURE__ */ cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {\n\t\t\t\tname: parentState.name,\n\t\t\t\tchildren: child.props.children\n\t\t\t})) : child;\n\t\t});\n\t}\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!passThrough && props.debug) console.warn(` getThemedChildren`, {\n\t\t\trequiresExtraWrapper,\n\t\t\tforceClassName,\n\t\t\tthemeState,\n\t\t\tstate,\n\t\t\tthemeSpanProps: getThemeClassNameAndColor(themeState, props, isRoot)\n\t\t});\n\t}\n\tif (forceClassName === false) return children;\n\tif (isWeb) {\n\t\tvar _props__themeUpdate;\n\t\tvar baseStyle = props.contain ? inertContainedStyle : inertStyle;\n\t\tvar { className = \"\", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);\n\t\tvar inlineClassName = passThrough ? void 0 : (_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.className;\n\t\tchildren = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: `${className} is_Theme${inlineClassName ? ` ${inlineClassName}` : \"\"}`,\n\t\t\tstyle: passThrough ? baseStyle : {\n\t\t\t\tcolor,\n\t\t\t\t...baseStyle\n\t\t\t},\n\t\t\tchildren\n\t\t});\n\t\tif (state.hasEverThemed === \"wrapped\") children = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: requiresExtraWrapper ? `${name.startsWith(\"light\") ? \"t_light\" : name.startsWith(\"dark\") ? \"t_dark\" : \"\"} _dsp_contents` : `_dsp_contents`,\n\t\t\tchildren\n\t\t});\n\t\treturn children;\n\t}\n\treturn children;\n}\nvar inertStyle = { display: \"contents\" };\nvar inertContainedStyle = {\n\tdisplay: \"contents\",\n\tcontain: \"strict\"\n};\nvar empty = {\n\tclassName: \"\",\n\tcolor: void 0\n};\nfunction getThemeClassNameAndColor(themeState, props) {\n\tvar isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tif (!themeState.isNew && !props.forceClassName) return empty;\n\treturn {\n\t\tcolor: (themeState === null || themeState === void 0 ? void 0 : themeState.theme) && themeState.isNew ? variableToString(themeState.theme.color) : \"\",\n\t\tclassName: getThemeClassNames(themeState.name, isRoot)\n\t};\n}\n\nexport { Theme, getThemedChildren };"],"mappings":";;;;;;;;;;;;;;AAaA,IAAI,QAAQ,mBAAmB,SAAS,OAAO,OAAO,KAAK;CAC1D;CACA,IAAI,MAAM,SAAS,OAAO,MAAM;CAChC,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC3C,KAAK,IAAI,OAAO,OAAO,IAAI,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Theme.native.js","names":[],"sources":["esm/views/Theme.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { createRefComponent } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { getThemeClassNames, reservedThemeProps } from \"@tamagui/helpers\";\nimport React, { Children, cloneElement, isValidElement, useRef } from \"react\";\nimport { variableToString } from \"../createVariable\";\nimport { formatDiagnostic } from \"../helpers/formatDiagnostic\";\nimport { removeNativeStyleScope, updateNativeStyleScope } from \"../helpers/nativeStyleEngine\";\nimport { warnOnce } from \"../helpers/warnOnce\";\nimport { useThemeWithState } from \"../hooks/useTheme\";\nimport { ThemeStateContext, getThemeState, hasThemeUpdatingProps } from \"../hooks/useThemeState\";\nimport { ThemeDebug } from \"./ThemeDebug\";\n\nvar Theme = createRefComponent(function Theme2(props, ref) {\n\t\"use no memo\";\n\tif (props.disable) return props.children;\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tfor (var key in props) if (!reservedThemeProps[key] && key !== \"srcloc\" && !key.startsWith(\"data-\")) warnOnce(`theme-update:${key}`, `<Theme ${key}=...> no longer accepts inline values. Wrap the subtree in <ThemeUpdate ${key}=...> instead.`);\n\t}\n\tvar { passThrough } = props;\n\tvar isRoot = !!props[\"_isRoot\"];\n\tvar [_, themeState] = useThemeWithState(props, isRoot, true);\n\tuseIsomorphicLayoutEffect(function() {\n\t\tupdateNativeStyleScope(themeState.id, themeState.name, themeState.theme);\n\t\treturn function() {\n\t\t\treturn removeNativeStyleScope(themeState.id);\n\t\t};\n\t}, [\n\t\tthemeState.id,\n\t\tthemeState.name,\n\t\tthemeState.theme\n\t]);\n\tvar finalChildren = props[\"disable-child-theme\"] ? Children.map(props.children, function(child) {\n\t\treturn passThrough || !/* @__PURE__ */ isValidElement(child) ? child : /* @__PURE__ */ cloneElement(child, { [\"data-disable-theme\"]: true });\n\t}) : props.children;\n\tif (ref) try {\n\t\tReact.Children.only(finalChildren);\n\t\tfinalChildren = /* @__PURE__ */ cloneElement(finalChildren, { ref });\n\t} catch (e) {}\n\tvar stateRef = useRef({ hasEverThemed: false });\n\treturn getThemedChildren(themeState, finalChildren, props, isRoot, stateRef, passThrough);\n});\nTheme[\"avoidForwardRef\"] = true;\nfunction getThemedChildren(themeState, children, props) {\n\tvar isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, stateRef = arguments.length > 4 ? arguments[4] : void 0, passThrough = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false;\n\tvar { shallow, forceClassName } = props;\n\tvar state = stateRef.current;\n\tvar shouldRenderChildrenWithTheme = state.hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props);\n\tif (process.env.NODE_ENV === \"development\" && props.debug === \"visualize\") children = /* @__PURE__ */ jsx(ThemeDebug, {\n\t\tthemeState,\n\t\tthemeProps: props,\n\t\tchildren\n\t});\n\tif (!shouldRenderChildrenWithTheme) return children;\n\tchildren = /* @__PURE__ */ jsx(ThemeStateContext.Provider, {\n\t\tvalue: themeState.id,\n\t\tchildren\n\t});\n\tvar { isInverse, name } = themeState;\n\tvar requiresExtraWrapper = isInverse || forceClassName;\n\tif (!state.hasEverThemed) state.hasEverThemed = true;\n\tif (requiresExtraWrapper || themeState.name === \"dark\" || themeState.name === \"light\") state.hasEverThemed = \"wrapped\";\n\tif (shallow) if (!themeState.parentId) {} else {\n\t\tvar parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);\n\t\tif (!parentState) throw new Error(process.env.NODE_ENV !== \"production\" ? formatDiagnostic(\"‼️010\", \"Theme\", \"parent theme state is missing for shallow rendering\", \"Keep <Theme shallow> inside its mounted parent Theme\", \"name,parentId\", {\n\t\t\tname: themeState.name,\n\t\t\tparentId: themeState.parentId\n\t\t}) : \"❌ Error 014\");\n\t\tchildren = Children.toArray(children).map(function(child) {\n\t\t\treturn /* @__PURE__ */ isValidElement(child) ? passThrough ? child : /* @__PURE__ */ cloneElement(child, void 0, /* @__PURE__ */ jsx(Theme, {\n\t\t\t\tname: parentState.name,\n\t\t\t\tchildren: child.props.children\n\t\t\t})) : child;\n\t\t});\n\t}\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (!passThrough && props.debug) console.warn(` getThemedChildren`, {\n\t\t\trequiresExtraWrapper,\n\t\t\tforceClassName,\n\t\t\tthemeState,\n\t\t\tstate,\n\t\t\tthemeSpanProps: getThemeClassNameAndColor(themeState, props, isRoot)\n\t\t});\n\t}\n\tif (forceClassName === false) return children;\n\tif (isWeb) {\n\t\tvar _props__themeUpdate;\n\t\tvar baseStyle = props.contain ? inertContainedStyle : inertStyle;\n\t\tvar { className = \"\", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);\n\t\tvar inlineClassName = passThrough ? void 0 : (_props__themeUpdate = props._themeUpdate) === null || _props__themeUpdate === void 0 ? void 0 : _props__themeUpdate.className;\n\t\tchildren = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: `${className} is_Theme${inlineClassName ? ` ${inlineClassName}` : \"\"}`,\n\t\t\tstyle: passThrough ? baseStyle : {\n\t\t\t\tcolor,\n\t\t\t\t...baseStyle\n\t\t\t},\n\t\t\tchildren\n\t\t});\n\t\tif (state.hasEverThemed === \"wrapped\") children = /* @__PURE__ */ jsx(\"span\", {\n\t\t\tclassName: requiresExtraWrapper ? `${name.startsWith(\"light\") ? \"t_light\" : name.startsWith(\"dark\") ? \"t_dark\" : \"\"} _dsp_contents` : `_dsp_contents`,\n\t\t\tchildren\n\t\t});\n\t\treturn children;\n\t}\n\treturn children;\n}\nvar inertStyle = { display: \"contents\" };\nvar inertContainedStyle = {\n\tdisplay: \"contents\",\n\tcontain: \"strict\"\n};\nvar empty = {\n\tclassName: \"\",\n\tcolor: void 0\n};\nfunction getThemeClassNameAndColor(themeState, props) {\n\tvar isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;\n\tif (!themeState.isNew && !props.forceClassName) return empty;\n\treturn {\n\t\tcolor: (themeState === null || themeState === void 0 ? void 0 : themeState.theme) && themeState.isNew ? variableToString(themeState.theme.color) : \"\",\n\t\tclassName: getThemeClassNames(themeState.name, isRoot)\n\t};\n}\n\nexport { Theme, getThemedChildren };"],"mappings":"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"}
|
|
@@ -48,10 +48,7 @@ function ThemeDebug({ themeState, themeProps, children }) {
|
|
|
48
48
|
color1: themeState.theme.color1.val,
|
|
49
49
|
parentId: themeState.parentId,
|
|
50
50
|
isNew: themeState.isNew,
|
|
51
|
-
themeProps: {
|
|
52
|
-
name: themeProps.name,
|
|
53
|
-
reset: themeProps.reset
|
|
54
|
-
},
|
|
51
|
+
themeProps: { name: themeProps.name },
|
|
55
52
|
parentState: {
|
|
56
53
|
name: parentState?.name,
|
|
57
54
|
isNew: parentState?.isNew
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeDebug.js","names":[],"sources":["esm/views/ThemeDebug.js"],"sourcesContent":["import { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getThemeState } from \"../hooks/useThemeState\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nlet node;\nfunction ThemeDebug({\n themeState,\n themeProps,\n children\n}) {\n if (process.env.NODE_ENV === \"development\") {\n const isHydrated = useDidFinishSSR();\n if (process.env.NODE_ENV === \"development\" && typeof document !== \"undefined\") {\n if (!node) {\n node = document.createElement(\"div\");\n node.style.height = \"200px\";\n node.style.overflowY = \"scroll\";\n node.style.position = \"fixed\";\n node.style.zIndex = 1e7;\n node.style.bottom = \"30px\";\n node.style.left = \"30px\";\n node.style.right = \"30px\";\n node.style.display = \"flex\";\n node.style.border = \"1px solid #888\";\n node.style.flexDirection = \"row\";\n node.style.background = \"var(--background)\";\n }\n }\n useEffect(() => {\n document.body.appendChild(node);\n }, []);\n if (themeProps[\"disable-child-theme\"] || !isHydrated) {\n return children;\n }\n const parentState = themeState.parentId ? getThemeState(themeState.parentId) : null;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n createPortal(\n /* @__PURE__ */ jsxs(\n \"code\",\n {\n style: {\n whiteSpace: \"pre\",\n maxWidth: 250,\n overflow: \"auto\",\n padding: 5\n },\n children: [\n \"<Theme \",\n themeState.id,\n \" />\\xA0\",\n JSON.stringify(\n {\n name: themeState.name,\n color1: themeState.theme.color1.val,\n parentId: themeState.parentId,\n // inverses: themeState.inverses,\n isNew: themeState.isNew,\n themeProps: {\n name: themeProps.name
|
|
1
|
+
{"version":3,"file":"ThemeDebug.js","names":[],"sources":["esm/views/ThemeDebug.js"],"sourcesContent":["import { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getThemeState } from \"../hooks/useThemeState\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nlet node;\nfunction ThemeDebug({\n themeState,\n themeProps,\n children\n}) {\n if (process.env.NODE_ENV === \"development\") {\n const isHydrated = useDidFinishSSR();\n if (process.env.NODE_ENV === \"development\" && typeof document !== \"undefined\") {\n if (!node) {\n node = document.createElement(\"div\");\n node.style.height = \"200px\";\n node.style.overflowY = \"scroll\";\n node.style.position = \"fixed\";\n node.style.zIndex = 1e7;\n node.style.bottom = \"30px\";\n node.style.left = \"30px\";\n node.style.right = \"30px\";\n node.style.display = \"flex\";\n node.style.border = \"1px solid #888\";\n node.style.flexDirection = \"row\";\n node.style.background = \"var(--background)\";\n }\n }\n useEffect(() => {\n document.body.appendChild(node);\n }, []);\n if (themeProps[\"disable-child-theme\"] || !isHydrated) {\n return children;\n }\n const parentState = themeState.parentId ? getThemeState(themeState.parentId) : null;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n createPortal(\n /* @__PURE__ */ jsxs(\n \"code\",\n {\n style: {\n whiteSpace: \"pre\",\n maxWidth: 250,\n overflow: \"auto\",\n padding: 5\n },\n children: [\n \"<Theme \",\n themeState.id,\n \" />\\xA0\",\n JSON.stringify(\n {\n name: themeState.name,\n color1: themeState.theme.color1.val,\n parentId: themeState.parentId,\n // inverses: themeState.inverses,\n isNew: themeState.isNew,\n themeProps: {\n name: themeProps.name\n },\n parentState: {\n name: parentState?.name,\n isNew: parentState?.isNew\n }\n },\n null,\n 2\n )\n ]\n }\n ),\n node\n ),\n /* @__PURE__ */ jsx(\"div\", { style: { color: \"red\" }, children: themeState.id }),\n children\n ] });\n }\n return children;\n}\nThemeDebug[\"displayName\"] = \"ThemeDebug\";\nexport {\n ThemeDebug\n};\n//# sourceMappingURL=ThemeDebug.js.map\n"],"mappings":";;;;;;;AAKA,IAAI;AACJ,SAAS,WAAW,EAClB,YACA,YACA,YACC;CACD,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC1C,MAAM,aAAa,gBAAgB;EACnC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,OAAO,aAAa,aAAa;GAC7E,IAAI,CAAC,MAAM;IACT,OAAO,SAAS,cAAc,KAAK;IACnC,KAAK,MAAM,SAAS;IACpB,KAAK,MAAM,YAAY;IACvB,KAAK,MAAM,WAAW;IACtB,KAAK,MAAM,SAAS;IACpB,KAAK,MAAM,SAAS;IACpB,KAAK,MAAM,OAAO;IAClB,KAAK,MAAM,QAAQ;IACnB,KAAK,MAAM,UAAU;IACrB,KAAK,MAAM,SAAS;IACpB,KAAK,MAAM,gBAAgB;IAC3B,KAAK,MAAM,aAAa;GAC1B;EACF;EACA,gBAAgB;GACd,SAAS,KAAK,YAAY,IAAI;EAChC,GAAG,CAAC,CAAC;EACL,IAAI,WAAW,0BAA0B,CAAC,YAAY;GACpD,OAAO;EACT;EACA,MAAM,cAAc,WAAW,WAAW,cAAc,WAAW,QAAQ,IAAI;EAC/E,OAAuB,qBAAK,UAAU,EAAE,UAAU;GAChD,aACkB,qBACd,QACA;IACE,OAAO;KACL,YAAY;KACZ,UAAU;KACV,UAAU;KACV,SAAS;IACX;IACA,UAAU;KACR;KACA,WAAW;KACX;KACA,KAAK,UACH;MACE,MAAM,WAAW;MACjB,QAAQ,WAAW,MAAM,OAAO;MAChC,UAAU,WAAW;MAErB,OAAO,WAAW;MAClB,YAAY,EACV,MAAM,WAAW,KACnB;MACA,aAAa;OACX,MAAM,aAAa;OACnB,OAAO,aAAa;MACtB;KACF,GACA,MACA,CACF;IACF;GACF,CACF,GACA,IACF;GACgB,oBAAI,OAAO;IAAE,OAAO,EAAE,OAAO,MAAM;IAAG,UAAU,WAAW;GAAG,CAAC;GAC/E;EACF,EAAE,CAAC;CACL;CACA,OAAO;AACT;AACA,WAAW,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.889.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nate Wienert"
|
|
@@ -100,22 +100,22 @@
|
|
|
100
100
|
"test:web": "vitest --typecheck --run"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
104
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
105
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
106
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
107
|
-
"@tamagui/is-equal-shallow": "3.0.0-beta.
|
|
108
|
-
"@tamagui/native": "3.0.0-beta.
|
|
109
|
-
"@tamagui/normalize-css-color": "3.0.0-beta.
|
|
110
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
111
|
-
"@tamagui/timer": "3.0.0-beta.
|
|
112
|
-
"@tamagui/types": "3.0.0-beta.
|
|
113
|
-
"@tamagui/use-did-finish-ssr": "3.0.0-beta.
|
|
114
|
-
"@tamagui/use-event": "3.0.0-beta.
|
|
115
|
-
"@tamagui/use-force-update": "3.0.0-beta.
|
|
103
|
+
"@tamagui/compose-refs": "3.0.0-beta.889.1",
|
|
104
|
+
"@tamagui/constants": "3.0.0-beta.889.1",
|
|
105
|
+
"@tamagui/dom": "3.0.0-beta.889.1",
|
|
106
|
+
"@tamagui/helpers": "3.0.0-beta.889.1",
|
|
107
|
+
"@tamagui/is-equal-shallow": "3.0.0-beta.889.1",
|
|
108
|
+
"@tamagui/native": "3.0.0-beta.889.1",
|
|
109
|
+
"@tamagui/normalize-css-color": "3.0.0-beta.889.1",
|
|
110
|
+
"@tamagui/style-grammar": "3.0.0-beta.889.1",
|
|
111
|
+
"@tamagui/timer": "3.0.0-beta.889.1",
|
|
112
|
+
"@tamagui/types": "3.0.0-beta.889.1",
|
|
113
|
+
"@tamagui/use-did-finish-ssr": "3.0.0-beta.889.1",
|
|
114
|
+
"@tamagui/use-event": "3.0.0-beta.889.1",
|
|
115
|
+
"@tamagui/use-force-update": "3.0.0-beta.889.1"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@tamagui/build": "3.0.0-beta.
|
|
118
|
+
"@tamagui/build": "3.0.0-beta.889.1",
|
|
119
119
|
"@testing-library/react": "^16.1.0",
|
|
120
120
|
"csstype": "^3.0.10",
|
|
121
121
|
"react": "19.2.3",
|
package/src/createComponent.tsx
CHANGED
|
@@ -264,7 +264,9 @@ export function createComponent<
|
|
|
264
264
|
// a const, a config read) makes it unfoldable.
|
|
265
265
|
if (process.env.TAMAGUI_RUNTIME === 'zero') {
|
|
266
266
|
throw new Error(
|
|
267
|
-
|
|
267
|
+
process.env.NODE_ENV !== 'production'
|
|
268
|
+
? `[tamagui zero-runtime] createComponent ran in a zero-runtime graph. No Tamagui component renderer ships in this mode, so a component reference survived compilation. Fix the site or move the owning module to a declared full-runtime island.`
|
|
269
|
+
: '❌ Error 010'
|
|
268
270
|
)
|
|
269
271
|
}
|
|
270
272
|
|
|
@@ -2227,6 +2229,24 @@ export function createComponent<
|
|
|
2227
2229
|
|
|
2228
2230
|
res.staticConfig = staticConfig
|
|
2229
2231
|
|
|
2232
|
+
// `.resolve` chains a component resolver (complete props + env -> style
|
|
2233
|
+
// fragment) by returning a NEW component with the resolver appended
|
|
2234
|
+
res.resolve = (resolver: any) => {
|
|
2235
|
+
const next: any = createComponent({
|
|
2236
|
+
...staticConfig,
|
|
2237
|
+
resolvers: staticConfig.resolvers
|
|
2238
|
+
? [...staticConfig.resolvers, resolver]
|
|
2239
|
+
: [resolver],
|
|
2240
|
+
})
|
|
2241
|
+
// carry over statics assigned after creation (styled() copies parent
|
|
2242
|
+
// statics onto the finished component)
|
|
2243
|
+
for (const key in res) {
|
|
2244
|
+
if (key === 'propTypes' || key in next) continue
|
|
2245
|
+
next[key] = (res as any)[key]
|
|
2246
|
+
}
|
|
2247
|
+
return next
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2230
2250
|
if (displayName) {
|
|
2231
2251
|
res.displayName = displayName
|
|
2232
2252
|
;(res as any)[componentDisplayName] = displayName
|
package/src/createStyledHOC.tsx
CHANGED
|
@@ -35,7 +35,9 @@ export function createStyledHOC<
|
|
|
35
35
|
: Props
|
|
36
36
|
> &
|
|
37
37
|
CustomProps,
|
|
38
|
-
ref
|
|
38
|
+
// always a ref value (null when the caller passed none), so a render
|
|
39
|
+
// callback may declare a required `Ref<TamaguiElement>` parameter
|
|
40
|
+
ref: ReactRef<NoInfer<Ref>> | null
|
|
39
41
|
) => ReactNode,
|
|
40
42
|
options?: StyledHOCOptions
|
|
41
43
|
): TamaguiComponent<
|
|
@@ -70,7 +72,7 @@ export function createStyledHOC<
|
|
|
70
72
|
let out: any = function StyledHOCComponent(props: any) {
|
|
71
73
|
'use no memo'
|
|
72
74
|
|
|
73
|
-
const { ref, ...rest } = props
|
|
75
|
+
const { ref = null, ...rest } = props
|
|
74
76
|
if (options?.disableTheme) {
|
|
75
77
|
return render(rest, ref)
|
|
76
78
|
}
|
package/src/createVariable.ts
CHANGED
|
@@ -100,16 +100,6 @@ export function getVariableValue(v: Variable | any, group?: TokenCategories) {
|
|
|
100
100
|
return v
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export function getVariableName(v: Variable | any) {
|
|
104
|
-
if (isVariable(v)) return v.name
|
|
105
|
-
return v
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function getVariableVariable(v: Variable | string | undefined) {
|
|
109
|
-
if (isVariable(v)) return v.variable
|
|
110
|
-
return v
|
|
111
|
-
}
|
|
112
|
-
|
|
113
103
|
// bugfix { space: { 0.5: 10 } } was generating var(--space-0.5) (invalid CSS):
|
|
114
104
|
export const createCSSVariable = (nameProp: string, includeVar = true) => {
|
|
115
105
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// the one classifier for border/outline shorthand components. every parser
|
|
2
|
+
// (web composite lowering, native border emission, native normalizeStyle
|
|
3
|
+
// expansion) routes through it so they cannot disagree on what counts as a
|
|
4
|
+
// width, a line style, or a color
|
|
5
|
+
|
|
6
|
+
export const lineStyles = new Set([
|
|
7
|
+
'none',
|
|
8
|
+
'hidden',
|
|
9
|
+
'dotted',
|
|
10
|
+
'dashed',
|
|
11
|
+
'solid',
|
|
12
|
+
'double',
|
|
13
|
+
'groove',
|
|
14
|
+
'ridge',
|
|
15
|
+
'inset',
|
|
16
|
+
'outset',
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
// splits on whitespace outside parens and quotes, so `rgb(1, 2, 3)` and
|
|
20
|
+
// `calc(1px + 1px)` stay single components
|
|
21
|
+
export function splitComponents(value: string): string[] {
|
|
22
|
+
return (
|
|
23
|
+
value.match(
|
|
24
|
+
/(?:[^\s("']+|\((?:[^()]|\([^)]*\))*\)|"(?:\\.|[^"])*"|'(?:\\.|[^'])*')+/g
|
|
25
|
+
) || []
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function startsValueFunction(value: string): boolean {
|
|
30
|
+
return /^-?[a-z][a-z0-9-]*\(/i.test(value)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const colorFunction =
|
|
34
|
+
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i
|
|
35
|
+
|
|
36
|
+
export type BorderComponents = {
|
|
37
|
+
width?: string
|
|
38
|
+
style?: string
|
|
39
|
+
color?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function classifyBorderComponents(raw: string, allowAuto = false) {
|
|
43
|
+
const out: BorderComponents = {}
|
|
44
|
+
for (const part of splitComponents(raw)) {
|
|
45
|
+
if (lineStyles.has(part) || (allowAuto && part === 'auto')) {
|
|
46
|
+
out.style = part
|
|
47
|
+
} else if (colorFunction.test(part)) {
|
|
48
|
+
out.color = part
|
|
49
|
+
} else if (
|
|
50
|
+
part === 'thin' ||
|
|
51
|
+
part === 'medium' ||
|
|
52
|
+
part === 'thick' ||
|
|
53
|
+
/^[+-]?(?:\d+\.?\d*|\.\d+)(?:%|[a-z]+)?$/.test(part) ||
|
|
54
|
+
startsValueFunction(part)
|
|
55
|
+
) {
|
|
56
|
+
out.width = part
|
|
57
|
+
} else {
|
|
58
|
+
out.color = part
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return out
|
|
62
|
+
}
|
|
@@ -243,8 +243,6 @@ const getStaticCSS = (
|
|
|
243
243
|
@scope (.is_Text) to (.is_View) { :where(.is_Text) { white-space: inherit; word-wrap: inherit; } }
|
|
244
244
|
._dsp_contents {display:contents;}
|
|
245
245
|
._no_backdrop::backdrop {display: none;}
|
|
246
|
-
.is_Input::selection, .is_TextArea::selection {background-color: var(--t_selectionColor);}
|
|
247
|
-
.is_Input::placeholder, .is_TextArea::placeholder {color: var(--t_placeholderColor);}
|
|
248
246
|
${pointerEventsCSS}
|
|
249
247
|
${hideScrollBarsCSS}
|
|
250
248
|
${autoVarCSS}
|
|
@@ -6,14 +6,7 @@ import { mergeProps } from './mergeProps'
|
|
|
6
6
|
import { objectIdentityKey } from './objectIdentityKey'
|
|
7
7
|
|
|
8
8
|
type EmptyDefault = Record<PropertyKey, never>
|
|
9
|
-
|
|
10
|
-
type EmptyDefaultOptions =
|
|
11
|
-
| string
|
|
12
|
-
| {
|
|
13
|
-
namespace?: string
|
|
14
|
-
keys?: never
|
|
15
|
-
}
|
|
16
|
-
|
|
9
|
+
type EmptyDefaultOptions = string | { namespace?: string; keys?: never }
|
|
17
10
|
type StyledContextKey<Props> = Extract<keyof Props, string>
|
|
18
11
|
|
|
19
12
|
type OptionalStyledContextKeys<Props extends Record<string, any>> = {
|
|
@@ -64,60 +57,39 @@ type StyledContextFactory = {
|
|
|
64
57
|
): StyledContext<VariantProps, never>
|
|
65
58
|
}
|
|
66
59
|
|
|
67
|
-
// use const (not function declaration) to prevent esbuild from hoisting
|
|
68
|
-
// above __esm lazy init - function declarations get hoisted before
|
|
69
|
-
// import_react is initialized, causing undefined.default errors in SSR
|
|
70
60
|
export const createStyledContext = (<VariantProps extends Record<string, any>>(
|
|
71
61
|
defaultValues?: VariantProps,
|
|
72
62
|
namespaceOrOptions:
|
|
73
63
|
| string
|
|
74
64
|
| StyledContextOptions<VariantProps, StyledContextKey<VariantProps>> = ''
|
|
75
65
|
): StyledContext<VariantProps, StyledContextKey<VariantProps>> => {
|
|
76
|
-
// avoid react compiler - we aren't breaking its rules but it mis-interprets
|
|
77
|
-
// how we change the context value
|
|
78
66
|
'use no memo'
|
|
79
67
|
|
|
80
|
-
// lazy initialization fixes vite ssr hmr - module-level assignments can fail
|
|
81
|
-
// when React is undefined during __esm re-initialization order issues.
|
|
82
|
-
// also React.createContext is optimized oddly by React compiler and our
|
|
83
|
-
// uncommon usage confuses it, so we use dynamic access
|
|
84
|
-
const createReactContext = React[
|
|
85
|
-
Math.random() ? 'createContext' : 'createContext'
|
|
86
|
-
] as typeof React.createContext
|
|
87
|
-
const useReactMemo = React[
|
|
88
|
-
Math.random() ? 'useMemo' : 'useMemo'
|
|
89
|
-
] as typeof React.useMemo
|
|
90
|
-
const useReactContext = React[
|
|
91
|
-
Math.random() ? 'useContext' : 'useContext'
|
|
92
|
-
] as typeof React.useContext
|
|
93
|
-
|
|
94
68
|
const namespace =
|
|
95
69
|
typeof namespaceOrOptions === 'string'
|
|
96
70
|
? namespaceOrOptions
|
|
97
71
|
: namespaceOrOptions.namespace || ''
|
|
72
|
+
const defaultKeys = isPlainObject(defaultValues)
|
|
73
|
+
? (Object.keys(defaultValues) as StyledContextKey<VariantProps>[])
|
|
74
|
+
: undefined
|
|
98
75
|
const propKeys =
|
|
99
|
-
typeof namespaceOrOptions === '
|
|
100
|
-
?
|
|
101
|
-
|
|
102
|
-
: undefined
|
|
103
|
-
: namespaceOrOptions.keys ||
|
|
104
|
-
(isPlainObject(defaultValues)
|
|
105
|
-
? (Object.keys(defaultValues) as StyledContextKey<VariantProps>[])
|
|
106
|
-
: undefined)
|
|
76
|
+
typeof namespaceOrOptions === 'object' && namespaceOrOptions.keys
|
|
77
|
+
? namespaceOrOptions.keys
|
|
78
|
+
: defaultKeys
|
|
107
79
|
|
|
108
|
-
const OGContext =
|
|
80
|
+
const OGContext = React.createContext<VariantProps | undefined>(defaultValues)
|
|
109
81
|
const OGProvider = OGContext.Provider
|
|
110
82
|
const Context = OGContext as any as StyledContext<
|
|
111
83
|
VariantProps,
|
|
112
84
|
StyledContextKey<VariantProps>
|
|
113
85
|
>
|
|
114
86
|
const scopedContexts = new Map<string, Context<VariantProps | undefined>>()
|
|
115
|
-
const LastScopeInNamespace =
|
|
87
|
+
const LastScopeInNamespace = React.createContext<string>(namespace)
|
|
116
88
|
|
|
117
89
|
function getOrCreateScopedContext(scope: string) {
|
|
118
90
|
let ScopedContext = scopedContexts.get(scope)
|
|
119
91
|
if (!ScopedContext) {
|
|
120
|
-
ScopedContext =
|
|
92
|
+
ScopedContext = React.createContext<VariantProps | undefined>(defaultValues)
|
|
121
93
|
scopedContexts.set(scope, ScopedContext)
|
|
122
94
|
}
|
|
123
95
|
return ScopedContext!
|
|
@@ -129,24 +101,16 @@ export const createStyledContext = (<VariantProps extends Record<string, any>>(
|
|
|
129
101
|
const Provider = ({
|
|
130
102
|
children,
|
|
131
103
|
scope: scopeIn,
|
|
132
|
-
// performance: avoid creating objects
|
|
133
104
|
__disableMergeDefaultValues,
|
|
134
105
|
...values
|
|
135
106
|
}: VariantProps & { children?: ReactNode; scope: string }) => {
|
|
136
107
|
const scope = getNamespacedScope(scopeIn)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (__disableMergeDefaultValues) {
|
|
140
|
-
// we already merged and want to keep ordering
|
|
141
|
-
return values
|
|
142
|
-
}
|
|
108
|
+
const next = React.useMemo(() => {
|
|
109
|
+
if (__disableMergeDefaultValues) return values
|
|
143
110
|
return mergeProps(defaultValues || {}, values)
|
|
144
111
|
}, [objectIdentityKey(values)])
|
|
145
112
|
|
|
146
|
-
|
|
147
|
-
if (scope) {
|
|
148
|
-
ScopedProvider = getOrCreateScopedContext(scope).Provider
|
|
149
|
-
}
|
|
113
|
+
const ScopedProvider = scope ? getOrCreateScopedContext(scope).Provider : OGProvider
|
|
150
114
|
return (
|
|
151
115
|
<LastScopeInNamespace.Provider value={scope}>
|
|
152
116
|
<ScopedProvider value={next as VariantProps}>{children}</ScopedProvider>
|
|
@@ -154,17 +118,15 @@ export const createStyledContext = (<VariantProps extends Record<string, any>>(
|
|
|
154
118
|
)
|
|
155
119
|
}
|
|
156
120
|
|
|
157
|
-
// use consumerComponent just to give a better error message
|
|
158
121
|
const useStyledContext = (scopeIn = '') => {
|
|
159
|
-
const lastScopeInNamespace =
|
|
122
|
+
const lastScopeInNamespace = React.useContext(LastScopeInNamespace)
|
|
160
123
|
const scope = namespace
|
|
161
124
|
? scopeIn
|
|
162
125
|
? getNamespacedScope(scopeIn)
|
|
163
126
|
: lastScopeInNamespace
|
|
164
127
|
: scopeIn
|
|
165
128
|
const context = scope ? getOrCreateScopedContext(scope) : OGContext
|
|
166
|
-
|
|
167
|
-
return value
|
|
129
|
+
return React.useContext(context!) as VariantProps
|
|
168
130
|
}
|
|
169
131
|
|
|
170
132
|
// @ts-expect-error we are overriding default provider
|
|
@@ -56,14 +56,14 @@ export function formatDiagnostic(
|
|
|
56
56
|
prop?: string,
|
|
57
57
|
received?: unknown
|
|
58
58
|
) {
|
|
59
|
-
if (process.env.NODE_ENV === '
|
|
60
|
-
|
|
59
|
+
if (process.env.NODE_ENV === 'development') {
|
|
60
|
+
const formattedValue = prop ? formatDiagnosticValue(received) : ''
|
|
61
|
+
const boundedValue =
|
|
62
|
+
formattedValue.length > maxDiagnosticValueLength
|
|
63
|
+
? `${formattedValue.slice(0, maxDiagnosticValueLength - 1)}…`
|
|
64
|
+
: formattedValue
|
|
65
|
+
const value = prop ? ` Received ${prop}=${boundedValue}.` : ''
|
|
66
|
+
return `${code} ${component}: ${message}.${value} ${action}`
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
const boundedValue =
|
|
64
|
-
formattedValue.length > maxDiagnosticValueLength
|
|
65
|
-
? `${formattedValue.slice(0, maxDiagnosticValueLength - 1)}…`
|
|
66
|
-
: formattedValue
|
|
67
|
-
const value = prop ? ` Received ${prop}=${boundedValue}.` : ''
|
|
68
|
-
return `${code} ${component}: ${message}.${value} ${action}`
|
|
68
|
+
return `${code}: ${message}`
|
|
69
69
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const empty = () => {
|
|
2
|
-
console.warn('no-op native')
|
|
3
|
-
}
|
|
1
|
+
const empty = () => {}
|
|
4
2
|
|
|
3
|
+
export const canGenerateCSS = false
|
|
4
|
+
export const flushDirectStyles = empty
|
|
5
|
+
export const addComposition = empty
|
|
6
|
+
export const registerAtomicSlot = empty
|
|
7
|
+
export const buildAtomicSlotCSS = empty
|
|
5
8
|
export const getCSSStylesAtomic = empty
|
|
6
9
|
export const getCSSStyleAtomic = empty
|
|
7
10
|
export const getStyleAtomic = empty
|