Notices
alikit:notices is a presentation layer over Alicorn’s notice runtime. It adds
notice construction, action/deadline helpers, and copyable card/stack parts for inline banners.
Real toasts stay on Alicorn’s built-in overlay, which owns stable-ID deduplication, bounded
capacity, live-region announcements, and one-shot expiry.
Preview
Section titled “Preview”
Responsibility split
Section titled “Responsibility split”| Layer | Responsibility |
|---|---|
| Alicorn | Bounded notice queue, stable-ID updates, capacity/eviction, action queue, expiry deadline, built-in toast overlay, live regions, and ui.motion. |
notices | Toast construction, post/dismiss/action/deadline helpers, card/stack parts, severity presentation, reveal/retire motion, and a namespaced card recipe. |
| Application | Notice text, severity, lifetime, actions, conditions, resolution, and application-hosted card items. |
The package does not create a second notice queue. post and emit call the runtime;
take_action, next_deadline, and advance are pass-throughs. Cards and stacks are ordinary
presentation of application-owned Item values; they do not schedule expiry or store runtime
actions.
Copyable implementation
Section titled “Copyable implementation”Files: notices/notices.odin, notices/notices_test.odin, examples/notices/main.odin,
examples/notices/theme.json.
import notices "alikit:notices"
// Between frames (for example from ui.run on_after_frame), with the host clock:_ = notices.post(rt, notices.toast( "workspace-failure", "Couldn't refresh folder", "The folder's contents may be out of date.", .Warning, .Persistent,), now_ns)
// During an application frame, drain one runtime action:if event, found := notices.take_action(rt); found { if event.action == RETRY_ACTION { start_retry() }}
// Inline presentation parts:if event := notices.stack(ctx, app.card_states[:], app.cards[:], key=alicorn.key_string("notices"), recipe=app.recipe); event.kind != .None { if event.kind == .Actioned { handle_action(event.action) } if event.kind == .Dismissed { app.cards[0].retiring = true } if event.kind == .Retire_Settled { remove_card(app) }}No init or destroy is required. State is per-card presentation state and allocates nothing.
Parts and identities
Section titled “Parts and identities”| Part | Identity | What can be omitted or replaced |
|---|---|---|
| Runtime toast | Runtime stable ID or emitted handle | Entire path optional; the runtime owns the visual card. |
| Inline card | Item.key (nonzero, stable) | Omit close/actions with hide_close/hide_actions; replace text, severity, and actions per item. |
| Stack | Caller key + item keys | Use card directly in a custom shell or stack for a vertical group. |
| Action buttons | Item.key + Action_ID | Application supplies action IDs, labels, and work. |
Removing a card from the application slice removes it immediately; setting Item.retiring
requests the presentation retire path. A repeated key is a widget-identity error, so keep keys
stable and unique.
Styling, motion, and theme
Section titled “Styling, motion, and theme”Recipe declares one optional namespaced surface role, card_surface_role (core fallback
Subtle_Surface; errors use Surface). Validate it with theme_contract_default,
theme_contract_check, theme_contract_satisfied, and theme_contract_missing_required. The
example registers vendor.alikit.notices.card and activates the theme for the card.
Options carries card width, padding, gap, corner radius, and opt-out hide_close /
hide_actions flags. Severity icon and color use core roles so severity remains readable without
a custom theme.
Entry motion reveals the noninteractive card content (icon, title, message, details) through
ui.motion with .Reveal; buttons are present immediately, as required by Alicorn’s
noninteractive-subtree rule. Setting item.retiring retargets the whole card to opacity 0; when
the presentation settles the card returns Retire_Settled and the application removes the item.
Reduced motion uses .Snap. The card never owns a timer.
Keyboard and accessibility contract
Section titled “Keyboard and accessibility contract”- Runtime toasts are nonmodal, do not take focus, and use the runtime’s live Status/Alert regions. Action buttons are ordinary Buttons reached by Tab.
- Inline cards publish role
Status, orAlertfor errors, with the title as label, the message as value, and details as description. Action and close buttons are ordinary Buttons. Escapeis not claimed by a card. The surrounding dialog/overlay owns dismissal policy.- A retiring card disables its action buttons and is not a new focus target.
- Not claimed: a custom card inside Alicorn’s built-in toast overlay, live announcements from inline cards, or an application-defined queue policy. At the pinned Alicorn revision the toast card is runtime-owned and there is no public live-region annotation for a custom surface; these are recorded as core gaps, not worked around.
Conformance tests
Section titled “Conformance tests”notices/notices_test.odin covers:
- runtime toast rendering as a Status card, action-button pointer activation, the runtime action queue, and the exact one-shot expiry deadline (no polling);
- persistent action-bearing notices surviving a transient expiry;
- inline card Status semantics, value/description,
Action_IDdelivery, and the retire path reachingRetire_Settled; toastdefaults and the card theme contract;- idle return after the retire motion settles.
odin test notices -define:ODIN_TEST_THREADS=1 -collection:alicorn=<alicorn> -collection:alikit=../out/notices_example.exe --smokeNo testui pattern kind fits a notice card. Runtime toasts use the runtime’s own semantics;
inline cards use explicit assertions. There is no negative pattern fixture to run.
API reference
Section titled “API reference”| Declaration | Notes |
|---|---|
toast | Construct a runtime notice with stable ID, title, message, severity, lifetime, and actions. |
post / emit | Submit a notice; emit returns a handle. |
dismiss / dismiss_handle | Dismiss by stable ID or handle. |
take_action | Drain one runtime action event. |
next_deadline / advance | Deadline sampling and advancement pass-throughs. |
Item | Application-owned inline card: key, title, message, details, severity, actions, retiring. |
Options | Card layout and close/action opt-outs. |
Recipe | Optional card_surface_role. |
State | Per-card reveal/retire presentation state. |
Event / Event_Kind | Actioned, Dismissed, Retire_Settled. |
card / stack | Describe one card or a vertical group. |
theme_contract_default, theme_contract_check | Setup-time role validation. |
Limits
Section titled “Limits”- Headless tests do not prove a native screen-reader announcement, OS toast placement, or pixels.
- Transient notices require a monotonic
now_nsin the host’s clock domain. Persistent notices need no deadline sample; the example posts them fromon_after_frame. - Inline cards do not publish live-region announcements; use runtime toasts when announcement is required.
- Card text is clipped by the runtime layout; keep messages short.
Compatibility
Section titled “Compatibility”47c9d4a7cd1f637876190fec899daeeac00a30ae. See
Compatibility and pinning.