Skip to content

feat(StyleProvider): add StyleProvider handle cssinjs features #6415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 6, 2023
Prev Previous commit
Next Next commit
chore(StyleProvider): update AStyleProviderProps type
  • Loading branch information
CCherry07 committed Apr 2, 2023
commit fb9de3ba1b95e2fa09a1b2716a8ff08ae7a10198
5 changes: 2 additions & 3 deletions components/_util/cssinjs/StyleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const AStyleProviderProps = () => ({
/** Use `:where` selector to reduce hashId css selector priority */
hashPriority: PropTypes.oneOf(['low', 'high'] as const),
/** Tell cssinjs where to inject style in */
container: PropTypes.any,
container: PropTypes.oneOfType([objectType<Element>(), objectType<ShadowRoot>()]),
/** Component wil render inline `<style />` for fallback in SSR. Not recommend. */
ssrInline: PropTypes.bool,
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
Expand All @@ -138,8 +138,7 @@ export const StyleProvider = defineComponent({
name: 'AStyleProvider',
props: initDefaultProps(AStyleProviderProps(), defaultStyleContext),
setup(props, { slots }) {
const providerProps = computed(() => ({ ...props }));
const context = useStyleProvider(providerProps);
const context = useStyleProvider(props);
const state = reactive<Partial<StyleContextProps>>({
...context.value,
});
Expand Down