-
Notifications
You must be signed in to change notification settings - Fork 113
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: use SCSS variables internally #344
Conversation
@josdejong rudely pinging you! This PR solves the styling issue:
I hope you like it, otherwise I wasted a few hours for nothing xD |
Thanks a lot Sam, it looks neat at first sight! I'll do an in-depth review+testing coming Wednesday I expect. One first thought: I think the file |
Yes, that might be a global search and replace mistake. Thought I caught all of them.. |
I see there where some tricky things involved, like getting the colors work in text mode, and you did something nice with the calculation of the left margin of nested items. Great job! This is a lot more work than the original 1 line PR 😅 , but I really love how this works out. It is indeed easy to maintain like this. I've gone through all details of the editor, and almost everything looks alright! I came across a number of (I think) small issues, listed below. Can you have a look into those? Please let me know if you need help. I've mostly tested with the development page http://localhost:5173/development: Using the default theme:
Using theme "dark":
Using theme "big"
|
I've fixed some points, others remain open; I'd love some help to pull this over the finish line. Regarding the buttons in modals I think the way this is currently implemented should actually be configured a bug:
Due to the way CSS variables work the variable defined in 3 has the value from 1, even if it is shown inside a modal. |
Thanks for all the fixes. I'll look into the issue with the modals, no problem. |
Big tip: if you see |
…lte-jsoneditor into SamMousa-feat-scss-variables
Your explanation is correct. However my intention was a bit different: I wanted to be able to just give the menu of the editor inside a modal a different color because it was looking ugly to me. So I think the name |
I wouldn't worry about BC at this level of detail to be honest. I mean anything can be considered a BC break if you're critical enough. |
Good point, it's already a very breaking change 😂 . I'll publish it as a major release and explain the changes. |
While you're at it you could also document the BC promise. |
Just for clarity: do you want me to finish the last open issues? |
yes please! |
okido |
I created #350, fixing the last open issues. I want to do one more testing round later this week, I expect on Wednesday. @SamMousa one last question: do you know whether the new way to handle indentation with a CSS variable |
I can't imagine it is faster to change styles directly, since you're doing 1000s of updates in such a case as well... But this is a guess |
I just did a small test by hand, it actually feels a bit faster 😁. I didn't do a real benchmark but it is as fast as before or a bit faster. |
That's what I expected, in theory it is more optimizable:
|
It makes sense indeed. This is a nice side-effect of this refactor 😎👍 |
Btw, for future reference: you can directly push to a PR branch as well, as long as a contributor has checked the checkbox during pr creation. Thanks for your efforts in finishing it! |
Ahh, I didn't know that. That's very handy indeed, also for example for PR's that are about finished but just have a linting error or something like that. |
Yay, that indeed works 😎 I've done another testing round, found a few small things and cleaned up some left over TODO's. Time to merge this PR. |
The refactoring is now published in |
This reworks the default theme to use SCSS variables.
defaults.scss
file.Some things that are still todo:
getIndentationStyle()
inCollapsedItems.svelte
getIndentationStyle()
inJSONNode.svelte
Since these todos only require a very small subset of variables one solution is to define them in the relevant component as internal CSS variables.
Todo from feedback below:
Using the default theme:
the selection bar between two rows:
in the nested editor modal (right click an object, click "Edit object" in the context menu):
Using theme "dark":
In the nested editor modal (same as with the default theme I think):
Using theme "big"