@tamagui/core 1.0.0-alpha.21 → 1.0.0-alpha.25

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.
Files changed (54) hide show
  1. package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
  2. package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
  3. package/package.json +8 -9
  4. package/types/helpers/createMediaStyle.d.ts +1 -0
  5. package/types/helpers/createMediaStyle.d.ts.map +1 -1
  6. package/types/helpers/getStylesAtomic.d.ts +1 -0
  7. package/types/helpers/getStylesAtomic.d.ts.map +1 -1
  8. package/src/constants/constants.ts +0 -12
  9. package/src/constants/platform.ts +0 -15
  10. package/src/constants/pseudos.ts +0 -14
  11. package/src/constants/rnw.tsx +0 -20
  12. package/src/createComponent.tsx +0 -614
  13. package/src/createFont.ts +0 -31
  14. package/src/createShorthands.ts +0 -5
  15. package/src/createTamagui.ts +0 -218
  16. package/src/createTheme.ts +0 -22
  17. package/src/createTokens.ts +0 -88
  18. package/src/createVariable.ts +0 -26
  19. package/src/helpers/addStylesUsingClassname.tsx +0 -60
  20. package/src/helpers/createMediaStyle.ts +0 -46
  21. package/src/helpers/createPropMapper.ts +0 -192
  22. package/src/helpers/createTamaguiProvider.tsx +0 -22
  23. package/src/helpers/extendStaticConfig.ts +0 -68
  24. package/src/helpers/fixNativeShadow.native.tsx +0 -27
  25. package/src/helpers/fixNativeShadow.tsx +0 -2
  26. package/src/helpers/getSplitStyles.tsx +0 -200
  27. package/src/helpers/getStylesAtomic.native.ts +0 -3
  28. package/src/helpers/getStylesAtomic.ts +0 -103
  29. package/src/helpers/insertStyleRule.tsx +0 -18
  30. package/src/helpers/isObj.ts +0 -1
  31. package/src/helpers/isTamaguiElement.tsx +0 -5
  32. package/src/helpers/matchMedia.native.ts +0 -6
  33. package/src/helpers/matchMedia.ts +0 -17
  34. package/src/helpers/themeable.tsx +0 -42
  35. package/src/helpers/validate.ts +0 -59
  36. package/src/hooks/useConstant.tsx +0 -10
  37. package/src/hooks/useFeatures.tsx +0 -79
  38. package/src/hooks/useMedia.tsx +0 -196
  39. package/src/hooks/usePressable.tsx +0 -9
  40. package/src/hooks/useTheme.tsx +0 -107
  41. package/src/index.ts +0 -32
  42. package/src/static/postProcessStyles.tsx +0 -20
  43. package/src/static.ts +0 -22
  44. package/src/styled.ts +0 -82
  45. package/src/types.tsx +0 -562
  46. package/src/views/Animated.tsx +0 -121
  47. package/src/views/Stack.tsx +0 -21
  48. package/src/views/Text.tsx +0 -67
  49. package/src/views/TextAncestorContext.tsx +0 -11
  50. package/src/views/Theme.tsx +0 -94
  51. package/src/views/ThemeContext.tsx +0 -5
  52. package/src/views/ThemeInverse.tsx +0 -22
  53. package/src/views/ThemeManagerContext.tsx +0 -62
  54. package/src/views/ThemeProvider.tsx +0 -52
@@ -1,218 +0,0 @@
1
- import { getStyleRules } from '@tamagui/helpers'
2
-
3
- import { Variable, createVariable, isVariable } from './createVariable'
4
- import { createTamaguiProvider } from './helpers/createTamaguiProvider'
5
- import { validateConfig } from './helpers/validate'
6
- import { configureMedia } from './hooks/useMedia'
7
- import {
8
- CreateTamaguiConfig,
9
- GenericTamaguiConfig,
10
- MediaQueryKey,
11
- TamaguiInternalConfig,
12
- TamaguiProviderProps,
13
- } from './types'
14
-
15
- export type CreateTamaguiProps = TamaguiProviderProps &
16
- // we omit and re-declare it because we need to allow instantation types to be flexible
17
- // user then re-defines the types after createTamagui returns the typed object they want
18
- Omit<GenericTamaguiConfig, 'themes'> & {
19
- themes: {
20
- [key: string]: {
21
- [key: string]: string | number | Variable
22
- }
23
- }
24
- // for ssr/native, will default to active
25
- mediaQueryDefaultActive?: MediaQueryKey[]
26
- }
27
-
28
- let conf: TamaguiInternalConfig | null
29
-
30
- export const getHasConfigured = () => !!conf
31
-
32
- export const getTamagui = () => conf!
33
- export const getTokens = () => conf!.tokensParsed
34
- export const getThemes = () => conf!.themes
35
-
36
- type ConfigListener = (conf: TamaguiInternalConfig) => void
37
- const configListeners = new Set<ConfigListener>()
38
- export const onConfiguredOnce = (cb: ConfigListener) => {
39
- if (conf) {
40
- cb(conf)
41
- } else {
42
- configListeners.add(cb)
43
- }
44
- }
45
-
46
- const PREFIX = `theme--`
47
-
48
- export function createTamagui<Conf extends CreateTamaguiProps>(
49
- config: Conf
50
- ): Conf extends CreateTamaguiConfig<infer A, infer B, infer C, infer D>
51
- ? TamaguiInternalConfig<A, B, C, D>
52
- : unknown {
53
- if (process.env.NODE_ENV === 'development') {
54
- // config is re-run by the @tamagui/static, dont double validate
55
- if (!config['parsed']) {
56
- validateConfig(config)
57
- }
58
- }
59
- // test env loads a few times as it runs diff tests
60
- if (conf) {
61
- console.warn('Called createTamagui twice! Should never do so')
62
- // throw new Error(`#000 createTamagui called twice`)
63
- }
64
-
65
- configureMedia({
66
- queries: config.media as any,
67
- defaultActive: config.mediaQueryDefaultActive,
68
- })
69
-
70
- // TODO can avoid some of this CSS creation on native
71
- const themeConfig = (() => {
72
- let cssRules: string[] = []
73
-
74
- // tokens
75
- let tokenRule = `:root {`
76
- const varsByValue = new Map<string, Variable>()
77
- const addVar = (v: Variable) => {
78
- varsByValue[v.val] = v
79
- const rule = `--${v.name}:${typeof v.val === 'number' ? `${v.val}px` : v.val};`
80
- tokenRule += rule
81
- }
82
-
83
- for (const key in config.tokens) {
84
- for (const skey in config.tokens[key]) {
85
- const val = config.tokens[key][skey]
86
- if (key === 'font') {
87
- for (const fkey in val) {
88
- if (fkey === 'family') {
89
- addVar(val[fkey])
90
- } else {
91
- for (const fskey in val[fkey]) {
92
- addVar(val[fkey][fskey])
93
- }
94
- }
95
- }
96
- } else {
97
- addVar(val)
98
- }
99
- }
100
- }
101
- cssRules.push(`${tokenRule}\n}`)
102
-
103
- // themes
104
- for (const themeName in config.themes) {
105
- // to allow using the same theme with diff names, be sure we don't mutate!
106
- config.themes[themeName] = { ...config.themes[themeName] }
107
- const theme = config.themes[themeName]
108
- let vars = ''
109
- for (const themeKey in theme) {
110
- const val = theme[themeKey]
111
- const getVariableCSS = (inv: any) => {
112
- const v = varsByValue[inv] ?? inv
113
- return isVariable(v) ? `--${themeKey}:var(--${v.name});` : `--${themeKey}:${v};`
114
- }
115
- vars += getVariableCSS(val)
116
- // TODO sanity check is necessary
117
- // make everything a variable that gets put into css
118
- if (!isVariable(val)) {
119
- theme[themeKey] = createVariable({
120
- name: themeKey,
121
- val,
122
- })
123
- }
124
- }
125
-
126
- const [themeClassName, parentName] = themeName.includes('-')
127
- ? themeName.split('-')
128
- : [themeName, '']
129
- // tiny hack for now assuming light/dark are typical parentName
130
- const oppositeName = parentName === 'dark' ? 'light' : 'dark'
131
- const cssParentSel = parentName ? `.${PREFIX}${parentName}` : ''
132
- const cssChildSel = `.${PREFIX}${themeClassName}`
133
- const cssSel = `${cssParentSel} ${cssChildSel}`
134
- // we need to force specificity
135
- const cssRule = `${cssSel}, .${PREFIX}${oppositeName} ${cssSel} {\n${vars}\n}`
136
- cssRules.push(cssRule)
137
- }
138
-
139
- Object.freeze(cssRules)
140
-
141
- return {
142
- cssRules,
143
- css: cssRules.join('\n'),
144
- }
145
- })()
146
-
147
- // faster lookups token keys become $keys to match input
148
- const tokensParsed: any = parseTokens(config.tokens)
149
- // all themes should match key and we just need variable name
150
- // TODO once w react native we'd want to have a reverse lookup back to value
151
- const themeParsed: any = {}
152
- const firstKey = Object.keys(config.themes)[0]
153
- for (const key in config.themes[firstKey]) {
154
- // themeParsed[`$${key}`] = config.themes[firstKey][key]
155
- const val = config.themes[firstKey][key].val
156
- themeParsed[`$${key}`] = new Variable({ val, name: key })
157
- }
158
-
159
- const next: TamaguiInternalConfig = {
160
- // @ts-ignore
161
- shorthands: {},
162
- ...config,
163
- Provider: createTamaguiProvider({
164
- defaultTheme: 'light',
165
- ...config,
166
- }),
167
- themeConfig,
168
- themeParsed,
169
- tokensParsed,
170
- parsed: true,
171
- getCSS() {
172
- return `${themeConfig.css}\n${[...getStyleRules()].join('\n')}`
173
- },
174
- }
175
- conf = next
176
-
177
- if (configListeners.size) {
178
- configListeners.forEach((cb) => cb(next))
179
- configListeners.clear()
180
- }
181
-
182
- // @ts-expect-error
183
- return next
184
- }
185
-
186
- export function getThemeParentClassName(themeName?: string | null) {
187
- return `theme-parent ${themeName ? `${PREFIX}${themeName}` : ''}`
188
- }
189
-
190
- const parseTokens = (tokens: any) => {
191
- const res: any = {}
192
- for (const key in tokens) {
193
- res[key] = {}
194
- if (key === 'font') {
195
- for (const family in tokens.font) {
196
- const obj = {}
197
- res.font[`$${family}`] = obj
198
- for (const attrKey in tokens.font[family]) {
199
- const attr = tokens.font[family][attrKey]
200
- if (attrKey === 'family') {
201
- obj[attrKey] = attr
202
- continue
203
- }
204
- obj[attrKey] = Object.keys(attr).reduce((acc, cur) => {
205
- acc[`$${cur}`] = attr[cur]
206
- return acc
207
- }, {})
208
- }
209
- }
210
- continue
211
- }
212
- for (const skey in tokens[key]) {
213
- res[key][`$${skey}`] = tokens[key][skey]
214
- }
215
- }
216
-
217
- return res
218
- }
@@ -1,22 +0,0 @@
1
- import { Variable, createVariable } from './createVariable'
2
-
3
- export const createTheme = <Theme extends { [key: string]: string | Variable }>(
4
- theme: Theme
5
- ): {
6
- // allow string | Variable
7
- [key in keyof Theme]: Variable | string
8
- } => {
9
- const res = {} as any
10
- for (const key in theme) {
11
- const val = theme[key]
12
- if (!(val instanceof Variable)) {
13
- res[key] = createVariable({
14
- name: key,
15
- val,
16
- })
17
- } else {
18
- res[key] = val
19
- }
20
- }
21
- return res
22
- }
@@ -1,88 +0,0 @@
1
- import { Variable, createVariable } from './createVariable'
2
- import { validateTokens } from './helpers/validate'
3
- import { CreateTokens } from './types'
4
-
5
- // tokens.color.dark.red ===> { var: `color-dark-red`, val: '' }
6
-
7
- export function createTokens<T extends CreateTokens>(tokens: T): MakeTokens<T> {
8
- if (process.env.NODE_ENV === 'development') {
9
- validateTokens(tokens)
10
- }
11
-
12
- return setupTokens(tokens) as any
13
- }
14
-
15
- function setupTokens(tokens: any) {
16
- return mapTokensToVariables(tokens)
17
- }
18
-
19
- export const mapTokensToVariables = (
20
- tokens: CreateTokens,
21
- parentPath = ''
22
- ): CreateTokens<Variable> => {
23
- const res = {}
24
- for (const key in tokens) {
25
- const val = tokens[key]
26
- const name = parentPath ? `${parentPath}-${key}` : key
27
- if (val && typeof val === 'object') {
28
- res[key] = mapTokensToVariables(tokens[key], name)
29
- } else {
30
- res[key] = createVariable({ val, name })
31
- }
32
- }
33
- // @ts-expect-error
34
- return res
35
- }
36
-
37
- // verbose but gives us nice types...
38
- type MakeTokens<T> = T extends {
39
- font: {
40
- [key in infer A]: {
41
- size: infer B
42
- lineHeight: infer C
43
- letterSpacing: infer D
44
- weight: infer Z
45
- family: infer Y
46
- }
47
- }
48
- color: infer E
49
- space: infer F
50
- size: infer G
51
- radius: infer H
52
- zIndex: infer J
53
- }
54
- ? {
55
- font: {
56
- [key in A]: {
57
- size: {
58
- [key in keyof B]: Variable
59
- }
60
- lineHeight: {
61
- [key in keyof C]: Variable
62
- }
63
- letterSpacing: {
64
- [key in keyof D]: Variable
65
- }
66
- weight: {
67
- [key in keyof Z]: Variable
68
- }
69
- family: Y
70
- }
71
- }
72
- color: {
73
- [key in keyof E]: Variable
74
- }
75
- space: {
76
- [key in keyof F]: Variable
77
- }
78
- size: {
79
- [key in keyof G]: Variable
80
- }
81
- radius: {
82
- [key in keyof H]: Variable
83
- }
84
- zIndex: {
85
- [key in keyof J]: Variable
86
- }
87
- }
88
- : never
@@ -1,26 +0,0 @@
1
- import { isWeb } from './constants/platform'
2
-
3
- export class Variable {
4
- name: string
5
- val: string | number
6
- variable: string | number
7
-
8
- constructor({ val, name }: VariableIn) {
9
- // converting to px breaks rn
10
- this.val = val //typeof val === 'string' ? val : `${val}px`
11
- this.name = name
12
- this.variable = isWeb ? `var(--${name})` : this.val
13
- }
14
-
15
- toString() {
16
- return `${isWeb ? this.variable : this.val}`
17
- }
18
- }
19
-
20
- type VariableIn = { val: string | number; name: string }
21
-
22
- export const createVariable = (props: VariableIn) => new Variable(props)
23
-
24
- export function isVariable(v: Variable | any): v is Variable {
25
- return v instanceof Variable
26
- }
@@ -1,60 +0,0 @@
1
- // @ts-ignore
2
- import { useInsertionEffect } from 'react'
3
-
4
- import { getStylesAtomic } from './getStylesAtomic'
5
- import { insertStyleRule } from './insertStyleRule'
6
-
7
- // uses new useInsertionEffect for better perf if available
8
-
9
- // could be cleared occasionally
10
- let added = new Set<string>()
11
-
12
- export function useStylesAsClassname(styles: any[]) {
13
- if (!useInsertionEffect) {
14
- return addStylesUsingClassname(styles)
15
- } else {
16
- const insertions: any[] = []
17
- const className = addStylesUsingClassname(styles, (_, rules) => {
18
- for (const rule of rules) {
19
- insertions.push(rule)
20
- }
21
- })
22
-
23
- useInsertionEffect(() => {
24
- for (const ruleset of insertions) {
25
- insertStyleRule(ruleset)
26
- }
27
- })
28
-
29
- return className
30
- }
31
- }
32
-
33
- export function addStylesUsingClassname(
34
- styles: any[],
35
- onAdd?: (identifier: string, rules: string[]) => any
36
- ) {
37
- let className = ''
38
- for (const style of styles) {
39
- if (!style) continue
40
- if (Array.isArray(style)) {
41
- className += ' ' + addStylesUsingClassname(style)
42
- continue
43
- }
44
- for (const { identifier, rules } of getStylesAtomic(style)) {
45
- className += ` ${identifier}`
46
- if (added.has(identifier)) {
47
- continue
48
- }
49
- added.add(identifier)
50
- if (onAdd) {
51
- onAdd(identifier, rules)
52
- } else {
53
- for (const rule of rules) {
54
- insertStyleRule(rule)
55
- }
56
- }
57
- }
58
- }
59
- return className
60
- }
@@ -1,46 +0,0 @@
1
- import { StyleObject } from '@tamagui/helpers'
2
-
3
- import { mediaObjectToString } from '../hooks/useMedia'
4
- import { MediaQueries } from '../types'
5
-
6
- // TODO have this be used by extractMediaStyle in tamagui static
7
-
8
- // not synced to static/constants for now
9
- export const MEDIA_SEP = '_'
10
-
11
- export const createMediaStyle = (
12
- { identifier, rules }: StyleObject,
13
- mediaKey: string,
14
- mediaQueries: MediaQueries,
15
- negate?: boolean,
16
- importance = 0
17
- ) => {
18
- const mediaKeys = Object.keys(mediaQueries)
19
- const mediaKeyPrecendence = mediaKeys.reduce((acc, cur, i) => {
20
- acc[cur] = new Array(importance + 1).fill(':root').join('')
21
- return acc
22
- }, {})
23
- const negKey = negate ? '0' : ''
24
- const ogPrefix = identifier.slice(0, identifier.indexOf('-') + 1)
25
- const nextIdentifier = `${identifier.replace(
26
- ogPrefix,
27
- `${ogPrefix}${MEDIA_SEP}${mediaKey}${negKey}${MEDIA_SEP}`
28
- )}`
29
- const screenStr = negate ? 'not all' : 'screen'
30
- const mediaSelector = mediaObjectToString(mediaQueries[mediaKey])
31
- const mediaQuery = `${screenStr} and ${mediaSelector}`
32
- const precendencePrefix = mediaKeyPrecendence[mediaKey]
33
- const styleInner = rules[0].replace(identifier, nextIdentifier)
34
- // combines media queries if they already exist
35
- let styleRule = ''
36
- if (styleInner.includes('@media')) {
37
- // combine
38
- styleRule = styleInner.replace('{', ` and ${mediaQuery} {`)
39
- } else {
40
- styleRule = `@media ${mediaQuery} { ${precendencePrefix} ${styleInner} }`
41
- }
42
- return {
43
- styleRule,
44
- identifier: nextIdentifier,
45
- }
46
- }
@@ -1,192 +0,0 @@
1
- import { isWeb } from '../constants/platform'
2
- import { getTamagui } from '../createTamagui'
3
- import { Variable } from '../createVariable'
4
- import { StaticConfig, TamaguiInternalConfig } from '../types'
5
- import { isObj } from './isObj'
6
-
7
- export const createPropMapper = (c: StaticConfig) => {
8
- const variants = c.variants
9
- let variantsParsed
10
- const defaultProps = c.defaultProps || {}
11
-
12
- return (key: string, value: any, theme: any, props: any) => {
13
- const conf = getTamagui()
14
- if (!conf) {
15
- console.trace('no conf! err')
16
- return
17
- }
18
- if (variants && !variantsParsed) {
19
- variantsParsed = parseVariants(variants, conf)
20
- }
21
-
22
- // handled here because we need to resolve this off tokens, its the only one-off like this
23
- let fontFamily = props.fontFamily || defaultProps.fontFamily || '$body'
24
-
25
- // expand variants
26
- const variant = variantsParsed?.[key]
27
- if (variant && typeof value !== 'undefined') {
28
- const val =
29
- value === true
30
- ? variant['$true'] || variant['true']
31
- : variant[value] ?? variant['...'] ?? value
32
-
33
- const res =
34
- typeof val === 'function'
35
- ? val(value, { tokens: conf.tokensParsed, theme, props })
36
- : isObj(val)
37
- ? { ...val }
38
- : val
39
-
40
- if (isObj(res)) {
41
- resolveTokens(res, conf, theme, fontFamily)
42
- }
43
-
44
- return res
45
- }
46
-
47
- let shouldReturn = false
48
-
49
- // handle shorthands
50
- if (conf.shorthands[key]) {
51
- shouldReturn = true
52
- key = conf.shorthands[key]
53
- }
54
-
55
- if (value && value[0] === '$') {
56
- shouldReturn = true
57
- value = getToken(key, value, conf, theme, fontFamily)
58
- }
59
-
60
- if (value instanceof Variable) {
61
- shouldReturn = true
62
- value = value.variable
63
- }
64
-
65
- if (shouldReturn) {
66
- return {
67
- [key]: value,
68
- }
69
- }
70
- }
71
- }
72
-
73
- const resolveTokens = (res: any, conf: TamaguiInternalConfig, theme: any, fontFamily: any) => {
74
- for (const rKey in res) {
75
- const fKey = conf.shorthands[rKey] || rKey
76
- const val = res[rKey]
77
- if (val instanceof Variable) {
78
- res[fKey] = val.variable
79
- } else if (typeof val === 'string') {
80
- const fVal = val[0] === '$' ? getToken(fKey, val, conf, theme, fontFamily) : val
81
- res[fKey] = fVal
82
- } else {
83
- if (isObj(val)) {
84
- // for things like shadowOffset which is a sub-object
85
- resolveTokens(val, conf, theme, fontFamily)
86
- }
87
- // nullish values cant be tokens so need no exrta parsing
88
- }
89
- }
90
- }
91
-
92
- const getToken = (
93
- key: string,
94
- value: string,
95
- { tokensParsed, themeParsed }: TamaguiInternalConfig,
96
- theme: any,
97
- fontFamily: string | undefined = '$body'
98
- ) => {
99
- if (themeParsed[value]) {
100
- if (isWeb && themeParsed[value].variable) {
101
- return themeParsed[value].variable
102
- } else {
103
- if (value && value[0] === '$') {
104
- return theme[`${value.slice(1)}`]?.val || themeParsed[value]?.val
105
- }
106
- }
107
- }
108
- let valOrVar: any
109
- if (key === 'fontFamily') {
110
- valOrVar = tokensParsed.font[value]?.family || value
111
- }
112
- if (key === 'fontSize') {
113
- valOrVar = tokensParsed.font[fontFamily]?.size[value] || value
114
- }
115
- if (key === 'lineHeight') {
116
- valOrVar = tokensParsed.font[fontFamily]?.lineHeight[value] || value
117
- }
118
- if (key === 'letterSpacing') {
119
- valOrVar = tokensParsed.font[fontFamily]?.letterSpacing[value] || value
120
- }
121
- if (key === 'fontWeight') {
122
- valOrVar = tokensParsed.font[fontFamily]?.weight[value] || value
123
- }
124
- if (typeof valOrVar !== 'undefined') {
125
- if (valOrVar instanceof Variable) {
126
- return valOrVar.variable
127
- } else {
128
- return valOrVar
129
- }
130
- }
131
- for (const cat in tokenCategories) {
132
- if (tokenCategories[cat][key]) {
133
- const res = tokensParsed[cat][value]
134
- if (res) {
135
- return res.variable
136
- } else {
137
- const themeVar = themeParsed[value]
138
- if (themeVar) {
139
- return themeVar.variable
140
- }
141
- }
142
- }
143
- }
144
- const spaceVar = tokensParsed.space[value]
145
- if (spaceVar) {
146
- return spaceVar.variable
147
- }
148
- return value
149
- }
150
-
151
- // just specificy the least costly, all else go to `space` (most keys - we can exclude)
152
- const tokenCategories = {
153
- size: {
154
- width: true,
155
- height: true,
156
- minWidth: true,
157
- minHeight: true,
158
- maxWidth: true,
159
- maxHeight: true,
160
- },
161
- color: {
162
- color: true,
163
- backgroundColor: true,
164
- borderColor: true,
165
- borderBottomColor: true,
166
- borderTopColor: true,
167
- borderLeftColor: true,
168
- borderRightColor: true,
169
- },
170
- }
171
-
172
- // turns variant spreads into individual lookups
173
- function parseVariants(variants: any, conf: TamaguiInternalConfig) {
174
- return Object.keys(variants).reduce((acc, key) => {
175
- acc[key] = Object.keys(variants[key]).reduce((vacc, vkey) => {
176
- const variantVal = variants[key][vkey]
177
- if (vkey.startsWith('...')) {
178
- // set the default one at '...' for easy fallback on non-exact-variant-match
179
- vacc['...'] = variantVal
180
- const tokenKey = vkey.slice(3)
181
- const tokens = conf.tokens[tokenKey]
182
- for (const tkey in tokens) {
183
- vacc[`$${tkey}`] = variantVal
184
- }
185
- } else {
186
- vacc[vkey] = variantVal
187
- }
188
- return vacc
189
- }, {})
190
- return acc
191
- }, {})
192
- }
@@ -1,22 +0,0 @@
1
- import * as React from 'react'
2
-
3
- import { TamaguiProviderProps } from '../types'
4
- import { TextAncestorProvider } from '../views/TextAncestorContext'
5
- import { ThemeProvider, ThemeProviderProps } from '../views/ThemeProvider'
6
-
7
- export function createTamaguiProvider(themeProps: ThemeProviderProps) {
8
- return function TamaguiProvider({
9
- initialWindowMetrics,
10
- fallback,
11
- children,
12
- ...themePropsProvider
13
- }: TamaguiProviderProps) {
14
- return (
15
- <TextAncestorProvider>
16
- <ThemeProvider {...themeProps} {...themePropsProvider}>
17
- <React.Suspense fallback={fallback || null}>{children}</React.Suspense>
18
- </ThemeProvider>
19
- </TextAncestorProvider>
20
- )
21
- }
22
- }