-
Notifications
You must be signed in to change notification settings - Fork 10
t/ckeditor5-ui/144: Migrated the package from SASS to PostCSS #114
Conversation
This reverts commit 215cebe.
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
@custom-selector :--ck-reset-all |
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.
It's the only one case of used @custom-selector
postcss plugin - getpostcssconfig.js in all stylesheets, do we really need it?
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.
A good point. Probably it's better to get rid of it.
@custom-selector :--ck-reset-all | ||
.ck-reset_all, | ||
.ck-reset_all *, | ||
.ck-reset_all a, |
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.
Is it necessary here to use 1-1
CSS specificity for <a>
and <textarea>
elements?
As we talked it was an issue with CK4 (IE10 maybe?) because UA override, but as I checked Chrome and Firefox and there is no override situation.
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.
Probably it's a legacy code because I copied it straight from v4.
|
||
.ck-placeholder::before { | ||
cursor: text; | ||
color: #c2c2c2; |
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.
Maybe we should use a variable here?
|
||
svg.ck-icon { | ||
width: calc(var(--ck-line-height-base) * 1em); | ||
height: calc(var(--ck-line-height-base) * 1em); |
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.
I see --ck-font-size-normal: 1em
, is it worthy to change it?
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.
What do you mean?
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.
I was thinking about changing 1em to variable:
width: calc(var(--ck-line-height-base) * var(--ck-font-size-normal));
background: var(--ck-color-input-background); | ||
border: 1px solid var(--ck-color-input-border); | ||
padding: var(--ck-spacing-small) var(--ck-spacing-medium); | ||
min-width: 21em; |
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.
Like earlier: maybe variable for min-width
?
*/ | ||
&.ck-tooltip_s { | ||
bottom: calc(-1 * var(--ck-tooltip-arrow-size)); | ||
transform: translateY( 100% ); |
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.
Let's speed up that transform: with translate3d( 0, 100%, 0);
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.
I wouldn't be so sure about it. It needs to be checked because I experienced some issues in the past developing tooltips.
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.
Thinking again and you are right this is about tooltip "triangle" and maybe it isn't worth to use hardware acceleration (GPU) caused by will-change/translate3d
property.
Anyway, we need to remember that sometimes we will need to use will-change/translate3d
- see this issue with firefox blurred icons.
|
||
& .ck-tooltip__text::after { | ||
top: calc(-1 * var(--ck-tooltip-arrow-size)); | ||
transform: translateX( -50% ); |
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.
Let's speed up that transform: with translate3d( -50%, 0, 0);
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.
*/ | ||
&.ck-tooltip_n { | ||
top: calc(-1 * var(--ck-tooltip-arrow-size)); | ||
transform: translateY( -100% ); |
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.
-> translate3d
.
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.
--ck-font-size-normal: 1em; | ||
--ck-font-size-big: 1.4em; | ||
--ck-font-size-large: 1.8em; | ||
} |
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.
We are setting levels of property with calc
in theme/ckeditor5-ui/globals/_spacing.css
maybe we should use it here?
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.
Probably a good idea.
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.
OTTH I noticed that while spacings multiply .8em
, which is not super-easy, fonts are related to 1em
, which is pretty straightforward. Changing it to calc
would be
--ck-font-size-big: 1.4em;
vs
--ck-font-size-big: calc(var(--some-base-size) * 1.4));
which looks bloated. I don't think it's a good idea.
@@ -0,0 +1,82 @@ | |||
/* |
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.
Why did you decide to make a folder for tooltip.css
instead of placing it directly into /components
?
Is there any reason? Because I see e.g: /components/panel/balloonpanel.css
& /components/panel/stickypanel.css
and understand that it needs a folder.
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.
Check out the structure of theme in ckeditor5-ui
. AFAIR the tooltip has a mixin and thus it has been defined as a directory (multiple files). The theme must follow such pattern if it is to be loaded properly.
TBH, now that I think about it, I think each component in ckeditor5-ui should have its own directory because if one day it gets a mixin or whatever, we wouldn't need to fix a structure of N–themes to reflect ckeditor5-ui and make them work with the theme importer. If you know what I mean :P
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.
Ok, I see this and it's clear to me 👍
theme/ckeditor5-link/linkform.css
Outdated
padding: var(--ck-spacing-large); | ||
|
||
&:focus { | ||
/*https://github.com/ckeditor/ckeditor5-link/issues/90*/ |
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.
Lack of space after /*
and before */
+ line 28 & 35.
*/ | ||
|
||
blockquote { | ||
border-left: solid 5px #CCC; |
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.
Like in code.css
we can use variable here too: --ck-color-blockquote-border
.
theme/ckeditor5-image/image.css
Outdated
text-align: center; | ||
|
||
& > img { | ||
/*Center the image if its width is smaller than content's width.*/ |
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.
Missing spaces in the comment.
& .image-style-align-left, | ||
& .image-style-align-center, | ||
& .image-style-align-right { | ||
max-width: var(--ck-image-max-width); |
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.
I'm not sure but for center aligned imagemax-width
should be 50%
?
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.
Check out the current code in SASS. I think I just copy–pasted it.
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.
True, just wondering why centered style of image indicate max-width: 50%
🤔
|
||
&.ck-balloon-panel_with-arrow { | ||
&:before, | ||
&:after { |
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.
We should use a double-colon instead of one for pseudoelements.
|
||
/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/111 */ | ||
.ck-toolbar-container.ck-editor-toolbar-container[class*="arrow_n"] { | ||
&:after { |
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.
Missing double-colon here and line 65 too.
& .ck-progress-bar { | ||
height: 2px; | ||
width: 0; | ||
background: #6ab5f9; |
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.
Would be nice to make variable here --ck-image-upload-progressbar-line-background
&.ck-infinite-progress::before { | ||
width: var(--ck-image-upload-progress-line-width); | ||
height: 2px; | ||
background: rgba(0, 0, 0, 0.1); |
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.
Would be nice to make variable here --ck-image-upload-progress-line-background
theme/ckeditor5-heading/heading.css
Outdated
*/ | ||
|
||
.ck-heading_heading1 { | ||
font-size: 1.5em; |
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.
What do you think to use here variable (--ck-font-size-normal: 1em;)
and make it:
font-size: calc(var(--ck-font-size-normal) * 1.5);
and apply it to heading2 and heading3 too?
border-bottom-right-radius: 0; | ||
} | ||
|
||
/* https://github.com/ckeditor/ckeditor5-editor-classic/issues/62 */ |
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.
Something is wrong with that url (I mean it is not that issue).
|
||
--ck-color-button-action-background: #1ABC9C; | ||
--ck-color-button-action-border: #49d2b7; | ||
--ck-color-button-action-focus-background: #17a98c; |
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.
As we talked we can't use postcss plugin for colors with functions like darken/lighten so maybe should we use hsl format? It be easier to understand & modify shades of color.
--ck-color-button-action-background: hsl( 168, 76%, 42% )
--ck-color-button-action-focus-background: hsl( 168, 76%, 38% )
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.
That's a great idea. And what's more, you can use variables and calc
to shift the color.
:root {
--lightness-shift: 30%;
}
#first {
background: hsl(120,100%, 50%);
}
#second {
background: hsl(120,100%, calc(50% - var(--lightness-shift)));
}
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.
...which may be broken in Firefox (and IE11?). Needs research.
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.
Perfect solution! I forgot about changing the shade of colour by a variable in HSL.
HSL is full supported since IE8+ so no worries here.
And we don't need any postcss color plugin 🎉
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.
Pity we won't be able to use calc()
with var()
. I checked that out, it does not work in FF and IE11.
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.
Still, hsl
sounds like a plan.
…migration in the future.
Suggested merge commit message (convention)
Other: Migrated the theme from SASS to PostCSS (see ckeditor/ckeditor5#5304).
BREAKING CHANGE: The styles are no longer developed in SASS which means various
.scss
files (including variables, mixins, etc.) became unavailable. Please refer to the Theme Customization guide to learn more about migration to PostCSS.