Skip to content
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

Support DOM Annotation for Blazor Component's source file locatio #11070

Open
chabiss opened this issue Oct 23, 2024 · 0 comments
Open

Support DOM Annotation for Blazor Component's source file locatio #11070

chabiss opened this issue Oct 23, 2024 · 0 comments
Assignees
Labels
area-compiler Umbrella for all compiler issues
Milestone

Comments

@chabiss
Copy link

chabiss commented Oct 23, 2024

In order to support
Experience 1758042: [Blazor Hybrid] Provide a Live Visual Tree/XAML Live Preview that works better with WebView

  1. An object model is needed to allow walking the Blazor Component tree.
    Similar to VisualTreeHelper Class (System.Windows.Media) | Microsoft Learn , Blazor also needs a navigable logical component tree. This allows an injected Agent to traverse and gather data to construct the JSON that is sent to the LVT tree via the VDEP protocol.

  2. An event system when the Blazor component tree changes
    Similar to VisualTreeChangeEventArgs Class (System.Windows.Diagnostics) | Microsoft Learn, or MutationObserver - Web APIs | MDN (mozilla.org) on modern Browser, events plays a role in updating the Live Visual Tree when changes are made through Hot Reload.

  3. Source Info Annotation
    Information known as Source Information is kept within the Blazor Component Tree to pinpoint the origin of the Blazor Component. During Hit Testing, which is conducted at the DOM level by the WebView, the DOM needs to retains information that aids in identifying the Blazor Web Component. This Source Info is crucial for the Blazor Web Component to locate and navigate to the original Source on the Razor page.

Based on a meeting with the Razor, we can solve 1) and 2) (DOM Mutation) by using 100% the DOM Element Tree to rebuild the Blazor Component Tree assuming that 3) contains the require annotation in the generate HTML.

So the request here is for 3) to have the Razor Compiler to

Generate DOM annotation that give the source location of the razor component. The annotation needs to contain:

  1. The source filename (relative path)
  2. Line Number
  3. Column number of the the start tag
    Image

Annotation would be contain on the DOM Element similar to
Image

@davidwengier davidwengier added the area-compiler Umbrella for all compiler issues label Oct 23, 2024
@chsienki chsienki self-assigned this Oct 24, 2024
@chsienki chsienki added this to the Backlog milestone Oct 24, 2024
@chsienki chsienki removed the untriaged label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues
Projects
None yet
Development

No branches or pull requests

3 participants