UTheme: name/scope - or a way to prevent it from applying to overlays
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.9k
- Forks
- 1.1k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 57
Description
Package
v4.x
Description
First of all: I'm super happy about the UTheme component, and hope it keeps evolving! It's a lifesaver for complex apps with discretely themed modules as well as enabling a lot of user prefs when it comes to layout.
Not quite sure how to best explain this possibly-edge case, but I've made a "FormCard" wrapper component similar to the settings page in the Dashboard template.
In this components I apply some defaults and adjustments to UFormField.
However, if this FormCard includes a button triggering a modal, popover etc, FormFields inside those overlays also inherit the theme settings.
I've included a few suggested ways of doing this (prop names for illustration purposes only):
Specify that a UTheme should not apply inside overlays
<UTheme :overlay-nesting="false">...</UTheme>- Should apply to the "current" overlay (if any), but not overlays called from within this declaration
Specify that a UTheme should not apply inside portals
<UTheme :portal-nesting="false">...</UTheme>- As for overlays, but specifically for portals. This may or may not be easier to implement and/or have less potential for side effects than the overlay scope
Named/resettable UTheme stack/scopes:
<UTheme name="formcard">...</UTheme>|<UTheme :omit="['formcard']">...</UTheme>- Needs to store a theme nesting stack to be able to generate component
uiwithout the named theme(s) omitcould take a string or an array of strings- Optionally log a warning if no theme with the specified names were found in the stack, and/or add a
silentprop to disable such warnings
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the UTheme component entry point and tracing how its settings reach fields rendered in overlays and portals. Compare the proposed overlay, portal, and named-scope approaches with the existing component behavior; done requires an agreed API and documented behavior for preventing selected nested overlays or portals from inheriting a theme.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100