Skip to content
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

feat(custom-element): Support css :host selector #8830

Merged
merged 13 commits into from
Aug 6, 2024

Conversation

baiwusanyu-c
Copy link
Member

close: #8826

@baiwusanyu-c

This comment was marked as outdated.

@baiwusanyu-c
Copy link
Member Author

In this pr, if sfc is rendered as a custom element, the css variables of its normal element tags (div, span...) will be promoted to the style attribute of the tag of the custom element, and it is compatible with pr #7942

// before
<my-custom-el>
  <span style="--color: red;"> hello </span>
</my-custom-el>
// after
<my-custom-el style="--color: red;">
  <span> hello </span>
</my-custom-el>

@baiwusanyu-c baiwusanyu-c marked this pull request as ready for review July 25, 2023 01:51
@felbry
Copy link

felbry commented Aug 1, 2023

哎 快点合并吧 这个问题严重阻塞开发进度了

@rocifier
Copy link

rocifier commented Aug 9, 2023

I like it. Is there any way to promote a normal css style like display to the host element, or do they have to be re-written as css variables?

Does this work for any size component?

What about child components, would the propagation stop at their root element?

What if there are multiple root elements?

…ctor

# Conflicts:
#	packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts
@github-actions
Copy link

github-actions bot commented Oct 20, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 97.7 kB (+7.51 kB) 37.1 kB (+2.54 kB) 33.4 kB (+2.23 kB)
vue.global.prod.js 155 kB (+8.48 kB) 56.9 kB (+2.81 kB) 50.5 kB (+2.47 kB)

Usages

Name Size Gzip Brotli
createApp 53.9 kB (+4.23 kB) 20.9 kB (+1.4 kB) 19 kB (+1.24 kB)
createSSRApp 57.8 kB (+4.57 kB) 22.5 kB (+1.52 kB) 20.5 kB (+1.35 kB)
defineCustomElement 57.5 kB (+5.61 kB) 22.1 kB (+1.84 kB) 20.1 kB (+1.62 kB)
overall 67.4 kB (+4.28 kB) 25.9 kB (+1.41 kB) 23.6 kB (+1.3 kB)

Copy link

codspeed-hq bot commented Dec 19, 2023

CodSpeed Performance Report

Merging #8830 will not alter performance

Comparing baiwusanyu-c:bwsy/fix/CEHostSelector (0308e0d) with main (bae79dd)

Summary

✅ 53 untouched benchmarks

baiwusanyu-c and others added 5 commits January 3, 2024 10:07
# Conflicts:
#	packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts
#	packages/runtime-dom/src/helpers/useCssVars.ts
# Conflicts:
#	packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts
#	packages/runtime-dom/src/helpers/useCssVars.ts
@yyx990803 yyx990803 changed the base branch from main to minor August 6, 2024 10:23
@yyx990803 yyx990803 merged commit 03a9ea2 into vuejs:minor Aug 6, 2024
6 of 7 checks passed
@baiwusanyu-c baiwusanyu-c deleted the bwsy/fix/CEHostSelector branch August 8, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

v-bind in the style module in sfc does not work as expected when using defineCustomCoponent
5 participants