API: Core
DirectionalityService
Root-level reactive source of truth for the document's text direction.
Overview
Root-level reactive source of truth for the document's text direction.
Resolved once at construction from document.documentElement (SSR-safe: the
resolution is pure attribute-walking, see resolveDirection, so it needs no
defaultView guard). Quartz does not watch for dir mutations with a
MutationObserver โ that's deliberately out of scope for this foundation.
Call refresh() after changing dir on the document yourself, or set()
to override the value directly (e.g. an app-level RTL toggle that doesn't
touch the DOM at all).
- Kind: Service
- Provided in:
root - Source: packages/core/src/directionality/directionality.service.ts:18
Properties
| Name | Type | Description |
|---|---|---|
readonly direction |
Signal<Direction> |
The current document-level direction. |
Public methods
refresh
refresh(): void
Re-reads direction from document.documentElement.
resolve
resolve(element?: Element | null): Direction
Resolves the effective direction for a specific element's subtree, without changing direction.
| Parameter | Type | Optional | Description |
|---|---|---|---|
element |
Element | null |
Yes |
set
set(direction: Direction): void
Explicitly overrides the tracked direction.
| Parameter | Type | Optional | Description |
|---|---|---|---|
direction |
Direction |