ArtificialSenseDocs

Docs / Infrastructure

Core utilities

Shared overlay, keyboard, a11y, and surface-variant primitives for @artificialsenselabs/ui. Kept on the public barrel on purpose — this is the CDK-style contract apps and nested overlays share, not convenience re-exports.

Overview

Import from the package root:

import {
  SenseFocusTrap,
  SenseLiveAnnouncerService,
  SenseAnnounceDirective,
  KEYBOARD_KEYS,
  claimOverlayZIndex,
  claimBodyScrollLock,
  pushModalLayer,
  SENSE_SURFACE_VARIANTS,
  normalizeFeedbackSeverity,
} from '@artificialsenselabs/ui';

SCSS helpers (focus-ring, reduced-motion, surface-variant, forced-colors, pointer) are for component authors via @use — they are not TypeScript exports. There is no showcase demo; core is infrastructure exercised by dialogs, drawers, and feedback surfaces.

Public API

ExportRole
SenseFocusTrapTab-cycle containment with optional focus restore for modal surfaces.
SenseLiveAnnouncerServiceProgrammatic aria-live announcements (SSR-safe via DOCUMENT).
SenseAnnounceDirectiveAnnounces a bound message via the live announcer whenever it changes.
SenseAnnounceOnChangeDirective Announces the host data-announce-message attribute on input/change. Prefer SenseAnnounceDirective for signal-bound messages.
KEYBOARD_KEYSShared KeyboardEvent.key constants for overlay and listbox handlers.
claimOverlayZIndex / releaseOverlayZIndexMonotonic z-index stacking for nested overlays.
claimBodyScrollLock / releaseBodyScrollLockRefcounted body overflow lock for nested modals.
pushModalLayer / popModalLayer / isTopModalLayerTopmost-only Escape / focus-trap stack for nested modals.
SENSE_SURFACE_VARIANTS + normalizers ADR-0030 filled / outlined / ghost helpers (plus legacy aliases).
normalizeFeedbackSeverity Canonical success / info / warning / danger vocabulary.

Test-only resetOverlayUtilsForTests is not on the public barrel — import it from the monorepo testing helpers when writing specs.