Skip to main content
cngx-src documentation

createContainerSize

Functioncommon/layout/observersv0.1.0

projects/common/layout/observers/container-size.ts

Description#

Creates a CngxContainerSize over element.

Observes the border box, so the reported size matches what an inline-size container query measures. The property() reads are plain computed()s over the same resize signal - the browser has already re-evaluated every container query by the time a ResizeObserver callback runs, so the read returns the current value without a second scheduling hop.

Signature#

createContainerSize(element: Element, destroyRef: DestroyRef, win)

Parameters#

@paramelementElement

The container host.

@paramdestroyRefDestroyRef

Scope whose destruction disconnects the observer.

@paramwin

The window-like object providing ResizeObserver and getComputedStyle.

Returns#

CngxContainerSize