@tamagui/web 1.124.10 → 1.124.12

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.
@@ -1,13 +1,6 @@
1
1
  import { isWeb } from '@tamagui/constants'
2
2
  import type { MutableRefObject } from 'react'
3
- import React, {
4
- Children,
5
- cloneElement,
6
- forwardRef,
7
- isValidElement,
8
- useEffect,
9
- useRef,
10
- } from 'react'
3
+ import React, { Children, cloneElement, forwardRef, isValidElement, useRef } from 'react'
11
4
  import { getSetting } from '../config'
12
5
  import { variableToString } from '../createVariable'
13
6
  import { useThemeWithState } from '../hooks/useTheme'
@@ -29,6 +22,7 @@ export const Theme = forwardRef(function Theme(props: ThemeProps, ref) {
29
22
  }
30
23
 
31
24
  const isRoot = !!props['_isRoot']
25
+
32
26
  const [_, themeState] = useThemeWithState(props, isRoot)
33
27
 
34
28
  const disableDirectChildTheme = props['disable-child-theme']
@@ -74,12 +68,19 @@ export function getThemedChildren(
74
68
  let shouldRenderChildrenWithTheme =
75
69
  hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props)
76
70
 
71
+ if (process.env.NODE_ENV === 'development' && props.debug) {
72
+ children = (
73
+ <ThemeDebug themeState={themeState} themeProps={props}>
74
+ {children}
75
+ </ThemeDebug>
76
+ )
77
+ }
78
+
77
79
  if (!shouldRenderChildrenWithTheme) {
78
80
  return children
79
81
  }
80
82
 
81
83
  // from here on out we have to be careful not to re-parent
82
-
83
84
  children = (
84
85
  <ThemeStateContext.Provider value={themeState.id}>
85
86
  {children}
@@ -133,11 +134,6 @@ export function getThemedChildren(
133
134
  state,
134
135
  ...getThemeClassNameAndStyle(themeState, props, isRoot),
135
136
  })
136
- children = (
137
- <ThemeDebug themeState={themeState} themeProps={props}>
138
- {children}
139
- </ThemeDebug>
140
- )
141
137
  }
142
138
  }
143
139
 
@@ -149,7 +145,13 @@ export function getThemedChildren(
149
145
  const { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot)
150
146
 
151
147
  children = (
152
- <span className={`${className} _dsp_contents is_Theme`} style={style}>
148
+ <span
149
+ {...(process.env.NODE_ENV === 'development' && {
150
+ 'data-theme-id': themeState.id,
151
+ })}
152
+ className={`${className} _dsp_contents is_Theme`}
153
+ style={style}
154
+ >
153
155
  {children}
154
156
  </span>
155
157
  )
@@ -1 +1 @@
1
- {"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE/E,KAAK,EAAE,GAAG,MAAM,CAAA;AAEhB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,WAAW,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,EAAE,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,iCAAwB,CAAA;AAEtD,eAAO,MAAM,QAAQ,uBAAgB,CAAA;AAWrC,eAAO,MAAM,iBAAiB,YAI7B,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,EAAE,2BAAmB,CAAA;AAQvD,eAAO,MAAM,iBAAiB,yBAAuB,CAAA;AAErD,eAAO,MAAM,aAAa,UACjB,sBAAsB,qCAEvB,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KACzC,UAwGF,CAAA;AA6ND,eAAO,MAAM,qBAAqB,UAAW,UAAU,YACiC,CAAA"}
1
+ {"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE/E,KAAK,EAAE,GAAG,MAAM,CAAA;AAEhB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,WAAW,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,EAAE,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,iCAAwB,CAAA;AAEtD,eAAO,MAAM,QAAQ,uBAAgB,CAAA;AA8BrC,eAAO,MAAM,iBAAiB,YAI7B,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,EAAE,2BAAmB,CAAA;AAQvD,eAAO,MAAM,iBAAiB,yBAAuB,CAAA;AAErD,eAAO,MAAM,aAAa,UACjB,sBAAsB,qCAEvB,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KACzC,UA2HF,CAAA;AAkOD,eAAO,MAAM,qBAAqB,UAAW,UAAU,YACiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAON,MAAM,OAAO,CAAA;AAId,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C,eAAO,MAAM,KAAK,4EAgChB,CAAA;AAIF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,UAAU,EACjB,MAAM,qBAAQ,EACd,QAAQ,EAAE,gBAAgB,CAAC;IAAE,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC,OAgHpE"}
1
+ {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAqE,MAAM,OAAO,CAAA;AAIzF,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C,eAAO,MAAM,KAAK,4EAiChB,CAAA;AAIF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,UAAU,EACjB,MAAM,qBAAQ,EACd,QAAQ,EAAE,gBAAgB,CAAC;IAAE,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC,OAwHpE"}