Skip to content

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.

Native notices window with Post saved, Post warning, and Post error buttons and an inline offline warning card with Retry and Details actions
Native SDL_GPU capture of examples/notices at Alicorn 47c9d4a. The inline card is an application-owned item; runtime toasts use Alicorn's own overlay and are not a second queue.
Interactive WebGPU preview is a later catalog step. The capture is the real native application; toast and card behavior is not recreated in JavaScript.
LayerResponsibility
AlicornBounded notice queue, stable-ID updates, capacity/eviction, action queue, expiry deadline, built-in toast overlay, live regions, and ui.motion.
noticesToast construction, post/dismiss/action/deadline helpers, card/stack parts, severity presentation, reveal/retire motion, and a namespaced card recipe.
ApplicationNotice 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.

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.

PartIdentityWhat can be omitted or replaced
Runtime toastRuntime stable ID or emitted handleEntire path optional; the runtime owns the visual card.
Inline cardItem.key (nonzero, stable)Omit close/actions with hide_close/hide_actions; replace text, severity, and actions per item.
StackCaller key + item keysUse card directly in a custom shell or stack for a vertical group.
Action buttonsItem.key + Action_IDApplication 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.

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.

  • 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, or Alert for errors, with the title as label, the message as value, and details as description. Action and close buttons are ordinary Buttons.
  • Escape is 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.

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_ID delivery, and the retire path reaching Retire_Settled;
  • toast defaults and the card theme contract;
  • idle return after the retire motion settles.
Terminal window
odin test notices -define:ODIN_TEST_THREADS=1 -collection:alicorn=<alicorn> -collection:alikit=.
./out/notices_example.exe --smoke

No 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.

DeclarationNotes
toastConstruct a runtime notice with stable ID, title, message, severity, lifetime, and actions.
post / emitSubmit a notice; emit returns a handle.
dismiss / dismiss_handleDismiss by stable ID or handle.
take_actionDrain one runtime action event.
next_deadline / advanceDeadline sampling and advancement pass-throughs.
ItemApplication-owned inline card: key, title, message, details, severity, actions, retiring.
OptionsCard layout and close/action opt-outs.
RecipeOptional card_surface_role.
StatePer-card reveal/retire presentation state.
Event / Event_KindActioned, Dismissed, Retire_Settled.
card / stackDescribe one card or a vertical group.
theme_contract_default, theme_contract_checkSetup-time role validation.
  • Headless tests do not prove a native screen-reader announcement, OS toast placement, or pixels.
  • Transient notices require a monotonic now_ns in the host’s clock domain. Persistent notices need no deadline sample; the example posts them from on_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.
Pin: built and captured against Alicorn 47c9d4a7cd1f637876190fec899daeeac00a30ae. See Compatibility and pinning.