@tamagui/web 1.39.7 → 1.39.8
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 +43 -105
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.js +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.js +69 -0
- package/dist/cjs/helpers/mergeVariants.js.map +6 -0
- package/dist/cjs/helpers/parseStaticConfig.js +40 -0
- package/dist/cjs/helpers/parseStaticConfig.js.map +6 -0
- package/dist/cjs/helpers/styledToStaticConfig.js +2 -0
- package/dist/cjs/helpers/styledToStaticConfig.js.map +6 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styled.js +13 -4
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/views/Stack.js +3 -1
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/Theme.js +3 -2
- package/dist/cjs/views/Theme.js.map +1 -1
- package/dist/cjs/views/View.js +3 -1
- package/dist/cjs/views/View.js.map +1 -1
- package/dist/esm/createComponent.js +44 -106
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/getThemeCSSRules.js +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.js +45 -0
- package/dist/esm/helpers/mergeVariants.js.map +6 -0
- package/dist/esm/helpers/parseStaticConfig.js +16 -0
- package/dist/esm/helpers/parseStaticConfig.js.map +6 -0
- package/dist/esm/helpers/styledToStaticConfig.js +1 -0
- package/dist/esm/helpers/styledToStaticConfig.js.map +6 -0
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styled.js +13 -4
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/views/Stack.js +3 -1
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/Theme.js +4 -3
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/View.js +3 -1
- package/dist/esm/views/View.js.map +1 -1
- package/package.json +9 -9
- package/src/createComponent.tsx +41 -138
- package/src/helpers/getThemeCSSRules.ts +1 -1
- package/src/helpers/mergeVariants.ts +59 -0
- package/src/helpers/parseStaticConfig.ts +14 -0
- package/src/index.ts +0 -1
- package/src/styled.tsx +16 -7
- package/src/views/Stack.tsx +3 -0
- package/src/views/Text.tsx +1 -1
- package/src/views/Theme.tsx +6 -3
- package/src/views/View.tsx +3 -0
- package/types/createComponent.d.ts +2 -2
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/mergeVariants.d.ts +3 -0
- package/types/helpers/mergeVariants.d.ts.map +1 -0
- package/types/helpers/parseStaticConfig.d.ts +3 -0
- package/types/helpers/parseStaticConfig.d.ts.map +1 -0
- package/types/helpers/styledToStaticConfig.d.ts +1 -0
- package/types/helpers/styledToStaticConfig.d.ts.map +1 -0
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/views/Stack.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/View.d.ts.map +1 -1
- package/src/helpers/extendStaticConfig.ts +0 -93
package/types/styled.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAG7D,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,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E,OAAO,CAAA;CAC3B,EACD,uBAAuB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,gjCA2KhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/views/Stack.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/views/Stack.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE1E,eAAO,MAAM,KAAK,qFAOhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/views/Theme.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0D,MAAM,OAAO,CAAA;AAM9E,OAAO,EAAE,oBAAoB,EAAwB,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAGrD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,OA0BtC;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,oBAAoB,EAChC,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE;IACL,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,EACD,MAAM,UAAQ,OAsDf;AAED,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,UAAU,EAAE,oBAAoB,CAAA;CACjC,eAkCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/views/View.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/views/View.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE1E,eAAO,MAAM,IAAI,qFAGf,CAAA"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { stylePropsView } from '@tamagui/helpers'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
GenericVariantDefinitions,
|
|
5
|
-
StaticConfig,
|
|
6
|
-
StaticConfigParsed,
|
|
7
|
-
StylableComponent,
|
|
8
|
-
} from '../types'
|
|
9
|
-
import { createPropMapper } from './createPropMapper'
|
|
10
|
-
import { mergeProps } from './mergeProps'
|
|
11
|
-
|
|
12
|
-
export function extendStaticConfig(
|
|
13
|
-
config: Partial<StaticConfig>,
|
|
14
|
-
parent?: StylableComponent
|
|
15
|
-
) {
|
|
16
|
-
if (!(parent && 'staticConfig' in parent)) {
|
|
17
|
-
return parseStaticConfig(config)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const parentStaticConfig = parent.staticConfig as StaticConfig
|
|
21
|
-
|
|
22
|
-
// merge variants... can we type this?
|
|
23
|
-
const variants = mergeVariants(parentStaticConfig.variants, config.variants)
|
|
24
|
-
|
|
25
|
-
// include our own
|
|
26
|
-
const parentNames = [...(parentStaticConfig.parentNames || [])]
|
|
27
|
-
if (parentStaticConfig.componentName) {
|
|
28
|
-
parentNames.push(parentStaticConfig.componentName)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const deoptProps = config.deoptProps || new Set<string>()
|
|
32
|
-
|
|
33
|
-
const merged = {
|
|
34
|
-
...config.defaultProps,
|
|
35
|
-
...config.defaultVariants,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const defaultProps = parentStaticConfig.isHOC
|
|
39
|
-
? merged
|
|
40
|
-
: mergeProps(parentStaticConfig.defaultProps, merged)[0]
|
|
41
|
-
|
|
42
|
-
return parseStaticConfig({
|
|
43
|
-
...parentStaticConfig,
|
|
44
|
-
...config,
|
|
45
|
-
parentStaticConfig,
|
|
46
|
-
deoptProps,
|
|
47
|
-
variants,
|
|
48
|
-
parentNames,
|
|
49
|
-
validStyles: config.validStyles
|
|
50
|
-
? {
|
|
51
|
-
...parentStaticConfig.validStyles,
|
|
52
|
-
...config.validStyles,
|
|
53
|
-
}
|
|
54
|
-
: parentStaticConfig.validStyles || stylePropsView,
|
|
55
|
-
defaultProps,
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const mergeVariants = (
|
|
60
|
-
parentVariants?: GenericVariantDefinitions,
|
|
61
|
-
ourVariants?: GenericVariantDefinitions
|
|
62
|
-
) => {
|
|
63
|
-
const variants = {
|
|
64
|
-
...parentVariants,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (ourVariants) {
|
|
68
|
-
for (const key in ourVariants) {
|
|
69
|
-
if (key in variants) {
|
|
70
|
-
variants[key] = {
|
|
71
|
-
...variants[key],
|
|
72
|
-
...ourVariants[key],
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
variants[key] = ourVariants[key]
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return variants
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const parseStaticConfig = (config: Partial<StaticConfig>): StaticConfigParsed => {
|
|
84
|
-
const parsed = {
|
|
85
|
-
defaultProps: {},
|
|
86
|
-
...config,
|
|
87
|
-
parsed: true,
|
|
88
|
-
} as const
|
|
89
|
-
return {
|
|
90
|
-
...parsed,
|
|
91
|
-
propMapper: createPropMapper(parsed as StaticConfigParsed),
|
|
92
|
-
}
|
|
93
|
-
}
|