Skip to content

Commit b86cc65

Browse files
authored
Revert "fix(provider): [theme] incorrect object type provide to component tree"
1 parent ba67712 commit b86cc65

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/core/src/providers/theme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, h, PropType, provide, reactive, ref, watch } from 'vue'
1+
import { defineComponent, h, PropType, provide, ref, watch } from 'vue'
22

33
export interface DefaultTheme {
44
[key: string]: any
@@ -7,7 +7,7 @@ export interface DefaultTheme {
77
export const ThemeProvider = defineComponent(
88
(props, { slots }) => {
99
const theme = ref(props.theme)
10-
provide('$theme', reactive(theme.value as DefaultTheme))
10+
provide('$theme', theme)
1111

1212
watch(
1313
() => props.theme,

packages/core/src/styled.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
onUnmounted,
88
PropType,
99
PublicProps,
10-
reactive,
10+
Ref,
1111
SlotsType,
1212
watch,
1313
} from 'vue'
@@ -66,9 +66,9 @@ function baseStyled<P extends Record<string, any>>(target: string | InstanceType
6666
return defineComponent(
6767
(props, { slots }) => {
6868
const myAttrs = { ...attributes }
69-
const theme = inject<Record<string, string | number>>('$theme', reactive({}))
69+
const theme = inject<Ref<Record<string, string | number>>>('$theme')
7070
let context = {
71-
theme,
71+
theme: theme?.value ?? {},
7272
...props,
7373
}
7474

@@ -78,7 +78,7 @@ function baseStyled<P extends Record<string, any>>(target: string | InstanceType
7878
[theme, props],
7979
() => {
8080
context = {
81-
theme,
81+
theme: theme?.value ?? {},
8282
...props,
8383
}
8484
injectStyle<T & { theme: DefaultTheme }>(myAttrs.class, cssWithExpression, context)

0 commit comments

Comments
 (0)