@tamagui/web 1.14.3 → 1.14.5
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 -17
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +38 -11
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +12 -3
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +10 -8
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/styled.js +6 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.js +26 -7
- package/dist/cjs/views/ThemeDebug.js.map +3 -3
- package/dist/esm/createComponent.js +2 -19
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +2 -19
- package/dist/esm/createComponent.mjs.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +37 -11
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.mjs +37 -11
- package/dist/esm/helpers/ThemeManager.mjs.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +12 -3
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +12 -3
- package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
- package/dist/esm/hooks/useTheme.js +12 -9
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useTheme.mjs +12 -9
- package/dist/esm/hooks/useTheme.mjs.map +2 -2
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +0 -3
- package/dist/esm/index.mjs.map +2 -2
- package/dist/esm/styled.js +6 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/styled.mjs +6 -1
- package/dist/esm/styled.mjs.map +2 -2
- package/dist/esm/views/ThemeDebug.js +26 -7
- package/dist/esm/views/ThemeDebug.js.map +3 -3
- package/dist/esm/views/ThemeDebug.mjs +26 -7
- package/dist/esm/views/ThemeDebug.mjs.map +3 -3
- package/package.json +9 -9
- package/src/createComponent.tsx +1 -14
- package/src/helpers/ThemeManager.tsx +49 -12
- package/src/helpers/getSplitStyles.tsx +13 -2
- package/src/hooks/useTheme.tsx +22 -8
- package/src/index.ts +0 -3
- package/src/styled.tsx +20 -3
- package/src/types.tsx +3 -2
- package/src/views/ThemeDebug.tsx +26 -4
- package/types/createComponent.d.ts +2 -2
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/ThemeManager.d.ts +5 -3
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +0 -3
- package/types/index.d.ts.map +1 -1
- package/types/styled.d.ts +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/types/views/Stack.d.ts +1 -1
- package/types/views/Stack.d.ts.map +1 -1
- package/types/views/Text.d.ts +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts +1 -2
- package/types/views/ThemeDebug.d.ts.map +1 -1
- package/src/addTheme.ts +0 -66
- package/src/updateTheme.ts +0 -27
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import { jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
2
4
|
function ThemeDebug({
|
|
3
5
|
themeState,
|
|
4
6
|
themeProps,
|
|
5
|
-
children
|
|
6
|
-
onChangeCount
|
|
7
|
+
children
|
|
7
8
|
}) {
|
|
8
|
-
var _a, _b, _c, _d;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
10
|
if (process.env.NODE_ENV === "development") {
|
|
11
|
+
const [onChangeCount, setOnChangeCount] = useState(0);
|
|
12
|
+
const rerender = useForceUpdate();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
var _a2, _b2;
|
|
15
|
+
(_b2 = (_a2 = themeState.themeManager) == null ? void 0 : _a2.parentManager) == null ? void 0 : _b2.onChangeTheme((name, manager) => {
|
|
16
|
+
setOnChangeCount((p) => ++p);
|
|
17
|
+
console.warn(`theme changed`, name);
|
|
18
|
+
});
|
|
19
|
+
}, [themeState.themeManager]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const tm = setInterval(rerender, 100);
|
|
22
|
+
return () => clearTimeout(tm);
|
|
23
|
+
}, []);
|
|
10
24
|
return /* @__PURE__ */ jsxs(
|
|
11
25
|
"div",
|
|
12
26
|
{
|
|
13
27
|
style: {
|
|
14
28
|
whiteSpace: "pre",
|
|
15
|
-
background: "
|
|
16
|
-
display: "inline",
|
|
29
|
+
background: "var(--background)",
|
|
30
|
+
display: "inline-block",
|
|
17
31
|
border: "1px solid #ccc",
|
|
18
|
-
margin: 20
|
|
32
|
+
margin: 20,
|
|
33
|
+
color: "red"
|
|
19
34
|
},
|
|
20
35
|
children: [
|
|
21
36
|
/* @__PURE__ */ jsxs("code", { children: [
|
|
@@ -30,7 +45,11 @@ function ThemeDebug({
|
|
|
30
45
|
id: (_b = themeState.themeManager) == null ? void 0 : _b.id,
|
|
31
46
|
parentId: (_d = (_c = themeState.themeManager) == null ? void 0 : _c.parentManager) == null ? void 0 : _d.id,
|
|
32
47
|
isNew: themeState.isNewTheme,
|
|
33
|
-
onChangeCount
|
|
48
|
+
onChangeCount,
|
|
49
|
+
listening: [...((_e = themeState.themeManager) == null ? void 0 : _e["_listeningIds"]) || []].join(
|
|
50
|
+
","
|
|
51
|
+
),
|
|
52
|
+
_numChangeEventsSent: (_f = themeState.themeManager) == null ? void 0 : _f["_numChangeEventsSent"]
|
|
34
53
|
},
|
|
35
54
|
null,
|
|
36
55
|
2
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeDebug.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ChangedThemeResponse } from '../hooks/useTheme.js'\nimport { ThemeProps } from '../types.js'\n\nexport function ThemeDebug({\n themeState,\n themeProps,\n children,\n
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { useForceUpdate } from '@tamagui/use-force-update'\nimport { useEffect, useState } from 'react'\n\nimport { ChangedThemeResponse } from '../hooks/useTheme.js'\nimport { ThemeProps } from '../types.js'\n\nexport function ThemeDebug({\n themeState,\n themeProps,\n children,\n}: {\n themeState: ChangedThemeResponse\n themeProps: ThemeProps\n children: any\n}) {\n if (process.env.NODE_ENV === 'development') {\n const [onChangeCount, setOnChangeCount] = useState(0)\n const rerender = useForceUpdate()\n\n useEffect(() => {\n themeState.themeManager?.parentManager?.onChangeTheme((name, manager) => {\n setOnChangeCount((p) => ++p)\n console.warn(`theme changed`, name)\n })\n }, [themeState.themeManager])\n\n useEffect(() => {\n // to refresh _listeningIds every so often\n const tm = setInterval(rerender, 100)\n return () => clearTimeout(tm)\n }, [])\n\n return (\n <div\n style={{\n whiteSpace: 'pre',\n background: 'var(--background)',\n display: 'inline-block',\n border: '1px solid #ccc',\n margin: 20,\n color: 'red',\n }}\n >\n <code>\n <Theme /> \n {JSON.stringify(\n {\n name: themeState.name,\n className: themeState.className,\n inverse: themeProps.inverse,\n forceClassName: themeProps.forceClassName,\n parent: themeState.themeManager?.state.parentName,\n id: themeState.themeManager?.id,\n parentId: themeState.themeManager?.parentManager?.id,\n isNew: themeState.isNewTheme,\n onChangeCount,\n listening: [...(themeState.themeManager?.['_listeningIds'] || [])].join(\n ','\n ),\n _numChangeEventsSent: themeState.themeManager?.['_numChangeEventsSent'],\n },\n null,\n 2\n )}\n </code>\n {children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,gBAAW,iBAAX,mBAA0B,qBAAoB,CAAC,CAAE,EAAE;AAAA,kBACjE;AAAA,gBACF;AAAA,gBACA,uBAAsB,gBAAW,iBAAX,mBAA0B;AAAA,cAClD;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,aACF;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["_a", "_b"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.14.
|
|
31
|
-
"@tamagui/constants": "1.14.
|
|
32
|
-
"@tamagui/helpers": "1.14.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.14.
|
|
34
|
-
"@tamagui/use-did-finish-ssr": "1.14.
|
|
35
|
-
"@tamagui/use-event": "1.14.
|
|
36
|
-
"@tamagui/use-force-update": "1.14.
|
|
30
|
+
"@tamagui/compose-refs": "1.14.5",
|
|
31
|
+
"@tamagui/constants": "1.14.5",
|
|
32
|
+
"@tamagui/helpers": "1.14.5",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.14.5",
|
|
34
|
+
"@tamagui/use-did-finish-ssr": "1.14.5",
|
|
35
|
+
"@tamagui/use-event": "1.14.5",
|
|
36
|
+
"@tamagui/use-force-update": "1.14.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "1.14.
|
|
42
|
+
"@tamagui/build": "1.14.5",
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
44
|
"csstype": "^3.0.10",
|
|
45
45
|
"react": "^18.2.0",
|
package/src/createComponent.tsx
CHANGED
|
@@ -735,21 +735,8 @@ export function createComponent<
|
|
|
735
735
|
|
|
736
736
|
if (process.env.NODE_ENV === 'development') {
|
|
737
737
|
if (props['debug'] === 'visualize') {
|
|
738
|
-
const [onChangeCount, setOnChangeCount] = useState(0)
|
|
739
|
-
|
|
740
|
-
useEffect(() => {
|
|
741
|
-
themeState.themeManager?.onChangeTheme((name, manager) => {
|
|
742
|
-
setOnChangeCount((p) => ++p)
|
|
743
|
-
console.warn(`🖤`, name)
|
|
744
|
-
})
|
|
745
|
-
}, [themeState.themeManager])
|
|
746
|
-
|
|
747
738
|
content = (
|
|
748
|
-
<ThemeDebug
|
|
749
|
-
themeState={themeState}
|
|
750
|
-
themeProps={props}
|
|
751
|
-
onChangeCount={onChangeCount}
|
|
752
|
-
>
|
|
739
|
+
<ThemeDebug themeState={themeState} themeProps={props}>
|
|
753
740
|
{content}
|
|
754
741
|
</ThemeDebug>
|
|
755
742
|
)
|
|
@@ -30,18 +30,22 @@ let uid = 0
|
|
|
30
30
|
|
|
31
31
|
export class ThemeManager {
|
|
32
32
|
id = uid++
|
|
33
|
+
isComponent = false
|
|
33
34
|
themeListeners = new Set<ThemeListener>()
|
|
34
35
|
parentManager: ThemeManager | null = null
|
|
35
36
|
state: ThemeManagerState = emptyState
|
|
36
37
|
|
|
37
38
|
constructor(
|
|
38
39
|
public props: ThemeProps = {},
|
|
39
|
-
|
|
40
|
+
parentManagerIn?: ThemeManager | 'root' | null | undefined
|
|
40
41
|
) {
|
|
41
|
-
if (
|
|
42
|
+
if (parentManagerIn === 'root') {
|
|
42
43
|
this.updateState(props, false)
|
|
43
44
|
return
|
|
44
45
|
}
|
|
46
|
+
|
|
47
|
+
const parentManager = getNonComponentParentManager(parentManagerIn)
|
|
48
|
+
|
|
45
49
|
if (!parentManager) {
|
|
46
50
|
if (process.env.NODE_ENV !== 'production') {
|
|
47
51
|
throw new Error(
|
|
@@ -60,9 +64,7 @@ export class ThemeManager {
|
|
|
60
64
|
this.parentManager = parentManager
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
if (updatedState) {
|
|
65
|
-
this.state = updatedState
|
|
67
|
+
if (this.updateState(props, false)) {
|
|
66
68
|
return
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -71,9 +73,9 @@ export class ThemeManager {
|
|
|
71
73
|
|
|
72
74
|
updateState(
|
|
73
75
|
props: ThemeProps & { forceTheme?: ThemeParsed } = this.props || {},
|
|
74
|
-
|
|
76
|
+
shouldNotify = true
|
|
75
77
|
) {
|
|
76
|
-
const
|
|
78
|
+
const isChanging = (() => {
|
|
77
79
|
if (props.forceTheme) {
|
|
78
80
|
this.state.theme = props.forceTheme
|
|
79
81
|
this.state.name = props.name || ''
|
|
@@ -86,10 +88,22 @@ export class ThemeManager {
|
|
|
86
88
|
return true
|
|
87
89
|
}
|
|
88
90
|
})()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
|
|
92
|
+
if (isChanging) {
|
|
93
|
+
const names = this.state.name.split('_')
|
|
94
|
+
const lastName = names[names.length - 1][0]
|
|
95
|
+
this.isComponent = lastName[0] === lastName[0].toUpperCase()
|
|
91
96
|
this._allKeys = null
|
|
92
|
-
|
|
97
|
+
|
|
98
|
+
if (process.env.NODE_ENV === 'development') {
|
|
99
|
+
this['_numChangeEventsSent'] ??= 0
|
|
100
|
+
this['_numChangeEventsSent']++
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (shouldNotify) {
|
|
104
|
+
this.notify()
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
return this.state
|
|
94
108
|
}
|
|
95
109
|
}
|
|
@@ -157,7 +171,14 @@ export class ThemeManager {
|
|
|
157
171
|
this.themeListeners.forEach((cb) => cb(this.state.name, this))
|
|
158
172
|
}
|
|
159
173
|
|
|
160
|
-
onChangeTheme(cb: ThemeListener) {
|
|
174
|
+
onChangeTheme(cb: ThemeListener, debugId?: number) {
|
|
175
|
+
if (process.env.NODE_ENV === 'development' && debugId) {
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
this._listeningIds ??= new Set()
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
this._listeningIds.add(debugId)
|
|
180
|
+
}
|
|
181
|
+
|
|
161
182
|
this.themeListeners.add(cb)
|
|
162
183
|
return () => {
|
|
163
184
|
this.themeListeners.delete(cb)
|
|
@@ -224,6 +245,7 @@ function getState(
|
|
|
224
245
|
if (process.env.NODE_ENV === 'development' && typeof props.debug === 'string') {
|
|
225
246
|
console.groupCollapsed('ThemeManager.getState()')
|
|
226
247
|
console.log({
|
|
248
|
+
props,
|
|
227
249
|
parentName,
|
|
228
250
|
parentBaseTheme,
|
|
229
251
|
base,
|
|
@@ -282,7 +304,7 @@ function getState(
|
|
|
282
304
|
|
|
283
305
|
// eslint-disable-next-line no-console
|
|
284
306
|
if (process.env.NODE_ENV === 'development' && typeof props.debug === 'string') {
|
|
285
|
-
console.
|
|
307
|
+
console.warn('ThemeManager.getState():', {
|
|
286
308
|
result,
|
|
287
309
|
})
|
|
288
310
|
console.trace()
|
|
@@ -297,3 +319,18 @@ const inverseThemeName = (themeName: string) => {
|
|
|
297
319
|
? themeName.replace(/^light/, 'dark')
|
|
298
320
|
: themeName.replace(/^dark/, 'light')
|
|
299
321
|
}
|
|
322
|
+
|
|
323
|
+
export function getNonComponentParentManager(themeManager?: ThemeManager | null) {
|
|
324
|
+
// components never inherit from components
|
|
325
|
+
// example <Switch><Switch.Thumb /></Switch>
|
|
326
|
+
// the Switch theme shouldn't be considered parent of Thumb
|
|
327
|
+
let res = themeManager
|
|
328
|
+
while (res) {
|
|
329
|
+
if (res?.isComponent) {
|
|
330
|
+
res = res.parentManager
|
|
331
|
+
} else {
|
|
332
|
+
break
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return res
|
|
336
|
+
}
|
|
@@ -108,6 +108,10 @@ if (process.env.TAMAGUI_TARGET === 'native') {
|
|
|
108
108
|
contain: true,
|
|
109
109
|
boxSizing: true,
|
|
110
110
|
boxShadow: true,
|
|
111
|
+
outlineStyle: true,
|
|
112
|
+
outlineOffset: true,
|
|
113
|
+
outlineWidth: true,
|
|
114
|
+
outlineColor: true,
|
|
111
115
|
})
|
|
112
116
|
}
|
|
113
117
|
|
|
@@ -606,7 +610,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
606
610
|
isPseudo = key in validPseudoKeys
|
|
607
611
|
const isMediaOrPseudo = isMedia || isPseudo
|
|
608
612
|
|
|
609
|
-
if (!isMediaOrPseudo && usedKeys
|
|
613
|
+
if (!isMediaOrPseudo && key in usedKeys) {
|
|
610
614
|
if (process.env.NODE_ENV === 'developmnet' && debug === 'verbose') {
|
|
611
615
|
console.log(`Used media/pseudo ${key}`)
|
|
612
616
|
}
|
|
@@ -650,6 +654,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
650
654
|
const pseudoStyles = getAtomicStyle(pseudoStyleObject, descriptor)
|
|
651
655
|
for (const psuedoStyle of pseudoStyles) {
|
|
652
656
|
const fullKey = `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}`
|
|
657
|
+
|
|
653
658
|
if (!usedKeys[fullKey]) {
|
|
654
659
|
usedKeys[fullKey] = 1
|
|
655
660
|
addStyleToInsertRules(rulesToInsert, psuedoStyle)
|
|
@@ -663,7 +668,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
663
668
|
}
|
|
664
669
|
}
|
|
665
670
|
} else {
|
|
666
|
-
if (usedKeys
|
|
671
|
+
if (key in usedKeys) {
|
|
667
672
|
continue
|
|
668
673
|
}
|
|
669
674
|
|
|
@@ -692,6 +697,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
692
697
|
psuedosUsed ||= {}
|
|
693
698
|
|
|
694
699
|
const importance = descriptor.priority
|
|
700
|
+
|
|
695
701
|
for (const pkey in pseudoStyleObject) {
|
|
696
702
|
const val = pseudoStyleObject[pkey]
|
|
697
703
|
// when disabled ensure the default value is set for future animations to align
|
|
@@ -1103,6 +1109,11 @@ export const getSubStyle = (
|
|
|
1103
1109
|
languageContext,
|
|
1104
1110
|
avoidDefaultProps
|
|
1105
1111
|
)
|
|
1112
|
+
if (!staticConfig.isHOC) {
|
|
1113
|
+
if (key in skipProps) {
|
|
1114
|
+
continue
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1106
1117
|
if (!expanded) continue
|
|
1107
1118
|
for (const [skey, sval] of expanded) {
|
|
1108
1119
|
if (!avoidMergeTransform && skey in stylePropsTransform) {
|
package/src/hooks/useTheme.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { createProxy } from '../helpers/createProxy.js'
|
|
|
9
9
|
import {
|
|
10
10
|
ThemeManager,
|
|
11
11
|
ThemeManagerState,
|
|
12
|
+
getNonComponentParentManager,
|
|
12
13
|
hasNoThemeUpdatingProps,
|
|
13
14
|
} from '../helpers/ThemeManager.js'
|
|
14
15
|
import { ThemeManagerContext } from '../helpers/ThemeManagerContext.js'
|
|
@@ -156,7 +157,8 @@ export const useChangeThemeEffect = (
|
|
|
156
157
|
themeManager: null,
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
+
|
|
161
|
+
const parentManager = getNonComponentParentManager(useContext(ThemeManagerContext))
|
|
160
162
|
|
|
161
163
|
const {
|
|
162
164
|
debug,
|
|
@@ -186,11 +188,14 @@ export const useChangeThemeEffect = (
|
|
|
186
188
|
return next
|
|
187
189
|
}
|
|
188
190
|
|
|
189
|
-
function getThemeManagerNextStateIfChanged(
|
|
191
|
+
function getThemeManagerNextStateIfChanged(
|
|
192
|
+
manager = themeManager,
|
|
193
|
+
forceShouldChange = false
|
|
194
|
+
) {
|
|
190
195
|
const next = getNextThemeManagerState(manager)
|
|
191
196
|
if (!next) return
|
|
192
197
|
if (disableUpdate?.() === true) return
|
|
193
|
-
if (!manager.getStateShouldChange(next, state)) return
|
|
198
|
+
if (!forceShouldChange && !manager.getStateShouldChange(next, state)) return
|
|
194
199
|
return next
|
|
195
200
|
}
|
|
196
201
|
|
|
@@ -228,13 +233,14 @@ export const useChangeThemeEffect = (
|
|
|
228
233
|
}
|
|
229
234
|
|
|
230
235
|
const disposeChangeListener = parentManager?.onChangeTheme((name, manager) => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
const shouldUpdate = Boolean(keys?.length || isNewTheme)
|
|
237
|
+
if (shouldUpdate) {
|
|
238
|
+
if (process.env.NODE_ENV === 'development' && props['debug']) {
|
|
239
|
+
console.log(`onChangeTheme`, shouldUpdate, { props, name, manager, keys })
|
|
234
240
|
}
|
|
235
241
|
setThemeState(createState)
|
|
236
242
|
}
|
|
237
|
-
})
|
|
243
|
+
}, themeManager.id)
|
|
238
244
|
|
|
239
245
|
return () => {
|
|
240
246
|
disposeChangeListener?.()
|
|
@@ -281,7 +287,15 @@ export const useChangeThemeEffect = (
|
|
|
281
287
|
if (prev?.themeManager) {
|
|
282
288
|
themeManager = prev.themeManager
|
|
283
289
|
|
|
284
|
-
|
|
290
|
+
// this could be a bit better, problem is on toggling light/dark the state is actually
|
|
291
|
+
// showing light even when the last was dark. but technically allso onChangeTheme should
|
|
292
|
+
// basically always call on a change, so i'm wondering if we even need the shouldUpdate
|
|
293
|
+
// at all anymore. this forces updates onChangeTheme for all dynamic style accessed components
|
|
294
|
+
// which is correct, potentially in the future we can avoid forceChange and just know to
|
|
295
|
+
// update if keys.length is set + onChangeTheme called
|
|
296
|
+
const forceChange = Boolean(keys?.length)
|
|
297
|
+
|
|
298
|
+
const nextState = getThemeManagerNextStateIfChanged(themeManager, forceChange)
|
|
285
299
|
|
|
286
300
|
if (nextState) {
|
|
287
301
|
state = nextState
|
package/src/index.ts
CHANGED
|
@@ -8,8 +8,6 @@ export * from './createTokens.js'
|
|
|
8
8
|
export * from './createVariable.js'
|
|
9
9
|
export * from './createVariables.js'
|
|
10
10
|
export * from './insertFont.js'
|
|
11
|
-
export * from './addTheme.js'
|
|
12
|
-
export * from './updateTheme.js'
|
|
13
11
|
export * from './styled.js'
|
|
14
12
|
export * from './types.js'
|
|
15
13
|
export * from './setupReactNative.js'
|
|
@@ -45,7 +43,6 @@ export * from './helpers/normalizeColor.js'
|
|
|
45
43
|
|
|
46
44
|
export * from './contexts/ButtonNestingContext.js'
|
|
47
45
|
|
|
48
|
-
export * from './hooks/useId.js'
|
|
49
46
|
export * from './hooks/useIsTouchDevice.js'
|
|
50
47
|
|
|
51
48
|
export {
|
package/src/styled.tsx
CHANGED
|
@@ -110,7 +110,10 @@ export function styled<
|
|
|
110
110
|
staticExtractionOptions?.isText || parentStaticConfig?.isText
|
|
111
111
|
)
|
|
112
112
|
const acceptsClassName =
|
|
113
|
-
acceptsClassNameProp ??
|
|
113
|
+
acceptsClassNameProp ??
|
|
114
|
+
(isPlainStyledComponent ||
|
|
115
|
+
isReactNative ||
|
|
116
|
+
(parentStaticConfig?.isHOC && parentStaticConfig?.acceptsClassName))
|
|
114
117
|
|
|
115
118
|
const conf: Partial<StaticConfig> = {
|
|
116
119
|
...staticExtractionOptions,
|
|
@@ -168,14 +171,28 @@ export function styled<
|
|
|
168
171
|
// add in pseudos
|
|
169
172
|
PseudoProps<Partial<OurPropsBase>>
|
|
170
173
|
|
|
174
|
+
type ParentStaticProperties = {
|
|
175
|
+
[Key in Exclude<
|
|
176
|
+
keyof ParentComponent,
|
|
177
|
+
'defaultProps' | 'propTypes' | '$$typeof' | 'staticConfig' | 'extractable'
|
|
178
|
+
>]: ParentComponent[Key]
|
|
179
|
+
}
|
|
180
|
+
|
|
171
181
|
type StyledComponent = TamaguiComponent<
|
|
172
182
|
Props,
|
|
173
183
|
TamaguiElement,
|
|
174
184
|
ParentPropsBase,
|
|
175
|
-
ParentVariants & OurVariants
|
|
185
|
+
ParentVariants & OurVariants,
|
|
186
|
+
ParentStaticProperties
|
|
176
187
|
>
|
|
177
188
|
|
|
178
|
-
|
|
189
|
+
for (const key in ComponentIn) {
|
|
190
|
+
if (key in component) continue
|
|
191
|
+
// @ts-expect-error assigning static properties over
|
|
192
|
+
component[key] = ComponentIn[key]
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return component as any as StyledComponent
|
|
179
196
|
}
|
|
180
197
|
|
|
181
198
|
// sanity check types
|
package/src/types.tsx
CHANGED
|
@@ -778,8 +778,9 @@ export type TamaguiComponent<
|
|
|
778
778
|
Props = any,
|
|
779
779
|
Ref = any,
|
|
780
780
|
BaseProps = {},
|
|
781
|
-
VariantProps = {}
|
|
782
|
-
|
|
781
|
+
VariantProps = {},
|
|
782
|
+
ParentStaticProperties = {}
|
|
783
|
+
> = ReactComponentWithRef<Props, Ref> & StaticComponentObject & ParentStaticProperties
|
|
783
784
|
|
|
784
785
|
type StaticComponentObject = {
|
|
785
786
|
staticConfig: StaticConfigParsed
|
package/src/views/ThemeDebug.tsx
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { useForceUpdate } from '@tamagui/use-force-update'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
|
+
|
|
1
4
|
import { ChangedThemeResponse } from '../hooks/useTheme.js'
|
|
2
5
|
import { ThemeProps } from '../types.js'
|
|
3
6
|
|
|
@@ -5,22 +8,37 @@ export function ThemeDebug({
|
|
|
5
8
|
themeState,
|
|
6
9
|
themeProps,
|
|
7
10
|
children,
|
|
8
|
-
onChangeCount,
|
|
9
11
|
}: {
|
|
10
12
|
themeState: ChangedThemeResponse
|
|
11
13
|
themeProps: ThemeProps
|
|
12
|
-
onChangeCount?: number
|
|
13
14
|
children: any
|
|
14
15
|
}) {
|
|
15
16
|
if (process.env.NODE_ENV === 'development') {
|
|
17
|
+
const [onChangeCount, setOnChangeCount] = useState(0)
|
|
18
|
+
const rerender = useForceUpdate()
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
themeState.themeManager?.parentManager?.onChangeTheme((name, manager) => {
|
|
22
|
+
setOnChangeCount((p) => ++p)
|
|
23
|
+
console.warn(`theme changed`, name)
|
|
24
|
+
})
|
|
25
|
+
}, [themeState.themeManager])
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
// to refresh _listeningIds every so often
|
|
29
|
+
const tm = setInterval(rerender, 100)
|
|
30
|
+
return () => clearTimeout(tm)
|
|
31
|
+
}, [])
|
|
32
|
+
|
|
16
33
|
return (
|
|
17
34
|
<div
|
|
18
35
|
style={{
|
|
19
36
|
whiteSpace: 'pre',
|
|
20
|
-
background: '
|
|
21
|
-
display: 'inline',
|
|
37
|
+
background: 'var(--background)',
|
|
38
|
+
display: 'inline-block',
|
|
22
39
|
border: '1px solid #ccc',
|
|
23
40
|
margin: 20,
|
|
41
|
+
color: 'red',
|
|
24
42
|
}}
|
|
25
43
|
>
|
|
26
44
|
<code>
|
|
@@ -36,6 +54,10 @@ export function ThemeDebug({
|
|
|
36
54
|
parentId: themeState.themeManager?.parentManager?.id,
|
|
37
55
|
isNew: themeState.isNewTheme,
|
|
38
56
|
onChangeCount,
|
|
57
|
+
listening: [...(themeState.themeManager?.['_listeningIds'] || [])].join(
|
|
58
|
+
','
|
|
59
|
+
),
|
|
60
|
+
_numChangeEventsSent: themeState.themeManager?.['_numChangeEventsSent'],
|
|
39
61
|
},
|
|
40
62
|
null,
|
|
41
63
|
2
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { DebugProp, SpaceDirection, SpaceTokens, SpacerProps, StaticConfig, StaticConfigParsed, StylableComponent, TamaguiComponent, TamaguiComponentState, TamaguiElement } from './types';
|
|
3
3
|
export declare const defaultComponentState: TamaguiComponentState;
|
|
4
4
|
export declare const mouseUps: Set<Function>;
|
|
5
|
-
export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(configIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, {}>;
|
|
5
|
+
export declare function createComponent<ComponentPropTypes extends Object = {}, Ref = TamaguiElement, BaseProps = never>(configIn: Partial<StaticConfig> | StaticConfigParsed, ParentComponent?: StylableComponent): TamaguiComponent<ComponentPropTypes, Ref, BaseProps, {}, {}>;
|
|
6
6
|
export declare const Unspaced: {
|
|
7
7
|
(props: {
|
|
8
8
|
children?: any;
|
|
9
9
|
}): any;
|
|
10
10
|
isUnspaced: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, {}>;
|
|
12
|
+
export declare const Spacer: TamaguiComponent<SpacerProps, TamaguiElement, never, {}, {}>;
|
|
13
13
|
export type SpacedChildrenProps = {
|
|
14
14
|
isZStack?: boolean;
|
|
15
15
|
children?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAYN,MAAM,OAAO,CAAA;AAiBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EAErB,cAAc,EAIf,MAAM,SAAS,CAAA;AAsBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAeD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA8B3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAYN,MAAM,OAAO,CAAA;AAiBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EAErB,cAAc,EAIf,MAAM,SAAS,CAAA;AAsBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAeD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA8B3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,gEAixBpC;AAGD,eAAO,MAAM,QAAQ;YAAW;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAAmB,CAAA;AAMrE,eAAO,MAAM,MAAM,8DA8CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAiGxD"}
|
|
@@ -17,13 +17,14 @@ export declare function hasNoThemeUpdatingProps(props: ThemeProps): boolean;
|
|
|
17
17
|
export declare class ThemeManager {
|
|
18
18
|
props: ThemeProps;
|
|
19
19
|
id: number;
|
|
20
|
+
isComponent: boolean;
|
|
20
21
|
themeListeners: Set<ThemeListener>;
|
|
21
22
|
parentManager: ThemeManager | null;
|
|
22
23
|
state: ThemeManagerState;
|
|
23
|
-
constructor(props?: ThemeProps,
|
|
24
|
+
constructor(props?: ThemeProps, parentManagerIn?: ThemeManager | 'root' | null | undefined);
|
|
24
25
|
updateState(props?: ThemeProps & {
|
|
25
26
|
forceTheme?: ThemeParsed;
|
|
26
|
-
},
|
|
27
|
+
}, shouldNotify?: boolean): ThemeManagerState | undefined;
|
|
27
28
|
getStateIfChanged(props?: ThemeProps, state?: ThemeManagerState | null, parentManager?: ThemeManager | null): ThemeManagerState | null | undefined;
|
|
28
29
|
getStateShouldChange(nextState: ThemeManagerState | null, state?: ThemeManagerState | null): boolean;
|
|
29
30
|
getState(props?: ThemeProps, parentManager?: ThemeManager | null): ThemeManagerState | null;
|
|
@@ -31,7 +32,8 @@ export declare class ThemeManager {
|
|
|
31
32
|
get allKeys(): Set<string>;
|
|
32
33
|
getValue(key: string, state?: ThemeManagerState): string | number | import("../createVariable.js").Variable<any> | undefined;
|
|
33
34
|
notify(): void;
|
|
34
|
-
onChangeTheme(cb: ThemeListener): () => void;
|
|
35
|
+
onChangeTheme(cb: ThemeListener, debugId?: number): () => void;
|
|
35
36
|
}
|
|
37
|
+
export declare function getNonComponentParentManager(themeManager?: ThemeManager | null): ThemeManager | null | undefined;
|
|
36
38
|
export {};
|
|
37
39
|
//# sourceMappingURL=ThemeManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeManager.d.ts","sourceRoot":"","sources":["../../src/helpers/ThemeManager.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAErD,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,EAAE,YAAY,KAAK,IAAI,CAAA;AAE9E,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,IAAI,CAAC,EAAE,M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,CAAA;IAC9B,KAAK,EAAE,eAAe,CAAA;IACtB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,eAAe,CAAC,EAAE,iBAAiB,CAAA;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;AA0FhE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7B,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,eAAe,EACtB,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,mBAAmB,EAErC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAqB7B,eAAO,MAAM,cAAc,EAAE,aA0xB5B,CAAA;AA0FD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,sBACK,OAAO,wBACL,OAAO,KAC5B,cAkCF,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAA;AA2BD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI1D,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAoBD,eAAO,MAAM,QAAQ,WAAW,UAAU,KAAgB,WAEzD,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,UAAU;;gBA7BrC,OAAO;kBACL,YAAY,GAAG,IAAI;UAC3B,MAAM;;QAmEb,CAAA;AAED,wBAAgB,eAAe,CAC7B,EACE,KAAK,EACL,YAAY,GACb,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACjC,KAAK,EAAE,WAAW,CAAA;CACnB,EACD,IAAI,CAAC,EAAE,MAAM,EAAE,eA2ChB;AAED,eAAO,MAAM,mBAAmB,mBAA0B,CAAA;AAE1D,eAAO,MAAM,oBAAoB,UACxB,UAAU,yBAEV,MAAM,EAAE,kBACC,MAAM,OAAO,KAC5B,oBA6LF,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ export * from './createTokens.js';
|
|
|
8
8
|
export * from './createVariable.js';
|
|
9
9
|
export * from './createVariables.js';
|
|
10
10
|
export * from './insertFont.js';
|
|
11
|
-
export * from './addTheme.js';
|
|
12
|
-
export * from './updateTheme.js';
|
|
13
11
|
export * from './styled.js';
|
|
14
12
|
export * from './types.js';
|
|
15
13
|
export * from './setupReactNative.js';
|
|
@@ -34,7 +32,6 @@ export * from './helpers/themeable.js';
|
|
|
34
32
|
export * from './helpers/withStaticProperties.js';
|
|
35
33
|
export * from './helpers/normalizeColor.js';
|
|
36
34
|
export * from './contexts/ButtonNestingContext.js';
|
|
37
|
-
export * from './hooks/useId.js';
|
|
38
35
|
export * from './hooks/useIsTouchDevice.js';
|
|
39
36
|
export { configureMedia, getMedia, mediaState, useMedia, useMediaPropsActive, mediaObjectToString, mediaQueryConfig, } from './hooks/useMedia.js';
|
|
40
37
|
export * from './hooks/useTheme.js';
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AAErC,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,cAAc,0BAA0B,CAAA;AAExC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kCAAkC,CAAA;AAChD,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAE3C,cAAc,oCAAoC,CAAA;AAElD,cAAc,6BAA6B,CAAA;AAE3C,OAAO,EACL,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAE7C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oCAAoC,CAAA;AAElD,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAElC,cAAc,iBAAiB,CAAA"}
|
package/types/styled.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export declare function styled<ParentComponent extends StylableComponent, Varian
|
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
};
|
|
17
17
|
acceptsClassName?: boolean;
|
|
18
|
-
}, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; }) & MediaProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>> & PseudoProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>>, TamaguiElement, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>;
|
|
18
|
+
}, staticExtractionOptions?: Partial<StaticConfig>): TamaguiComponent<Variants extends void ? GetProps<ParentComponent> : GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; }) & MediaProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>> & PseudoProps<Partial<GetBaseProps<ParentComponent> & Omit<GetVariantProps<ParentComponent>, keyof (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; })>>, TamaguiElement, GetBaseProps<ParentComponent>, GetVariantProps<ParentComponent> & (Variants extends void ? {} : { [Key in keyof Variants]?: (Variants[Key] extends VariantSpreadFunction<any, infer Val> ? Val : GetVariantValues<keyof Variants[Key]>) | undefined; }), { [Key_1 in Exclude<keyof ParentComponent, "defaultProps" | "propTypes" | "staticConfig" | "extractable" | "$$typeof">]: ParentComponent[Key_1]; }>;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=styled.d.ts.map
|