@arbidocs/react 0.3.183 → 0.3.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ import * as zustand from 'zustand';
2
+ import * as React from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { ToasterProps } from 'sonner';
5
+
6
+ type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
7
+ interface AppNotification {
8
+ id: string;
9
+ title: string;
10
+ description?: string;
11
+ variant: NotifyVariant;
12
+ /** Epoch ms the entry was recorded. */
13
+ ts: number;
14
+ read: boolean;
15
+ /** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */
16
+ href?: string;
17
+ /** Optional click action — wins over `href` when both are present. Session
18
+ * history only; entries are never serialized, so a closure is safe here. */
19
+ onSelect?: () => void;
20
+ /** Routine session activity ("Opening workspace…", "Saved") — kept for the
21
+ * log but not something that demands attention: excluded from the unread
22
+ * badge and from the bell's default list (shown under "All activity"). */
23
+ ambient?: boolean;
24
+ /** Where the entry comes from. Session entries (`record`) have none; a
25
+ * backend bridge stamps its own (e.g. 'server') so {@link syncSource} can
26
+ * replace exactly its slice on every refetch without touching the rest. */
27
+ source?: string;
28
+ }
29
+ interface NotifyOptions {
30
+ description?: string;
31
+ /** Also record a persistent notification-centre entry (default true). */
32
+ record?: boolean;
33
+ href?: string;
34
+ duration?: number;
35
+ /** A toast action button (sonner). */
36
+ action?: {
37
+ label: ReactNode;
38
+ onClick: () => void;
39
+ };
40
+ /** Override the toast glyph (sonner). */
41
+ icon?: ReactNode;
42
+ /** Record as routine session activity (see {@link AppNotification.ambient}). */
43
+ ambient?: boolean;
44
+ }
45
+ interface NotifyState {
46
+ notifications: AppNotification[];
47
+ markRead: (id: string) => void;
48
+ markAllRead: () => void;
49
+ removeNotification: (id: string) => void;
50
+ clearNotifications: () => void;
51
+ /** Replace the centre's history (e.g. seed a demo/initial set). */
52
+ seed: (items: AppNotification[]) => void;
53
+ /** Record a centre entry (used by `notify.*`; sonner renders the toast). */
54
+ record: (note: AppNotification) => void;
55
+ /** Reconcile one source's slice with fresh truth (e.g. a backend list on
56
+ * every refetch): entries stamped with `source` are replaced wholesale —
57
+ * including their read state, which the source owns — while entries from
58
+ * other sources (session activity) stay untouched. Newest first. */
59
+ syncSource: (source: string, items: AppNotification[]) => void;
60
+ }
61
+ declare const useNotify: zustand.UseBoundStore<zustand.StoreApi<NotifyState>>;
62
+ declare const notify: {
63
+ success: (title: string, opts?: NotifyOptions) => string;
64
+ error: (title: string, opts?: NotifyOptions) => string;
65
+ info: (title: string, opts?: NotifyOptions) => string;
66
+ warning: (title: string, opts?: NotifyOptions) => string;
67
+ };
68
+ /** Replace the notification centre's history — inject a seed/initial set. */
69
+ declare function seedNotifications(items: AppNotification[]): void;
70
+ /** Unread count selector for the topbar bell — ambient session activity never
71
+ * demands attention, so it never counts. */
72
+ declare const selectUnread: (s: NotifyState) => number;
73
+ /** Default glyph colour per variant (raw palette, override via `toneClassNames`). */
74
+ declare const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string>;
75
+
76
+ declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
77
+
78
+ export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, type NotifyOptions as N, Toaster as T, type NotifyVariant as a, selectUnread as b, notify as n, seedNotifications as s, useNotify as u };
@@ -0,0 +1,78 @@
1
+ import * as zustand from 'zustand';
2
+ import * as React from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { ToasterProps } from 'sonner';
5
+
6
+ type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
7
+ interface AppNotification {
8
+ id: string;
9
+ title: string;
10
+ description?: string;
11
+ variant: NotifyVariant;
12
+ /** Epoch ms the entry was recorded. */
13
+ ts: number;
14
+ read: boolean;
15
+ /** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */
16
+ href?: string;
17
+ /** Optional click action — wins over `href` when both are present. Session
18
+ * history only; entries are never serialized, so a closure is safe here. */
19
+ onSelect?: () => void;
20
+ /** Routine session activity ("Opening workspace…", "Saved") — kept for the
21
+ * log but not something that demands attention: excluded from the unread
22
+ * badge and from the bell's default list (shown under "All activity"). */
23
+ ambient?: boolean;
24
+ /** Where the entry comes from. Session entries (`record`) have none; a
25
+ * backend bridge stamps its own (e.g. 'server') so {@link syncSource} can
26
+ * replace exactly its slice on every refetch without touching the rest. */
27
+ source?: string;
28
+ }
29
+ interface NotifyOptions {
30
+ description?: string;
31
+ /** Also record a persistent notification-centre entry (default true). */
32
+ record?: boolean;
33
+ href?: string;
34
+ duration?: number;
35
+ /** A toast action button (sonner). */
36
+ action?: {
37
+ label: ReactNode;
38
+ onClick: () => void;
39
+ };
40
+ /** Override the toast glyph (sonner). */
41
+ icon?: ReactNode;
42
+ /** Record as routine session activity (see {@link AppNotification.ambient}). */
43
+ ambient?: boolean;
44
+ }
45
+ interface NotifyState {
46
+ notifications: AppNotification[];
47
+ markRead: (id: string) => void;
48
+ markAllRead: () => void;
49
+ removeNotification: (id: string) => void;
50
+ clearNotifications: () => void;
51
+ /** Replace the centre's history (e.g. seed a demo/initial set). */
52
+ seed: (items: AppNotification[]) => void;
53
+ /** Record a centre entry (used by `notify.*`; sonner renders the toast). */
54
+ record: (note: AppNotification) => void;
55
+ /** Reconcile one source's slice with fresh truth (e.g. a backend list on
56
+ * every refetch): entries stamped with `source` are replaced wholesale —
57
+ * including their read state, which the source owns — while entries from
58
+ * other sources (session activity) stay untouched. Newest first. */
59
+ syncSource: (source: string, items: AppNotification[]) => void;
60
+ }
61
+ declare const useNotify: zustand.UseBoundStore<zustand.StoreApi<NotifyState>>;
62
+ declare const notify: {
63
+ success: (title: string, opts?: NotifyOptions) => string;
64
+ error: (title: string, opts?: NotifyOptions) => string;
65
+ info: (title: string, opts?: NotifyOptions) => string;
66
+ warning: (title: string, opts?: NotifyOptions) => string;
67
+ };
68
+ /** Replace the notification centre's history — inject a seed/initial set. */
69
+ declare function seedNotifications(items: AppNotification[]): void;
70
+ /** Unread count selector for the topbar bell — ambient session activity never
71
+ * demands attention, so it never counts. */
72
+ declare const selectUnread: (s: NotifyState) => number;
73
+ /** Default glyph colour per variant (raw palette, override via `toneClassNames`). */
74
+ declare const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string>;
75
+
76
+ declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
77
+
78
+ export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, type NotifyOptions as N, Toaster as T, type NotifyVariant as a, selectUnread as b, notify as n, seedNotifications as s, useNotify as u };