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: add range CSS parts #990

Merged
merged 2 commits into from
Oct 4, 2024
Merged

feat: add range CSS parts #990

merged 2 commits into from
Oct 4, 2024

Conversation

luwes
Copy link
Contributor

@luwes luwes commented Sep 26, 2024

fix #921, fix #983

  1. a smooth track height transition on hover looks like
  media-time-range::part(track) {
    transition: transform 0.2s;
    transform: scaleY(1);
  }

  media-time-range:hover::part(track) {
    transform: scaleY(1.5);
  }
  1. adding border-radius to track buffered and track progress elements
media-time-range::part(buffered),
media-time-range::part(progress) {
  border-radius: 9999px;
}

@luwes luwes self-assigned this Sep 26, 2024
@luwes luwes requested review from heff and a team as code owners September 26, 2024 19:39
Copy link

vercel bot commented Sep 26, 2024

@luwes is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.90%. Comparing base (3ea80df) to head (4c559c2).
Report is 123 commits behind head on main.

Files with missing lines Patch % Lines
src/js/media-time-range.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #990      +/-   ##
==========================================
- Coverage   78.55%   76.90%   -1.65%     
==========================================
  Files          59       50       -9     
  Lines       11080    12095    +1015     
  Branches        0      699     +699     
==========================================
+ Hits         8704     9302     +598     
- Misses       2376     2768     +392     
- Partials        0       25      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

vercel bot commented Sep 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
media-chrome ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 4:31pm
media-chrome-demo-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 4:31pm
media-chrome-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 4:31pm

heff
heff previously approved these changes Sep 26, 2024
Copy link
Collaborator

@heff heff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -240,13 +240,13 @@ template.innerHTML = /*html*/ `
<div id="startpoint"></div>
<div id="endpoint"></div>
<div id="appearance" part="appearance">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is appearance an undocumented part? Or should it not be exposed? It's kind of an odd concept.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree now but it was documented unfortunately so I don't think we can remove it :(

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we don't frequently do this, but I think this is a good case to deprecate (and document the deprecation). I think several of these names may be confusing or at least not intuitive. The track-specific parts are not obviously track specific. I'm not sure why the div indicating what's been buffered is called "highlight"? I don't have a clear sense of what "pointer" actually is from the name or the description? Might be worth some time/thought/discussion getting these names right, since, per @luwes's last comment, once we add these parts + names it's a bigger deal to change or remove them.

If we do deprecate "appearance" and decide to rename it in the deprecation process, I think we can just:

  1. add the new part name to the attribute
  2. update the docs indicating that appearance is deprecated and will be removed in a future release and they should use whatever the new part name is (which should also be documented).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good yes, I don't want to rush this.

There's much to think about also heading in the future CSS vars vs CSS parts. And if we ever want to deprecate CSS vars in favor of a CSS part.

highlight is called like that because it's in the base class MediaChromeRange.
It doesn't really know about buffering or even if it's a time range.

the appearance naming is from CSS and webkit uses this as well. it's the visual UI, the appearance :)

Copy link
Collaborator

@heff heff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@luwes luwes merged commit 4c6298f into muxinc:main Oct 4, 2024
7 of 8 checks passed
@luwes luwes deleted the range-css-parts branch October 4, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

media-time-range height transition on hover Customizing the buffering bar
3 participants