-
Notifications
You must be signed in to change notification settings - Fork 449
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 text-transform
attribute to the style
block
#1118
feat: Add text-transform
attribute to the style
block
#1118
Conversation
5d178fc
to
0188918
Compare
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.
amazing, thanks so much for opening a PR for this.
- your intuition is right about the boolean type, but we should make all of them typed in a refactor and test rigorously, vs having a temporary one-off type in the list of styles. (there's an issue for this: compiler: add different scalar types #285). could you use the same
Scalar
type here please? - Tests:
Line 13 in a53eb48
name: "terminal",
- Add a caps lock = false for an object in there
- Regenerate the test with
TESTDATA_ACCEPT=1 ./ci/test.sh ./e2etests -run TestE2E/themes
- Check the output SVG to see that caps lock=false worked.
And then do that for another test to test capslock=true works.
0188918
to
410962f
Compare
@alixander - updated as per your comment:
|
Maybe it would be better to make |
@janydoe that's an interesting point, thank you for that suggestion. maybe we literally just do https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform yeah that's more flexible. i've found myself wanting to do capital casing sometimes, and i think many others would too, and I don't want separate keywords for that. So then the way to disable the theme's uppercasing is to do Sorry for the moving goal post @alexstoick , would you mind changing to that? You can just support the values |
@alixander I'm happy to implement the
If the above sounds good - LMK and I'll update the PR. Thank you 🙇 |
@alexstoick sounds good to me! |
410962f
to
44e2775
Compare
caps-lock
attribute to the style
blocktext-transform
attribute to the style
block
be9ddb1
to
b7ad89f
Compare
@alixander - I've implemented the |
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.
generally looks good to me, let's add tests and get this in, ty @alexstoick !
b7ad89f
to
59d23ed
Compare
@alixander - when you say |
oh, i guess those tests do cover it all, nvm! |
59d23ed
to
2048417
Compare
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.
can you add a changelog here too please?
c529fbc
to
120e439
Compare
@alexstoick looks like a format error, if you run |
120e439
to
c866c66
Compare
@alixander - yep; odd that my formatter didn't auto-fix. Updated now ✅ |
44676e3
to
52977d3
Compare
52977d3
to
86a0254
Compare
This provides an option to override the functionality provided by the theme, or apply `text-transform` outside of the theme. The functionality of the `text-transform` is as below: - `text-transform: none` - will disable **any** transformation (like the uppercasing by `terminal` theme) - `text-transform: uppercase` (uppercase not upper as per your message) - will force all characters into uppercase. - `text-transform: lowercase` - will force all characters into lowercase. - `text-transform: capitalize` - will uppercase the first letter of every word In addition, this commit introduces: - helper methods on the `d2graph.Style` struct to determine the type of `text-transform` to be applied. - `ApplyTextTransform` method on the `d2graph.Attributes` which will transform the `Label.Value` to the correct text case.
86a0254
to
a260068
Compare
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.
tested and works great, thanks @alexstoick
This provides an option to override the functionality provided by the
theme, or apply
text-transform
outside of the theme.The functionality of the
text-transform
is as below:text-transform: none
- will disable any transformation (like the uppercasing byterminal
theme)text-transform: uppercase
(uppercase not upper as per your message) - will force all characters into uppercase.text-transform: lowercase
- will force all characters into lowercase.text-transform: capitalize
- will uppercase the first letter of every wordIn addition, this commit introduces:
d2graph.Style
struct to determine the type oftext-transform
to be applied.ApplyTextTransform
method on thed2graph.Attributes
which willtransform the
Label.Value
to the correct text case.Screenshots pending.
Fixes: #1117