@provideContext and @consumeContext decorators for a better developer experience (#20510)
* feat: adds first draft of a context consume decorator * feat: uses an options pattern * feat: changes approach to use `addInitializer` and `queueMicroTask` instead * feat: adds extra warning if context is consumed on disconnected controllers * feat: example implementation of consume decorator * feat: adds support for 'subscribe' * feat: initial work on provide decorator * docs: adds license to consume decorator * feat: adds support for umbraco controllers with `hostConnected` * feat: uses asPromise to handle one-time subscription instead * test: adds unit tests for consume decorator * feat: adds support for controllers through hostConnected injection * feat: adds support for controllers through hostConnected injection * test: adds unit tests for provide decorator * docs: adds more documentation around usage and adds a few warnings in console when it detects wrong usage * feat: removes unused controllerMap * docs: adds wording on standard vs legacy decorators * docs: clarifies usage around internal state * feat: adds proper return types for decorators * docs: adds more types * feat: makes element optional * feat: makes element optional * feat: uses @consume in the log viewer to showcase * chore: cleans up debug info * feat: renames to `consumeContext` and `provideContext` to stay inline with our own methods * chore: removes unneeded typings * chore: removes not needed check * chore: removes not needed check * test: adds test for rendered value * feat: splits up code into several smaller functions * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * docs: augments code example for creating a context * Update src/Umbraco.Web.UI.Client/src/packages/log-viewer/workspace/views/search/components/log-viewer-search-input.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@provideContext and @consumeContext decorators for a better developer experience (#20510)
Umbraco CMS
Umbraco is a free and open source .NET content management system. Our mission is to help you deliver delightful digital experiences by making Umbraco friendly, simpler and social.
Learn more at umbraco.com
Looking to install Umbraco?
You can get started using the following commands on Windows, Linux and MacOS (after installing the .NET Runtime and SDK):
dotnet new install Umbraco.Templates
dotnet new umbraco --name MyProject
cd MyProject
dotnet run
Documentation
Our comprehensive documentation takes you from the fundamentals on how to start with Umbraco to deploying it to production.
Some important documentation links to get you started:
- Installing Umbraco CMS
- Getting to know Umbraco
- Tutorials for creating a basic website and customizing the editing experience
Get help
If you need a bit of feedback while building your Umbraco projects, we are chatty on Discord. Our Discord server serves as a social space for all Umbracians. If you have any questions or need some help with a problem, head over to our dedicated forum where the Umbraco Community will be happy to help.
Looking to contribute back to Umbraco?
You came to the right place! Our GitHub repository is available for all kinds of contributions:
Umbraco is contribution-focused and community-driven. If you want to contribute back to the Umbraco source code, please check out our guide to contributing.
