@molecule/app-angular 3.12.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-23T06:34:57.062Z
6
+ Generated: 2026-11-24T00:43:34.695Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-angular
@@ -1357,8 +1357,8 @@ interface Router {
1357
1357
  * link, the back button, `navigate`), with the new location and the navigation action.
1358
1358
  * A router calls it before the browser paints the new page, so a component that renders
1359
1359
  * from a listener (the framework bindings' `useLocation` and `useParams` do) shows the new
1360
- * location in the same paint as the new page. The router conformance cases of
1361
- * `@molecule/app-framework-conformance/routing` check that at every paint.
1360
+ * location in the same paint as the new page. Molecule's router conformance tests check
1361
+ * that at every paint.
1362
1362
  *
1363
1363
  * @param listener - Called with the new location and the navigation action.
1364
1364
  * @returns Stops calling `listener`.
@@ -1627,6 +1627,39 @@ interface Theme {
1627
1627
  }
1628
1628
  ```
1629
1629
 
1630
+ #### `SlotReader`
1631
+
1632
+ Reads whether a slot renders anything; see {@link usePlacement}. A capture
1633
+ that also holds the port's own text before the slot (`<span #c>{{ label
1634
+ }}<ng-content /></span>`) passes how many leading child nodes are the
1635
+ port's: one per interpolation or static text before the `<ng-content>`.
1636
+
1637
+ ```typescript
1638
+ interface SlotReader {
1639
+ (capture: Node | null | undefined, ownLeadingNodes?: number): boolean
1640
+ /**
1641
+ * The slot's React children (`React.Children.toArray(slot)`): its elements
1642
+ * and its text that is not template indentation, in order, wherever
1643
+ * {@link placeContent} rendered them. A `*molLazy` slot is one child, its
1644
+ * anchor comment, whether or not its content is stamped: hide that node to
1645
+ * hide the child, and its content is destroyed until it shows again.
1646
+ *
1647
+ * The same array comes back while the children are the same nodes, so it can be kept in a
1648
+ * signal (`children.set(hasContent.nodes(capture))`) and passed to a binding: the placement
1649
+ * function runs after every render, and a new array each time would render again forever.
1650
+ *
1651
+ * @param capture - The element Angular projected the content into.
1652
+ * @returns The children.
1653
+ */
1654
+ nodes(capture: Node | null | undefined): readonly Node[]
1655
+ }
1656
+ ```
1657
+
1658
+ - `capture` — The element Angular projected the content into.
1659
+ - `ownLeadingNodes` — How many of the capture's first child nodes the port renders itself (default 0).
1660
+
1661
+ **Returns:** Whether the slot has content.
1662
+
1630
1663
  #### `UseAIModelsResult`
1631
1664
 
1632
1665
  Result returned by {@link useAIModels}: every field as a signal.
@@ -3461,6 +3494,41 @@ type MaybeSignal<T> = T | Signal<T>
3461
3494
 
3462
3495
  ### Classes
3463
3496
 
3497
+ #### `MolPlacement`
3498
+
3499
+ Gives {@link usePlacement} the component's own moments. A component that
3500
+ calls `usePlacement` lists it in `hostDirectives`; `usePlacement` throws
3501
+ without it. Its hooks fire exactly when the component's own would: after the
3502
+ component's view was first rendered (its view queries are set), and each
3503
+ time the parent checks the component (its inputs are set).
3504
+
3505
+ ```typescript
3506
+ @Directive({ standalone: true })
3507
+ export class MolPlacement implements AfterViewInit, DoCheck {
3508
+ private readonly runs: (() => void)[] = []
3509
+
3510
+ /**
3511
+ * Adds a placement function to run at the component's moments.
3512
+ *
3513
+ * @param run - Runs it.
3514
+ * @internal
3515
+ */
3516
+ add(run: () => void): void {
3517
+ this.runs.push(run)
3518
+ }
3519
+
3520
+ /** The component's view exists and its view queries are set. */
3521
+ ngAfterViewInit(): void {
3522
+ for (const run of this.runs) run()
3523
+ }
3524
+
3525
+ /** The parent set the component's inputs. */
3526
+ ngDoCheck(): void {
3527
+ for (const run of this.runs) run()
3528
+ }
3529
+ }
3530
+ ```
3531
+
3464
3532
  #### `WrappedChildren`
3465
3533
 
3466
3534
  The wrappers around a component's projected children: React's
@@ -3563,6 +3631,71 @@ export class MolWrapEachChild {
3563
3631
  }
3564
3632
  ```
3565
3633
 
3634
+ #### `MolLazy`
3635
+
3636
+ Stamps projected content in its own place, and keeps it exactly while that place is in the
3637
+ page: created when the component that received it shows it, destroyed when the component
3638
+ hides it, created again when it shows it again, as React mounts a slot. A place that moves to
3639
+ another parent (a sidebar rendered on the other side) is a new place: React never moves a
3640
+ mounted node to another parent, so the content is created again there. Write it as `*molLazy`
3641
+ on the slot's element, or as `molLazy` on an `<ng-template>` (with `ngProjectAs` for a named
3642
+ slot):
3643
+
3644
+ ```html
3645
+ <mol-modal [open]="open" (close)="open = false">
3646
+ <form *molLazy>…</form>
3647
+ <div slot="footer" *molLazy><button molButton>Save</button></div>
3648
+ <ng-template molLazy ngProjectAs="[slot=footer]">…</ng-template>
3649
+ </mol-modal>
3650
+ ```
3651
+
3652
+ Plain projected content is created with the consumer's view and kept for its whole life,
3653
+ which is right for static content (a closed dialog's footer buttons). Use `*molLazy` for
3654
+ content with state, effects or a fetch, which must not run while hidden and must start fresh
3655
+ each time it shows. It works on every component that hides a slot by taking its place out of
3656
+ the page, through `@if` or the `@molecule/app-angular` DOM placement, and on content that a
3657
+ wrapper component projects on.
3658
+
3659
+ The decision runs after every render, once every component has placed its slots: a component
3660
+ that attaches or detaches a region does it in a render's `write` phase or earlier, and this
3661
+ directive reads the result in the `mixedReadWrite` phase of the same render. It does not run on
3662
+ the server, where a lazy slot renders nothing.
3663
+
3664
+ ```typescript
3665
+ @Directive({ selector: '[molLazy]', standalone: true })
3666
+ export class MolLazy {
3667
+ constructor() {
3668
+ const template = inject(TemplateRef, { optional: true })
3669
+ if (template === null) {
3670
+ throw new Error('molLazy goes on an <ng-template>, or as *molLazy on an element.')
3671
+ }
3672
+ const views = inject(ViewContainerRef)
3673
+ const anchor = inject(ElementRef).nativeElement as Comment
3674
+ lazyAnchors.set(anchor, template)
3675
+ /** The parent the content was stamped in. */
3676
+ let stampedIn: Node | null = null
3677
+ afterEveryRender({
3678
+ // After every component's placement (`write`), so a closed dialog's footer is already out
3679
+ // of the page; outside change detection, so no view is edited while Angular walks it.
3680
+ mixedReadWrite: () => {
3681
+ const shown = anchor.isConnected
3682
+ if (views.length > 0 && (!shown || anchor.parentNode !== stampedIn)) {
3683
+ stampedRoots.delete(anchor)
3684
+ views.clear()
3685
+ }
3686
+ if (shown && views.length === 0) {
3687
+ stampedIn = anchor.parentNode
3688
+ const view = views.createEmbeddedView(template)
3689
+ for (const node of view.rootNodes as Node[]) lazyContent.add(node)
3690
+ stampedRoots.set(anchor, view.rootNodes as Node[])
3691
+ view.detectChanges()
3692
+ }
3693
+ },
3694
+ })
3695
+ }
3696
+ }
3697
+ ```
3698
+
3566
3699
  #### `Link`
3567
3700
 
3568
3701
  `<a molLink="/settings">`: sets the anchor's `href` and navigates in-app
@@ -3631,7 +3764,8 @@ export class Link implements OnInit, LinkProps {
3631
3764
  Renders the matched child route, through whichever routing bond the app wired (an outlet
3632
3765
  component under the angular-router bond). A layout or guard renders it where its page goes
3633
3766
  when it was given no projected content, so the component imports no router library. The page
3634
- renders inside this element, whose box the page takes (`display: contents`).
3767
+ renders where this element stands, and the element itself is not in the page: React's
3768
+ `RoutedView` renders only the page.
3635
3769
 
3636
3770
  Throws an `I18nError` (`angular.error.noRoutedView`) when it is created and the routing bond
3637
3771
  has no routed view: project the page instead. Rendering nothing there would show a blank page
@@ -3641,14 +3775,12 @@ with no error.
3641
3775
  @Component({
3642
3776
  selector: 'mol-routed-view',
3643
3777
  standalone: true,
3778
+ hostDirectives: [MolPlacement],
3644
3779
  template: '<ng-container #outlet />',
3645
- host: {
3646
- 'data-parity-unwrap': '',
3647
- style: 'display: contents',
3648
- },
3649
3780
  })
3650
3781
  export class RoutedView implements OnInit {
3651
3782
  private readonly view = routedViewOrThrow()
3783
+ private readonly host = inject(ElementRef).nativeElement as HTMLElement
3652
3784
  /**
3653
3785
  * An anchor of its own template: a RoutedView created outside any template (a test mounting it
3654
3786
  * alone) has no parent element for its host's container, so a page placed there never shows. A
@@ -3657,6 +3789,14 @@ export class RoutedView implements OnInit {
3657
3789
  */
3658
3790
  @ViewChild('outlet', { read: ViewContainerRef, static: true }) outlet?: ViewContainerRef
3659
3791
 
3792
+ constructor() {
3793
+ // Alone (no parent element), the host keeps the page: placeContentBefore needs a place.
3794
+ usePlacement(() => {
3795
+ placeContentBefore(this.host, this.host)
3796
+ setElementPresent(this.host, false)
3797
+ })
3798
+ }
3799
+
3660
3800
  /** Creates the routed view's component at this element's anchor. */
3661
3801
  ngOnInit(): void {
3662
3802
  this.outlet?.createComponent(this.view)
@@ -4919,6 +5059,50 @@ export class SessionReady {
4919
5059
  }
4920
5060
  ```
4921
5061
 
5062
+ #### `MolSlotCopy`
5063
+
5064
+ Renders a slot's children here, as React renders `{children}` inside each row, node or gap:
5065
+ every place shows its own copy. Give it the slot's children (`SlotReader.nodes` of
5066
+ `usePlacement`) and keep the slot itself out of the page (`setElementPresent(capture,
5067
+ false)`), so the slot shows no copy of its own.
5068
+
5069
+ A `*molLazy` child is stamped here from its template: a live instance per place, created with
5070
+ this copy and destroyed with it or when the child leaves the slot, as each of React's is. Any
5071
+ other child is copied as DOM (`cloneNode`), which has no listeners and no components, so
5072
+ content with either is written with `*molLazy` (`MolLazy`). A child that stays in the
5073
+ slot keeps its copy here when other children come and go.
5074
+
5075
+ ````html
5076
+ ```typescript @Directive({ selector: '[molSlotCopy]', standalone: true }) export class MolSlotCopy
5077
+ implements OnDestroy { /** The slot's children to render here, in order. */ @Input({ required: true
5078
+ }) molSlotCopy: readonly Node[] = [] /** Where the stamped instances go. */ private readonly views =
5079
+ inject(ViewContainerRef) /** The directive's own place: the copies sit right before it. */ private
5080
+ readonly anchor = inject(ElementRef).nativeElement as Comment /** The copies, in render order. */
5081
+ private copies: Copy[] = [] /** The children the copies were last rendered from. */ private
5082
+ rendered: readonly Node[] = [] constructor() { // In the same phase as `MolLazy`, after it: a slot's
5083
+ own lazy children are stamped first, // in the order React mounts them (the original before its
5084
+ copies). afterEveryRender({ mixedReadWrite: () => this.render() }) } /** Destroys every instance it
5085
+ stamped. */ ngOnDestroy(): void { for (const copy of this.copies) this.destroy(copy) this.copies =
5086
+ [] } /** Renders the children it is given, keeping the copy of each child it already shows. */
5087
+ private render(): void { // `SlotReader.nodes` returns the same array while the children are the
5088
+ same. if (this.molSlotCopy === this.rendered) return this.rendered = this.molSlotCopy const kept =
5089
+ new Map(this.copies.map((copy) => [copy.source, copy])) const next = this.molSlotCopy.map((source)
5090
+ => { const copy = kept.get(source) if (copy === undefined) return this.create(source)
5091
+ kept.delete(source) return copy }) for (const gone of kept.values()) this.destroy(gone) // The
5092
+ stamped instances in their order, so Angular inserts each next to the right neighbour. let index = 0
5093
+ for (const copy of next) if (copy.view !== null) this.views.move(copy.view, index++) // Then every
5094
+ copy, back to front, right before the one that follows it. let ref: ChildNode = this.anchor for
5095
+ (const copy of [...next].reverse()) { const nodes = nodesOf(copy) as ChildNode[] const first =
5096
+ nodes[0] if (first === undefined) continue if (nodes[nodes.length - 1]?.nextSibling !== ref)
5097
+ ref.before(...nodes) ref = first } this.copies = next } /** * Renders one child here. * * @param
5098
+ source - The slot's child. * @returns Its copy. */ private create(source: Node): Copy { const
5099
+ template = lazySlotTemplate(source) if (template === undefined) return { source, view: null, node:
5100
+ source.cloneNode(true) } const view = this.views.createEmbeddedView(template) view.detectChanges()
5101
+ return { source, view, node: null } } /** * Takes one copy out of the page, destroying its instance.
5102
+ * * @param copy - The copy. */ private destroy(copy: Copy): void { if (copy.view !== null)
5103
+ copy.view.destroy() else (copy.node as ChildNode).remove() } }
5104
+ ````
5105
+
4922
5106
  ### Functions
4923
5107
 
4924
5108
  #### `useChatProvider()`
@@ -4950,6 +5134,43 @@ function useChat(options: UseChatOptions | Signal<UseChatOptions>): UseChatResul
4950
5134
 
4951
5135
  **Returns:** Each state field as a signal, and the chat controls.
4952
5136
 
5137
+ #### `setHostRoot(host, root, options)`
5138
+
5139
+ Names the element that stands for the calling component's host: React's
5140
+ `{...rest}` target. Call it in the component's {@link usePlacement}
5141
+ function, for a component whose host is out of the page.
5142
+
5143
+ An Angular consumer binds on the component's tag: `<mol-switch
5144
+ (keydown)="…" class="…" data-testid="…" [attr.aria-label]="…">`. With the
5145
+ host out of the page those would do nothing. Instead, while the host is
5146
+ absent:
5147
+
5148
+ - native listeners are attached to the root (`$event.currentTarget` is the
5149
+ root, as it is in React);
5150
+ - attributes, class names and styles the consumer writes on the tag are
5151
+ written on the root, in the same instruction, and the ones already on the
5152
+ host are moved there.
5153
+
5154
+ A component that calls nothing gets the common case for free: with one
5155
+ element in its place (`placeElementBefore(root, host)`) that element is the
5156
+ root; with several elements or projected content in its place, listeners go
5157
+ to each of them (the events that used to bubble to the host) and attributes
5158
+ stay on the host. A component with nothing in its place (a portal) names its
5159
+ root, or a listener on its tag throws in dev mode: it could never fire.
5160
+
5161
+ ```typescript
5162
+ function setHostRoot(
5163
+ host: Element,
5164
+ root: Element | null | undefined,
5165
+ options?: { except?: readonly string[] },
5166
+ ): void
5167
+ ```
5168
+
5169
+ - `host` — The component's host element.
5170
+ - `root` — The element that stands for it, or `null` while React renders none.
5171
+ - `options` — `except`: attribute names the component reads off its host itself (it merges them with its own), which stay on the host.
5172
+ - `options.except` — Those attribute names.
5173
+
4953
5174
  #### `provideDomPlacement()`
4954
5175
 
4955
5176
  Installs the placement rules in the application's renderer. `provideMolecule`
@@ -4971,6 +5192,8 @@ in the same place once it is true: Angular's equivalent of React's
4971
5192
  holds an `<ng-content>`). "Attached" means the element has a parent, not
4972
5193
  that it is in the document, so it also works inside a host that is itself
4973
5194
  absent. An element that was never taken out is left where Angular put it.
5195
+ An element rendered elsewhere ({@link placeElement}, {@link placeElementBefore})
5196
+ leaves that parent too, and `true` puts it back in its own place.
4974
5197
  Angular may remove or move the element while it is absent; its placeholder
4975
5198
  goes then.
4976
5199
 
@@ -4981,6 +5204,22 @@ function setElementPresent(element: Node | null | undefined, present: boolean):
4981
5204
  - `element` — The element (nothing happens without one).
4982
5205
  - `present` — Whether React would render it now.
4983
5206
 
5207
+ #### `heldElement(node)`
5208
+
5209
+ The element a placeholder stands in for while the element is out of its own
5210
+ place ({@link setElementPresent}, {@link placeElement},
5211
+ {@link placeElementBefore}). A slot's children ({@link SlotReader.nodes})
5212
+ list such an element as its placeholder; a component that took one of its
5213
+ slot's children out of the page finds that child again with this.
5214
+
5215
+ ```typescript
5216
+ function heldElement(node: Node | null | undefined): Node | undefined
5217
+ ```
5218
+
5219
+ - `node` — A node of the rendered tree.
5220
+
5221
+ **Returns:** The element whose place the node holds, or `undefined` when the node is not a current placeholder.
5222
+
4984
5223
  #### `placeElement(element, target)`
4985
5224
 
4986
5225
  Renders an element in another parent while it keeps its place in Angular's
@@ -4996,8 +5235,68 @@ removed from the other parent too, as React unmounts a portal.
4996
5235
  function placeElement(element: Node | null | undefined, target: Node | null): void
4997
5236
  ```
4998
5237
 
5238
+ #### `placeElementBefore(element, sibling)`
5239
+
5240
+ Renders an element of the component's template immediately in front of
5241
+ another node, as its sibling: Angular's equivalent of a React component whose
5242
+ root is a fragment, `<><div>{children}</div>{portal}</>`, where the node is
5243
+ the component's host (kept in the DOM with `display: contents`).
5244
+
5245
+ The element then belongs to the node's place. Angular inserts a new sibling
5246
+ before the element, not between the two; when Angular moves the node (a
5247
+ consumer `@for` reorders), the element moves with it; when Angular removes
5248
+ the node, the element goes back to its own place inside it and leaves the
5249
+ page with it. Several elements placed before the same node stand in the
5250
+ order they were placed. Calling it again moves nothing while the element
5251
+ already stands there.
5252
+
5253
+ "In front of the node" means in front of the node's place. A host that is
5254
+ absent (`setElementPresent(host, false)`) holds its place with a comment, and
5255
+ the element stands in front of that: this is how a fragment root renders
5256
+ React's exact DOM, with no host element among the siblings at all. A node
5257
+ another component rendered elsewhere ({@link placeElement}) is likewise
5258
+ led at its place, not where it was rendered.
5259
+
5260
+ Nothing happens while the node has no parent; call it
5261
+ from the component's {@link usePlacement} function, which runs again.
5262
+ `placeElement(element, null)` puts the element back in its own place.
5263
+
5264
+ ```typescript
5265
+ function placeElementBefore(
5266
+ element: Node | null | undefined,
5267
+ sibling: Node | null | undefined,
5268
+ ): void
5269
+ ```
5270
+
4999
5271
  - `element` — The element (nothing happens without one).
5000
- - `target` — The parent to render it in, or `null` for its own place.
5272
+ - `sibling` — The node it stands in front of, usually the host.
5273
+
5274
+ #### `renderedParent(node)`
5275
+
5276
+ A node's parent in the rendered tree: the parent React context follows.
5277
+ It is the DOM parent, except where this module placed the node:
5278
+
5279
+ - an element that is absent, or rendered in another parent
5280
+ ({@link setElementPresent}, {@link placeElement},
5281
+ {@link placeElementBefore}), belongs where its placeholder is, the place
5282
+ the template gave it. A portal's content therefore has the component that
5283
+ declared it as an ancestor, not `document.body`, as in React.
5284
+ - a top-level node of a capture's content that renders outside the capture
5285
+ ({@link placeContent}, {@link placeContentBefore}) belongs to the capture.
5286
+ With `placeContentBefore(host, host)` that is the host: what a provider
5287
+ renders in its own place is the provider's child, and a sibling that merely
5288
+ shares the DOM parent is not.
5289
+
5290
+ So a component looks its context up from its own host and registers one on
5291
+ its own host, whether or not the host is in the page.
5292
+
5293
+ ```typescript
5294
+ function renderedParent(node: Node | null | undefined): Element | null
5295
+ ```
5296
+
5297
+ - `node` — The node.
5298
+
5299
+ **Returns:** Its parent in the rendered tree, or `null` at the top (or for a node that has no place: never inserted, or removed).
5001
5300
 
5002
5301
  #### `placeContent(capture, target, before)`
5003
5302
 
@@ -5011,7 +5310,8 @@ consumer's `@for` and `@if` keep working at the new place: Angular inserts a
5011
5310
  view under the parent of its anchor, before a node of the same run. Never
5012
5311
  move a filtered or remembered list of nodes instead; the anchors or the
5013
5312
  nodes Angular adds later stay behind (NG05106). Calling it again with the
5014
- same target moves nothing.
5313
+ same target moves nothing. When Angular removes the capture (its view went),
5314
+ the content goes back inside it and leaves the page with it.
5015
5315
 
5016
5316
  ```typescript
5017
5317
  function placeContent(
@@ -5025,22 +5325,86 @@ function placeContent(
5025
5325
  - `target` — The parent to render the content in, or `null` to put it back inside `capture`.
5026
5326
  - `before` — The child of `target` to place the content before (default: at the end).
5027
5327
 
5028
- #### `hasContent(capture)`
5328
+ #### `placeContentBefore(capture, sibling)`
5329
+
5330
+ Renders a capture's content immediately in front of another node, as its
5331
+ siblings, with no element around it: Angular's equivalent of a React
5332
+ component whose root is a fragment of what it was given, `<>{children}</>`
5333
+ (a provider or a gate that renders no DOM of its own). The node is usually
5334
+ the component's host, and the capture may be the host itself:
5335
+ `placeContentBefore(host, host)` renders everything the host holds in front
5336
+ of it and leaves the host empty.
5029
5337
 
5030
- Whether a slot renders anything, React's `{slot && …}` for projected
5031
- content: an element, or text that is not template indentation. It reads the
5032
- content wherever {@link placeContent} rendered it, so a component that moved
5033
- its slot elsewhere still sees it. Comments (Angular's anchors) are not
5034
- content.
5338
+ The content then belongs to the node's place, as an element does with
5339
+ {@link placeElementBefore}: Angular inserts a new sibling before the content,
5340
+ the content moves with the node, and it goes back inside the capture when
5341
+ Angular removes the node. Angular's block anchors move with the content, so
5342
+ an `@if` in the component's own template around `<ng-content>` and the
5343
+ consumer's blocks render at the new place from the first node on. Nothing
5344
+ happens while the node has no parent; call it from the component's
5345
+ {@link usePlacement} function. `placeContent(capture, null)` puts the
5346
+ content back.
5347
+
5348
+ ```typescript
5349
+ function placeContentBefore(
5350
+ capture: Element | null | undefined,
5351
+ sibling: Node | null | undefined,
5352
+ ): void
5353
+ ```
5354
+
5355
+ - `capture` — The element that holds the content (nothing happens without one).
5356
+ - `sibling` — The node the content stands in front of, usually the host.
5357
+
5358
+ #### `hasContent(capture)` _(deprecated)_
5359
+
5360
+ > **Deprecated:** Use the reader {@link usePlacement} passes.
5361
+
5362
+ Reads a slot from a lifecycle hook, which can lag the content: a hook runs
5363
+ before the consumer's `@if` adds its node, and no hook runs at all when the
5364
+ content comes through an `OnPush` component in between. Read slots in the
5365
+ function passed to {@link usePlacement} instead; this export goes in the
5366
+ next major version.
5035
5367
 
5036
5368
  ```typescript
5037
5369
  function hasContent(capture: Node | null | undefined): boolean
5038
5370
  ```
5039
5371
 
5040
- - `capture` — The element Angular projected the content into.
5372
+ - `capture` — The capture.
5041
5373
 
5042
5374
  **Returns:** Whether the slot has content.
5043
5375
 
5376
+ #### `usePlacement(place)`
5377
+
5378
+ Registers the calling component's placement function: the one place where
5379
+ it decides, from its inputs and its projected content, which of its template
5380
+ elements are present ({@link setElementPresent}) and where its slots render
5381
+ ({@link placeContent}, {@link placeElement}). Call it in the constructor.
5382
+
5383
+ The component writes no lifecycle hook for this. The function runs:
5384
+
5385
+ - right after Angular adds, removes or changes a node of a slot the function
5386
+ read, in the same instruction — in whatever pass and from whatever
5387
+ template the node came, so the decision never lags the content and the new
5388
+ content is in the page before its own `ngAfterViewInit`;
5389
+ - when a signal it read changed (an effect);
5390
+ - when the component's view was first rendered and each time its parent
5391
+ checks it ({@link MolPlacement}, which the component lists in
5392
+ `hostDirectives`), so a plain input is followed in any kind of change
5393
+ detection, a bare `detectChanges()` included;
5394
+ - after every render.
5395
+
5396
+ `hasContent` is the only way to ask whether a slot has content, and it works
5397
+ only while the function runs: a lifecycle hook cannot read a slot, because
5398
+ no hook runs at a moment when the slot is known to be current
5399
+ (`ngDoCheck` runs before the consumer's `@if` adds its node; no hook at all
5400
+ runs when the content comes through an `OnPush` component in between).
5401
+
5402
+ ```typescript
5403
+ function usePlacement(place: (hasContent: SlotReader) => void): void
5404
+ ```
5405
+
5406
+ - `place` — The placement function. It gets `hasContent`.
5407
+
5044
5408
  #### `useHostPresence(isPresent)`
5045
5409
 
5046
5410
  Keeps the calling component's host element out of the DOM while
@@ -6247,6 +6611,83 @@ function t(key: string, values?: InterpolationValues, options?: TranslateOptions
6247
6611
 
6248
6612
  **Returns:** Translated string
6249
6613
 
6614
+ #### `isLazySlotAnchor(node)`
6615
+
6616
+ Whether a node is the anchor of a {@link MolLazy} slot. A lazy slot is one child of the
6617
+ component it is passed to, stamped or not (React's `children` holds the element either way):
6618
+ a slot reader counts its anchor as content and as the child, so the wrapper that holds it is in
6619
+ the page, and a component that hides a child takes the anchor out of the page, which destroys
6620
+ the content.
6621
+
6622
+ ```typescript
6623
+ function isLazySlotAnchor(node: Node): boolean
6624
+ ```
6625
+
6626
+ - `node` — A node of a slot.
6627
+
6628
+ **Returns:** Whether it is a lazy slot's anchor.
6629
+
6630
+ #### `isElementChild(node)`
6631
+
6632
+ Whether a slot's child is an element, as React's `isValidElement(child)` tells an element from
6633
+ text: an element, or a {@link MolLazy} slot, which stands for the element it stamps whether or
6634
+ not it is stamped yet. Use it to pick a slot's elements out of `SlotReader.nodes`; a component
6635
+ that then moves the child (`placeElement`) moves the lazy slot, which stamps its content in the
6636
+ new place.
6637
+
6638
+ ```typescript
6639
+ function isElementChild(node: Node): boolean
6640
+ ```
6641
+
6642
+ - `node` — A child of a slot (`SlotReader.nodes`).
6643
+
6644
+ **Returns:** Whether it is an element child.
6645
+
6646
+ #### `slotElement(node)`
6647
+
6648
+ The element a slot's child is, for a component that works the child itself (React's
6649
+ `cloneElement(child, …)`: a trigger that gets the listeners and `aria-*`, an anchor a popup is
6650
+ positioned against): the child when it is an element, the element a {@link MolLazy} child stamped
6651
+ once it is stamped, else `null`. A lazy child is stamped after the placement that put it in the
6652
+ page, and stamping it runs that placement again, which then finds the element; decide the
6653
+ layout from {@link isElementChild} meanwhile, so the child is not given a wrapper it then leaves.
6654
+
6655
+ ```typescript
6656
+ function slotElement(node: Node): Element | null
6657
+ ```
6658
+
6659
+ - `node` — A child of a slot (`SlotReader.nodes`).
6660
+
6661
+ **Returns:** The element, or `null`.
6662
+
6663
+ #### `lazySlotTemplate(node)`
6664
+
6665
+ The template of a {@link MolLazy} slot, which a component that renders a slot's children in more
6666
+ than one place stamps in each of them (`MolSlotCopy` does this): each copy is then a live
6667
+ instance, as each of React's is. Plain projected content exists once in Angular; a copy of it
6668
+ (`cloneNode`) has no listeners or components.
6669
+
6670
+ ```typescript
6671
+ function lazySlotTemplate(node: Node): TemplateRef<unknown> | undefined
6672
+ ```
6673
+
6674
+ - `node` — A child of a slot (`SlotReader.nodes`).
6675
+
6676
+ **Returns:** The lazy slot's template, or `undefined` when the node is not a lazy slot's anchor.
6677
+
6678
+ #### `isLazySlotContent(node)`
6679
+
6680
+ Whether a node is a root node of a {@link MolLazy} slot's stamped content: part of the child
6681
+ its anchor stands for ({@link isLazySlotAnchor}), not a child of its own.
6682
+
6683
+ ```typescript
6684
+ function isLazySlotContent(node: Node): boolean
6685
+ ```
6686
+
6687
+ - `node` — A node of a slot.
6688
+
6689
+ **Returns:** Whether it is stamped lazy content.
6690
+
6250
6691
  #### `readMaybeSignal(value)`
6251
6692
 
6252
6693
  Reads a hook argument's current value. Inside a `computed` or `effect` this
@@ -6261,6 +6702,23 @@ function readMaybeSignal<T>(value: MaybeSignal<T>): T
6261
6702
 
6262
6703
  **Returns:** The argument's current value.
6263
6704
 
6705
+ #### `rendersNode(node)`
6706
+
6707
+ Whether a node input renders anything: not `null`, `undefined`, a boolean or `''`, and not
6708
+ a list holding only those. React's `slot(node)` from `@molecule/app-react/render` decides the
6709
+ same way, so a component that renders a wrapper, a default or an `aria-*` reference only
6710
+ while a node prop has something to show reads the same in both: `title=""` renders no heading,
6711
+ like an omitted `title`. Projected content is read with the `SlotReader` of
6712
+ {@link usePlacement} instead, which already counts only what renders.
6713
+
6714
+ ```typescript
6715
+ function rendersNode(node: unknown): boolean
6716
+ ```
6717
+
6718
+ - `node` — The input's value.
6719
+
6720
+ **Returns:** True when it renders something.
6721
+
6264
6722
  #### `provideState(provider)`
6265
6723
 
6266
6724
  Provide state management.
@@ -6312,7 +6770,7 @@ function provideRouter(
6312
6770
  - `options` — From a routing bond: its routed view (see `RoutedView`).
6313
6771
  - `options.routedView` — The component that renders the matched child route where a layout or guard puts it. Left out when the bond has none, and `RoutedView` then throws an error saying so.
6314
6772
 
6315
- **Returns:** Environment providers
6773
+ **Returns:** Environment providers, {@link provideDomPlacement} included: `RoutedView` and a bond's routed view render the page with no element of their own.
6316
6774
 
6317
6775
  #### `provideI18n(provider)`
6318
6776