-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
HiDPI breakpoints #9661
HiDPI breakpoints #9661
Conversation
Changes: - Factorize breakpoint value check and min/max limits computation. - Factorize breakpoint string generation.
Changes: - Add `$breakpoints-hidpi` map: A list of named HiDPI breakpoints with HiDPI ratios (without units). - Add support for HiDPI breakpoints (up, only, down) in `@function breakpoint`. Other changes: - Add `@function -zf-map-next-number`: Find the next number in a map. No breaking changes: HiDPI breakpoints works exactly like standard breakpoints. `retina` is an alias for `hidpi-2`.
Add unit tests for HiDPI breakpoint with default (up), up, only and down ranges.
Changes: - Add separation comments - Change some test descriptions
Media Queries does not accept nested logic. Changes: - Generate a valid media query using string joining functions. - Update unit tests Add required functions: - `-zf-bp-join`: Return media query string from the given min and/or max limits. - `zf-str-join`: Return a join of the two given strings `$str1` and `$str2`. If the two strings are not empty, they are separated by `$delimiter`.
So, some news: I looked at how to add HiDPI breakpoints to Interchange. It will require a refactor of Interchange and util.MediaQuery since these two files are built on the assumption there is only size breakpoint and only one breakpoint is valid at the same time. It would also be good to pass datas from SCSS to Js properly throw JSON instead of serialised map. But I do not want to add any SCSS library (SassyJSON) before having a proper SCSS dependency management. So it will wait for #9542. @kball @nlap Let me know it you want the Interchange support to be added in this PR or an other. |
Hmm I see, I hadn't looked into it enough until now to notice the interchange retina query wasn't passed from the SCSS. FWIW my use for #9556 was specifically with Interchange, but I think this PR adds value as it is. |
I concur, lets keep the interchange refactor separate. @brettsmason @andycochran as our other "sassy" yetinauts, can one of you review? ;) |
ping @andycochran can you take a look at this? |
37cef7f
to
c3dc69d
Compare
I did not read correctly the W3C documentation. * DPI = dots per inch = device pixel per inch * DPPX = dots per pixel * 1in = 72pt = 96px So: * 1dpi = 1/72dppt = 1/96dppx * 1dppx = 72dppt = 96dpi
Note: this PR only add support for hidpi in the The problem mainly comes from that functions/mixins will manually get the |
Which is still relevant also for #10979 |
Bumping this per discussion in #9556 Although my main use case was with Interchange, I think this PR is a great addition, makes more sense than the current conventions, and should be pulled in 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, fixing merge conflicts and merging.
ClosesPartially fix #9556.Add
hidpi-1-5
,hidpi-2
andhidpi-3
breakpoints.Usage
Any HiDPI breakpoint can be added in the
$breakpoints-hidpi
map (the order does not matter):Changes:
$breakpoints-hidpi
map: A list of named HiDPI breakpoints with HiDPI ratios (without units).@function breakpoint
.Other changes:
@function -zf-map-next-number
: Find the next number in a map.@function -zf-bp-join
: Return media query string from the given min and/ormax limits.
@function zf-str-join
: Return a join of the two given strings$str1
and$str2
. If the two strings are not empty, they are separated by$delimiter
.No breaking changes: HiDPI breakpoints works exactly like standard breakpoints.
retina
is an alias forhidpi-2
.