import { SymbioteSurface, type ISymbioteNode } from '@symbiote-native/engine'; import type { Renderer2, RendererFactory2, RendererType2 } from '@angular/core'; type IHostNode = ISymbioteNode; type IHostElement = ISymbioteNode | SymbioteSurface; export declare class SymbioteRenderer implements Renderer2 { private readonly surface; readonly data: Record; destroyNode: ((node: ISymbioteNode) => void) | null; private pendingStyleNode; private pendingStyle; private matchCandidate; private matchCandidateSize; private readonly matchedKeys; private pendingClassNode; private readonly releaseBeforeFlush; constructor(surface: SymbioteSurface); /** * Angular is done with this renderer FOR ONE COMPONENT — which is not the same as this renderer * being done, and the difference was a shipped bug. * * The factory hands ONE instance to every component on the surface, so Angular calls this * whenever ANY component's views are torn down; a keyed `@for` replace destroys a thousand. So it * publishes what it is holding and nothing more. Releasing the `beforeFlush` registration here * closed the only door a style run has — `flushOps` is what asks a renderer for what it holds — * while every still-living view went on writing into the accumulator. The style then reached * Fabric only when some OTHER node's `openStyleRun` happened to close the run, which on the * benchmark screen was two steps after the selection that asked for it. * * The registration follows the SURFACE now, and `SymbioteRendererFactory.dispose` releases it. */ destroy(): void; /** The surface is going away — publish what is held and stop listening. See `destroy` above. */ dispose(): void; /** * Publish whatever the styling run is holding. Idempotent, and free when it holds nothing. * * IT DOES NOT REQUEST A COMMIT, and that is not an omission — the request is made when the style * is ACCUMULATED, exactly where it was made before the run existed. This runs from inside * `flushOps`, which the commit itself calls first, so asking there schedules a SECOND commit whose * tree is already current: a full `completeRoot` plus a Yoga pass for nothing. * * Measured, because it did not look like a cost. The bench arm's `select` fell 17.1 -> 3.8 ms and * its `remove` rose 7.1 -> 18.2 in the same runs — the extra commit lands in whichever step's * microtask happens to run it, so the work had MOVED between steps rather than gone. Two rows * moving by the same amount in opposite directions is what that always looks like. */ private flushStyling; /** * The union of a node's two class sources, or `undefined` when it has none. * * A node can be told its classes BOTH ways in one pass: Ivy compiles `[class.foo]`, `[ngClass]` * and a static `class=` down to per-token `addClass`/`removeClass`, while a whole-string `class` * arrives at `setProperty` — which is the shape Angular uses when a directive declares `class` as * an input and the styling binding is shadowed into it (`setShadowStylingInputFlags`, * `view/directives.ts`). Publishing either one alone erases the other, and the DOM renderer this * mirrors has no such problem because `classList` accumulates for it. */ private classStringFor; /** * Style objects this renderer has already published, so a list of identical rows sends ONE. * * The intern table keys by IDENTITY, so a fresh object per node is a fresh entry per node and the * host converts every entry across JSI. Measured on the bench arm: `values` 7 001 against Vue's * 3 004 for the identical tree, with `convert` 19.5 ms against 0.6 — and the gap is the KIND * rather than the count, ~4 000 of Angular's being objects that convert recursively where Vue's * are scalars plus four hoisted styles every row shares. * * Angular cannot share them on its own: `ɵɵstyleMap` hands over KEYS, so the object is this * renderer's own construction. Recognising one it has already built is what puts an Angular app * back on the footing of a framework whose author hoisted the constant. * * SMALL AND MRU. A screen has a handful of distinct styles and re-publishes them thousands of * times, so a hit is almost always at the front; a miss costs at most `STYLE_CACHE` shallow * compares, which is nothing beside the conversion it saves. An app with more distinct styles than * this simply stops sharing — it never stops being correct. */ private readonly publishedStyles; private readonly publishedSizes; /** A published object equal to this one, or this one — which then becomes the published copy. */ private canonicalStyle; /** Open this node's style run (closing any other); a no-op when it is already the open one. */ private openRun; private isChoosingCandidate; private chooseCandidate; /** Stop matching: write the keys matched so far into the accumulator the run goes on with. */ private materializeMatch; /** The accumulator for this node's style run, opening one (and closing any other) if needed. */ private openStyleRun; private writeStyle; createElement(name: string): IHostNode; createComment(): IHostNode; createText(value: string): IHostNode; appendChild(parent: IHostElement | null, newChild: IHostNode): void; insertBefore(parent: IHostElement | null, newChild: IHostNode, refChild: IHostNode | null): void; removeChild(_parent: IHostElement | null, oldChild: IHostNode): void; parentNode(node: IHostNode): IHostElement | null; nextSibling(node: IHostNode): IHostNode | null; selectRootElement(selectorOrNode: string | IHostElement): IHostElement; setAttribute(el: IHostElement, name: string, value: string): void; removeAttribute(el: IHostElement, name: string): void; private readonly classTokens; private readonly classStrings; private readonly callbackWrappers; addClass(el: IHostElement, name: string): void; removeClass(el: IHostElement, name: string): void; private openClassRun; setStyle(el: IHostElement, style: string, value: unknown): void; removeStyle(el: IHostElement, style: string): void; setProperty(el: IHostElement, name: string, value: unknown): void; private wrapCallback; setValue(node: IHostNode, value: string): void; listen(target: unknown, eventName: string, callback: (event: unknown) => boolean | void): () => void; } export declare class SymbioteRendererFactory implements RendererFactory2 { private readonly surface; private renderer; constructor(surface: SymbioteSurface); createRenderer(_hostElement: unknown, _type: RendererType2 | null): Renderer2; /** * The surface is being torn down, so the one renderer it shares can stop listening. * * IT IS THE FACTORY'S JOB and not Angular's, because the instance outlives any single component: * Angular's own `Renderer2.destroy()` arrives once per destroyed component and must not close a * door every surviving view still writes through. See `SymbioteRenderer.destroy`. */ dispose(): void; end(): void; } export {};