@tamagui/core 1.0.1-beta.210 → 1.0.1-beta.212
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 +16 -14
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +29 -15
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/createTamagui.js +2 -1
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +13 -19
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/useShallowSetState.js +6 -1
- package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/createComponent.js +18 -15
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createFont.js +29 -15
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/createTamagui.js +2 -1
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +13 -19
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/useShallowSetState.js +6 -1
- package/dist/esm/helpers/useShallowSetState.js.map +2 -2
- package/dist/esm/styled.js.map +2 -2
- package/package.json +12 -12
- package/src/createComponent.tsx +49 -15
- package/src/createFont.ts +37 -22
- package/src/createTamagui.ts +4 -1
- package/src/helpers/getSplitStyles.tsx +14 -24
- package/src/helpers/useShallowSetState.tsx +9 -1
- package/src/styled.tsx +0 -1
- package/src/types.tsx +1 -2
- package/types/helpers/useShallowSetState.d.ts +1 -1
- package/types/types.d.ts +2 -3
package/src/createTamagui.ts
CHANGED
|
@@ -195,10 +195,13 @@ export function createTamagui<Conf extends CreateTamaguiProps>(
|
|
|
195
195
|
tokensParsed,
|
|
196
196
|
parsed: true,
|
|
197
197
|
getCSS: () => `
|
|
198
|
+
.is_Text .is_Text { display: inline-flex; }
|
|
199
|
+
._dsp_contents { display: contents; }
|
|
198
200
|
${themeConfig.css}
|
|
199
201
|
${getAllRules().join('\n')}
|
|
200
|
-
.is_Text .is_Text { display: inline-flex; }
|
|
201
202
|
`,
|
|
203
|
+
// const tokens = [...getToken(tokens.size[0])]
|
|
204
|
+
// .spacer-sm + ._dsp_contents._dsp-sm-hidden { margin-left: -var(--${}) }
|
|
202
205
|
}
|
|
203
206
|
|
|
204
207
|
configureMedia(config)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isClient, isRSC, isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
2
|
import { stylePropsText, stylePropsTransform, validPseudoKeys, validStyles } from '@tamagui/helpers'
|
|
3
|
+
import { timer } from '@tamagui/timer'
|
|
3
4
|
import type { ViewStyle } from '@tamagui/types-react-native'
|
|
4
5
|
import { useInsertionEffect } from 'react'
|
|
5
6
|
|
|
@@ -600,7 +601,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
600
601
|
mergeClassName(transforms, classNames, fullKey, out.identifier, true)
|
|
601
602
|
}
|
|
602
603
|
}
|
|
603
|
-
} else if (mediaState[
|
|
604
|
+
} else if (mediaState[mediaKey]) {
|
|
604
605
|
for (const key in mediaStyle) {
|
|
605
606
|
const didMerge = mergeMediaByImportance(style, key, mediaStyle[key], usedKeys)
|
|
606
607
|
if (didMerge && key === 'fontFamily') {
|
|
@@ -799,30 +800,19 @@ function mergeClassName(
|
|
|
799
800
|
*
|
|
800
801
|
* and to avoid re-creating it over and over, use a WeakMap
|
|
801
802
|
*/
|
|
802
|
-
const
|
|
803
|
-
function
|
|
804
|
-
|
|
805
|
-
// functional variants may want to eventually do something like:
|
|
806
|
-
// have a hooks-like rule (no conditionals)
|
|
807
|
-
// then we run them once on compile with a proxy to capture the keys accessed
|
|
808
|
-
// then add those keys to `inlineProps` so we know we must inline them
|
|
809
|
-
// for now this will trigger because compiled away
|
|
810
|
-
// right now also we don't pass in any pre-extracted styled() props but we should pass them in..
|
|
811
|
-
return baseProps
|
|
812
|
-
}
|
|
803
|
+
const cache = new WeakMap()
|
|
804
|
+
function getSubStyleProps(defaultProps: Object, baseProps: Object, specificProps: Object) {
|
|
805
|
+
const key = specificProps || baseProps
|
|
813
806
|
// can cache based only on specific it's always referentially consistent with base
|
|
814
|
-
if (
|
|
815
|
-
return
|
|
807
|
+
if (cache.has(key)) {
|
|
808
|
+
return cache.get(key)
|
|
816
809
|
}
|
|
817
|
-
const next =
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
},
|
|
824
|
-
})
|
|
825
|
-
propProxies.set(specificProps, next)
|
|
810
|
+
const next = {
|
|
811
|
+
...defaultProps,
|
|
812
|
+
...baseProps,
|
|
813
|
+
...specificProps,
|
|
814
|
+
}
|
|
815
|
+
cache.set(key, next)
|
|
826
816
|
return next
|
|
827
817
|
}
|
|
828
818
|
|
|
@@ -845,7 +835,7 @@ export const getSubStyle = (
|
|
|
845
835
|
key,
|
|
846
836
|
val,
|
|
847
837
|
theme,
|
|
848
|
-
|
|
838
|
+
getSubStyleProps(staticConfig.defaultProps, props, props[subKey]),
|
|
849
839
|
state,
|
|
850
840
|
languageContext,
|
|
851
841
|
avoidDefaultProps
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React, { useCallback } from 'react'
|
|
2
2
|
|
|
3
3
|
export function useShallowSetState<State extends Object>(
|
|
4
|
-
setter: React.Dispatch<React.SetStateAction<State
|
|
4
|
+
setter: React.Dispatch<React.SetStateAction<State>>,
|
|
5
|
+
debug?: boolean | 'verbose',
|
|
6
|
+
debugName?: string
|
|
5
7
|
) {
|
|
6
8
|
return useCallback(
|
|
7
9
|
(next: Partial<State>) => {
|
|
8
10
|
setter((prev) => {
|
|
9
11
|
for (const key in next) {
|
|
10
12
|
if (prev[key] !== next[key]) {
|
|
13
|
+
if (process.env.NODE_ENV === 'development') {
|
|
14
|
+
if (debug === 'verbose') {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.warn(`update ${debugName}`, next)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
11
19
|
return { ...prev, ...next }
|
|
12
20
|
}
|
|
13
21
|
}
|
package/src/styled.tsx
CHANGED
|
@@ -136,7 +136,6 @@ export function styled<
|
|
|
136
136
|
...nativeConf,
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
// TODO compiler doesn't have logic to include children, de-opt (see EnsureFlexed for test usage)
|
|
140
139
|
// bail on non className views as well
|
|
141
140
|
if (defaultProps.children || !acceptsClassName) {
|
|
142
141
|
conf.neverFlatten = true
|
package/src/types.tsx
CHANGED
|
@@ -385,7 +385,7 @@ export type GenericFont<Key extends number | string = number | string> = {
|
|
|
385
385
|
transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>
|
|
386
386
|
color?: Partial<{ [key in Key]: string | Variable }>
|
|
387
387
|
// for native use only, lets you map to alternative fonts
|
|
388
|
-
face?: { [key in FontWeightSteps]: { normal?: string; italic?: string } }
|
|
388
|
+
face?: Partial<{ [key in FontWeightSteps]: { normal?: string; italic?: string } }>
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
// media
|
|
@@ -1229,7 +1229,6 @@ export type TamaguiComponentState = {
|
|
|
1229
1229
|
focus: boolean
|
|
1230
1230
|
mounted: boolean
|
|
1231
1231
|
mediaState?: null | Record<string, boolean>
|
|
1232
|
-
hasAnimation?: boolean
|
|
1233
1232
|
animation?: null | {
|
|
1234
1233
|
style?: any
|
|
1235
1234
|
avoidClasses?: boolean
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function useShallowSetState<State extends Object>(setter: React.Dispatch<React.SetStateAction<State
|
|
2
|
+
export declare function useShallowSetState<State extends Object>(setter: React.Dispatch<React.SetStateAction<State>>, debug?: boolean | 'verbose', debugName?: string): (next: Partial<State>) => void;
|
|
3
3
|
//# sourceMappingURL=useShallowSetState.d.ts.map
|
package/types/types.d.ts
CHANGED
|
@@ -238,12 +238,12 @@ export declare type GenericFont<Key extends number | string = number | string> =
|
|
|
238
238
|
color?: Partial<{
|
|
239
239
|
[key in Key]: string | Variable;
|
|
240
240
|
}>;
|
|
241
|
-
face?: {
|
|
241
|
+
face?: Partial<{
|
|
242
242
|
[key in FontWeightSteps]: {
|
|
243
243
|
normal?: string;
|
|
244
244
|
italic?: string;
|
|
245
245
|
};
|
|
246
|
-
}
|
|
246
|
+
}>;
|
|
247
247
|
};
|
|
248
248
|
export declare type MediaQueryObject = {
|
|
249
249
|
[key: string]: string | number | string;
|
|
@@ -559,7 +559,6 @@ export declare type TamaguiComponentState = {
|
|
|
559
559
|
focus: boolean;
|
|
560
560
|
mounted: boolean;
|
|
561
561
|
mediaState?: null | Record<string, boolean>;
|
|
562
|
-
hasAnimation?: boolean;
|
|
563
562
|
animation?: null | {
|
|
564
563
|
style?: any;
|
|
565
564
|
avoidClasses?: boolean;
|