API
automagicA11y is declarative-first, but every pattern exposes programmatic helpers when you need fine-grained control.
Registry helpers
Section titled “Registry helpers”import { initAllPatterns, initPattern, initPatterns, initNode } from 'automagica11y';initAllPatterns(root?)– hydrate every registered pattern underroot(defaults todocument).initPattern(name, root?)– hydrate a single pattern by name.initPatterns(names, root?)– hydrate several patterns at once.initNode(node)– run all registered initializers against a specific element. Perfect for islands or freshly injected markup.
Pattern helpers
Section titled “Pattern helpers”import { initToggle, isToggleOpen, getToggleTarget, initTooltip, initPopover, initDialog, initFocusInitial, initFocusMap} from 'automagica11y';initToggle(trigger)– initialize an individual toggle trigger.isToggleOpen(trigger)– read the resolved boolean state.getToggleTarget(trigger)– return the resolved target element.initTooltip(trigger)– hydrate a tooltip trigger (context-aware).initPopover(trigger)– hydrate a popover trigger.initDialog(trigger)– hydrate a dialog trigger.initFocusInitial(element)– apply the initial-focus helper to a node.initFocusMap(element)– wire a custom focus order map.
All helpers return cleanup functions when applicable, enabling frameworks to destroy behaviors during unmount.
Extensions
Section titled “Extensions”import { registerAnnouncePlugin, initAnimateLifecycle } from 'automagica11y';The announce plugin still requires an explicit registration so it can listen for toggle changes. Animate is now part of the core lifecycle and no longer needs a manual call. For advanced scenarios you can call initAnimateLifecycle(document) to register the listener against a specific document (iframes, portals, etc.), but the default build handles it automatically during hydration.