@tamagui/web 2.0.0-1768326993354 → 2.0.0-1768427228811

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/web",
3
- "version": "2.0.0-1768326993354",
3
+ "version": "2.0.0-1768427228811",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/cjs",
@@ -28,16 +28,16 @@
28
28
  "reset.css"
29
29
  ],
30
30
  "dependencies": {
31
- "@tamagui/compose-refs": "2.0.0-1768326993354",
32
- "@tamagui/constants": "2.0.0-1768326993354",
33
- "@tamagui/helpers": "2.0.0-1768326993354",
34
- "@tamagui/is-equal-shallow": "2.0.0-1768326993354",
35
- "@tamagui/normalize-css-color": "2.0.0-1768326993354",
36
- "@tamagui/timer": "2.0.0-1768326993354",
37
- "@tamagui/types": "2.0.0-1768326993354",
38
- "@tamagui/use-did-finish-ssr": "2.0.0-1768326993354",
39
- "@tamagui/use-event": "2.0.0-1768326993354",
40
- "@tamagui/use-force-update": "2.0.0-1768326993354"
31
+ "@tamagui/compose-refs": "2.0.0-1768427228811",
32
+ "@tamagui/constants": "2.0.0-1768427228811",
33
+ "@tamagui/helpers": "2.0.0-1768427228811",
34
+ "@tamagui/is-equal-shallow": "2.0.0-1768427228811",
35
+ "@tamagui/normalize-css-color": "2.0.0-1768427228811",
36
+ "@tamagui/timer": "2.0.0-1768427228811",
37
+ "@tamagui/types": "2.0.0-1768427228811",
38
+ "@tamagui/use-did-finish-ssr": "2.0.0-1768427228811",
39
+ "@tamagui/use-event": "2.0.0-1768427228811",
40
+ "@tamagui/use-force-update": "2.0.0-1768427228811"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "*",
@@ -45,7 +45,7 @@
45
45
  "react-native": "*"
46
46
  },
47
47
  "devDependencies": {
48
- "@tamagui/build": "2.0.0-1768326993354",
48
+ "@tamagui/build": "2.0.0-1768427228811",
49
49
  "@testing-library/react": "^16.1.0",
50
50
  "csstype": "^3.0.10",
51
51
  "react": "*",
@@ -298,6 +298,9 @@ export function createComponent<
298
298
  : undefined
299
299
  let overriddenContextProps: GenericProps | null = null
300
300
 
301
+ const componentContext = React.useContext(ComponentContext)
302
+ const hasTextAncestor = !!(isWeb && isText ? componentContext.inText : false)
303
+
301
304
  if (
302
305
  !process.env.TAMAGUI_IS_CORE_NODE &&
303
306
  process.env.NODE_ENV === 'development' &&
@@ -316,8 +319,27 @@ export function createComponent<
316
319
 
317
320
  // merge both default props and styled context props - ensure order is preserved
318
321
  if (styledContextValue || defaultProps) {
322
+ // For nested text, override base Text defaults to use CSS inheritance
323
+ // Only override if using base defaults, not styled component explicit values
324
+ let effectiveDefaults = defaultProps
325
+ if (
326
+ process.env.TAMAGUI_TARGET === 'web' &&
327
+ isText &&
328
+ hasTextAncestor &&
329
+ defaultProps
330
+ ) {
331
+ effectiveDefaults = { ...defaultProps }
332
+ if (effectiveDefaults.fontFamily === 'unset')
333
+ effectiveDefaults.fontFamily = 'inherit'
334
+ if (effectiveDefaults.whiteSpace === 'pre-wrap')
335
+ effectiveDefaults.whiteSpace = 'inherit'
336
+ if (!effectiveDefaults.color) effectiveDefaults.color = 'inherit'
337
+ if (!effectiveDefaults.letterSpacing) effectiveDefaults.letterSpacing = 'inherit'
338
+ if (!effectiveDefaults.textTransform) effectiveDefaults.textTransform = 'inherit'
339
+ }
340
+
319
341
  const [nextProps, overrides] = mergeComponentProps(
320
- defaultProps,
342
+ effectiveDefaults,
321
343
  styledContextValue,
322
344
  propsIn
323
345
  )
@@ -392,7 +414,6 @@ export function createComponent<
392
414
  }, [componentName])
393
415
  }
394
416
 
395
- const componentContext = React.useContext(ComponentContext)
396
417
  const groupContextParent = React.useContext(GroupContext)
397
418
  const animationDriver = componentContext.animationDriver
398
419
  const useAnimations = animationDriver?.useAnimations as UseAnimationHook | undefined
@@ -484,8 +505,6 @@ export function createComponent<
484
505
 
485
506
  if (process.env.NODE_ENV === 'development' && time) time`use-state`
486
507
 
487
- const hasTextAncestor = !!(isWeb && isText ? componentContext.inText : false)
488
-
489
508
  const isTaggable = !Component || typeof Component === 'string'
490
509
  const tagProp = props.tag
491
510
  // default to tag, fallback to component (when both strings)
@@ -1403,6 +1422,15 @@ export function createComponent<
1403
1422
  )
1404
1423
  }
1405
1424
 
1425
+ // Text components set inText context for children so nested Text can inherit styles
1426
+ if (process.env.TAMAGUI_TARGET === 'web' && isText && !hasTextAncestor) {
1427
+ content = (
1428
+ <ComponentContext.Provider {...componentContext} inText={true}>
1429
+ {content}
1430
+ </ComponentContext.Provider>
1431
+ )
1432
+ }
1433
+
1406
1434
  if (process.env.NODE_ENV === 'development' && time) time`group-context`
1407
1435
 
1408
1436
  content =
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAoBtC,OAAO,KAAK,EASV,YAAY,EAEZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAQf,MAAM,SAAS,CAAA;AAYhB,KAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,wBAA+B,CAAA;AA8J9D,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEAq2C3B"}
1
+ {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAoBtC,OAAO,KAAK,EASV,YAAY,EAEZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAQf,MAAM,SAAS,CAAA;AAYhB,KAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,wBAA+B,CAAA;AA8J9D,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEAi4C3B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../src/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,YAAY,EAAE,OAAO,KAAK,KAAG,KAEtE,CAAA"}