- Name
items- Kind
- parameter
- Type
readonly NotificationItemProjection[]- Requirement
- required
DocsAPI referenceUI machinesnotification-center
notification-center machine
The public state machine contract for @grassroot/ui-machines/notification-center. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/notification-center
Package
Service example
notification-center.tsts
import { createService } from "@grassroot/statechart";import { notificationCenterMachine } from "@grassroot/ui-machines/notification-center"; const service = createService(notificationCenterMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();23 of 23
Exports
countUnreadNotificationProjections
functionDuplicate of frozen `countUnreadNotifications`.
countUnreadNotificationProjectionsts
declare function countUnreadNotificationProjections(items: readonly NotificationItemProjection[]): number;Name
Kind
Type
Requirement
itemsparameter
readonly NotificationItemProjection[]required
returnreturn value
numbern/a
- Name
return- Kind
- return value
- Type
number- Requirement
- n/a
groupNotificationProjections
functionDuplicate of frozen `groupNotifications`.
groupNotificationProjectionsts
declare function groupNotificationProjections(items: readonly NotificationItemProjection[]): readonly NotificationGroupProjection[];Name
Kind
Type
Requirement
itemsparameter
readonly NotificationItemProjection[]required
returnreturn value
readonly NotificationGroupProjection[]n/a
- Name
items- Kind
- parameter
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly NotificationGroupProjection[]- Requirement
- n/a
NotificationAction
typeNotificationActionts
type NotificationAction = { readonly type: "markAllRead";} | { readonly type: "dismiss"; readonly id: string;};NotificationCenterChangeReasonts
type NotificationCenterChangeReason = "pointer" | "keyboard" | "programmatic";NotificationCenterCommandts
type NotificationCenterCommand = CommandObject & { readonly type: "ITEMS_CHANGE_REQUEST"; readonly items: readonly NotificationItemProjection[]; readonly action: NotificationAction; readonly reason: NotificationCenterChangeReason;};Name
Kind
Type
Requirement
actionproperty
NotificationActionrequired
itemsproperty
readonly NotificationItemProjection[]required
reasonproperty
NotificationCenterChangeReasonrequired
typeproperty
stringrequired
- Name
action- Kind
- property
- Type
NotificationAction- Requirement
- required
- Name
items- Kind
- property
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
reason- Kind
- property
- Type
NotificationCenterChangeReason- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
NotificationCenterContextts
type NotificationCenterContext = { readonly mode: BindingMode; readonly items: readonly NotificationItemProjection[];};Name
Kind
Type
Requirement
itemsproperty
readonly NotificationItemProjection[]required
modeproperty
BindingModerequired
- Name
items- Kind
- property
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
mode- Kind
- property
- Type
BindingMode- Requirement
- required
NotificationCenterDiagnosticCodests
export declare const NotificationCenterDiagnosticCodes: readonly DiagnosticCatalogueEntry[];NotificationCenterEventts
type NotificationCenterEvent = { readonly type: "MARK_ALL_READ"; readonly reason: NotificationCenterChangeReason;} | { readonly type: "DISMISS"; readonly id: string; readonly reason: NotificationCenterChangeReason;} | { readonly type: "RESET";};NotificationCenterInputts
type NotificationCenterInput = { /** Controlled committed projections. Defining it (including `[]`) fixes controlled mode. */ readonly items?: readonly NotificationItemProjection[]; /** Uncontrolled initial projections. @default [] */ readonly defaultItems?: readonly NotificationItemProjection[]; /** Accessible name. Presentation-only; the machine ignores it. @default "Notifications" */ readonly title?: string;};Name
Kind
Type
Requirement
Description
defaultItemsproperty
readonly NotificationItemProjection[]optional
Uncontrolled initial projections.
itemsproperty
readonly NotificationItemProjection[]optional
Controlled committed projections. Defining it (including `[]`) fixes controlled mode.
titleproperty
stringoptional
Accessible name. Presentation-only; the machine ignores it.
- Name
defaultItems- Kind
- property
- Type
readonly NotificationItemProjection[]- Requirement
- optional
- Description
- Uncontrolled initial projections.
- Name
items- Kind
- property
- Type
readonly NotificationItemProjection[]- Requirement
- optional
- Description
- Controlled committed projections. Defining it (including `[]`) fixes controlled mode.
- Name
title- Kind
- property
- Type
string- Requirement
- optional
- Description
- Accessible name. Presentation-only; the machine ignores it.
notificationCenterMachinets
export declare const notificationCenterMachine: NotificationCenterMachine;NotificationCenterMachinets
type NotificationCenterMachine = Machine<NotificationCenterInput, NotificationCenterStateValue, NotificationCenterContext, NotificationCenterEvent, NotificationCenterCommand>;NotificationCenterMachineStatets
type NotificationCenterMachineState = MachineState<NotificationCenterStateValue, NotificationCenterContext>;notificationCenterReplaySequencets
export declare const notificationCenterReplaySequence: readonly NotificationCenterEvent[];notificationCenterSelectorsts
export declare const notificationCenterSelectors: { items: (snapshot: NotificationCenterSnapshot) => readonly NotificationItemProjection[]; mode: (snapshot: NotificationCenterSnapshot) => BindingMode; unreadCount: (snapshot: NotificationCenterSnapshot) => number; groups: (snapshot: NotificationCenterSnapshot) => readonly NotificationGroupProjection[];};Name
Kind
Type
Requirement
groupsproperty
(snapshot: NotificationCenterSnapshot) => readonly NotificationGroupProjection[]required
itemsproperty
(snapshot: NotificationCenterSnapshot) => readonly NotificationItemProjection[]required
modeproperty
(snapshot: NotificationCenterSnapshot) => BindingModerequired
unreadCountproperty
(snapshot: NotificationCenterSnapshot) => numberrequired
- Name
groups- Kind
- property
- Type
(snapshot: NotificationCenterSnapshot) => readonly NotificationGroupProjection[]- Requirement
- required
- Name
items- Kind
- property
- Type
(snapshot: NotificationCenterSnapshot) => readonly NotificationItemProjection[]- Requirement
- required
- Name
mode- Kind
- property
- Type
(snapshot: NotificationCenterSnapshot) => BindingMode- Requirement
- required
- Name
unreadCount- Kind
- property
- Type
(snapshot: NotificationCenterSnapshot) => number- Requirement
- required
NotificationCenterSnapshotts
type NotificationCenterSnapshot = Snapshot<NotificationCenterStateValue, NotificationCenterContext>;NotificationCenterStateValuets
type NotificationCenterStateValue = "active";NotificationGroupProjectionts
type NotificationGroupProjection = { readonly name: string; readonly rows: readonly NotificationItemProjection[];};Name
Kind
Type
Requirement
nameproperty
stringrequired
rowsproperty
readonly NotificationItemProjection[]required
- Name
name- Kind
- property
- Type
string- Requirement
- required
- Name
rows- Kind
- property
- Type
readonly NotificationItemProjection[]- Requirement
- required
NotificationItemProjectionts
type NotificationItemProjection = { readonly id: string; readonly group: string; readonly kind: NotificationKind; readonly time: string; readonly unread: boolean;};Name
Kind
Type
Requirement
groupproperty
stringrequired
idproperty
stringrequired
kindproperty
NotificationKindrequired
timeproperty
stringrequired
unreadproperty
booleanrequired
- Name
group- Kind
- property
- Type
string- Requirement
- required
- Name
id- Kind
- property
- Type
string- Requirement
- required
- Name
kind- Kind
- property
- Type
NotificationKind- Requirement
- required
- Name
time- Kind
- property
- Type
string- Requirement
- required
- Name
unread- Kind
- property
- Type
boolean- Requirement
- required
NotificationKind
typeNotificationKindts
type NotificationKind = "deploy" | "alert" | "mention" | "pr" | "error";notificationProjectionsEqual
functionnotificationProjectionsEqualts
declare function notificationProjectionsEqual(left: readonly NotificationItemProjection[], right: readonly NotificationItemProjection[]): boolean;Name
Kind
Type
Requirement
leftparameter
readonly NotificationItemProjection[]required
rightparameter
readonly NotificationItemProjection[]required
returnreturn value
booleann/a
- Name
left- Kind
- parameter
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
right- Kind
- parameter
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
projectNotificationItem
functionprojectNotificationItemts
declare function projectNotificationItem(item: { readonly id: string; readonly group: string; readonly kind: NotificationKind; readonly time: string; readonly unread?: boolean;}): NotificationItemProjection;Name
Kind
Type
Requirement
itemparameter
{
readonly id: string;
readonly group: string;
readonly kind: NotificationKind;
readonly time: string;
readonly unread?: boolean;
}required
returnreturn value
NotificationItemProjectionn/a
- Name
item- Kind
- parameter
- Type
{ readonly id: string; readonly group: string; readonly kind: NotificationKind; readonly time: string; readonly unread?: boolean; }- Requirement
- required
- Name
return- Kind
- return value
- Type
NotificationItemProjection- Requirement
- n/a
projectNotificationItems
functionprojectNotificationItemsts
declare function projectNotificationItems(items: readonly { readonly id: string; readonly group: string; readonly kind: NotificationKind; readonly time: string; readonly unread?: boolean;}[]): NotificationItemProjection[];Name
Kind
Type
Requirement
itemsparameter
readonly {
readonly id: string;
readonly group: string;
readonly kind: NotificationKind;
readonly time: string;
readonly unread?: boolean;
}[]required
returnreturn value
NotificationItemProjection[]n/a
- Name
items- Kind
- parameter
- Type
readonly { readonly id: string; readonly group: string; readonly kind: NotificationKind; readonly time: string; readonly unread?: boolean; }[]- Requirement
- required
- Name
return- Kind
- return value
- Type
NotificationItemProjection[]- Requirement
- n/a
reduceNotificationProjections
functionDuplicate of frozen `reduceNotifications`, with S6 same-reference no-ops.
reduceNotificationProjectionsts
declare function reduceNotificationProjections(items: readonly NotificationItemProjection[], action: NotificationAction): readonly NotificationItemProjection[];Name
Kind
Type
Requirement
itemsparameter
readonly NotificationItemProjection[]required
actionparameter
NotificationActionrequired
returnreturn value
readonly NotificationItemProjection[]n/a
- Name
items- Kind
- parameter
- Type
readonly NotificationItemProjection[]- Requirement
- required
- Name
action- Kind
- parameter
- Type
NotificationAction- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly NotificationItemProjection[]- Requirement
- n/a