@tamagui/web 1.124.3 → 1.124.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/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/webPropsToSkip.native.js +0 -2
- package/dist/cjs/helpers/webPropsToSkip.native.js.map +2 -2
- package/dist/cjs/hooks/getThemeProxied.cjs +21 -15
- package/dist/cjs/hooks/getThemeProxied.js +20 -12
- package/dist/cjs/hooks/getThemeProxied.js.map +1 -1
- package/dist/cjs/hooks/getThemeProxied.native.js +25 -21
- package/dist/cjs/hooks/getThemeProxied.native.js.map +2 -2
- package/dist/cjs/hooks/useThemeState.cjs +76 -62
- package/dist/cjs/hooks/useThemeState.js +51 -39
- package/dist/cjs/hooks/useThemeState.js.map +2 -2
- package/dist/cjs/hooks/useThemeState.native.js +38 -30
- package/dist/cjs/hooks/useThemeState.native.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/webPropsToSkip.native.js +0 -2
- package/dist/esm/helpers/webPropsToSkip.native.js.map +2 -2
- package/dist/esm/hooks/getThemeProxied.js +20 -11
- package/dist/esm/hooks/getThemeProxied.js.map +1 -1
- package/dist/esm/hooks/getThemeProxied.mjs +20 -14
- package/dist/esm/hooks/getThemeProxied.mjs.map +1 -1
- package/dist/esm/hooks/getThemeProxied.native.js +26 -21
- package/dist/esm/hooks/getThemeProxied.native.js.map +2 -2
- package/dist/esm/hooks/useThemeState.js +51 -39
- package/dist/esm/hooks/useThemeState.js.map +2 -2
- package/dist/esm/hooks/useThemeState.mjs +76 -63
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +37 -30
- package/dist/esm/hooks/useThemeState.native.js.map +2 -2
- package/package.json +11 -11
- package/src/helpers/insertStyleRule.tsx +0 -1
- package/src/helpers/webPropsToSkip.native.ts +0 -2
- package/src/hooks/getThemeProxied.ts +19 -13
- package/src/hooks/useThemeState.ts +99 -57
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +0 -2
- package/types/helpers/webPropsToSkip.native.d.ts.map +1 -1
- package/types/hooks/getThemeProxied.d.ts +2 -2
- package/types/hooks/getThemeProxied.d.ts.map +1 -1
- package/types/hooks/useThemeState.d.ts +1 -0
- package/types/hooks/useThemeState.d.ts.map +1 -1
|
@@ -26,23 +26,33 @@ export type ThemeState = {
|
|
|
26
26
|
|
|
27
27
|
export const ThemeStateContext = createContext<ID>('')
|
|
28
28
|
|
|
29
|
+
export const keysToId = new WeakMap()
|
|
30
|
+
|
|
29
31
|
const allListeners = new Map<ID, Function>()
|
|
30
32
|
const listenersByParent: Record<ID, Set<ID>> = {}
|
|
33
|
+
const hasRenderedOnce = new WeakMap<any, boolean>()
|
|
34
|
+
const pendingUpdate = new Map<any, boolean | 'force'>()
|
|
31
35
|
|
|
32
36
|
// TODO this will gain memory over time but its not going to be a ton
|
|
33
37
|
const states: Map<ID, ThemeState | undefined> = new Map()
|
|
34
38
|
|
|
39
|
+
let shouldForce = false
|
|
35
40
|
export const forceUpdateThemes = () => {
|
|
41
|
+
cacheVersion++
|
|
42
|
+
shouldForce = true
|
|
36
43
|
allListeners.forEach((cb) => cb())
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
export const getThemeState = (id: ID) => states.get(id)
|
|
40
47
|
|
|
48
|
+
const cache = new Map<string, ThemeState>()
|
|
49
|
+
let cacheVersion = 0
|
|
50
|
+
|
|
51
|
+
let themes: Record<string, ThemeParsed> | null = null
|
|
52
|
+
|
|
41
53
|
let rootThemeState: ThemeState | null = null
|
|
42
54
|
export const getRootThemeState = () => rootThemeState
|
|
43
55
|
|
|
44
|
-
const HasRenderedOnce = new WeakMap<any, boolean>()
|
|
45
|
-
|
|
46
56
|
export const useThemeState = (
|
|
47
57
|
props: UseThemeWithStateProps,
|
|
48
58
|
isRoot = false,
|
|
@@ -63,23 +73,70 @@ export const useThemeState = (
|
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
const id = useId()
|
|
76
|
+
|
|
66
77
|
const subscribe = useCallback(
|
|
67
78
|
(cb: Function) => {
|
|
68
79
|
listenersByParent[parentId] ||= new Set()
|
|
69
80
|
listenersByParent[parentId].add(id)
|
|
70
|
-
allListeners.set(id,
|
|
81
|
+
allListeners.set(id, () => {
|
|
82
|
+
pendingUpdate.set(id, shouldForce ? 'force' : true)
|
|
83
|
+
cb()
|
|
84
|
+
})
|
|
71
85
|
return () => {
|
|
72
86
|
allListeners.delete(id)
|
|
73
87
|
listenersByParent[parentId].delete(id)
|
|
74
88
|
}
|
|
75
89
|
},
|
|
76
|
-
[id, parentId
|
|
90
|
+
[id, parentId]
|
|
77
91
|
)
|
|
78
92
|
|
|
79
93
|
const propsKey = getPropsKey(props)
|
|
80
94
|
|
|
81
95
|
const getSnapshot = () => {
|
|
82
|
-
|
|
96
|
+
const last = states.get(id)
|
|
97
|
+
const needsUpdate =
|
|
98
|
+
props.name === 'light' || props.name === 'dark'
|
|
99
|
+
? true
|
|
100
|
+
: !hasRenderedOnce.get(keys)
|
|
101
|
+
? true
|
|
102
|
+
: keys?.current?.size
|
|
103
|
+
? true
|
|
104
|
+
: props.needsUpdate?.()
|
|
105
|
+
|
|
106
|
+
const parentState = states.get(parentId)
|
|
107
|
+
const cacheKey = `${cacheVersion}${id}${propsKey}${parentState?.name || ''}${isRoot}`
|
|
108
|
+
|
|
109
|
+
if (!needsUpdate) {
|
|
110
|
+
if (cache.has(cacheKey)) {
|
|
111
|
+
return cache.get(cacheKey)!
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const next = getSnapshotFrom(
|
|
116
|
+
last,
|
|
117
|
+
props,
|
|
118
|
+
propsKey,
|
|
119
|
+
isRoot,
|
|
120
|
+
id,
|
|
121
|
+
parentId,
|
|
122
|
+
needsUpdate,
|
|
123
|
+
pendingUpdate.get(id)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if (last !== next) {
|
|
127
|
+
pendingUpdate.delete(id)
|
|
128
|
+
states.set(id, next)
|
|
129
|
+
cache.set(id, next)
|
|
130
|
+
if (
|
|
131
|
+
process.env.NODE_ENV === 'development' &&
|
|
132
|
+
props.debug &&
|
|
133
|
+
props.debug !== 'profile'
|
|
134
|
+
) {
|
|
135
|
+
console.warn(` · useTheme(${id}) UPDATE from`, last, 'to', next)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return next
|
|
83
140
|
}
|
|
84
141
|
|
|
85
142
|
if (process.env.NODE_ENV === 'development' && globalThis.time)
|
|
@@ -88,11 +145,11 @@ export const useThemeState = (
|
|
|
88
145
|
const state = useSyncExternalStore(subscribe, getSnapshot, getSnapshot)
|
|
89
146
|
|
|
90
147
|
useIsomorphicLayoutEffect(() => {
|
|
91
|
-
if (!
|
|
92
|
-
|
|
93
|
-
HasRenderedOnce.set(keys, true)
|
|
148
|
+
if (!hasRenderedOnce.get(keys)) {
|
|
149
|
+
hasRenderedOnce.set(keys, true)
|
|
94
150
|
return
|
|
95
151
|
}
|
|
152
|
+
if (!propsKey) return
|
|
96
153
|
if (
|
|
97
154
|
process.env.NODE_ENV === 'development' &&
|
|
98
155
|
props.debug &&
|
|
@@ -103,52 +160,35 @@ export const useThemeState = (
|
|
|
103
160
|
scheduleUpdate(id)
|
|
104
161
|
}, [keys, propsKey])
|
|
105
162
|
|
|
106
|
-
if (process.env.NODE_ENV === 'development' && props.debug) {
|
|
107
|
-
console.groupCollapsed(
|
|
108
|
-
` · useTheme(${id}) =>`,
|
|
109
|
-
state.name,
|
|
110
|
-
id === state.id ? '🎉' : '⏭️'
|
|
111
|
-
)
|
|
112
|
-
console.info({
|
|
113
|
-
state,
|
|
114
|
-
parentId,
|
|
115
|
-
props,
|
|
116
|
-
propsKey,
|
|
117
|
-
id,
|
|
118
|
-
parentState: states.get(parentId),
|
|
119
|
-
})
|
|
120
|
-
console.groupEnd()
|
|
121
|
-
}
|
|
122
|
-
|
|
123
163
|
return state.id === id ? { ...state, isNew: true } : state
|
|
124
164
|
}
|
|
125
165
|
|
|
126
|
-
// const cache = new Map<string, ThemeState>()
|
|
127
|
-
let themes: Record<string, ThemeParsed> | null = null
|
|
128
|
-
|
|
129
166
|
const getSnapshotFrom = (
|
|
167
|
+
lastState: ThemeState | undefined,
|
|
130
168
|
props: UseThemeWithStateProps,
|
|
131
169
|
propsKey: string,
|
|
132
170
|
isRoot = false,
|
|
133
171
|
id: string,
|
|
134
172
|
parentId: string,
|
|
135
|
-
|
|
173
|
+
needsUpdate: boolean | undefined,
|
|
174
|
+
pendingUpdate: boolean | 'force' | undefined
|
|
136
175
|
): ThemeState => {
|
|
137
|
-
const needsUpdate = keys?.current?.size || props.needsUpdate?.()
|
|
138
176
|
const parentState = states.get(parentId)
|
|
139
177
|
|
|
140
|
-
// const cacheKey = `${id}${propsKey}${needsUpdate}${parentState?.name || ''}${isRoot}`
|
|
141
|
-
// if (cache.has(cacheKey)) {
|
|
142
|
-
// return cache.get(cacheKey)!
|
|
143
|
-
// }
|
|
144
|
-
|
|
145
178
|
if (!themes) {
|
|
146
179
|
themes = getConfig().themes
|
|
147
180
|
}
|
|
148
181
|
|
|
149
|
-
const
|
|
182
|
+
const name =
|
|
183
|
+
!propsKey && pendingUpdate !== 'force'
|
|
184
|
+
? null
|
|
185
|
+
: getNewThemeName(
|
|
186
|
+
parentState?.name,
|
|
187
|
+
props,
|
|
188
|
+
pendingUpdate === 'force' ? true : !!needsUpdate
|
|
189
|
+
)
|
|
150
190
|
|
|
151
|
-
const
|
|
191
|
+
const isSameAsParent = Boolean(!name && propsKey) // name = null if matching parent and has props
|
|
152
192
|
|
|
153
193
|
if (
|
|
154
194
|
process.env.NODE_ENV === 'development' &&
|
|
@@ -160,32 +200,27 @@ const getSnapshotFrom = (
|
|
|
160
200
|
console.info(message)
|
|
161
201
|
} else {
|
|
162
202
|
console.groupCollapsed(message)
|
|
163
|
-
console.
|
|
203
|
+
console.trace({ name, lastState, parentState, props, propsKey, id, isSameAsParent })
|
|
164
204
|
console.groupEnd()
|
|
165
205
|
}
|
|
166
206
|
}
|
|
167
207
|
|
|
168
|
-
const isSameAsParent = !name && propsKey // name = null if matching parent and has props
|
|
169
208
|
if (parentState && isSameAsParent) {
|
|
170
209
|
return parentState
|
|
171
210
|
}
|
|
172
211
|
|
|
173
212
|
if (!name) {
|
|
174
|
-
|
|
175
|
-
|
|
213
|
+
const next = lastState ?? parentState!
|
|
214
|
+
|
|
215
|
+
if (needsUpdate && pendingUpdate) {
|
|
216
|
+
const updated = { ...(parentState || lastState)! }
|
|
217
|
+
return updated
|
|
176
218
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return parentState!
|
|
219
|
+
|
|
220
|
+
return next
|
|
180
221
|
}
|
|
181
222
|
|
|
182
|
-
if (
|
|
183
|
-
lastState &&
|
|
184
|
-
lastState.name === name
|
|
185
|
-
// &&
|
|
186
|
-
// (!parentState || parentState.name === lastState.parentName)
|
|
187
|
-
) {
|
|
188
|
-
// cache.set(cacheKey, lastState!)
|
|
223
|
+
if (pendingUpdate !== 'force' && lastState && lastState.name === name) {
|
|
189
224
|
return lastState
|
|
190
225
|
}
|
|
191
226
|
|
|
@@ -210,18 +245,24 @@ const getSnapshotFrom = (
|
|
|
210
245
|
props.debug &&
|
|
211
246
|
props.debug !== 'profile'
|
|
212
247
|
) {
|
|
213
|
-
console.groupCollapsed(` · useTheme(${id}) ⏭️ ${name}`)
|
|
248
|
+
console.groupCollapsed(` · useTheme(${id}) ⏭️2 ${name}`)
|
|
214
249
|
console.info('state', nextState)
|
|
215
250
|
console.groupEnd()
|
|
216
251
|
}
|
|
217
252
|
|
|
218
|
-
states.set(id, nextState)
|
|
219
|
-
// cache.set(cacheKey, nextState)
|
|
220
|
-
|
|
221
253
|
if (isRoot) {
|
|
222
254
|
rootThemeState = nextState
|
|
223
255
|
}
|
|
224
256
|
|
|
257
|
+
// we still update the state (not changing identity), that way children can properly resolve the right state
|
|
258
|
+
// but this one wont trigger an update
|
|
259
|
+
if (pendingUpdate !== 'force') {
|
|
260
|
+
if (lastState && !needsUpdate) {
|
|
261
|
+
Object.assign(lastState, nextState)
|
|
262
|
+
return lastState
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
225
266
|
return nextState
|
|
226
267
|
}
|
|
227
268
|
|
|
@@ -259,7 +300,7 @@ function getScheme(name: string) {
|
|
|
259
300
|
|
|
260
301
|
function getNewThemeName(
|
|
261
302
|
parentName = '',
|
|
262
|
-
{ name, reset, componentName, inverse }: UseThemeWithStateProps,
|
|
303
|
+
{ name, reset, componentName, inverse, debug }: UseThemeWithStateProps,
|
|
263
304
|
forceUpdate = false
|
|
264
305
|
): string | null {
|
|
265
306
|
if (name && reset) {
|
|
@@ -310,7 +351,8 @@ function getNewThemeName(
|
|
|
310
351
|
if (found) break
|
|
311
352
|
}
|
|
312
353
|
|
|
313
|
-
if (
|
|
354
|
+
if (inverse) {
|
|
355
|
+
found ||= parentName
|
|
314
356
|
const scheme = found.split('_')[0]
|
|
315
357
|
found = found.replace(new RegExp(`^${scheme}`), scheme === 'light' ? 'dark' : 'light')
|
|
316
358
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EAEb,YAAY,EACb,MAAM,UAAU,CAAA;AAQjB,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,8BAAqB,CAAA;AACjD,eAAO,MAAM,WAAW,gBAAgC,CAAA;AACxD,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AA8BxD,wBAAgB,qBAAqB,SAkBpC;AAID,wBAAgB,aAAa,CAC3B,aAAa,UAAQ,EACrB,MAAM,CAAC,EAAE,YAAY,GACpB,aAAa,GAAG,SAAS,CA8B3B;AAiOD,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,uBAW9D;AAGD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,QAEjC;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,QAqC5D;AAUD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EAEb,YAAY,EACb,MAAM,UAAU,CAAA;AAQjB,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,8BAAqB,CAAA;AACjD,eAAO,MAAM,WAAW,gBAAgC,CAAA;AACxD,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AA8BxD,wBAAgB,qBAAqB,SAkBpC;AAID,wBAAgB,aAAa,CAC3B,aAAa,UAAQ,EACrB,MAAM,CAAC,EAAE,YAAY,GACpB,aAAa,GAAG,SAAS,CA8B3B;AAiOD,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,uBAW9D;AAGD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,QAEjC;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,QAqC5D;AAUD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,WAsBxD"}
|
|
@@ -7,12 +7,10 @@ export declare const webPropsToSkip: {
|
|
|
7
7
|
contain: number;
|
|
8
8
|
boxSizing: number;
|
|
9
9
|
touchAction: number;
|
|
10
|
-
boxShadow: number;
|
|
11
10
|
outlineStyle: number;
|
|
12
11
|
outlineOffset: number;
|
|
13
12
|
outlineWidth: number;
|
|
14
13
|
outlineColor: number;
|
|
15
|
-
filter: number;
|
|
16
14
|
backdropFilter: number;
|
|
17
15
|
backgroundImage: number;
|
|
18
16
|
mixBlendMode: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPropsToSkip.native.d.ts","sourceRoot":"","sources":["../../src/helpers/webPropsToSkip.native.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"webPropsToSkip.native.d.ts","sourceRoot":"","sources":["../../src/helpers/webPropsToSkip.native.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD1B,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MutableRefObject } from 'react';
|
|
2
2
|
import type { Variable } from '../createVariable';
|
|
3
3
|
import type { ThemeParsed, Tokens, UseThemeWithStateProps, VariableVal, VariableValGeneric } from '../types';
|
|
4
|
-
import type
|
|
4
|
+
import { type ThemeState } from './useThemeState';
|
|
5
5
|
export type ThemeProxied = {
|
|
6
6
|
[Key in keyof ThemeParsed | keyof Tokens['color']]: ThemeGettable<Key extends keyof ThemeParsed ? ThemeParsed[Key] : Variable<any>>;
|
|
7
7
|
} & {
|
|
@@ -20,6 +20,6 @@ type ThemeGettable<Val> = Val & {
|
|
|
20
20
|
*/
|
|
21
21
|
get: (platform?: 'web') => string | (Val extends Variable<infer X> ? X extends VariableValGeneric ? any : Exclude<X, Variable> : Val extends VariableVal ? string | number : unknown);
|
|
22
22
|
};
|
|
23
|
-
export declare function getThemeProxied(_props: UseThemeWithStateProps,
|
|
23
|
+
export declare function getThemeProxied(_props: UseThemeWithStateProps, _state: ThemeState | null, _keys: MutableRefObject<Set<string> | null>): ThemeProxied;
|
|
24
24
|
export {};
|
|
25
25
|
//# sourceMappingURL=getThemeProxied.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThemeProxied.d.ts","sourceRoot":"","sources":["../../src/hooks/getThemeProxied.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getThemeProxied.d.ts","sourceRoot":"","sources":["../../src/hooks/getThemeProxied.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,YAAY,GAAG;KACxB,GAAG,IAAI,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,aAAa,CAC/D,GAAG,SAAS,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CACjE;CACF,GAAG;KAED,GAAG,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;CACpD,CAAA;AAED,KAAK,aAAa,CAAC,GAAG,IAAI,GAAG,GAAG;IAC9B;;;;;;;;;OASG;IACH,GAAG,EAAE,CACH,QAAQ,CAAC,EAAE,KAAK,KAEd,MAAM,GACN,CAAC,GAAG,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAC1B,CAAC,SAAS,kBAAkB,GAC1B,GAAG,GACH,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GACtB,GAAG,SAAS,WAAW,GACrB,MAAM,GAAG,MAAM,GACf,OAAO,CAAC,CAAA;CACnB,CAAA;AAYD,wBAAgB,eAAe,CAE7B,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAC1C,YAAY,CA2Gd"}
|
|
@@ -13,6 +13,7 @@ export type ThemeState = {
|
|
|
13
13
|
scheme?: 'light' | 'dark';
|
|
14
14
|
};
|
|
15
15
|
export declare const ThemeStateContext: import("react").Context<string>;
|
|
16
|
+
export declare const keysToId: WeakMap<WeakKey, any>;
|
|
16
17
|
export declare const forceUpdateThemes: () => void;
|
|
17
18
|
export declare const getThemeState: (id: ID) => ThemeState | undefined;
|
|
18
19
|
export declare const getRootThemeState: () => ThemeState | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE/E,KAAK,EAAE,GAAG,MAAM,CAAA;AAEhB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,WAAW,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,EAAE,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,iCAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"useThemeState.d.ts","sourceRoot":"","sources":["../../src/hooks/useThemeState.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE/E,KAAK,EAAE,GAAG,MAAM,CAAA;AAEhB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,WAAW,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,EAAE,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,iCAAwB,CAAA;AAEtD,eAAO,MAAM,QAAQ,uBAAgB,CAAA;AAWrC,eAAO,MAAM,iBAAiB,YAI7B,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,EAAE,2BAAmB,CAAA;AAQvD,eAAO,MAAM,iBAAiB,yBAAuB,CAAA;AAErD,eAAO,MAAM,aAAa,UACjB,sBAAsB,qCAEvB,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KACzC,UAwGF,CAAA;AA0ND,eAAO,MAAM,qBAAqB,UAAW,UAAU,YACiC,CAAA"}
|