@tamagui/web 1.84.1 → 1.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +1 -1
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +1 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createTamagui.js +1 -1
- package/dist/cjs/createTamagui.js.map +1 -1
- package/dist/cjs/createTamagui.native.js +1 -1
- package/dist/cjs/createTamagui.native.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.js +2 -2
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.native.js +2 -2
- package/dist/cjs/helpers/ThemeManager.native.js.map +1 -1
- package/dist/cjs/helpers/ThemeManagerContext.js +3 -3
- package/dist/cjs/helpers/ThemeManagerContext.js.map +1 -1
- package/dist/cjs/helpers/ThemeManagerContext.native.js +3 -3
- package/dist/cjs/helpers/ThemeManagerContext.native.js.map +1 -1
- package/dist/cjs/helpers/createMediaStyle.js.map +1 -1
- package/dist/cjs/helpers/createMediaStyle.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +9 -9
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +18 -21
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +2 -4
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.js +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/cjs/helpers/propMapper.js +3 -3
- package/dist/cjs/helpers/propMapper.js.map +1 -1
- package/dist/cjs/helpers/propMapper.native.js +3 -3
- package/dist/cjs/helpers/propMapper.native.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js +25 -9
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/cjs/hooks/useTheme.native.js +25 -9
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/hooks/useThemeName.js +2 -2
- package/dist/cjs/hooks/useThemeName.js.map +1 -1
- package/dist/cjs/hooks/useThemeName.native.js +2 -2
- package/dist/cjs/hooks/useThemeName.native.js.map +1 -1
- package/dist/cjs/setupReactNative.js.map +1 -1
- package/dist/cjs/setupReactNative.native.js +1 -1
- package/dist/cjs/setupReactNative.native.js.map +1 -1
- package/dist/cjs/views/Theme.js +4 -2
- package/dist/cjs/views/Theme.js.map +1 -1
- package/dist/cjs/views/Theme.native.js +4 -2
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.js.map +1 -1
- package/dist/esm/createComponent.js +1 -1
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.native.js +1 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createTamagui.js +1 -1
- package/dist/esm/createTamagui.js.map +1 -1
- package/dist/esm/createTamagui.native.js +1 -1
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js +2 -2
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.native.js +2 -2
- package/dist/esm/helpers/ThemeManager.native.js.map +1 -1
- package/dist/esm/helpers/ThemeManagerContext.js +2 -2
- package/dist/esm/helpers/ThemeManagerContext.js.map +1 -1
- package/dist/esm/helpers/ThemeManagerContext.native.js +2 -2
- package/dist/esm/helpers/ThemeManagerContext.native.js.map +1 -1
- package/dist/esm/helpers/createMediaStyle.js.map +1 -1
- package/dist/esm/helpers/createMediaStyle.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +9 -9
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +18 -21
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +2 -4
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/esm/helpers/propMapper.js +3 -3
- package/dist/esm/helpers/propMapper.js.map +1 -1
- package/dist/esm/helpers/propMapper.native.js +3 -3
- package/dist/esm/helpers/propMapper.native.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +25 -10
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +25 -10
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/hooks/useThemeName.js +3 -2
- package/dist/esm/hooks/useThemeName.js.map +1 -1
- package/dist/esm/hooks/useThemeName.native.js +3 -2
- package/dist/esm/hooks/useThemeName.native.js.map +1 -1
- package/dist/esm/setupReactNative.js.map +1 -1
- package/dist/esm/setupReactNative.native.js.map +1 -1
- package/dist/esm/views/Theme.js +5 -3
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/Theme.native.js +5 -3
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/dist/esm/views/ThemeDebug.js.map +1 -1
- package/package.json +13 -11
- package/src/createComponent.tsx +10 -6
- package/src/createTamagui.ts +5 -3
- package/src/createVariables.ts +2 -2
- package/src/helpers/ThemeManager.tsx +4 -1
- package/src/helpers/ThemeManagerContext.tsx +1 -3
- package/src/helpers/createMediaStyle.ts +6 -4
- package/src/helpers/getSplitStyles.tsx +56 -71
- package/src/helpers/getThemeCSSRules.ts +6 -5
- package/src/helpers/insertStyleRule.tsx +2 -2
- package/src/helpers/normalizeValueWithProperty.ts +1 -1
- package/src/helpers/propMapper.ts +6 -6
- package/src/hooks/useTheme.tsx +39 -14
- package/src/hooks/useThemeName.tsx +3 -2
- package/src/interfaces/GetRef.tsx +19 -15
- package/src/setupReactNative.ts +15 -16
- package/src/styled.tsx +9 -9
- package/src/types.tsx +112 -109
- package/src/views/Theme.tsx +12 -6
- package/src/views/ThemeDebug.tsx +0 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createVariables.d.ts.map +1 -1
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/ThemeManagerContext.d.ts +1 -2
- package/types/helpers/ThemeManagerContext.d.ts.map +1 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +1 -0
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/hooks/useThemeName.d.ts.map +1 -1
- package/types/interfaces/GetRef.d.ts.map +1 -1
- package/types/setupReactNative.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Theme.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,SAAS,UAAU,cAAc,YAAY,gBAAgB,cAAc;AAElF,SAAS,wBAAwB;AACjC,SAAS,
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,SAAS,UAAU,cAAc,YAAY,gBAAgB,cAAc;AAElF,SAAS,wBAAwB;AAC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AK,CAAC,aACjC,WAIP,iCACG;AAAA;AAAA,QACC;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,YAAY;AAAA,YACd;AAAA,YACD;AAAA;AAAA,cACY;AAAA,cAAG;AAAA,cACb,KAAK;AAAA,gBACJ;AAAA,kBACE,MAAM,YAAY,OAAO;AAAA,kBACzB,WAAW,YAAY,OAAO;AAAA,kBAC9B,SAAS,WAAW;AAAA,kBACpB,gBAAgB,WAAW;AAAA,kBAC3B,QAAQ,WAAW,cAAc,MAAM;AAAA,kBACvC,IAAI,WAAW,cAAc;AAAA,kBAC7B,UAAU,WAAW,cAAc,eAAe;AAAA,kBAClD,OAAO,WAAW;AAAA,kBAClB;AAAA,kBACA,WAAW,CAAC,GAAI,WAAW,cAAe,iBAAoB,CAAC,CAAE,EAAE;AAAA,oBACjE;AAAA,kBACF;AAAA,kBACA,sBAAsB,WAAW,cAAe;AAAA,gBAClD;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA;AAAA;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,MAEA,oBAAC,SAAI,OAAO,EAAE,OAAO,MAAM,GAAI,cAAG;AAAA,MAEjC;AAAA,OACH;AAAA,EAEJ;AACA,SAAO;AACT;AAEA,WAAW,cAAiB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,23 +27,25 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.
|
|
31
|
-
"@tamagui/constants": "1.
|
|
32
|
-
"@tamagui/helpers": "1.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.
|
|
34
|
-
"@tamagui/timer": "1.
|
|
35
|
-
"@tamagui/use-did-finish-ssr": "1.
|
|
36
|
-
"@tamagui/use-event": "1.
|
|
37
|
-
"@tamagui/use-force-update": "1.
|
|
30
|
+
"@tamagui/compose-refs": "1.85.0",
|
|
31
|
+
"@tamagui/constants": "1.85.0",
|
|
32
|
+
"@tamagui/helpers": "1.85.0",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.85.0",
|
|
34
|
+
"@tamagui/timer": "1.85.0",
|
|
35
|
+
"@tamagui/use-did-finish-ssr": "1.85.0",
|
|
36
|
+
"@tamagui/use-event": "1.85.0",
|
|
37
|
+
"@tamagui/use-force-update": "1.85.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react": "*"
|
|
40
|
+
"react": "*",
|
|
41
|
+
"react-dom": "*"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@tamagui/build": "1.
|
|
44
|
+
"@tamagui/build": "1.85.0",
|
|
44
45
|
"@testing-library/react": "^14.0.0",
|
|
45
46
|
"csstype": "^3.0.10",
|
|
46
47
|
"react": "^18.2.0",
|
|
48
|
+
"react-dom": "^18.2.0",
|
|
47
49
|
"typescript": "^5.2.2",
|
|
48
50
|
"vitest": "^0.34.3"
|
|
49
51
|
},
|
package/src/createComponent.tsx
CHANGED
|
@@ -145,7 +145,7 @@ let hasSetupBaseViews = false
|
|
|
145
145
|
export function createComponent<
|
|
146
146
|
ComponentPropTypes extends StackProps | TextProps = {},
|
|
147
147
|
Ref = TamaguiElement,
|
|
148
|
-
BaseProps = never
|
|
148
|
+
BaseProps = never,
|
|
149
149
|
>(staticConfig: StaticConfig) {
|
|
150
150
|
let config: TamaguiInternalConfig | null = null
|
|
151
151
|
let defaultProps = staticConfig.defaultProps
|
|
@@ -361,6 +361,7 @@ export function createComponent<
|
|
|
361
361
|
|
|
362
362
|
if (process.env.NODE_ENV === 'development' && time) time`stateref`
|
|
363
363
|
|
|
364
|
+
// TODO can remove and fold into stateRef
|
|
364
365
|
const hostRef = useRef<TamaguiElement>(null)
|
|
365
366
|
|
|
366
367
|
/**
|
|
@@ -371,7 +372,7 @@ export function createComponent<
|
|
|
371
372
|
|
|
372
373
|
// after we get states mount we need to turn off isAnimated for server side
|
|
373
374
|
const hasAnimationProp = Boolean(
|
|
374
|
-
|
|
375
|
+
'animation' in props || (props.style && hasAnimatedStyleValue(props.style))
|
|
375
376
|
)
|
|
376
377
|
|
|
377
378
|
// disable for now still ssr issues
|
|
@@ -464,8 +465,8 @@ export function createComponent<
|
|
|
464
465
|
const componentClassName = props.asChild
|
|
465
466
|
? ''
|
|
466
467
|
: props.componentName
|
|
467
|
-
|
|
468
|
-
|
|
468
|
+
? `is_${props.componentName}`
|
|
469
|
+
: defaultComponentClassName
|
|
469
470
|
|
|
470
471
|
const hasTextAncestor = !!(isWeb && isText ? componentContext.inText : false)
|
|
471
472
|
const isDisabled = props.disabled ?? props.accessibilityState?.disabled
|
|
@@ -554,8 +555,11 @@ export function createComponent<
|
|
|
554
555
|
if (debugProp && debugProp !== 'profile') {
|
|
555
556
|
// prettier-ignore
|
|
556
557
|
const name = `${
|
|
557
|
-
componentName ||
|
|
558
|
-
|
|
558
|
+
componentName ||
|
|
559
|
+
Component?.displayName ||
|
|
560
|
+
Component?.name ||
|
|
561
|
+
'[Unnamed Component]'
|
|
562
|
+
}`
|
|
559
563
|
const type = isAnimatedReactNative ? '(animated)' : isReactNative ? '(rnw)' : ''
|
|
560
564
|
const dataIs = propsIn['data-is'] || ''
|
|
561
565
|
const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type} id ${internalID}`
|
package/src/createTamagui.ts
CHANGED
|
@@ -322,14 +322,16 @@ function getThemesDeduped(themes: ThemesLikeObject): DedupedThemes {
|
|
|
322
322
|
const darkOrLightSpecificPrefix = themeName.startsWith('dark')
|
|
323
323
|
? 'dark'
|
|
324
324
|
: themeName.startsWith('light')
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
? 'light'
|
|
326
|
+
: ''
|
|
327
327
|
|
|
328
328
|
const rawTheme = themes[themeName]
|
|
329
329
|
|
|
330
330
|
// dont force referential equality but may need something more consistent than JSON.stringify
|
|
331
331
|
// separate between dark/light
|
|
332
|
-
const key =
|
|
332
|
+
const key =
|
|
333
|
+
darkOrLightSpecificPrefix +
|
|
334
|
+
JSON.stringify(Object.entries(rawTheme).sort((a, b) => (a[0] > b[0] ? -1 : 1)))
|
|
333
335
|
|
|
334
336
|
// if existing, avoid
|
|
335
337
|
if (existing.has(key)) {
|
package/src/createVariables.ts
CHANGED
|
@@ -10,8 +10,8 @@ export type DeepVariableObject<A extends DeepTokenObject> = {
|
|
|
10
10
|
[Key in keyof A]: A[Key] extends string | number
|
|
11
11
|
? Variable<A[Key]>
|
|
12
12
|
: A[Key] extends DeepTokenObject
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
? DeepVariableObject<A[Key]>
|
|
14
|
+
: never
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const cache = new WeakMap()
|
|
@@ -36,7 +36,7 @@ export function getHasThemeUpdatingProps(props: ThemeProps) {
|
|
|
36
36
|
let uid = 0
|
|
37
37
|
|
|
38
38
|
export class ThemeManager {
|
|
39
|
-
id =
|
|
39
|
+
id = 0
|
|
40
40
|
themeListeners = new Set<ThemeListener>()
|
|
41
41
|
parentManager: ThemeManager | null = null
|
|
42
42
|
state: ThemeManagerState = emptyState
|
|
@@ -45,6 +45,9 @@ export class ThemeManager {
|
|
|
45
45
|
public props: ThemeProps = {},
|
|
46
46
|
parentManager?: ThemeManager | 'root' | null | undefined
|
|
47
47
|
) {
|
|
48
|
+
uid = (uid + 1) % Number.MAX_VALUE
|
|
49
|
+
this.id = uid
|
|
50
|
+
|
|
48
51
|
if (parentManager === 'root') {
|
|
49
52
|
this.updateStateFromProps(props, false)
|
|
50
53
|
return
|
|
@@ -98,10 +98,12 @@ export const createMediaStyle = (
|
|
|
98
98
|
const precedenceImportancePrefix = groupMediaKey
|
|
99
99
|
? ''
|
|
100
100
|
: enableMediaPropOrder
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
? // this new array should be cached
|
|
102
|
+
new Array(priority)
|
|
103
|
+
.fill(':root')
|
|
104
|
+
.join('')
|
|
105
|
+
: // @ts-ignore
|
|
106
|
+
prefixes[mediaKey]
|
|
105
107
|
const prefix = groupMediaKey ? `@container ${containerName}` : '@media'
|
|
106
108
|
|
|
107
109
|
if (groupMediaKey) {
|
|
@@ -352,7 +352,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
352
352
|
}
|
|
353
353
|
viewProps[nativeA11yProp] = valInit
|
|
354
354
|
continue
|
|
355
|
-
}
|
|
355
|
+
}
|
|
356
|
+
if (nativeAccessibilityValue[keyInit]) {
|
|
356
357
|
let field = nativeAccessibilityValue[keyInit]
|
|
357
358
|
if (viewProps['accessibilityValue']) {
|
|
358
359
|
viewProps['accessibilityValue'][field] = valInit
|
|
@@ -441,61 +442,60 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
441
442
|
if (keyInit in accessibilityDirectMap) {
|
|
442
443
|
viewProps[accessibilityDirectMap[keyInit]] = valInit
|
|
443
444
|
continue
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
continue
|
|
453
|
-
}
|
|
454
|
-
case 'accessibilityLabelledBy':
|
|
455
|
-
case 'accessibilityFlowTo':
|
|
456
|
-
case 'accessibilityControls':
|
|
457
|
-
case 'accessibilityDescribedBy': {
|
|
458
|
-
viewProps[`aria-${keyInit.replace('accessibility', '').toLowerCase()}`] =
|
|
459
|
-
processIDRefList(valInit)
|
|
460
|
-
continue
|
|
461
|
-
}
|
|
462
|
-
case 'accessibilityKeyShortcuts': {
|
|
463
|
-
if (Array.isArray(valInit)) {
|
|
464
|
-
viewProps['aria-keyshortcuts'] = valInit.join(' ')
|
|
465
|
-
}
|
|
466
|
-
continue
|
|
467
|
-
}
|
|
468
|
-
case 'accessibilityLiveRegion': {
|
|
469
|
-
viewProps['aria-live'] = valInit === 'none' ? 'off' : valInit
|
|
470
|
-
continue
|
|
445
|
+
}
|
|
446
|
+
switch (keyInit) {
|
|
447
|
+
case 'accessibilityRole': {
|
|
448
|
+
if (valInit === 'none') {
|
|
449
|
+
viewProps.role = 'presentation'
|
|
450
|
+
} else {
|
|
451
|
+
viewProps.role = accessibilityRoleToWebRole[valInit] || valInit
|
|
471
452
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
)
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
453
|
+
continue
|
|
454
|
+
}
|
|
455
|
+
case 'accessibilityLabelledBy':
|
|
456
|
+
case 'accessibilityFlowTo':
|
|
457
|
+
case 'accessibilityControls':
|
|
458
|
+
case 'accessibilityDescribedBy': {
|
|
459
|
+
viewProps[`aria-${keyInit.replace('accessibility', '').toLowerCase()}`] =
|
|
460
|
+
processIDRefList(valInit)
|
|
461
|
+
continue
|
|
462
|
+
}
|
|
463
|
+
case 'accessibilityKeyShortcuts': {
|
|
464
|
+
if (Array.isArray(valInit)) {
|
|
465
|
+
viewProps['aria-keyshortcuts'] = valInit.join(' ')
|
|
483
466
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
467
|
+
continue
|
|
468
|
+
}
|
|
469
|
+
case 'accessibilityLiveRegion': {
|
|
470
|
+
viewProps['aria-live'] = valInit === 'none' ? 'off' : valInit
|
|
471
|
+
continue
|
|
472
|
+
}
|
|
473
|
+
case 'accessibilityReadOnly': {
|
|
474
|
+
viewProps['aria-readonly'] = valInit
|
|
475
|
+
// Enhance with native semantics
|
|
476
|
+
if (
|
|
477
|
+
elementType === 'input' ||
|
|
478
|
+
elementType === 'select' ||
|
|
479
|
+
elementType === 'textarea'
|
|
480
|
+
) {
|
|
481
|
+
viewProps.readOnly = true
|
|
495
482
|
}
|
|
496
|
-
|
|
497
|
-
|
|
483
|
+
continue
|
|
484
|
+
}
|
|
485
|
+
case 'accessibilityRequired': {
|
|
486
|
+
viewProps['aria-required'] = valInit
|
|
487
|
+
// Enhance with native semantics
|
|
488
|
+
if (
|
|
489
|
+
elementType === 'input' ||
|
|
490
|
+
elementType === 'select' ||
|
|
491
|
+
elementType === 'textarea'
|
|
492
|
+
) {
|
|
493
|
+
viewProps.required = valInit
|
|
498
494
|
}
|
|
495
|
+
continue
|
|
496
|
+
}
|
|
497
|
+
default: {
|
|
498
|
+
didUseKeyInit = false
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
}
|
|
@@ -741,21 +741,6 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
741
741
|
const isEnter = key === 'enterStyle'
|
|
742
742
|
const isExit = key === 'exitStyle'
|
|
743
743
|
|
|
744
|
-
// dev-time warning that helps clear confusion around need for animation when using enter/exit style
|
|
745
|
-
if (
|
|
746
|
-
process.env.NODE_ENV === 'development' &&
|
|
747
|
-
!styleProps.isAnimated &&
|
|
748
|
-
!componentState.unmounted &&
|
|
749
|
-
(isEnter || isExit)
|
|
750
|
-
) {
|
|
751
|
-
console.warn(
|
|
752
|
-
`No animation prop given to component ${staticConfig.componentName || ''} ${
|
|
753
|
-
props['data-at'] || ''
|
|
754
|
-
} with enterStyle / exitStyle, these styles will be ignored`,
|
|
755
|
-
{ props }
|
|
756
|
-
)
|
|
757
|
-
}
|
|
758
|
-
|
|
759
744
|
// don't continue here on isEnter && !state.unmounted because we need to merge defaults
|
|
760
745
|
if (!descriptor || (isExit && !styleProps.isExiting)) {
|
|
761
746
|
continue
|
|
@@ -776,7 +761,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
776
761
|
|
|
777
762
|
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
778
763
|
// prettier-ignore
|
|
779
|
-
console.groupCollapsed(
|
|
764
|
+
console.groupCollapsed('pseudo (classes)', key)
|
|
780
765
|
|
|
781
766
|
log({ pseudoStyleObject, pseudoStyles })
|
|
782
767
|
console.groupEnd()
|
|
@@ -815,7 +800,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
815
800
|
|
|
816
801
|
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
817
802
|
// prettier-ignore
|
|
818
|
-
console.groupCollapsed(
|
|
803
|
+
console.groupCollapsed('pseudo', key, { isDisabled })
|
|
819
804
|
|
|
820
805
|
log(pseudoStyleObject, {
|
|
821
806
|
isDisabled,
|
|
@@ -874,7 +859,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
874
859
|
continue
|
|
875
860
|
}
|
|
876
861
|
// media
|
|
877
|
-
|
|
862
|
+
if (isMedia) {
|
|
878
863
|
if (!val) continue
|
|
879
864
|
|
|
880
865
|
if (isMedia === 'platform') {
|
|
@@ -1338,7 +1323,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1338
1323
|
viewPropsOrder: Object.keys(viewProps),
|
|
1339
1324
|
rulesToInsert,
|
|
1340
1325
|
parentSplitStyles,
|
|
1341
|
-
}
|
|
1326
|
+
}
|
|
1342
1327
|
for (const key in logs) {
|
|
1343
1328
|
log(key, logs[key])
|
|
1344
1329
|
}
|
|
@@ -15,7 +15,8 @@ export function getThemeCSSRules(props: {
|
|
|
15
15
|
|
|
16
16
|
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
17
17
|
return cssRuleSets
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
|
+
if (
|
|
19
20
|
!process.env.TAMAGUI_DOES_SSR_CSS ||
|
|
20
21
|
process.env.TAMAGUI_DOES_SSR_CSS === 'mutates-themes' ||
|
|
21
22
|
process.env.TAMAGUI_DOES_SSR_CSS === 'false'
|
|
@@ -46,7 +47,7 @@ export function getThemeCSSRules(props: {
|
|
|
46
47
|
const isDarkBase = themeName === 'dark'
|
|
47
48
|
const isLightBase = themeName === 'light'
|
|
48
49
|
const baseSelectors = names.map((name) => `${CNP}${name}`)
|
|
49
|
-
const selectorsSet = new Set(baseSelectors)
|
|
50
|
+
const selectorsSet = new Set(isDarkBase || isLightBase ? baseSelectors : [])
|
|
50
51
|
|
|
51
52
|
// since we dont specify dark/light in classnames we have to do an awkward specificity war
|
|
52
53
|
// use config.maxDarkLightNesting to determine how deep you can nest until it breaks
|
|
@@ -94,9 +95,9 @@ export function getThemeCSSRules(props: {
|
|
|
94
95
|
|
|
95
96
|
// for light/dark/light:
|
|
96
97
|
selectorsSet.add(`${parentSelectors.join(' ')} ${nextChildSelector}`.trim())
|
|
97
|
-
selectorsSet.add(
|
|
98
|
-
|
|
99
|
-
)
|
|
98
|
+
// selectorsSet.add(
|
|
99
|
+
// `${parentSelectors.join(' ')} ${nextChildSelector}.is_inversed`.trim()
|
|
100
|
+
// )
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
}
|
|
@@ -265,8 +265,8 @@ function addThemesFromCSS(cssStyleRule: CSSStyleRule, tokens?: TokensParsed) {
|
|
|
265
265
|
let scheme = selector.includes('t_dark')
|
|
266
266
|
? 'dark'
|
|
267
267
|
: selector.includes('t_light')
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
? 'light'
|
|
269
|
+
: ''
|
|
270
270
|
let name = selector.slice(selector.lastIndexOf('.t_') + 3)
|
|
271
271
|
|
|
272
272
|
if (name.startsWith(scheme)) {
|
|
@@ -68,7 +68,7 @@ export function reverseMapClassNameToValue(key: string, className: string) {
|
|
|
68
68
|
rcache[cssRule] = res
|
|
69
69
|
if (process.env.NODE_ENV === 'development') {
|
|
70
70
|
// ensure we are parsing properly
|
|
71
|
-
if (typeof res === 'number' && isNaN(res)) {
|
|
71
|
+
if (typeof res === 'number' && Number.isNaN(res)) {
|
|
72
72
|
console.info('Tamagui invalid parsed value, NaN:', {
|
|
73
73
|
res,
|
|
74
74
|
cssVal,
|
|
@@ -54,17 +54,17 @@ export const propMapper: PropMapper = (key, value, styleStateIn, subPropsIn) =>
|
|
|
54
54
|
|
|
55
55
|
// prettier-ignore
|
|
56
56
|
if (
|
|
57
|
-
process.env.NODE_ENV ===
|
|
57
|
+
process.env.NODE_ENV === 'development' &&
|
|
58
58
|
fontFamily &&
|
|
59
|
-
fontFamily[0] ===
|
|
59
|
+
fontFamily[0] === '$' &&
|
|
60
60
|
!(fontFamily in conf.fontsParsed)
|
|
61
61
|
) {
|
|
62
62
|
// prettier-ignore
|
|
63
63
|
console.warn(
|
|
64
|
-
`Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
|
|
65
|
-
|
|
66
|
-
)}
|
|
67
|
-
)
|
|
64
|
+
`Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
|
|
65
|
+
conf.fontsParsed
|
|
66
|
+
).join(', ')}`
|
|
67
|
+
)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (!styleProps.noExpand) {
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ThemeManagerState,
|
|
10
10
|
getHasThemeUpdatingProps,
|
|
11
11
|
} from '../helpers/ThemeManager'
|
|
12
|
-
import {
|
|
12
|
+
import { ThemeManagerIDContext } from '../helpers/ThemeManagerContext'
|
|
13
13
|
import type {
|
|
14
14
|
DebugProp,
|
|
15
15
|
ThemeParsed,
|
|
@@ -61,8 +61,8 @@ export type ThemeGettable<Val> = Val & {
|
|
|
61
61
|
? any
|
|
62
62
|
: Exclude<X, Variable>
|
|
63
63
|
: Val extends VariableVal
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
? string | number
|
|
65
|
+
: unknown)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export type UseThemeResult = {
|
|
@@ -106,8 +106,8 @@ export const useThemeWithState = (
|
|
|
106
106
|
|
|
107
107
|
const { themeManager, state } = changedThemeState
|
|
108
108
|
|
|
109
|
-
if (
|
|
110
|
-
if (
|
|
109
|
+
if (process.env.NODE_ENV === 'development') {
|
|
110
|
+
if (!state?.theme) {
|
|
111
111
|
if (process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== '1') {
|
|
112
112
|
console.warn(
|
|
113
113
|
`[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
|
|
@@ -263,6 +263,21 @@ function someParentIsInversed(manager?: ThemeManager) {
|
|
|
263
263
|
|
|
264
264
|
export const activeThemeManagers = new Set<ThemeManager>()
|
|
265
265
|
|
|
266
|
+
const _uidToManager = new WeakMap<Object, ThemeManager>()
|
|
267
|
+
const _idToUID: Record<number, Object> = {}
|
|
268
|
+
const getId = (id: number) => _idToUID[id]
|
|
269
|
+
|
|
270
|
+
export const getThemeManager = (id: number) => {
|
|
271
|
+
return _uidToManager.get(getId(id)!)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const registerThemeManager = (t: ThemeManager) => {
|
|
275
|
+
if (!_idToUID[t.id]) {
|
|
276
|
+
const id = (_idToUID[t.id] = {})
|
|
277
|
+
_uidToManager.set(id, t)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
266
281
|
export const useChangeThemeEffect = (
|
|
267
282
|
props: UseThemeWithStateProps,
|
|
268
283
|
isRoot = false,
|
|
@@ -270,8 +285,8 @@ export const useChangeThemeEffect = (
|
|
|
270
285
|
shouldUpdate?: () => boolean | undefined
|
|
271
286
|
): ChangedThemeResponse => {
|
|
272
287
|
const { disable } = props
|
|
273
|
-
|
|
274
|
-
const parentManager =
|
|
288
|
+
const parentManagerId = useContext(ThemeManagerIDContext)
|
|
289
|
+
const parentManager = getThemeManager(parentManagerId)
|
|
275
290
|
|
|
276
291
|
if ((!isRoot && !parentManager) || disable) {
|
|
277
292
|
return {
|
|
@@ -335,11 +350,8 @@ export const useChangeThemeEffect = (
|
|
|
335
350
|
return
|
|
336
351
|
}
|
|
337
352
|
|
|
338
|
-
if (isNewTheme && themeManager) {
|
|
339
|
-
activeThemeManagers.add(themeManager)
|
|
340
|
-
}
|
|
341
|
-
|
|
342
353
|
if (isNewTheme || getShouldUpdateTheme(themeManager)) {
|
|
354
|
+
activeThemeManagers.add(themeManager)
|
|
343
355
|
setThemeState(createState)
|
|
344
356
|
}
|
|
345
357
|
|
|
@@ -365,7 +377,14 @@ export const useChangeThemeEffect = (
|
|
|
365
377
|
|
|
366
378
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
367
379
|
// prettier-ignore
|
|
368
|
-
console.info(` 🔸 onChange`, themeManager.id, {
|
|
380
|
+
console.info(` 🔸 onChange`, themeManager.id, {
|
|
381
|
+
force,
|
|
382
|
+
shouldTryUpdate,
|
|
383
|
+
props,
|
|
384
|
+
name,
|
|
385
|
+
manager,
|
|
386
|
+
keys,
|
|
387
|
+
})
|
|
369
388
|
}
|
|
370
389
|
|
|
371
390
|
if (shouldTryUpdate) {
|
|
@@ -378,7 +397,9 @@ export const useChangeThemeEffect = (
|
|
|
378
397
|
return () => {
|
|
379
398
|
selfListenerDispose()
|
|
380
399
|
disposeChangeListener?.()
|
|
381
|
-
|
|
400
|
+
if (isNewTheme) {
|
|
401
|
+
activeThemeManagers.delete(themeManager)
|
|
402
|
+
}
|
|
382
403
|
}
|
|
383
404
|
}, [
|
|
384
405
|
themeManager,
|
|
@@ -479,6 +500,10 @@ export const useChangeThemeEffect = (
|
|
|
479
500
|
|
|
480
501
|
const isNewTheme = Boolean(themeManager !== parentManager || props.inverse)
|
|
481
502
|
|
|
503
|
+
if (isNewTheme) {
|
|
504
|
+
registerThemeManager(themeManager)
|
|
505
|
+
}
|
|
506
|
+
|
|
482
507
|
// only inverse relies on this for ssr
|
|
483
508
|
const mounted = !props.inverse ? true : isRoot || prev?.mounted
|
|
484
509
|
|
|
@@ -503,8 +528,8 @@ export const useChangeThemeEffect = (
|
|
|
503
528
|
}
|
|
504
529
|
|
|
505
530
|
const shouldReturnPrev =
|
|
506
|
-
!force &&
|
|
507
531
|
prev &&
|
|
532
|
+
!force &&
|
|
508
533
|
// isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
509
534
|
isEqualShallow(prev, response) &&
|
|
510
535
|
// ... and then compare just the state, because we make a new state obj but is likely the same
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
2
|
import { useContext, useState } from 'react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ThemeManagerIDContext } from '../helpers/ThemeManagerContext'
|
|
5
5
|
import { ThemeName } from '../types'
|
|
6
|
+
import { getThemeManager } from './useTheme'
|
|
6
7
|
|
|
7
8
|
export function useThemeName(opts?: { parent?: true }): ThemeName {
|
|
8
|
-
const manager = useContext(
|
|
9
|
+
const manager = getThemeManager(useContext(ThemeManagerIDContext)!)
|
|
9
10
|
const [name, setName] = useState(manager?.state.name || '')
|
|
10
11
|
|
|
11
12
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -6,18 +6,22 @@ import { TamaguiComponent } from '../types'
|
|
|
6
6
|
|
|
7
7
|
export type GetRef<C> = C extends TamaguiComponent<any, infer Ref>
|
|
8
8
|
? Ref
|
|
9
|
-
: C extends new (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
: C extends new (
|
|
10
|
+
props: any
|
|
11
|
+
) => Component
|
|
12
|
+
? InstanceType<C>
|
|
13
|
+
: C extends abstract new (
|
|
14
|
+
...args: any
|
|
15
|
+
) => any
|
|
16
|
+
? InstanceType<C>
|
|
17
|
+
: C extends Component
|
|
18
|
+
? C
|
|
19
|
+
: (
|
|
20
|
+
C extends JSXElementConstructor<{ ref?: infer R }>
|
|
21
|
+
? R
|
|
22
|
+
: C extends keyof JSX.IntrinsicElements
|
|
23
|
+
? JSX.IntrinsicElements[C]['ref']
|
|
24
|
+
: unknown
|
|
25
|
+
) extends Ref<infer T> | string | undefined
|
|
26
|
+
? T
|
|
27
|
+
: unknown
|