Skip to content

test - #70189

Draft
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:there-shall-be-hostless
Draft

test#70189
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:there-shall-be-hostless

Conversation

@JeanMeche

Copy link
Copy Markdown
Member

Wild wild wip

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Aug 13, 2026
@ngbot ngbot Bot added this to the Backlog milestone Aug 13, 2026
@JeanMeche
JeanMeche force-pushed the there-shall-be-hostless branch 3 times, most recently from 19ac482 to f83df70 Compare August 13, 2026 16:49
@thePunderWoman

Copy link
Copy Markdown
Contributor

Test comment

@thePunderWoman

Copy link
Copy Markdown
Contributor

Test comment

Test reply

@JeanMeche

Copy link
Copy Markdown
Member Author

@thePunderWoman

image

@JeanMeche
JeanMeche force-pushed the there-shall-be-hostless branch 21 times, most recently from 1bd0d2a to f8eab2c Compare August 14, 2026 13:08
@JeanMeche
JeanMeche force-pushed the there-shall-be-hostless branch 7 times, most recently from 6a3afe8 to ed6b2c6 Compare August 14, 2026 14:48
Adds support for hostless components in Angular via the `hostless: true` option in the `@Component` decorator. Hostless components do not create a host DOM element; instead, their templates render directly at the component invocation site using an anchor `Comment` node.

### Runtime & View Engine Architecture
- Emits `ComponentDef.hostless = true` in Ivy definitions.
- Replaces physical host DOM element creation with a comment node anchor (`傻傻elementStart` / `locateOrCreateCommentNodeImpl`).
- Updates native DOM collection, insertion, and removal utilities (`collectNativeNodes`, `nativeInsertBefore`, `nativeRemoveNode`, `removeNestedView`) to seamlessly manage virtual comment-anchored views and their projected content.
- Returns the anchor node for `ComponentRef.location.nativeElement` and the virtual root element in `TestBed`.

### Compiler & Type-Checking
- Adds `hostless: boolean` to `R3ComponentMetadata`, compiler facades, and partial linkers.
- Emits the `IsHostless` type argument in `傻傻ComponentDeclaration` in `.d.ts` declaration files for downstream type checking.
- Diagnostics in `ComponentDecoratorHandler`:
  - Disallows `@HostBinding`, `@HostListener`, and `host: {}` bindings on hostless components (`HOSTLESS_COMPONENT_WITH_HOST_BINDINGS`).
  - Disallows `ViewEncapsulation.ShadowDom` (`HOSTLESS_COMPONENT_SHADOW_DOM`).
  - Disallows `:host` and `:host-context` selector usage in component styles (`HOSTLESS_COMPONENT_HOST_STYLE`).
  - Disallows `@Component({ animations: [...] })` (`HOSTLESS_COMPONENT_ANIMATIONS`).
- Diagnostics in `TemplateSemanticsChecker`:
  - Enforces DOM binding restrictions on hostless component invocation elements using `CssSelector.parse`.
  - Disallows arbitrary DOM attribute, class, style, and event bindings on hostless elements while permitting matched directive selectors/inputs and `ngSkipHydration`.

### Server-Side Rendering & Hydration
- Adds full SSR hydration support for hostless components by locating and claiming server-rendered comment anchors and child DOM nodes.
- Implements `ngSkipHydration` support on hostless components, clearing server-rendered DOM nodes within the virtual component boundary during hydration.
- Enhances hydration path resolution (`calcPathForNode` and `locateRNodeByPath`) to correctly navigate up to parent element containers when anchoring hostless components.
@JeanMeche
JeanMeche force-pushed the there-shall-be-hostless branch from 75e1816 to 26110e1 Compare August 14, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants