-
Notifications
You must be signed in to change notification settings - Fork 170
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
Tailwind Padding #6537
Closed
Closed
Tailwind Padding #6537
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#14885 Bundle Size — 57.98MiB (~+0.01%).445fa14(current) vs 916e8b9 master#14883(baseline) Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
|
Current #14885 |
Baseline #14883 |
|
---|---|---|
Initial JS | 40.96MiB (~+0.01% ) |
40.96MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 17.99% |
17.88% |
Chunks | 20 |
20 |
Assets | 22 |
22 |
Modules | 4153 |
4153 |
Duplicate Modules | 213 |
213 |
Duplicate Code | 27.33% |
27.33% |
Packages | 477 |
477 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #14885 |
Baseline #14883 |
|
---|---|---|
JS | 57.97MiB (~+0.01% ) |
57.97MiB |
HTML | 7.37KiB (-0.25% ) |
7.39KiB |
Bundle analysis report Branch feature/padding-tailwind Project dashboard
Generated by RelativeCI Documentation Report issue
…to feature/padding-tailwind
…to feature/padding-tailwind
…to feature/padding-tailwind
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Paddings defined from Tailwind cannot be edited on the canvas.
Other problems that came up in this PR:
padding
prop and all four longhand padding props (padding{ Top | Left | Right | Bottom }
), and sets them one or more of these later. When this happens, the property patching code kicks in, and sets all 5 props to their default value (0px
). However I found an unknown unknown here: it seems like if the shorthand padding prop is set last, it takes precedence over the longhand padding props, so settingpadding: 0
last negates apaddingTop: 10
for example. This is not a Utopia-specific problem, it can be reproed in codesandbox by commenting out and re-adding one of the padding props (utopia project for reference)Fix
Tailwind paddings:
StyleInfo
and add the necessary reader codesimplePaddingFromMetadata
to read fromStyleInfo
and make the necessary refactorsPlugin prop removal code:
The immediate problem is fixed by tracking the prop setting/deleting commands, and simulate them to figure out which props are reset after they are deleted.
This solutions works for the specific problem in this PR, but it poses a bigger question: what if, in the command runner function, a command tries to remove a prop from some other element that's not in the command constructor function? The commands are only aware of the style prop, so in a Tailwind project, the remove just won't work (and we couldn't find out even if we diffed the project contents before and after a command has run)
Padding prop weirdness:
I fixed this by only using the longhand versions of a prop to patch the shorthand (see
utopia/editor/src/components/editor/actions/action-utils.ts
Lines 532 to 622 in c493375
Manual Tests:
I hereby swear that:
Fixes #[ticket_number] (<< pls delete this line if it's not relevant)