-
-
Notifications
You must be signed in to change notification settings - Fork 216
Make style sheets cascade #2977
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
Conversation
70e138c
to
0a08673
Compare
c5eb5a8
to
660a324
Compare
660a324
to
74e970a
Compare
So it is no longer required in the base style.
Just like HTML.
We need it for caching anyway.
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.
This looks like a nice improvement, thanks @amolenaar!
I merged main to resolve a merge conflict. However, mypy isn't happy since the node argument to compute_node
is getting a PseudoStyleNode
, and importing it from the styling module creates a circular import.
I'm not done yet :) |
e514b44
to
d5c7758
Compare
a247295
to
5720afa
Compare
Assign one CompiledStyleSheet per diagram, so style caches can be invalidated when a diagram is updated.
So that we can just iterate and apply in the right order
69733ac
to
2e25cac
Compare
Now that styles are inherited, assigning a color will also assign it to the diagram. Since color is an inherited property, it will automatically be assigned to all items.
2e25cac
to
42d485c
Compare
In case text-color is not defined.
@danyeaw I think it's ready for review |
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.
Thanks @amolenaar!
This is a follow-up PR on #2969.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently, every item on the diagram is a root item, even if it's contained in another item
Issue Number: #3023
What is the new behavior?
:root
has been fixed. Refers to the top-level diagram. (Note that there's also a DiagramItem, which is referred to as diagram!):has()
and:empty
)CssNode
s.compile_style_sheet()
output. The function now makes sure the rules are in ascending order.color
as color iftext-color
is not defined.text-color
is deprecated.Does this PR introduce a breaking change?
Other information
The
gaphor.core.modeling.diagram.StyledItem
class now depends on the interface ofgaphor.diagram.shapes.CssNode
. This is not so clean, but can be fixed by implementing a protocol in the future.