Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Scope shared component styles by their owning element to avoid bleed
When the same subcomponent is reused in multiple hosts, scope its styles to a distinguishing parent selector so one host's overrides don't silently affect another.
Bad example
| 1 | .dropdown { ... } /* same global rules for every host that renders it */ |
Explanation (EN)
A global override can unexpectedly restyle every host that renders the shared class.
Objašnjenje (HR)
Good example
| 1 | hegnar-news .dropdown { ... } |
| 2 | hegnar-watchlist .dropdown { ... } /* scoped per owning element */ |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For host-specific variants of a reused component, use supported variant hooks, scoped selectors or CSS modules so one host's override does not reach another.
Exceptions / Tradeoffs (EN)
Portal/shadow-root rendering may escape a parent selector; verify the actual DOM ownership before relying on descendant scoping.