@tamagui/web 1.115.4 → 1.116.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.cjs +16 -25
- package/dist/cjs/createComponent.cjs.map +1 -1
- package/dist/cjs/createComponent.native.js +14 -18
- package/dist/cjs/createComponent.native.js.map +2 -2
- package/dist/cjs/defaultComponentState.cjs +1 -6
- package/dist/cjs/defaultComponentState.cjs.map +1 -1
- package/dist/cjs/defaultComponentState.native.js +2 -7
- package/dist/cjs/defaultComponentState.native.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.cjs +13 -14
- package/dist/cjs/helpers/getSplitStyles.cjs.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +7 -10
- package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/cjs/helpers/isActivePlatform.cjs +1 -0
- package/dist/cjs/helpers/isActivePlatform.cjs.map +1 -1
- package/dist/cjs/helpers/isActivePlatform.native.js +2 -0
- package/dist/cjs/helpers/isActivePlatform.native.js.map +2 -2
- package/dist/cjs/helpers/isActiveTheme.cjs +28 -0
- package/dist/cjs/helpers/isActiveTheme.cjs.map +6 -0
- package/dist/cjs/helpers/isActiveTheme.native.js +29 -0
- package/dist/cjs/helpers/isActiveTheme.native.js.map +6 -0
- package/dist/cjs/helpers/log.cjs +2 -2
- package/dist/cjs/helpers/log.cjs.map +1 -1
- package/dist/cjs/helpers/log.native.js +2 -2
- package/dist/cjs/helpers/log.native.js.map +2 -2
- package/dist/cjs/helpers/themeable.cjs +9 -9
- package/dist/cjs/helpers/themeable.cjs.map +1 -1
- package/dist/cjs/helpers/themeable.native.js +6 -6
- package/dist/cjs/helpers/themeable.native.js.map +2 -2
- package/dist/cjs/hooks/useComponentState.cjs +21 -21
- package/dist/cjs/hooks/useComponentState.cjs.map +1 -1
- package/dist/cjs/hooks/useComponentState.native.js +12 -10
- package/dist/cjs/hooks/useComponentState.native.js.map +2 -2
- package/dist/cjs/hooks/useMedia.cjs +34 -37
- package/dist/cjs/hooks/useMedia.cjs.map +1 -1
- package/dist/cjs/hooks/useMedia.native.js +55 -40
- package/dist/cjs/hooks/useMedia.native.js.map +2 -2
- package/dist/cjs/hooks/useProps.cjs +1 -1
- package/dist/cjs/hooks/useProps.cjs.map +1 -1
- package/dist/cjs/hooks/useProps.native.js +1 -1
- package/dist/cjs/hooks/useProps.native.js.map +2 -2
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.native.js +2 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.cjs.map +1 -1
- package/dist/cjs/views/TamaguiProvider.native.js +2 -2
- package/dist/cjs/views/TamaguiProvider.native.js.map +2 -2
- package/dist/cjs/views/Theme.cjs +2 -2
- package/dist/cjs/views/Theme.cjs.map +1 -1
- package/dist/cjs/views/Theme.native.js +2 -2
- package/dist/cjs/views/Theme.native.js.map +2 -2
- package/dist/cjs/views/ThemeDebug.cjs.map +1 -1
- package/dist/esm/createComponent.js +13 -16
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.mjs +16 -25
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +14 -18
- package/dist/esm/createComponent.native.js.map +2 -2
- package/dist/esm/defaultComponentState.js +1 -5
- package/dist/esm/defaultComponentState.js.map +1 -1
- package/dist/esm/defaultComponentState.mjs +1 -5
- package/dist/esm/defaultComponentState.mjs.map +1 -1
- package/dist/esm/defaultComponentState.native.js +1 -5
- package/dist/esm/defaultComponentState.native.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +11 -23
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +11 -12
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +10 -12
- package/dist/esm/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/esm/helpers/isActivePlatform.js +2 -0
- package/dist/esm/helpers/isActivePlatform.js.map +1 -1
- package/dist/esm/helpers/isActivePlatform.mjs +1 -0
- package/dist/esm/helpers/isActivePlatform.mjs.map +1 -1
- package/dist/esm/helpers/isActivePlatform.native.js +2 -0
- package/dist/esm/helpers/isActivePlatform.native.js.map +2 -2
- package/dist/esm/helpers/isActiveTheme.js +8 -0
- package/dist/esm/helpers/isActiveTheme.js.map +6 -0
- package/dist/esm/helpers/isActiveTheme.mjs +5 -0
- package/dist/esm/helpers/isActiveTheme.mjs.map +1 -0
- package/dist/esm/helpers/isActiveTheme.native.js +8 -0
- package/dist/esm/helpers/isActiveTheme.native.js.map +6 -0
- package/dist/esm/helpers/log.js +3 -3
- package/dist/esm/helpers/log.js.map +1 -1
- package/dist/esm/helpers/log.mjs +3 -3
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +3 -3
- package/dist/esm/helpers/log.native.js.map +2 -2
- package/dist/esm/helpers/themeable.js +5 -13
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themeable.mjs +12 -12
- package/dist/esm/helpers/themeable.mjs.map +1 -1
- package/dist/esm/helpers/themeable.native.js +6 -6
- package/dist/esm/helpers/themeable.native.js.map +2 -2
- package/dist/esm/hooks/useComponentState.js +14 -14
- package/dist/esm/hooks/useComponentState.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +21 -21
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +13 -12
- package/dist/esm/hooks/useComponentState.native.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +38 -37
- package/dist/esm/hooks/useMedia.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +33 -36
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +54 -39
- package/dist/esm/hooks/useMedia.native.js.map +2 -2
- package/dist/esm/hooks/useProps.js +1 -1
- package/dist/esm/hooks/useProps.js.map +1 -1
- package/dist/esm/hooks/useProps.mjs +1 -1
- package/dist/esm/hooks/useProps.mjs.map +1 -1
- package/dist/esm/hooks/useProps.native.js +1 -1
- package/dist/esm/hooks/useProps.native.js.map +2 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -1
- package/dist/esm/index.native.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +1 -2
- package/dist/esm/views/TamaguiProvider.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 +2 -2
- package/dist/esm/views/Theme.js +2 -2
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/Theme.mjs +2 -2
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +2 -2
- package/dist/esm/views/Theme.native.js.map +2 -2
- package/dist/esm/views/ThemeDebug.js.map +1 -1
- package/dist/esm/views/ThemeDebug.mjs.map +1 -1
- package/package.json +13 -11
- package/src/createComponent.tsx +19 -26
- package/src/defaultComponentState.tsx +0 -5
- package/src/helpers/getSplitStyles.tsx +15 -27
- package/src/helpers/isActivePlatform.ts +3 -0
- package/src/helpers/isActiveTheme.ts +4 -0
- package/src/helpers/log.ts +3 -3
- package/src/helpers/themeable.tsx +27 -9
- package/src/hooks/useComponentState.ts +47 -39
- package/src/hooks/useMedia.tsx +67 -75
- package/src/hooks/useProps.tsx +3 -3
- package/src/index.ts +1 -0
- package/src/types.tsx +1 -1
- package/src/views/TamaguiProvider.tsx +0 -4
- package/src/views/Theme.tsx +7 -3
- package/src/views/ThemeDebug.tsx +0 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/defaultComponentState.d.ts +0 -1
- package/types/defaultComponentState.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/isActivePlatform.d.ts.map +1 -1
- package/types/helpers/isActiveTheme.d.ts +2 -0
- package/types/helpers/isActiveTheme.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +1 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts +2 -2
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useProps.d.ts +2 -2
- package/types/hooks/useProps.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.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/hooks/useDidHydrateOnce.cjs +0 -50
- package/dist/cjs/hooks/useDidHydrateOnce.cjs.map +0 -6
- package/dist/cjs/hooks/useDidHydrateOnce.native.js +0 -53
- package/dist/cjs/hooks/useDidHydrateOnce.native.js.map +0 -6
- package/dist/esm/hooks/useDidHydrateOnce.js +0 -16
- package/dist/esm/hooks/useDidHydrateOnce.js.map +0 -6
- package/dist/esm/hooks/useDidHydrateOnce.mjs +0 -15
- package/dist/esm/hooks/useDidHydrateOnce.mjs.map +0 -1
- package/dist/esm/hooks/useDidHydrateOnce.native.js +0 -24
- package/dist/esm/hooks/useDidHydrateOnce.native.js.map +0 -6
- package/src/hooks/useDidHydrateOnce.tsx +0 -42
- package/types/hooks/useDidHydrateOnce.d.ts +0 -3
- package/types/hooks/useDidHydrateOnce.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeDebug.tsx"],
|
|
4
|
-
"mappings": "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W,qBAAqB,KAAK,CAAC,aACjC,WAIP,iCACG;AAAA;AAAA,QACC;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,UAAU;AAAA,cACV,UAAU;AAAA,cACV,SAAS;AAAA,YACX;AAAA,YACD;AAAA;AAAA,cACY;AAAA,cAAG;AAAA,cACb,KAAK;AAAA,gBACJ;AAAA,kBACE,WAAW,WAAW;AAAA,kBACtB,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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useDidFinishSSR","useForceUpdate","createPortal","Fragment","jsx","jsxs","node","ThemeDebug","themeState","themeProps","children","process","env","NODE_ENV","isHydrated","onChangeCount","setOnChangeCount","useState","rerender","id","useId","document","createElement","style","height","overflowY","position","zIndex","bottom","left","right","display","border","flexDirection","background","body","appendChild","useEffect","themeManager","parentManager","onChangeTheme","name","manager","p","console","warn","tm","setInterval","clearTimeout","whiteSpace","maxWidth","overflow","padding","JSON","stringify","propsName","state","className","inverse","forceClassName","parent","parentName","parentId","isNew","isNewTheme","listening","_listeningIds","join","_numChangeEventsSent","color","displayName"],"sources":["../../../src/views/ThemeDebug.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,eAAA,QAAuB;AAChC,SAASC,cAAA,QAAsB;
|
|
1
|
+
{"version":3,"names":["React","useDidFinishSSR","useForceUpdate","createPortal","Fragment","jsx","jsxs","node","ThemeDebug","themeState","themeProps","children","process","env","NODE_ENV","isHydrated","onChangeCount","setOnChangeCount","useState","rerender","id","useId","document","createElement","style","height","overflowY","position","zIndex","bottom","left","right","display","border","flexDirection","background","body","appendChild","useEffect","themeManager","parentManager","onChangeTheme","name","manager","p","console","warn","tm","setInterval","clearTimeout","whiteSpace","maxWidth","overflow","padding","JSON","stringify","propsName","state","className","inverse","forceClassName","parent","parentName","parentId","isNew","isNewTheme","listening","_listeningIds","join","_numChangeEventsSent","color","displayName"],"sources":["../../../src/views/ThemeDebug.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,eAAA,QAAuB;AAChC,SAASC,cAAA,QAAsB;AAC/B,SAASC,YAAA,QAAoB;AAyDvB,SAAAC,QAAA,EAmCEC,GAAA,EAjCEC,IAAA,QAFJ;AApDN,IAAIC,IAAA;AAEG,SAASC,WAAW;EACzBC,UAAA;EACAC,UAAA;EACAC;AACF,GAAgF;EAC9E,IAAIC,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,eAAe;IAC1C,MAAMC,UAAA,GAAad,eAAA,CAAgB;MAC7B,CAACe,aAAA,EAAeC,gBAAgB,IAAIjB,KAAA,CAAMkB,QAAA,CAAS,CAAC;MACpDC,QAAA,GAAWjB,cAAA,CAAe;MAC1BkB,EAAA,GAAKpB,KAAA,CAAMqB,KAAA,CAAM;IAoCvB,OAlCIT,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,iBAAiB,OAAOQ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|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.116.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,18 +27,20 @@
|
|
|
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/types": "1.
|
|
36
|
-
"@tamagui/use-did-finish-ssr": "1.
|
|
37
|
-
"@tamagui/use-event": "1.
|
|
38
|
-
"@tamagui/use-force-update": "1.
|
|
30
|
+
"@tamagui/compose-refs": "1.116.0",
|
|
31
|
+
"@tamagui/constants": "1.116.0",
|
|
32
|
+
"@tamagui/helpers": "1.116.0",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.116.0",
|
|
34
|
+
"@tamagui/timer": "1.116.0",
|
|
35
|
+
"@tamagui/types": "1.116.0",
|
|
36
|
+
"@tamagui/use-did-finish-ssr": "1.116.0",
|
|
37
|
+
"@tamagui/use-event": "1.116.0",
|
|
38
|
+
"@tamagui/use-force-update": "1.116.0",
|
|
39
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
40
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "1.
|
|
43
|
+
"@tamagui/build": "1.116.0",
|
|
42
44
|
"@testing-library/react": "^16.0.1",
|
|
43
45
|
"csstype": "^3.0.10",
|
|
44
46
|
"typescript": "^5.5.2",
|
package/src/createComponent.tsx
CHANGED
|
@@ -353,7 +353,7 @@ export function createComponent<
|
|
|
353
353
|
presenceState,
|
|
354
354
|
setState,
|
|
355
355
|
setStateShallow,
|
|
356
|
-
|
|
356
|
+
noClass,
|
|
357
357
|
state,
|
|
358
358
|
stateRef,
|
|
359
359
|
supportsCSSVars,
|
|
@@ -361,9 +361,6 @@ export function createComponent<
|
|
|
361
361
|
willBeAnimatedClient,
|
|
362
362
|
} = useComponentState(props, componentContext, staticConfig, config!)
|
|
363
363
|
|
|
364
|
-
const shouldForcePseudo = !!propsIn.forceStyle
|
|
365
|
-
const noClassNames = shouldAvoidClasses || shouldForcePseudo
|
|
366
|
-
|
|
367
364
|
if (process.env.NODE_ENV === 'development' && time) time`use-state`
|
|
368
365
|
|
|
369
366
|
const hasTextAncestor = !!(isWeb && isText ? componentContext.inText : false)
|
|
@@ -434,7 +431,7 @@ export function createComponent<
|
|
|
434
431
|
(hasEnterStyle ? '(hasEnter)' : ' ') +
|
|
435
432
|
(isAnimated ? '(animated)' : ' ') +
|
|
436
433
|
(isReactNative ? '(rnw)' : ' ') +
|
|
437
|
-
(
|
|
434
|
+
(noClass ? '(noClass)' : ' ') +
|
|
438
435
|
(state.press || state.pressIn ? '(PRESSED)' : ' ') +
|
|
439
436
|
(state.hover ? '(HOVERED)' : ' ') +
|
|
440
437
|
(state.focus ? '(FOCUSED)' : ' ') +
|
|
@@ -448,7 +445,7 @@ export function createComponent<
|
|
|
448
445
|
)
|
|
449
446
|
|
|
450
447
|
if (isServer) {
|
|
451
|
-
log({
|
|
448
|
+
log({ noClass, isAnimated, isWeb, supportsCSSVars })
|
|
452
449
|
} else {
|
|
453
450
|
// if strict mode or something messes with our nesting this fixes:
|
|
454
451
|
console.groupEnd()
|
|
@@ -480,7 +477,7 @@ export function createComponent<
|
|
|
480
477
|
|
|
481
478
|
if (process.env.NODE_ENV === 'development' && time) time`theme`
|
|
482
479
|
|
|
483
|
-
const mediaState = useMedia(
|
|
480
|
+
const mediaState = useMedia(componentContext, debugProp)
|
|
484
481
|
|
|
485
482
|
setDidGetVariableValue(false)
|
|
486
483
|
|
|
@@ -495,7 +492,7 @@ export function createComponent<
|
|
|
495
492
|
|
|
496
493
|
const styleProps = {
|
|
497
494
|
mediaState,
|
|
498
|
-
|
|
495
|
+
noClass,
|
|
499
496
|
resolveValues,
|
|
500
497
|
isExiting,
|
|
501
498
|
isAnimated,
|
|
@@ -532,7 +529,7 @@ export function createComponent<
|
|
|
532
529
|
const shouldListenForMedia =
|
|
533
530
|
didGetVariableValue() ||
|
|
534
531
|
hasRuntimeMediaKeys ||
|
|
535
|
-
(
|
|
532
|
+
(noClass && splitStyles.hasMedia === true)
|
|
536
533
|
|
|
537
534
|
const mediaListeningKeys = hasRuntimeMediaKeys
|
|
538
535
|
? (splitStyles.hasMedia as Record<string, boolean>)
|
|
@@ -720,23 +717,21 @@ export function createComponent<
|
|
|
720
717
|
return
|
|
721
718
|
}
|
|
722
719
|
|
|
720
|
+
let tm
|
|
721
|
+
|
|
723
722
|
if (state.unmounted === true && hasEnterStyle) {
|
|
724
723
|
setStateShallow({ unmounted: 'should-enter' })
|
|
725
724
|
return
|
|
726
725
|
}
|
|
727
726
|
|
|
728
|
-
let tm
|
|
729
|
-
|
|
730
727
|
if (state.unmounted) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
setStateShallow({ unmounted: false })
|
|
735
|
-
})
|
|
736
|
-
} else {
|
|
728
|
+
// this setTimeout fixes moti and css driver enter animations
|
|
729
|
+
// not sure why
|
|
730
|
+
tm = setTimeout(() => {
|
|
737
731
|
setStateShallow({ unmounted: false })
|
|
738
|
-
}
|
|
739
|
-
|
|
732
|
+
})
|
|
733
|
+
|
|
734
|
+
return () => clearTimeout(tm)
|
|
740
735
|
}
|
|
741
736
|
|
|
742
737
|
const dispose = subscribeToContextGroup({
|
|
@@ -762,10 +757,9 @@ export function createComponent<
|
|
|
762
757
|
|
|
763
758
|
// if its a group its gotta listen for pseudos to emit them to children
|
|
764
759
|
|
|
765
|
-
const runtimePressStyle = !disabled &&
|
|
766
|
-
const runtimeFocusStyle = !disabled &&
|
|
767
|
-
const runtimeFocusVisibleStyle =
|
|
768
|
-
!disabled && noClassNames && pseudos?.focusVisibleStyle
|
|
760
|
+
const runtimePressStyle = !disabled && noClass && pseudos?.pressStyle
|
|
761
|
+
const runtimeFocusStyle = !disabled && noClass && pseudos?.focusStyle
|
|
762
|
+
const runtimeFocusVisibleStyle = !disabled && noClass && pseudos?.focusVisibleStyle
|
|
769
763
|
const attachFocus = Boolean(
|
|
770
764
|
runtimePressStyle ||
|
|
771
765
|
runtimeFocusStyle ||
|
|
@@ -785,7 +779,7 @@ export function createComponent<
|
|
|
785
779
|
onClick ||
|
|
786
780
|
pseudos?.focusVisibleStyle
|
|
787
781
|
)
|
|
788
|
-
const runtimeHoverStyle = !disabled &&
|
|
782
|
+
const runtimeHoverStyle = !disabled && noClass && pseudos?.hoverStyle
|
|
789
783
|
const needsHoverState = Boolean(
|
|
790
784
|
groupName || runtimeHoverStyle || onHoverIn || onHoverOut
|
|
791
785
|
)
|
|
@@ -1151,8 +1145,7 @@ export function createComponent<
|
|
|
1151
1145
|
mediaListeningKeys,
|
|
1152
1146
|
pseudos,
|
|
1153
1147
|
shouldAttach,
|
|
1154
|
-
|
|
1155
|
-
shouldForcePseudo,
|
|
1148
|
+
noClass,
|
|
1156
1149
|
shouldListenForMedia,
|
|
1157
1150
|
splitStyles,
|
|
1158
1151
|
splitStylesStyle,
|
|
@@ -14,8 +14,3 @@ export const defaultComponentStateMounted: TamaguiComponentState = {
|
|
|
14
14
|
...defaultComponentState,
|
|
15
15
|
unmounted: false,
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
export const defaultComponentStateShouldEnter: TamaguiComponentState = {
|
|
19
|
-
...defaultComponentState,
|
|
20
|
-
unmounted: 'should-enter',
|
|
21
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import {
|
|
3
2
|
isAndroid,
|
|
4
3
|
isClient,
|
|
@@ -17,6 +16,7 @@ import {
|
|
|
17
16
|
validPseudoKeys,
|
|
18
17
|
validStyles,
|
|
19
18
|
} from '@tamagui/helpers'
|
|
19
|
+
import React from 'react'
|
|
20
20
|
|
|
21
21
|
import { getConfig, getFont } from '../config'
|
|
22
22
|
import { accessibilityDirectMap } from '../constants/accessibilityDirectMap'
|
|
@@ -61,6 +61,8 @@ import {
|
|
|
61
61
|
shouldInsertStyleRules,
|
|
62
62
|
updateRules,
|
|
63
63
|
} from './insertStyleRule'
|
|
64
|
+
import { isActivePlatform } from './isActivePlatform'
|
|
65
|
+
import { isActiveTheme } from './isActiveTheme'
|
|
64
66
|
import { log } from './log'
|
|
65
67
|
import {
|
|
66
68
|
normalizeValueWithProperty,
|
|
@@ -69,9 +71,8 @@ import {
|
|
|
69
71
|
import { getPropMappedFontFamily, propMapper } from './propMapper'
|
|
70
72
|
import { pseudoDescriptors, pseudoPriorities } from './pseudoDescriptors'
|
|
71
73
|
import { skipProps } from './skipProps'
|
|
72
|
-
import { transformsToString } from './transformsToString'
|
|
73
|
-
import { isActivePlatform } from './isActivePlatform'
|
|
74
74
|
import { sortString } from './sortString'
|
|
75
|
+
import { transformsToString } from './transformsToString'
|
|
75
76
|
|
|
76
77
|
const consoleGroupCollapsed = isWeb ? console.groupCollapsed : console.info
|
|
77
78
|
|
|
@@ -168,7 +169,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
168
169
|
const viewProps: GetStyleResult['viewProps'] = {}
|
|
169
170
|
const mediaState = styleProps.mediaState || globalMediaState
|
|
170
171
|
const usedKeys: Record<string, number> = {}
|
|
171
|
-
const shouldDoClasses = acceptsClassName && isWeb && !styleProps.
|
|
172
|
+
const shouldDoClasses = acceptsClassName && isWeb && !styleProps.noClass
|
|
172
173
|
const rulesToInsert: RulesToInsert =
|
|
173
174
|
process.env.TAMAGUI_TARGET === 'native' ? (undefined as any) : {}
|
|
174
175
|
const classNames: ClassNamesObject = {}
|
|
@@ -241,12 +242,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
241
242
|
valInit &&
|
|
242
243
|
typeof valInit === 'object'
|
|
243
244
|
) {
|
|
244
|
-
viewProps[keyInit] = getSubStyle(
|
|
245
|
-
styleState,
|
|
246
|
-
keyInit,
|
|
247
|
-
valInit,
|
|
248
|
-
styleProps.noClassNames
|
|
249
|
-
)
|
|
245
|
+
viewProps[keyInit] = getSubStyle(styleState, keyInit, valInit, styleProps.noClass)
|
|
250
246
|
continue
|
|
251
247
|
}
|
|
252
248
|
}
|
|
@@ -556,7 +552,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
556
552
|
// valInit,
|
|
557
553
|
// fontFamily,
|
|
558
554
|
// true,
|
|
559
|
-
// state.
|
|
555
|
+
// state.noClass
|
|
560
556
|
// )
|
|
561
557
|
// const descriptor = pseudoDescriptors[keyInit]
|
|
562
558
|
// for (const key in pseudoStyleObject) {
|
|
@@ -685,12 +681,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
685
681
|
|
|
686
682
|
// TODO can avoid processing this if !shouldDoClasses + state is off
|
|
687
683
|
// (note: can't because we need to set defaults on enter/exit or else enforce that they should)
|
|
688
|
-
const pseudoStyleObject = getSubStyle(
|
|
689
|
-
styleState,
|
|
690
|
-
key,
|
|
691
|
-
val,
|
|
692
|
-
styleProps.noClassNames
|
|
693
|
-
)
|
|
684
|
+
const pseudoStyleObject = getSubStyle(styleState, key, val, styleProps.noClass)
|
|
694
685
|
|
|
695
686
|
const descriptor = pseudoDescriptors[key as keyof typeof pseudoDescriptors]
|
|
696
687
|
const isEnter = key === 'enterStyle'
|
|
@@ -874,10 +865,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
874
865
|
// for now we're doing weird stuff, getStylesAtomic will put the
|
|
875
866
|
// $platform-web into property so we can check it here
|
|
876
867
|
const property = style[0]
|
|
877
|
-
if (property[0] === '$') {
|
|
878
|
-
|
|
879
|
-
continue
|
|
880
|
-
}
|
|
868
|
+
if (property[0] === '$' && !isActivePlatform(property)) {
|
|
869
|
+
continue
|
|
881
870
|
}
|
|
882
871
|
|
|
883
872
|
const out = createMediaStyle(
|
|
@@ -930,8 +919,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
930
919
|
if (isThemeMedia) {
|
|
931
920
|
// needed to get updates when theme changes
|
|
932
921
|
dynamicThemeAccess = true
|
|
933
|
-
|
|
934
|
-
if (!(themeName ===
|
|
922
|
+
|
|
923
|
+
if (!(themeName === mediaKeyShort || themeName.startsWith(mediaKeyShort))) {
|
|
935
924
|
continue
|
|
936
925
|
}
|
|
937
926
|
} else if (isGroupMedia) {
|
|
@@ -1024,9 +1013,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1024
1013
|
continue
|
|
1025
1014
|
}
|
|
1026
1015
|
if (subKey[0] === '$') {
|
|
1027
|
-
if (!isActivePlatform(subKey))
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1016
|
+
if (!isActivePlatform(subKey)) continue
|
|
1017
|
+
if (!isActiveTheme(subKey, themeName)) continue
|
|
1030
1018
|
for (const subSubKey in mediaStyle[subKey]) {
|
|
1031
1019
|
mergeMediaStyle(subSubKey, mediaStyle[subKey][subSubKey])
|
|
1032
1020
|
}
|
|
@@ -1162,7 +1150,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1162
1150
|
const [key, value, identifier] = atomicStyle
|
|
1163
1151
|
const isAnimatedAndAnimateOnly =
|
|
1164
1152
|
styleProps.isAnimated &&
|
|
1165
|
-
styleProps.
|
|
1153
|
+
styleProps.noClass &&
|
|
1166
1154
|
(!props.animateOnly || props.animateOnly.includes(key))
|
|
1167
1155
|
|
|
1168
1156
|
// or not animated but you have animateOnly
|
package/src/helpers/log.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _disableMediaTouch } from '../hooks/useMedia'
|
|
2
2
|
|
|
3
3
|
export function log(...args: any[]) {
|
|
4
4
|
if (process.env.NODE_ENV === 'production') return
|
|
5
|
-
|
|
5
|
+
_disableMediaTouch(true)
|
|
6
6
|
try {
|
|
7
7
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
8
8
|
return console.info(...args)
|
|
@@ -11,6 +11,6 @@ export function log(...args: any[]) {
|
|
|
11
11
|
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
|
|
12
12
|
return console.log(...args)
|
|
13
13
|
} finally {
|
|
14
|
-
|
|
14
|
+
_disableMediaTouch(false)
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import type { StaticConfig, ThemeableProps } from '../types'
|
|
3
|
+
import type { StaticConfig, ThemeableProps, ThemeProps } from '../types'
|
|
4
4
|
import { Theme } from '../views/Theme'
|
|
5
5
|
|
|
6
6
|
export function themeable<ComponentType extends (props: any) => any>(
|
|
@@ -30,15 +30,33 @@ export function themeable<ComponentType extends (props: any) => any>(
|
|
|
30
30
|
<Component ref={ref} {...rest} data-disable-theme />
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
+
// we filter out the props here, why?
|
|
34
|
+
// Theme internally avoids wrapping <span /> unless 'theme' in props
|
|
35
|
+
// reason for this is to avoid wrapping every single component with span
|
|
36
|
+
// *if* ever it themes once, it leaves the span, to avoid reparenting
|
|
37
|
+
// its expected if users want to avoid re-parenting, they keep the theme prop
|
|
38
|
+
// and just set it to null. but we need to "respect" that here by filtering
|
|
39
|
+
// one example of a bug caused by not doing this is in <Select native> on web
|
|
40
|
+
// where it renders to an <option />, and then Theme would wrap a <span /> in that
|
|
41
|
+
// which is not allowed in HTML and causes hydration errors / logs
|
|
42
|
+
const filteredProps: Partial<ThemeProps> = {
|
|
43
|
+
componentName: componentName || staticConfig?.componentName,
|
|
44
|
+
}
|
|
45
|
+
if ('debug' in props) {
|
|
46
|
+
filteredProps.debug = props.debug
|
|
47
|
+
}
|
|
48
|
+
if ('theme' in props) {
|
|
49
|
+
filteredProps.name = props.theme
|
|
50
|
+
}
|
|
51
|
+
if ('themeInverse' in props) {
|
|
52
|
+
filteredProps.inverse = props.themeInverse
|
|
53
|
+
}
|
|
54
|
+
if ('themeReset' in props) {
|
|
55
|
+
filteredProps.reset = themeReset
|
|
56
|
+
}
|
|
57
|
+
|
|
33
58
|
let contents = (
|
|
34
|
-
<Theme
|
|
35
|
-
componentName={componentName || staticConfig?.componentName}
|
|
36
|
-
name={theme}
|
|
37
|
-
disable-child-theme
|
|
38
|
-
debug={props.debug}
|
|
39
|
-
inverse={themeInverse}
|
|
40
|
-
reset={themeReset}
|
|
41
|
-
>
|
|
59
|
+
<Theme disable-child-theme {...filteredProps}>
|
|
42
60
|
{element}
|
|
43
61
|
</Theme>
|
|
44
62
|
)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { isServer, isWeb } from '@tamagui/constants'
|
|
2
|
+
import { useRef, useState } from 'react'
|
|
1
3
|
import {
|
|
2
4
|
defaultComponentState,
|
|
3
5
|
defaultComponentStateMounted,
|
|
4
|
-
defaultComponentStateShouldEnter,
|
|
5
6
|
} from '../defaultComponentState'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { createShallowSetState } from '../helpers/createShallowSetState'
|
|
8
|
+
import { isObj } from '../helpers/isObj'
|
|
9
|
+
import { log } from '../helpers/log'
|
|
8
10
|
import type {
|
|
9
11
|
ComponentContextI,
|
|
10
12
|
GroupStateListener,
|
|
@@ -16,10 +18,6 @@ import type {
|
|
|
16
18
|
TextProps,
|
|
17
19
|
UseAnimationHook,
|
|
18
20
|
} from '../types'
|
|
19
|
-
import { isServer, isWeb } from '@tamagui/constants'
|
|
20
|
-
import { createShallowSetState } from '../helpers/createShallowSetState'
|
|
21
|
-
import { isObj } from '../helpers/isObj'
|
|
22
|
-
import { log } from '../helpers/log'
|
|
23
21
|
|
|
24
22
|
export const useComponentState = (
|
|
25
23
|
props: StackProps | TextProps | Record<string, any>,
|
|
@@ -57,6 +55,8 @@ export const useComponentState = (
|
|
|
57
55
|
curStateRef.hasAnimated = true
|
|
58
56
|
}
|
|
59
57
|
|
|
58
|
+
const { disableClassName } = props
|
|
59
|
+
|
|
60
60
|
// HOOK
|
|
61
61
|
const presence =
|
|
62
62
|
(willBeAnimated &&
|
|
@@ -68,15 +68,24 @@ export const useComponentState = (
|
|
|
68
68
|
const isEntering = presenceState?.isPresent === true && presenceState.initial !== false
|
|
69
69
|
|
|
70
70
|
const hasEnterStyle = !!props.enterStyle
|
|
71
|
-
|
|
72
|
-
const
|
|
71
|
+
|
|
72
|
+
const hasAnimationThatNeedsHydrate =
|
|
73
|
+
hasAnimationProp && (animationDriver?.isReactNative || !supportsCSSVars)
|
|
73
74
|
|
|
74
75
|
const hasEnterState = hasEnterStyle || isEntering
|
|
75
76
|
|
|
76
77
|
// this can be conditional because its only ever needed with animations
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const shouldEnter =
|
|
79
|
+
hasEnterState ||
|
|
80
|
+
hasAnimationThatNeedsHydrate ||
|
|
81
|
+
// disableClassName doesnt work server side, only client, so needs hydrate
|
|
82
|
+
// this is just for a better ux, supports css variables for light/dark, media queries, etc
|
|
83
|
+
disableClassName
|
|
84
|
+
|
|
85
|
+
// two stage enter: because we switch from css driver to spring driver
|
|
86
|
+
// - first render: render to match server with css driver
|
|
87
|
+
// - second render: state.unmounted = should-enter, still rendering the initial,
|
|
88
|
+
// non-entered state but now with the spring animation driver
|
|
80
89
|
|
|
81
90
|
const initialState = shouldEnter
|
|
82
91
|
? // on the very first render we switch all spring animation drivers to css rendering
|
|
@@ -84,9 +93,7 @@ export const useComponentState = (
|
|
|
84
93
|
// without flickers of the wrong colors.
|
|
85
94
|
// but once we do that initial hydration and we are in client side rendering mode,
|
|
86
95
|
// we can avoid the extra re-render on mount
|
|
87
|
-
|
|
88
|
-
? defaultComponentState
|
|
89
|
-
: defaultComponentStateShouldEnter
|
|
96
|
+
defaultComponentState
|
|
90
97
|
: defaultComponentStateMounted
|
|
91
98
|
|
|
92
99
|
// will be nice to deprecate half of these:
|
|
@@ -102,11 +109,16 @@ export const useComponentState = (
|
|
|
102
109
|
const state = props.forceStyle ? { ...states[0], [props.forceStyle]: true } : states[0]
|
|
103
110
|
const setState = states[1]
|
|
104
111
|
|
|
105
|
-
const isHydrated = state.unmounted === false
|
|
112
|
+
const isHydrated = state.unmounted === false
|
|
106
113
|
|
|
107
114
|
// only web server + initial client render run this when not hydrated:
|
|
108
115
|
let isAnimated = willBeAnimated
|
|
109
|
-
if (
|
|
116
|
+
if (
|
|
117
|
+
isWeb &&
|
|
118
|
+
hasAnimationThatNeedsHydrate &&
|
|
119
|
+
!staticConfig.isHOC &&
|
|
120
|
+
state.unmounted === true
|
|
121
|
+
) {
|
|
110
122
|
isAnimated = false
|
|
111
123
|
curStateRef.willHydrate = true
|
|
112
124
|
}
|
|
@@ -123,10 +135,6 @@ export const useComponentState = (
|
|
|
123
135
|
|
|
124
136
|
let setStateShallow = createShallowSetState(setState, disabled, false, props.debug)
|
|
125
137
|
|
|
126
|
-
// if (isHydrated && state.unmounted === 'should-enter') {
|
|
127
|
-
// state.unmounted = true
|
|
128
|
-
// }
|
|
129
|
-
|
|
130
138
|
// set enter/exit variants onto our new props object
|
|
131
139
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
132
140
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
@@ -151,33 +159,33 @@ export const useComponentState = (
|
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
161
|
|
|
154
|
-
let
|
|
162
|
+
let noClass = !isWeb || !!props.forceStyle
|
|
155
163
|
|
|
156
164
|
// on server for SSR and animation compat added the && isHydrated but perhaps we want
|
|
157
165
|
// disableClassName="until-hydrated" to be more straightforward
|
|
158
166
|
// see issue if not, Button sets disableClassName to true <Button animation="" /> with
|
|
159
167
|
// the react-native driver errors because it tries to animate var(--color) to rbga(..)
|
|
160
168
|
if (isWeb) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
// no matter what if fully unmounted or on the server we use className
|
|
170
|
+
// only once we hydrate do we switch to spring animation drivers or disableClassName etc
|
|
171
|
+
if (!isServer || isHydrated) {
|
|
172
|
+
const isAnimatedAndHydrated = isAnimated && !supportsCSSVars
|
|
165
173
|
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
const isClassNameDisabled =
|
|
175
|
+
!staticConfig.acceptsClassName && (config.disableSSR || !state.unmounted)
|
|
168
176
|
|
|
169
|
-
|
|
170
|
-
disableClassName && !isServer && didHydrateOnce && state.unmounted === true
|
|
177
|
+
const isDisabledManually = disableClassName && !state.unmounted
|
|
171
178
|
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
if (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) {
|
|
180
|
+
noClass = true
|
|
174
181
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
if (process.env.NODE_ENV === 'development' && props.debug) {
|
|
183
|
+
log(`avoiding className`, {
|
|
184
|
+
isAnimatedAndHydrated,
|
|
185
|
+
isDisabledManually,
|
|
186
|
+
isClassNameDisabled,
|
|
187
|
+
})
|
|
188
|
+
}
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
191
|
}
|
|
@@ -231,7 +239,7 @@ export const useComponentState = (
|
|
|
231
239
|
presenceState,
|
|
232
240
|
setState,
|
|
233
241
|
setStateShallow,
|
|
234
|
-
|
|
242
|
+
noClass,
|
|
235
243
|
state,
|
|
236
244
|
stateRef,
|
|
237
245
|
supportsCSSVars,
|